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 230 forks source link

Issue with homology of matrices #3256

Open Ahuchala opened 4 months ago

Ahuchala commented 4 months ago

When computing the homology of matrices, Macaulay seems to have an issue with composing matrices over a polynomial ring.

R = QQ[x]
M = matrix{{0,x},{0,0}}
homology(M,M)

returns

error: expected maps to be composable

Intended behavior would be to return QQ, since the kernel of M is R e1 and the image is xR e1.

On the other hand, it is able to return the homology of matrices whose composition is not zero, which isn't meaningful.

R = QQ
M = matrix{{1,1},{0,0}}
homology(M,M)

returns

subquotient (| 1  |, | 1 1 |)
                  | -1 |  | 0 0 |

                                 2
ZZ-module, subquotient of ZZ

and it should probably just return an error.

Ahuchala commented 4 months ago

It appears that this can be fixed by asserting that M is a map, ie M = map(R^2,R^2,M). The second issue persists, though.

jkyang92 commented 3 months ago

This is because matrices try to be homogeneous, in particular, source M != target M, in particular, the source in this case will be a free module generated in degrees 1 and 0, so homology will complain, where as the target is two copies of R both generated in degree 0. When you say map(R^2,R^2,M) you are giving a non-homogeneous map (in the sense that the map is not a degree 0 map of graded modules) then the source and target will be the same.