Skip to content

Commit b0b3018

Browse files
authored
Merge pull request #46 from mplough-kobold/matt-fix-macos-tests
Fix CI
2 parents 077992d + d79d979 commit b0b3018

File tree

4 files changed

+40
-16
lines changed

4 files changed

+40
-16
lines changed

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

+9-7
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,15 @@ jobs:
1919
shell: bash -l {0}
2020
strategy:
2121
matrix:
22-
os: [ubuntu-latest, macOS-latest, windows-latest]
23-
python-version: [3.7, 3.8, 3.9, "3.10"]
22+
# NOTE: macOS-13 is the last Intel runner.
23+
# When we move past that version we'll need to deal with Apple Silicon, likely using MUMPS.
24+
os: [ubuntu-latest, windows-latest, macOS-13]
25+
python-version: ["3.8", "3.9", "3.10", "3.11"]
2426

2527
steps:
26-
- uses: actions/checkout@v2
28+
- uses: actions/checkout@v4
2729
- name: Setup Conda
28-
uses: conda-incubator/setup-miniconda@v2
30+
uses: conda-incubator/setup-miniconda@v3
2931
with:
3032
auto-update-conda: true
3133
activate-environment: dev
@@ -56,7 +58,7 @@ jobs:
5658
5759
- name: Upload coverage
5860
if: ${{ matrix.os == 'ubuntu-latest' }} and {{ matrix.python-version == '3.8' }}
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

pymatsolver/iterative.py

+26-8
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
import numpy as np
2+
import scipy
23
import scipy.sparse as sp
3-
from scipy.sparse.linalg import bicgstab
4+
from scipy.sparse.linalg import aslinearoperator, bicgstab
5+
from packaging.version import Version
46
from pymatsolver.solvers import Base
57

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

713
class BicgJacobi(Base):
814
"""Bicg Solver with Jacobi preconditioner"""
@@ -23,25 +29,37 @@ def factor(self):
2329
return
2430
nSize = self.A.shape[0]
2531
Ainv = sp.spdiags(1./self.A.diagonal(), 0, nSize, nSize)
26-
self.M = sp.linalg.interface.aslinearoperator(Ainv)
32+
self.M = aslinearoperator(Ainv)
2733
self._factored = True
2834

2935
def _solve1(self, rhs):
3036
self.factor()
3137
sol, info = self.solver(
32-
self.A, rhs,
33-
tol=self.tol,
34-
maxiter=self.maxiter,
35-
M=self.M
38+
self.A,
39+
rhs,
40+
**{
41+
TOL_ARG_NAME: self.tol,
42+
"maxiter": self.maxiter,
43+
"M": self.M,
44+
}
3645
)
3746
return sol
3847

3948
def _solveM(self, rhs):
4049
self.factor()
4150
sol = []
4251
for icol in range(rhs.shape[1]):
43-
sol.append(self.solver(self.A, rhs[:, icol].flatten(),
44-
tol=self.tol, maxiter=self.maxiter, M=self.M)[0])
52+
sol.append(
53+
self.solver(
54+
self.A,
55+
rhs[:, icol].flatten(),
56+
**{
57+
TOL_ARG_NAME: self.tol,
58+
"maxiter": self.maxiter,
59+
"M": self.M,
60+
}
61+
)[0]
62+
)
4563
out = np.hstack(sol)
4664
out.shape
4765
return out

requirements_docs.txt

+4
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

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
packages=find_packages(exclude=["*mumps", "tests"]),
3434
install_requires=[
3535
'numpy>=1.7',
36-
'scipy>=0.13',
36+
'scipy>=1.8',
3737
],
3838
author="Rowan Cockett",
3939
author_email="[email protected]",

0 commit comments

Comments
 (0)