josdejong/mathjs

Kronecker product needs a SparseMatrix implementation

Open

#1.610 geöffnet am 6. Sept. 2019

Auf GitHub ansehen
 (5 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)JavaScript (1.298 Forks)batch import
featurehelp wanted

Repository-Metriken

Stars
 (13.832 Stars)
PR-Merge-Metriken
 (Keine gemergten PRs in 30 T)

Beschreibung

The current implementation of the Kronecker product #704 silently changes sparse matrices into dense matrices.

Example:

v1 = math.matrix([0, 2, 3, 0, 0], 'sparse')
v2 = math.matrix([0, 1, 0 -1], 'sparse')
v = math.kron(v1, v2)

Returns v, which is a DenseMatrix even though v1 and v2 areSparseMatrix. I would expect SparseMatrix instead.

Is it intended behavior?

Contributor Guide