pymoto.solvers.SolverDiagonal
- class pymoto.solvers.SolverDiagonal(A=None)
Solver for diagonal matrices
- __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])Solve using the diagonal only, by \(x_i = b_i / A_{ii}\)
update(A)Extracts the diagonal of the matrix
Attributes
- update(A)
Extracts the diagonal of the matrix
- solve(rhs, x0=None, trans='N')
Solve using the diagonal only, by \(x_i = b_i / A_{ii}\)
The right-hand-side \(\mathbf{b}\) can be of size
(N)or(N, K), whereNis the size of matrix \(\mathbf{A}\) andKis 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