[Numpy-discussion] Question on F/C-ordering in numpy svd
Fri Jan 13 02:05:55 CST 2012
On 01/12/2012 04:21 PM, Ivan Oseledets wrote:
> Dear all!
> I quite new to numpy and python.
> I am a matlab user, my work is mainly
> on multidimensional arrays, and I have a question on the svd function
> from numpy.linalg
> It seems that
> returns u and v in the F-contiguous format.
The reason for this is that the underlying computational routine
is in Fortran (when using system lapack library, for instance) that
requires and returns F-contiguous arrays and the current behaviour
guarantees the most memory efficient computation of svd.
> That is not in a good agreement with other numpy stuff, where
> C-ordering is default.
> For example, matrix multiplication, dot() ignores ordering and returns
> result always in C-ordering.
> (which is documented), but the svd feature is not documented.
In generic numpy operation, the particular ordering of arrays
should not matter as the underlying code should know how to
compute array operation results from different input orderings
This behaviour of svd should be documented. However, one
should check that when using the svd from numpy lapack_lite (which is
f2c code and could use also C-ordering, in principle),
F-contiguous arrays are actually returned.
More information about the NumPy-Discussion