# [Numpy-discussion] Re: linalg.svd returns fortran arrays, causes problems

Robert Kern robert.kern at gmail.com
Mon Mar 20 17:26:07 CST 2006

```Zachary Pincus wrote:
> numpy.reshape(numpy.array([[1,2,3,4,5,6,7,8,9,10],
> [11,12,13,14,15,16,17,18,19,20]], fortran = False), [2, 5, 2])
> array([[[ 1,  2],
>         [ 3,  4],
>         [ 5,  6],
>         [ 7,  8],
>         [ 9, 10]],
>
>        [[11, 12],
>         [13, 14],
>         [15, 16],
>         [17, 18],
>         [19, 20]]])
>
> numpy.reshape(numpy.array([[1,2,3,4,5,6,7,8,9,10],
> [11,12,13,14,15,16,17,18,19,20]], fortran = True), [2, 5, 2])
> array([[[ 1,  6],
>         [ 2,  7],
>         [ 3,  8],
>         [ 4,  9],
>         [ 5, 10]],
>
>        [[11, 16],
>         [12, 17],
>         [13, 18],
>         [14, 19],
>         [15, 20]]])

I think this is a new bug, then.

In [82]: reshape(numpy.array([[1,2,3,4,5,6,7,8,9,10],
[11,12,13,14,15,16,17,18,19,20]], fortran = True), (2,5,2))
Out[82]:
array([[[ 1,  2],
[ 3,  4],
[ 5,  6],
[ 7,  8],
[ 9, 10]],

[[11, 12],
[13, 14],
[15, 16],
[17, 18],
[19, 20]]])

In [83]: reshape(numpy.array([[1,2,3,4,5,6,7,8,9,10],
[11,12,13,14,15,16,17,18,19,20]], fortran = False), (2,5,2))
Out[83]:
array([[[ 1,  2],
[ 3,  4],
[ 5,  6],
[ 7,  8],
[ 9, 10]],

[[11, 12],
[13, 14],
[15, 16],
[17, 18],
[19, 20]]])

In [84]: numpy.__version__
Out[84]: '0.9.6.2148'

--
Robert Kern
robert.kern at gmail.com

"I have come to believe that the whole world is an enigma, a harmless enigma