Macaulay2 / M2

The primary source code repository for Macaulay2, a system for computing in commutative algebra, algebraic geometry and related fields.
https://macaulay2.com
343 stars 229 forks source link

Components & formation of direct sums of matrices #2891

Open mahrud opened 1 year ago

mahrud commented 1 year ago

(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.

pzinn commented 1 year ago
mahrud commented 1 year ago

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.

mahrud commented 1 month ago

Moving over these from #535:

Problem: kernel changes 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) -- fails

The ambient of 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.

mahrud commented 1 month ago

Also related: #300