# Revision history [back]

### Multiplying sparse matrices

Can Sage multiply sparse matrices? If so, does it require some special syntax? I've been trying to run the following code:

M = Matrix(QQ, 1000001, 1000001, {(3,2): 27, (2,98): 71})
M2 = M*M


and it hasn't been working. If M is being converted to a dense matrix for multiplication then of course I wouldn't expect this to run. But it shouldn't be hard to do as sparse matrices, right?

 2 retagged tmonteil 27163 ●31 ●197 ●511 http://wiki.sagemath.o...

### Multiplying sparse matrices

Can Sage multiply sparse matrices? If so, does it require some special syntax? I've been trying to run the following code:

M = Matrix(QQ, 1000001, 1000001, {(3,2): 27, (2,98): 71})
M2 = M*M


and it hasn't been working. If M is being converted to a dense matrix for multiplication then of course I wouldn't expect this to run. But it shouldn't be hard to do as sparse matrices, right?

 3 retagged tmonteil 27163 ●31 ●197 ●511 http://wiki.sagemath.o...

### Multiplying sparse matrices

Can Sage multiply sparse matrices? If so, does it require some special syntax? I've been trying to run the following code:

M = Matrix(QQ, 1000001, 1000001, {(3,2): 27, (2,98): 71})
M2 = M*M


and it hasn't been working. If M is being converted to a dense matrix for multiplication then of course I wouldn't expect this to run. But it shouldn't be hard to do as sparse matrices, right?