modalities.fmri.spm.trace

Module: modalities.fmri.spm.trace

nipy.modalities.fmri.spm.trace.trRV(X=None, V=None)[source]

If V is None it defaults to identity.

If X is None, it defaults to the 0-dimensional subspace, i.e. R is the identity.

>>> import numpy as np
>>> from numpy.random import standard_normal
>>>
>>> X = standard_normal((100, 4))
>>> np.allclose(trRV(X), (96.0, 96.0))
True
>>> V = np.identity(100)
>>> np.allclose(trRV(X), (96.0, 96.0))
True
>>>
>>> X[:,3] = X[:,1] + X[:,2]
>>> np.allclose(trRV(X), (97.0, 97.0))
True
>>>
>>> u = orth(X)
>>> V = np.dot(u, u.T)
>>> print(np.allclose(trRV(X, V), 0))
True