Actually one can use as_explicit. I did not saw it in the
documentations, only when I checked the code I found about it.
On 11 March 2012 21:14, krastanov.ste...@gmail.com
wrote:
> n [8]: i = ImmutableMatrix(eye(3))
>
> In [9]: i**2
> Out[9]:
>
> 2
> ⎡1 0 0⎤
> ⎢ ⎥
> ⎢0 1 0⎥
>
Right i**2 is a MatrixExpr. At some point someone suggested that we have
unevaluated dense matrix expressions. This choice was made to satisfy that
desire. We can change things around though.
In [1]: X = ImmutableMatrix(3,3, range(9))
In [4]: Y = ImmutableMatrix(ones(3, 3))
In [6]: X*Y
Out[6]:
⎡0
On Sun, Mar 11, 2012 at 3:55 PM, Matthew Rocklin wrote:
> Right i**2 is a MatrixExpr. At some point someone suggested that we have
> unevaluated dense matrix expressions. This choice was made to satisfy that
> desire. We can change things around though.
>
> In [1]: X = ImmutableMatrix(3,3, range(9
@Aaron - Will do. In general my point was that here is a case where we want
to write down X*Y in one way potentially but act on the syntax in two
different ways. We want to build two different mechanisms to consume the
expression X+Y
1. Return an unevaluated but simplified Matrix Expr
2. Ret
How about using MatrixExpr as an unevaluated proxy, and then
substitute ImmutibleMatrix when you want to evaluate it? It really
seems to me that sums, producs, and powers of ImmutibleMatrix should
evaluate by default.
Would you ever want X + X to not reduce to 2*X? That's kind of how
the core wo