josdejong/mathjs

Kronecker product needs a SparseMatrix implementation

开放

#1,610 创建于 2019年9月6日

 (5 条评论) (0 个反应) (0 位负责人)JavaScript (1,314 个派生)batch import
featurehelp wanted

仓库指标

星标
 (15,065 个星标)
PR 合并指标
 (PR 指标待抓取)

描述

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?

贡献者指南