[Numpy-discussion] determinant of a scalar not handled

Skipper Seabold jsseabold at gmail.com
Mon Jul 26 12:45:22 EDT 2010


Right now np.linalg.det does not handle scalars or 1d (scalar) arrays.
 It first tests that an array is 2d, then if it is square.  This seems
redundant to me.

This currently works

In [20]: np.linalg.det([[1]])
Out[20]: 1.0

but

In [21]: np.linalg.det([1])
<snip>
LinAlgError: 1-dimensional array given. Array must be
two-dimensional

The diff attached to this ticket
<http://projects.scipy.org/numpy/ticket/1556> gives

In [3]: np.linalg.det([[1]])
Out[3]: 1.0

In [4]: np.linalg.det([1])
Out[4]: 1.0

In [5]: np.linalg.det(1)
Out[5]: 1.0

Skipper



More information about the NumPy-Discussion mailing list