Hello, As Matrix needs to be re-written anyway this summer to make it work like polys, and to make the external Matrix handling independent of the internal data representation(Dense or Sparse), making a separate ImmutableMatrix class with different functions won't be a big problem. We can have a freeze() function in MutableMatrix, which will return ImmutableMatrix, and an unfreeze() function in ImmutableMatrix which will return a MutableMatrix.
The Matrix class would default to MutableMatrix and the user can perform all changes he needs to perform, then use freeze before using the Matrix elsewhere. >>> A = Matrix(...) # A is MutableMatrix, not a subclass of Basic. >>> A[...] = ... # perform changes >>> A = A.freeze() # A is now ImmutableMatrix, a subclass of Basic. # Used in expressions and wherever Immutability and being a subclass of Basic is required. # ... >>> A = A.unfreeze() # A is now a MutableMatrix and the user can make changes. And there is a point to discuss. Should special ImmutableMatrix editing functions be written, something like this ? >>> A = ImmutableMatrix(...) >>> A = A.change(...) Of course this would be expensive, as it would involve remaking the object. But need might dictate the user to do this. He can always unfreeze to edit, if he wants faster changes. I think this is very important to do, and would be very helpful in implementing matrix expressions. Need your comments, critique and suggestions. Thanks, Sherjil Ozair -- You received this message because you are subscribed to the Google Groups "sympy" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/sympy?hl=en.
