I think we should do it. It shouldn't be hard. I think a lot of the
discussion got bogged down on discussions about rewriting internal
data structures, but these should probably be separate considerations.
We should just create an immutable object based on what we currently
have, and then if we work on new internal structures, build them to
work with both.
Regarding your branch, I think the class hierarchy should probably be
done differently. It doesn't make sense to me to make ImmutableMatrix
derive from (mutable) Matrix. Then the immutable subclass has to make
sure that it correctly makes all mutable implementations from the
superclass immutable. What I would do is create a MatrixBase class
that has all the algorithms that are independent of mutability. The
subclasses Matrix and ImmutableMatrix should then contain only those
things that are different between the two, like __new__ or
__setitem__. That's just the first thing that comes to my mind when
thinking about how I would do the class structure. Maybe others can
suggest even better ways to do it.
I also am wondering why you derive it from MatrixExpr. What exactly
did you plan to do with that?
Aaron Meurer
> --
> You received this message because you are subscribed to the Google Groups
> "sympy" group.
> To post to this group, send email to sy...@googlegroups.com.
> To unsubscribe from this group, send email to
> sympy+un...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/sympy?hl=en.
Will deriving from MatrixExpr let you combine ImmutableMatrix objects
seamlessly with MatrixExpr objects? I suppose this could be a good
thing. If x is a MatrixSymbol and M is an ImmutableMatrix, then x*M
would return a MatrixMul (or raise ShapeError). But if x is just
Symbol('x'), or some other Expr, x*M should distribute x across the
elements of M.
Aaron Meurer
You can go ahead and start a pull request for discussion on this.
That will make it easier to talk about your changes specifically.
Aaron Meurer