Dear all,
I'm trying to use block matrices in the following way:
n1, n2 = symbols('n1 n2', integer=True)
U1 = MatrixSymbol('U1', n1, n1+n2)
U2 = MatrixSymbol('U2', n2, n1+n2)
D1 = MatrixSymbol('D1', n1, n1)
D2 = MatrixSymbol('D2', n2, n2)
D = BlockDiagMatrix(D1, D2)
U = BlockMatrix([[U1], [U2]])
K = U * D * U.T
Kc = sympy.block_collapse(K)
For the record, K looks like this:
In [32]: K
Out[32]:
⎡ T T⎤
⎡U₁⎤⋅⎡D₁ 0 ⎤⋅⎣U₁ U₂ ⎦
⎢ ⎥ ⎢ ⎥
⎣U₂⎦ ⎣0 D₂⎦
Kc looks as follows:
⎡ T T⎤
⎢⎡U₁⎤⋅⎡D₁ 0 ⎤⋅U₁ ⎡U₁⎤⋅⎡D₁ 0 ⎤⋅U₂ ⎥
⎢⎢ ⎥ ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ ⎥
⎣⎣U₂⎦ ⎣0 D₂⎦ ⎣U₂⎦ ⎣0 D₂⎦ ⎦
In [30]: Kc.blockshape
Out[30]: (1, 2)
What I'm looking for is a way to recursively break down these blocks
further (i.e. a blockshape of (2,2)). I tried the following, to no avail:
In [31]: sympy.block_collapse(Kc.blocks[0])
Out[31]:
T
⎡U₁⎤⋅⎡D₁ 0 ⎤⋅U₁
⎢ ⎥ ⎢ ⎥
⎣U₂⎦ ⎣0 D₂⎦
Any ideas on how to achieve this?
Thank you!
Chris
--
You received this message because you are subscribed to the Google Groups
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sympy.
To view this discussion on the web visit
https://groups.google.com/d/msgid/sympy/4297d8bf-c9a7-4927-bd25-428bc2ea4954%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.