Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions src/sectionproperties/analysis/solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,15 @@ def solve_cgs(
k: ``N x N`` matrix of the linear system
f: ``N x 1`` right hand side of the linear system
m: Preconditioner for the linear matrix approximating the inverse of ``k``
tol: Tolerance for the solver to achieve. The algorithm terminates when either
the relative or the absolute residual is below ``tol``
tol: Relative tolerance for the solver to achieve.

Returns:
The solution vector to the linear system of equations

Raises:
RuntimeError: If the CGS iterative method does not converge
"""
u, info = linalg.cgs(A=k, b=f, tol=tol, M=m)
u, info = linalg.cgs(A=k, b=f, rtol=tol, M=m)

if info != 0:
raise RuntimeError("CGS iterative method did not converge.")
Expand All @@ -67,8 +66,7 @@ def solve_cgs_lagrange(
k_lg: ``(N+1) x (N+1)`` Lagrangian multiplier matrix of the linear system
f: ``N x 1`` right hand side of the linear system
m: Preconditioner for the linear matrix approximating the inverse of ``k``
tol: Tolerance for the solver to achieve. The algorithm terminates when either
the relative or the absolute residual is below ``tol``
tol: Relative tolerance for the solver to achieve.

Returns:
The solution vector to the linear system of equations
Expand All @@ -77,7 +75,7 @@ def solve_cgs_lagrange(
RuntimeError: If the CGS iterative method does not converge or the error from
the Lagrangian multiplier method exceeds the tolerance
"""
u, info = linalg.cgs(A=k_lg, b=np.append(f, 0), tol=tol, M=m)
u, info = linalg.cgs(A=k_lg, b=np.append(f, 0), rtol=tol, M=m)

if info != 0:
raise RuntimeError("CGS iterative method did not converge.")
Expand Down