pymoto.solvers.SolverSparseCholeskyScikit

class pymoto.solvers.SolverSparseCholeskyScikit(A=None)

Solver for positive-definite Hermitian matrices using a Cholesky factorization.

This solver requires the Python package scikit-sparse. This package depends on the library suitesparse, which can be more difficult to install on some systems. In case suitesparse cannot be installed, SolverSparseCholeskyCVXOPT is recommended, as installation of CVXOpt is easier and is packaged with suitesparse.

References

__init__(A=None)

Initialize the solver

Parameters:

A (matrix, optional) – Optionally provide a matrix, which is used in :method:`update` right away.

Methods

__init__([A])

Initialize the solver

residual(A, x, b[, trans])

Calculates the (relative) residual of the linear system of equations

solve(rhs[, x0, trans])

Solves the linear system of equations \(\mathbf{A} \mathbf{x} = \mathbf{b}\) by forward and backward substitution of \(\mathbf{x} = \mathbf{L}^{-\text{H}}\mathbf{L}^{-1}\mathbf{b}\) in case of an Hermitian matrix.

update(A)

Factorize the matrix using Cholmod.

Attributes

defined

defined = False
update(A)

Factorize the matrix using Cholmod. In case the matrix \(\mathbf{A}\) is non-Hermitian, the system of equations is solved in a least-squares sense: \(\min \left| \mathbf{A}\mathbf{x} - \mathbf{b} \right|^2\). The solution of this minimization is \(\mathbf{x}=(\mathbf{A}^\text{H}\mathbf{A})^{-1}\mathbf{A}^\text{H}\mathbf{b}\).

solve(rhs, x0=None, trans='N')

Solves the linear system of equations \(\mathbf{A} \mathbf{x} = \mathbf{b}\) by forward and backward substitution of \(\mathbf{x} = \mathbf{L}^{-\text{H}}\mathbf{L}^{-1}\mathbf{b}\) in case of an Hermitian matrix.

The right-hand-side \(\mathbf{b}\) can be of size (N) or (N, K), where N is the size of matrix \(\mathbf{A}\) and K is the number of right-hand sides.

static residual(A, x, b, trans='N')

Calculates the (relative) residual of the linear system of equations

The residual is calculated as \(r = \frac{\left| \mathbf{A} \mathbf{x} - \mathbf{b} \right|}{\left| \mathbf{b} \right|}\)

Parameters:
  • A – The matrix

  • x – Solution vector

  • b – Right-hand side

  • trans (optional) – Matrix tranformation (N is normal, T is transposed, H is hermitian transposed)

Returns:

Residual value