pymoto.solvers.SolverDenseLU

class pymoto.solvers.SolverDenseLU(A=None)

Solver for dense (square) matrices using an LU decomposition

__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 using the LU factorization.

update(A)

Factorize the matrix as \(\mathbf{A}=\mathbf{L}\mathbf{U}\), where \(\mathbf{L}\) is a lower triangular matrix and \(\mathbf{U}\) is upper triangular.

Attributes

defined

update(A)

Factorize the matrix as \(\mathbf{A}=\mathbf{L}\mathbf{U}\), where \(\mathbf{L}\) is a lower triangular matrix and \(\mathbf{U}\) is upper triangular.

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

Solves the linear system of equations using the LU factorization.

\(\mathbf{A} \mathbf{x} = \mathbf{b}\) by forward and backward substitution of \(\mathbf{x} = \mathbf{U}^{-1}\mathbf{L}^{-1}\mathbf{b}\).

trans

Equation

Solution of \(x\)

N

\(A x = b\)

\(x = U^{-1} L^{-1}\)

T

\(A^T x = b\)

\(x = L^{-1} U^{-1}\)

H

\(A^H x = b\)

\(x = L^{-*} U^{-*}\)

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.

defined = True
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