Difference between A = sparse.lil_matrix((3, 3), dtype=complex) and A = sparse.lil_matrix((3, 3), complex)
Hi all, Can someone explain the difference between A = sparse.lil_matrix((3, 3),dtype=complex) and A = sparse.lil_matrix((3, 3),complex) The first definition produces a complex matrix while the second one results in a r e a l matrix. This is counterintuitive. In [1]: from scipy import sparse In [2]: A = sparse.lil_matrix((3, 3),complex) In [3]: A Out[3]: <3x3 sparse matrix of type '<type 'numpy.float64'>' with 0 stored elements in LInked List format> In [4]: A = sparse.lil_matrix((3, 3),dtype=complex) In [5]: A Out[5]: <3x3 sparse matrix of type '<type 'numpy.complex128'>' with 0 stored elements in LInked List format> Cheers, Nils
On Feb 16, 2008 2:21 PM, Nils Wagner <nwagner@iam.uni-stuttgart.de> wrote:
Hi all,
Can someone explain the difference between
A = sparse.lil_matrix((3, 3),dtype=complex) and
A = sparse.lil_matrix((3, 3),complex)
The first definition produces a complex matrix while the second one results in a r e a l matrix.
This is counterintuitive.
The latter case, 'complex' is being assigned to the shape= argument (which was ignored). This usage now raises an exception. You should always use keyword= for keyword arguments instead of relying on their order. -- Nathan Bell wnbell@gmail.com http://graphics.cs.uiuc.edu/~wnbell/
On Sat, 16 Feb 2008 14:43:04 -0600 "Nathan Bell" <wnbell@gmail.com> wrote:
On Feb 16, 2008 2:21 PM, Nils Wagner <nwagner@iam.uni-stuttgart.de> wrote:
Hi all,
Can someone explain the difference between
A = sparse.lil_matrix((3, 3),dtype=complex) and
A = sparse.lil_matrix((3, 3),complex)
The first definition produces a complex matrix while the second one results in a r e a l matrix.
This is counterintuitive.
The latter case, 'complex' is being assigned to the shape= argument (which was ignored). This usage now raises an exception.
You should always use keyword= for keyword arguments instead of relying on their order.
-- Nathan Bell wnbell@gmail.com http://graphics.cs.uiuc.edu/~wnbell/ _______________________________________________ Scipy-dev mailing list Scipy-dev@scipy.org http://projects.scipy.org/mailman/listinfo/scipy-dev
Hi Nathan, Thank you very much for the explanation. Nils
participants (2)
-
Nathan Bell -
Nils Wagner