From: Rob S. <rs...@MI...> - 2010-02-26 23:30:41
|
It's hard to tell from the Web, but it sounds like the right thing to do when I encounter unexpected behavior in PySparse is to e-mail this list, right? I'm trying to assign to a slice of an ll_mat from another matrix. If this other matrix is also an ll_mat, this works fine. However, it acts very strange if the other matrix is a standard NumPy ndarray: ---------- In [1]: from pysparse.spmatrix import * In [2]: sq = ll_mat(5,5) In [3]: sq Out[3]: <ll_mat object at 0x1d26bf0> In [4]: print sq ------> print(sq) ll_mat(general, [5,5]): -------- -------- -------- -------- -------- -------- -------- -------- -------- -------- -------- -------- -------- -------- -------- -------- -------- -------- -------- -------- -------- -------- -------- -------- -------- In [6]: import numpy as np In [7]: sq[:,:] = np.arange(25).reshape((5,5)) In LHS=RHS, RHS has shape (2,27483600), LHS has shape (5,5) --------------------------------------------------------------------------- ValueError Traceback (most recent call last) /Users/rspeer/python/src/pysparse/<ipython console> in <module>() ValueError: Matrix shapes are different ----------- There seems to be no other straightforward way to convert a small dense matrix to a sparse one, either. Am I missing how to do this, or is this a bug that should be fixed? -- Rob |