M2 icon indicating copy to clipboard operation
M2 copied to clipboard

Operations for sparse matrices

Open pzinn opened this issue 1 year ago • 1 comments

edited: after M2internals discussion

Normal (nonmutable) matrices are sparse, but creating large modules is an issue right now, making it impossible to create very large sparse matrices -- this is something that could be improved in the future.

In the meantime, I tried using mutable matrices which have less overhead. However, most basic operations are not implemented for sparse matrices, making them unusable:

i1 : m=mutableMatrix({{1,2},{0,0}},Dense=>false)

o1 = | 1 2 |
     | 0 0 |

o1 : MutableMatrix

i2 : m*m
stdio:2:1:(3): error: 'mult matrices' not implemented for this kind of matrix over this ring

i3 : m**m
stdio:3:1:(3): error: no method for binary operator ** applied to objects:
--            | 1 2 | (of class MutableMatrix)
--            | 0 0 |
--     **     | 1 2 | (of class MutableMatrix)
--            | 0 0 |

pzinn avatar Nov 18 '23 08:11 pzinn

edited: after M2internals

I would volunteer to implement this, but I'm afraid I don't know enough of the inner workings of M2... also it seems the current implementation of mutable matrices may change.

pzinn avatar Nov 18 '23 12:11 pzinn