fips.linalg.LinearOperator#

class fips.linalg.LinearOperator(shape)[source]#

Bases: LinearOperator

A real matrix in one of fips’s forms, for multiplying, adding, transposing and solving.

The base class of DenseOperator, SparseOperator, DiagonalOperator, BlockDiagonalOperator and KroneckerOperator: build one of those, or let as_linear_operator() choose. A form has no labels; an Operator puts a Space on each of its axes.

A new form subclasses this one and implements _matmat and _transpose. Every other method has a default that is right for any form, which the subclass overrides where its form has a cheaper way. A form that is neither dense nor sparse also gets a SciPy sparse matrix in _matmat, from a product with a SparseOperator. A covariance form with a root cheaper than the Cholesky factor of its dense matrix (the one a draw is made with) overrides _make_root. A form that keeps something out of its pickle (a cache) overrides __getstate__ starting from this class’s, which leaves out SciPy’s own attributes and the root a draw is made with.

Parameters:

shape (tuple[int, ...]) – (rows, columns).

See also

as_linear_operator

The form that fits an array or a sparse matrix.

fips.Operator

A form with a space on each axis.

Methods

dense()

Return the form as a dense NumPy array.

diagonal()

Return the main diagonal; a sparse or diagonal form reads it from its entries.

dot(x)

Return self @ x, or the form scaled by a scalar x.

logdet()

Return the logarithm of the determinant, for a symmetric positive-definite form.

solve(B)

Solve self @ X = B for a symmetric positive-definite form.

sqrt()

Return a square root \(L\) with \(L L^T\) equal to this symmetric positive-definite form.

trace()

Return the sum of the main diagonal.