Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How can I invert matrix of matrices

Consider:

A = matrix(SR, 2, var('a1,b1,c1,d1'))
B = matrix(SR, 2, var('a2,b2,c2,d2'))
C = matrix(SR, 2, var('a3,b3,c3,d3'))
D = matrix(2,2, [A, B, B.T, C])
D; D.is_invertible()

This gives the matrix D as a matrix of (fully expanded) matrices, and confirms that D is invertible. However:

D.inverse()

results in

Traceback (click to the left of this block for traceback) 
...
AttributeError: 'MatrixSpace_with_category' object has no attribute
'is_field'

Seemingly, one cannot build after all a matrix of matrices, but only of basic ring elements.


Even better, I would prefer to construct a matrix of the (non-commutative, invertible) symbolic variables A, B, C, so as to eliminate the clutter of their constituent elements.