Status: Valid
Owner: ----
Labels: Type-Defect Priority-Medium Matrices NeedsReview smichr

New issue 3406 by smi...@gmail.com: SparseMatrix attribute is incompatible with MatrixBase methods
http://code.google.com/p/sympy/issues/detail?id=3406

SparseMatrix subclasses from MatrixBase, but MatrixBase includes methods that should really be in MutableMatrix because MutableMatrix and SparseMatrix share a common attribute (mat) that is used in methods of MatrixBase, e.g. LDLdecomposition.

MutableMatrix.mat is a flat list of all the matrix elements in row-order; SparseMatrix.mat is a dictionary: {(i, j): value}. So any method that tries to use the mat structure will fail for a SparseMatrix.

In PR 1535 I've renamed Sparse's mat as smat so anything that refers to mat will fail for SparseMatrix, indicating that that method needs to be added to Sparse Matrix.

An alternative would be to move methods from MatrixBase to MutableMatrix so SparseMatrix can't access them but I (personally) don't want to get into that reorganization right now.

If people don't like the smat idea, I can rename it to mat again and we can let it fail as it does now.

Also, it seems like mat and smat should be private data structures and named _mat and _smat so we are free to change those in the future.

--
You received this message because you are subscribed to the Google Groups 
"sympy-patches" group.
To post to this group, send email to sympy-patches@googlegroups.com.
To unsubscribe from this group, send email to 
sympy-patches+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to