Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

You can access the $(i,j)$-th block using B.subdivision(i,j).

For your more general problem:

sage: A = random_matrix(ZZ,12,12)
sage: A.subdivide([3,6,9],[3,6,9])
sage: B = block_matrix([[A.subdivision(i,j) + A.subdivision(j,i) for i in range(4)] for j in range(4)])
sage: A

[   0   -1    1|   1    0    1| -18   -1   -2|  -1    1   -1]
[  -1    8 -312|  16    1   -3|   3    0    0|   0   -1    0]
[   0  -13   -1|   4    2   -1|  -1    1    1|  21   -6    1]
[--------------+--------------+--------------+--------------]
[   1   -3   -4|   2   -2    2|  -3    2    0|  -1    3    0]
[  -1    1    1|  -2   -1   -2|  -1   -3   -1|   0   -1    6]
[   5    1    1|  -1   -1   -2|  -7   -1    0|   1   -1    1]
[--------------+--------------+--------------+--------------]
[  -1    4   -3|   1    4  -15|   5    1    1|   1    0    2]
[   5    0    0|   2   -1   -1| -16   -2    1|   0   -2   -1]
[   0    1    0|  -2    1    5|   8  -11    1|  -7   -1   -2]
[--------------+--------------+--------------+--------------]
[   1    1   -4|  -6   -1    3|-217   -1    0|   3    0   -1]
[  -1    0    1|   0   -7    0|  -1    3    1|  -3    3    1]
[  -1    0    0|   2    0   -1|  -2   -2    0|  -1   -2    0]
sage: B

[   0   -2    2|   2   -3   -3| -19    3   -5|   0    2   -5]
[  -2   16 -624|  15    2   -2|   8    0    0|  -1   -1    1]
[   0  -26   -2|   9    3    0|  -1    2    1|  20   -6    1]
[--------------+--------------+--------------+--------------]
[   2   -3   -3|   4   -4    4|  -2    6  -15|  -7    2    3]
[  15    2   -2|  -4   -2   -4|   1   -4   -2|   0   -8    6]
[   9    3    0|  -2   -2   -4|  -9    0    5|   3   -1    0]
[--------------+--------------+--------------+--------------]
[ -19    3   -5|  -2    6  -15|  10    2    2|-216   -1    2]
[   8    0    0|   1   -4   -2| -32   -4    2|  -1    1    0]
[  -1    2    1|  -9    0    5|  16  -22    2|  -9   -3   -2]
[--------------+--------------+--------------+--------------]
[   0    2   -5|  -7    2    3|-216   -1    2|   6    0   -2]
[  -1   -1    1|   0   -8    6|  -1    1    0|  -6    6    2]
[  20   -6    1|   3   -1    0|  -9   -3   -2|  -2   -4    0]