linalg.sparse#

Classes#

Inheritance diagram of psydac.linalg.sparse

SparseMatrixLinearOperator(domain, codomain, ...)

LinearOperator representation of a sparse matrix.

Details#

class SparseMatrixLinearOperator(domain, codomain, sparse_matrix)[source]#

Bases: LinearOperator

LinearOperator representation of a sparse matrix.

Parameters:
domainVectorSpace

The domain of the operator.

codomainVectorSpace

The codomain of the operator.

sparse_matrixscipy.sparse.sparray | scipy.sparse.spmatrix

The sparse SciPy matrix representing the operator. Recommended formats are CSR and BSR. Any other format will be converted to CSR (csr_array).

property domain#

The domain of the linear operator - an element of Vectorspace

property codomain#

The codomain of the linear operator - an element of Vectorspace

property dtype#

The data type of the coefficients of the linear operator, upon convertion to matrix.

toarray()[source]#

Convert to Numpy 2D array.

tosparse()[source]#

Convert to a sparse matrix in any of the formats supported by scipy.sparse.

transpose(conjugate=False)[source]#

Transpose the LinearOperator .

If conjugate is True, return the Hermitian transpose.

dot(v, out=None)[source]#

Apply the LinearOperator self to the Vector v.

The result is written to the Vector out, if provided.

Parameters:
vVector

The vector to which the linear operator (self) is applied. It must belong to the domain of self.

outVector

The vector in which the result of the operation is stored. It must belong to the codomain of self. If out is None, a new vector is created and returned.

Returns:
Vector

The result of the operation. If out is None, a new vector is returned. Otherwise, the result is stored in out and out is returned.