# Revision history [back]

### How to build a matrix as thought of as an array of smaller matrices?

Say I am given a data set which looks like $[ (0,2,A), (0,3,B), (1,2,C), (1,4,D) ]$ where $A,B,C,D$ are matrices all of the same dimension say $k$. (the data set will always have unique pairs of integers - as in if (1,2,) tuple occurs then (2,1,) tuple will not occur)

Now I want to create a 4x4 matrix say X of dimension $4k$ thought of as a 4x4 array of k-dimensional matrices. The arrays in $B$ are to be defined as $X(0,2) = A, X(2,0) = A^{-1}, X(0,3) = B, X(3,0) = B^{-1}, X(1,2) = C, X(2,1) = C^{-1}, X(1,4) = D, X(4,1) = D^{-1}$ and all other array positions in $X$ are to be filled in with $0$ matrices of dimension $k$.

• How can one create such a X on SAGE?

X is a matrix of matrices and I am not sure how one can define this on SAGE. Like saying "X(0,3) = B" is not going to make any obvious sense to SAGE.

[I showed this above example with just $4$ tuples. I want to eventually do it with much larger data sets]

### How to build a matrix as thought of as an array of smaller matrices?

Say I am given a data set which looks like $[ (0,2,A), (0,3,B), (1,2,C), (1,4,D) ]$ where $A,B,C,D$ are matrices all of the same dimension say $k$. (the data set will always have unique pairs of integers - as in if (1,2,) tuple occurs then (2,1,) tuple will not occur)

Now I want to create a 4x4 matrix say X of dimension $4k$ thought of as a 4x4 array of k-dimensional matrices. The arrays in $B$ are to be defined as $X(0,2) = A, X(2,0) = A^{-1}, X(0,3) = B, X(3,0) = B^{-1}, X(1,2) = C, X(2,1) = C^{-1}, X(1,4) = D, X(4,1) = D^{-1}$ and all other array positions in $X$ are to be filled in with $0$ matrices of dimension $k$.

• How can one create such a X on SAGE?

X is a matrix of matrices and I am not sure how one can define this on SAGE. Like saying "X(0,3) = B" is not going to make any obvious sense to SAGE.

[I showed this above example with just $4$ tuples. I want to eventually do it with much larger data sets]

### How to build a matrix thought of as an array of smaller matrices?

Say I am given a data set which looks like $[ (0,2,A), (0,3,B), (1,2,C), (1,4,D) ]$ where $A,B,C,D$ are matrices all of the same dimension say $k$. (the data set will always have unique pairs of integers - as in if (1,2,) tuple occurs then (2,1,) tuple will not occur)

Now I want to create a 4x4 matrix say X of dimension $4k$ thought of as a 4x4 array of k-dimensional matrices. The arrays in $B$ $X$ are to be defined as $X(0,2) = A, X(2,0) = A^{-1}, X(0,3) = B, X(3,0) = B^{-1}, X(1,2) = C, X(2,1) = C^{-1}, X(1,4) = D, X(4,1) = D^{-1}$ and all other array positions in $X$ are to be filled in with $0$ matrices of dimension $k$.

• How can one create such a X on SAGE?

X is a matrix of matrices and I am not sure how one can define this on SAGE. Like saying "X(0,3) = B" is not going to make any obvious sense to SAGE.

[I showed this above example with just $4$ tuples. I want to eventually do it with much larger data sets]

### How to build a matrix thought of as an array of smaller matrices?

Say I am given a data set which looks like $[ (0,2,A), (0,3,B), (1,2,C), (1,4,D) ]$ where $A,B,C,D$ are matrices all of the same dimension say $k$. (the data set will always have unique pairs of integers - as in if (1,2,) tuple occurs then (2,1,) tuple will not occur)

Now I want to create a 4x4 matrix say X of dimension $4k$ thought of as a 4x4 array of k-dimensional matrices. The arrays in $X$ are to be defined as $X(0,2) = A, X(2,0) = A^{-1}, X(0,3) = B, X(3,0) = B^{-1}, X(1,2) = C, X(2,1) = C^{-1}, X(1,4) = D, X(4,1) = D^{-1}$ and all other array positions in $X$ are to be filled in with $0$ matrices of dimension $k$.

• How can one create such a X on SAGE?

X is a matrix of matrices and I am not sure how one can define this on SAGE. Like saying "X(0,3) = B" is not going to make any obvious sense to SAGE. I necessarily need X to be a matrix so that i can later say calculate its characteristic polynomial.

[I showed this above example with just $4$ tuples. I want to eventually do it with much larger data sets]