Description
directSum(M,N,...) -- forms the direct sum of matrices or modules.
The components can be recovered later with components or with formation.
Projection and inclusion maps for direct sums:
It sometimes happens that the user has indices for the components of a direct sum preferable to the usual consecutive small integers. In this case the preferred indices can be specified with code like
directSum(a=>M,b=>N,...), as in the following example.
i1 : F = directSum(a=>ZZ^1, b=>ZZ^2, c=>ZZ^3)
6
o1 = ZZ
o1 : ZZ-module, free
|
i2 : F_[b]
o2 = | 0 0 |
| 1 0 |
| 0 1 |
| 0 0 |
| 0 0 |
| 0 0 |
6 2
o2 : Matrix ZZ <-- ZZ
|
i3 : F^[c]
o3 = | 0 0 0 1 0 0 |
| 0 0 0 0 1 0 |
| 0 0 0 0 0 1 |
3 6
o3 : Matrix ZZ <-- ZZ
|
Similar syntax works with
++.
i4 : F = (a => ZZ^1) ++ (b => ZZ^2)
3
o4 = ZZ
o4 : ZZ-module, free
|
i5 : F_[b]
o5 = | 0 0 |
| 1 0 |
| 0 1 |
3 2
o5 : Matrix ZZ <-- ZZ
|