M2
M2 copied to clipboard
Components & formation of direct sums of matrices
(I vaguely recall a related issue, but I couldn't find it. Let me know if this is duplicate)
It seems like there are a lot of procedures that cause M2 to forget component and formation information. Ideally this work shouldn't have to be duplicated in every single method. Is there a good way to do this once? For instance, when creating the directSum method give it an option that indicates that the method should store formation in each call.
More specifically for this issue, I think the following should work:
i1 : m = matrix{{1}};
1 1
o1 : Matrix ZZ <--- ZZ
i2 : components(m ++ m)
o2 = {| 1 |, | 1 |}
o2 : List
i3 : components coker(m ++ m) -- HERE
o3 = {cokernel | 1 0 |}
| 0 1 |
o3 : List
i4 : components(coker m ++ coker m)
o4 = {cokernel | 1 |, cokernel | 1 |}
Perhaps additive methods should automatically be applied component-wise? Not sure if this is a good idea in general though.
- taking the transpose / dual will lose formation
- tensor product will lose components though formation will be there
- labels of blocks get lost even with
++edit: actually I was thinking of modules, not matrices, but kinda same
I think like this could be a thing that method functions do automatically so you don't have to do it manually dozens of places.
Moving over these from #535:
Problem:
kernelchanges the ambient free module. For instance, the original might have direct sum components, as in the example below, but the call to 'kernel' loses this information.S = ZZ/101[a..d] M = S^1 ++ S^2 F = S^2 f = random(F,M) K = kernel f assert(target generators K == M) assert(target generators K === M) assert(components target generators K == components M) -- failsThe
ambientof the map should also remember this information.g = K_{0} ambient g target ambient g === M components M components target ambient g assert(components M == components target ambient g)
There is (or recently was) the same problem with tensor products and Hom. I wrote special versions “tensorWithSummands” etc to fix this.
Also related: #300