pymoto.solvers.SOR
- class pymoto.solvers.SOR(A=None, w=1.0)
Successive over-relaxation preconditioner The matrix \(A = L + D + U\) is split into a lower triangular, diagonal, and upper triangular part. \(M = \left(\frac{D}{\omega} + L\right) \frac{\omega D^{-1}}{2-\omega} \left(\frac{D}{\omega} + U\right)\)
- __init__(A=None, w=1.0)
Initialize the SOR preconditioner
- Parameters:
A (optional) – The matrix w (optional): Weight factor \(0 < \omega < 2\)
Methods
__init__([A, w])Initialize the SOR preconditioner
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}\)
update(A)Updates with a new matrix of the same structure
Attributes
- update(A)
Updates with a new matrix of the same structure
- Parameters:
A (matrix) – The new matrix of size
(N, N)- Returns:
self
- solve(rhs, x0=None, trans='N')
Solves the linear system of equations \(\mathbf{A} \mathbf{x} = \mathbf{b}\)
- Parameters:
rhs – Right hand side \(\mathbf{b}\) of shape
(N)or(N, K)for multiple right-hand-sidesx0 (optional) – Initial guess for the solution
trans (optional) – Option to transpose matrix ‘N’: A @ x == rhs (default) Normal matrix ‘T’: A^T @ x == rhs Transposed matrix ‘H’: A^H @ x == rhs Hermitian transposed matrix (conjugate transposed)
- Returns:
Solution vector \(\mathbf{x}\) of same shape as \(\mathbf{b}\)
- 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