Skip to content

Commit c276180

Browse files
committed
Merge branch 'main' into mumps
2 parents 86ff15e + b0b3018 commit c276180

File tree

5 files changed

+21
-26
lines changed

5 files changed

+21
-26
lines changed

.github/workflows/python-package-conda.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,13 @@ jobs:
2020
strategy:
2121
fail-fast: false
2222
matrix:
23-
os: [ubuntu-latest, macOS-13, windows-latest]
24-
python-version: [3.9, "3.10", "3.11", "3.12"]
23+
# NOTE: macOS-13 is the last Intel runner.
24+
# When we move past that version we'll need to deal with Apple Silicon, likely using MUMPS.
25+
os: [ubuntu-latest, windows-latest, macOS-13]
26+
python-version: [3.8, 3.9, "3.10", "3.11", "3.12"]
2527

2628
steps:
27-
- uses: actions/checkout@v2
29+
- uses: actions/checkout@v4
2830
- name: Setup Conda
2931
uses: conda-incubator/setup-miniconda@v3
3032
with:
@@ -56,7 +58,7 @@ jobs:
5658
5759
- name: Upload coverage
5860
if: ${{ matrix.os == 'ubuntu-latest' }} and {{ matrix.python-version == '3.11' }}
59-
uses: codecov/codecov-action@v2
61+
uses: codecov/codecov-action@v4
6062
with:
6163
verbose: true # optional (default = false)
6264

@@ -70,9 +72,9 @@ jobs:
7072
shell: bash -l {0}
7173

7274
steps:
73-
- uses: actions/checkout@v2
75+
- uses: actions/checkout@v4
7476
- name: Setup Conda
75-
uses: conda-incubator/setup-miniconda@v2
77+
uses: conda-incubator/setup-miniconda@v3
7678
with:
7779
auto-update-conda: true
7880
activate-environment: dev

README.rst

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@ pymatsolver
99
:target: https://github.com/simpeg/pymatsolver/blob/master/LICENSE
1010
:alt: MIT license.
1111

12-
.. image:: https://img.shields.io/travis/rowanc1/pymatsolver.svg
13-
:target: https://travis-ci.org/simpeg/pymatsolver
14-
:alt: Travis CI build status
15-
1612
.. image:: https://codecov.io/gh/simpeg/pymatsolver/branch/master/graph/badge.svg
1713
:target: https://codecov.io/gh/simpeg/pymatsolver
1814
:alt: Coverage status

pymatsolver/iterative.py

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,16 @@
11
import numpy as np
2+
import scipy
23
import scipy.sparse as sp
3-
from scipy.sparse.linalg import bicgstab, cg
4-
from .solvers import Base
4+
from scipy.sparse.linalg import bicgstab, cg, aslinearoperator
55
from .wrappers import WrapIterative
66

7+
# The tol kwarg was removed from bicgstab in scipy 1.14.0.
8+
# See https://docs.scipy.org/doc/scipy-1.12.0/reference/generated/scipy.sparse.linalg.bicgstab.html
9+
RTOL_ARG_NAME = "rtol" if Version(scipy.__version__) >= Version("1.14.0") else "tol"
710

811
SolverCG = WrapIterative(cg, name="SolverCG")
912
SolverBiCG = WrapIterative(bicgstab, name="SolverBiCG")
1013

11-
import scipy
12-
_rtol_call = False
13-
scipy_major, scipy_minor, scipy_patch = scipy.__version__.split(".")
14-
if int(scipy_major) >= 1 and int(scipy_minor) >= 12:
15-
_rtol_call = True
16-
1714
class BiCGJacobi(Base):
1815
"""Bicg Solver with Jacobi preconditioner"""
1916

@@ -34,15 +31,12 @@ def factor(self):
3431
return
3532
nSize = self.A.shape[0]
3633
Ainv = sp.spdiags(1./self.A.diagonal(), 0, nSize, nSize)
37-
self.M = sp.linalg.interface.aslinearoperator(Ainv)
34+
self.M = aslinearoperator(Ainv)
3835
self._factored = True
3936

4037
@property
4138
def _tols(self):
42-
if _rtol_call:
43-
return {'rtol': self.rtol, 'atol': self.atol}
44-
else:
45-
return {'tol': self.rtol, 'atol': self.atol}
39+
return {RTOL_ARG_NAME: self.rtol, 'atol': self.atol}
4640

4741

4842
def _solve1(self, rhs):
@@ -60,8 +54,7 @@ def _solveM(self, rhs):
6054
sol = []
6155
for icol in range(rhs.shape[1]):
6256
sol.append(self.solver(self.A, rhs[:, icol].flatten(),
63-
maxiter=self.maxiter, M=self.M,
64-
**self._tols,)[0])
57+
maxiter=self.maxiter, M=self.M, **self._tols,)[0])
6558
out = np.hstack(sol)
6659
out.shape
6760
return out

requirements_docs.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
sphinx
22
numpydoc
3+
4+
# Restrict pydata-sphinx-theme on older versions of Python on Windows.
5+
# Otherwise we get doc build failures.
6+
pydata-sphinx-theme~=0.14.4,<0.15 ; python_version <= '3.9' and platform_system == "Windows"
37
pydata-sphinx-theme

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
packages=find_packages(exclude=["tests"]),
3333
install_requires=[
3434
'numpy>=1.7',
35-
'scipy>=0.13',
35+
'scipy>=1.8',
3636
],
3737
author="SimPEG Developers",
3838
author_email="[email protected]",

0 commit comments

Comments
 (0)