Skip to content

Commit c3e91a2

Browse files
Merge pull request #444 from robbievanleeuwen/scipy-cgs
Fix `scipy` deprecation for `sparse.linalg.cgs()`
2 parents 20a081d + d91643b commit c3e91a2

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/sectionproperties/analysis/solver.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,15 @@ def solve_cgs(
3838
k: ``N x N`` matrix of the linear system
3939
f: ``N x 1`` right hand side of the linear system
4040
m: Preconditioner for the linear matrix approximating the inverse of ``k``
41-
tol: Tolerance for the solver to achieve. The algorithm terminates when either
42-
the relative or the absolute residual is below ``tol``
41+
tol: Relative tolerance for the solver to achieve.
4342
4443
Returns:
4544
The solution vector to the linear system of equations
4645
4746
Raises:
4847
RuntimeError: If the CGS iterative method does not converge
4948
"""
50-
u, info = linalg.cgs(A=k, b=f, tol=tol, M=m)
49+
u, info = linalg.cgs(A=k, b=f, rtol=tol, M=m)
5150

5251
if info != 0:
5352
raise RuntimeError("CGS iterative method did not converge.")
@@ -67,8 +66,7 @@ def solve_cgs_lagrange(
6766
k_lg: ``(N+1) x (N+1)`` Lagrangian multiplier matrix of the linear system
6867
f: ``N x 1`` right hand side of the linear system
6968
m: Preconditioner for the linear matrix approximating the inverse of ``k``
70-
tol: Tolerance for the solver to achieve. The algorithm terminates when either
71-
the relative or the absolute residual is below ``tol``
69+
tol: Relative tolerance for the solver to achieve.
7270
7371
Returns:
7472
The solution vector to the linear system of equations
@@ -77,7 +75,7 @@ def solve_cgs_lagrange(
7775
RuntimeError: If the CGS iterative method does not converge or the error from
7876
the Lagrangian multiplier method exceeds the tolerance
7977
"""
80-
u, info = linalg.cgs(A=k_lg, b=np.append(f, 0), tol=tol, M=m)
78+
u, info = linalg.cgs(A=k_lg, b=np.append(f, 0), rtol=tol, M=m)
8179

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

0 commit comments

Comments
 (0)