Opened 4 months ago

Last modified 2 months ago

#31086 new defect

Fix tensor product of dense matrix by sparse matrix

Reported by: slelievre Owned by:
Priority: major Milestone: sage-9.4
Component: linear algebra Keywords: matrix, tensor_product, dense, sparse
Cc: slelievre Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description (last modified by slelievre)

The tensor product of a dense matrix by a sparse matrix fails for some base rings including cyclotomic fields. Everything works fine over ZZ or QQ.

Illustration in Sage 9.3.beta4:

sage: k = CyclotomicField(3)
sage: I = identity_matrix(k, 2)
sage: J = identity_matrix(k, 2, sparse=True)
sage: J.tensor_product(J)
[1 0|0 0]
[0 1|0 0]
[---+---]
[0 0|1 0]
[0 0|0 1]
sage: J.tensor_product(I)
[1 0|0 0]
[0 1|0 0]
[---+---]
[0 0|1 0]
[0 0|0 1]
sage: I.tensor_product(I)
[1 0|0 0]
[0 1|0 0]
[---+---]
[0 0|1 0]
[0 0|0 1]
sage: I.tensor_product(J)
Traceback (most recent call last)
...
AttributeError: 'sage.matrix.matrix_generic_sparse.Matrix_generic_sparse'
object has no attribute '_rational_matrix'

Initial report by Will Orrick at

Change History (2)

comment:1 Changed 4 months ago by slelievre

  • Description modified (diff)

comment:2 Changed 2 months ago by mkoeppe

  • Milestone changed from sage-9.3 to sage-9.4

Setting new milestone based on a cursory review of ticket status, priority, and last modification date.

Note: See TracTickets for help on using tickets.