[sympy] Problems with Sparse Matrix

2013-06-03 Thread Saurabh Jha
Hi, I think there are some redundancies in the current sparse matrices-- 1. In __init__, I think we don't need the branch/conditional if callable(args[2] because it defeats the reason of having sparse matrices. That will always produce a matrix that does not have a large number of zeroes 2. In

Re: [sympy] Problems with Sparse Matrix

2013-06-03 Thread Aaron Meurer
But couldn't matrices constructed from those forms be sparse nonetheless? Aaron Meurer On Mon, Jun 3, 2013 at 12:06 PM, Saurabh Jha saurabh.j...@gmail.com wrote: Hi, I think there are some redundancies in the current sparse matrices-- 1. In __init__, I think we don't need the

Re: [sympy] Problems with Sparse Matrix

2013-06-03 Thread Chris Smith
Yes, the callable could create only a few non-zero entries. And only the non-zero entries are retained in the SparseMatrix so it is reasonable to keep that code: SparseMatrix(3,3,lambda i,j: 1 if i==j else 0) [1, 0, 0] [0, 1, 0] [0, 0, 1] _._smat {(0, 0): 1, (1, 1): 1, (2, 2): 1} Again, the

Re: [sympy] Problems with Sparse Matrix

2013-06-03 Thread Aaron Meurer
Well according to the pull request https://github.com/sympy/sympy/pull/2152 there are some bugs. Definitely there were a lot of bugs before, mostly because it wasn't (and still isn't) very heavily used. Aaron Meurer On Mon, Jun 3, 2013 at 7:11 PM, Chris Smith smi...@gmail.com wrote: Yes, the

Re: [sympy] Problems with Sparse Matrix

2013-06-03 Thread Matthew Rocklin
Curious. Does anyone actually use sparse matrix? For the function bit just a note. MatrixExprs have a FunctionMatrix that accomplishes the same result with a Lambda. Should be fully compatible with normal matrices. On Jun 3, 2013 7:16 PM, Aaron Meurer asmeu...@gmail.com wrote: Well according