[Numpy-discussion] Efficient orthogonalisation with scipy/numpy
Tue Jan 19 14:22:30 CST 2010
On Tue, Jan 19, 2010 at 14:12, Gael Varoquaux
> Hi there,
> Forgive me for turning to the mailing list to do my homework. I am
> currently optimizing a code, and it turns out that the main bottleneck is
> the orthogonalisation of a vector 'y' to a set of vectors 'confounds',
> that I am currently doing with the following code:
> y = y - np.dot(confounds.T, linalg.lstsq(confounds.T, y))
> with np = numpy and linalg = scipy.linalg where scipy calls ATLAS.
For clarification, are you trying to find the components of the y
vectors that are perpendicular to the space spanned by the 10
orthonormal vectors in confounds?
> Most of the time is spent in linalg.lstsq. The length of the vectors is
> 810, and there are about 10 confounds.
Exactly what are the shapes? y.shape = (810, N); confounds.shape = (810, 10)?
"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
-- Umberto Eco
More information about the NumPy-Discussion