稀疏矩阵#

SparseMatrix类引用#

sympy.matrices.sparse.SparseMatrix[源代码]#

MutableSparseMatrix 的别名

class sympy.matrices.sparse.MutableSparseMatrix(*args, **kwargs)[源代码]#

ImmutableParseMatrix类引用#

class sympy.matrices.immutable.ImmutableSparseMatrix(*args, **kwargs)[源代码]#

创建一个不可变的稀疏矩阵。

实例

>>> from sympy import eye, ImmutableSparseMatrix
>>> ImmutableSparseMatrix(1, 1, {})
Matrix([[0]])
>>> ImmutableSparseMatrix(eye(3))
Matrix([
[1, 0, 0],
[0, 1, 0],
[0, 0, 1]])
>>> _[0, 0] = 42
Traceback (most recent call last):
...
TypeError: Cannot set values of ImmutableSparseMatrix
>>> _.shape
(3, 3)