Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix CI #46

Merged
merged 18 commits into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
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
16 changes: 9 additions & 7 deletions .github/workflows/python-package-conda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@ jobs:
shell: bash -l {0}
strategy:
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
python-version: [3.7, 3.8, 3.9, "3.10"]
# NOTE: macOS-13 is the last Intel runner.
# When we move past that version we'll need to deal with Apple Silicon, likely using MUMPS.
os: [ubuntu-latest, windows-latest, macOS-13]
python-version: ["3.8", "3.9", "3.10", "3.11"]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Setup Conda
uses: conda-incubator/setup-miniconda@v2
uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
activate-environment: dev
Expand Down Expand Up @@ -56,7 +58,7 @@ jobs:

- name: Upload coverage
if: ${{ matrix.os == 'ubuntu-latest' }} and {{ matrix.python-version == '3.8' }}
uses: codecov/codecov-action@v2
uses: codecov/codecov-action@v4
with:
verbose: true # optional (default = false)

Expand All @@ -70,9 +72,9 @@ jobs:
shell: bash -l {0}

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Setup Conda
uses: conda-incubator/setup-miniconda@v2
uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
activate-environment: dev
Expand Down
34 changes: 26 additions & 8 deletions pymatsolver/iterative.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
import numpy as np
import scipy
import scipy.sparse as sp
from scipy.sparse.linalg import bicgstab
from scipy.sparse.linalg import aslinearoperator, bicgstab
from packaging.version import Version
from pymatsolver.solvers import Base

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


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

def _solve1(self, rhs):
self.factor()
sol, info = self.solver(
self.A, rhs,
tol=self.tol,
maxiter=self.maxiter,
M=self.M
self.A,
rhs,
**{
TOL_ARG_NAME: self.tol,
"maxiter": self.maxiter,
"M": self.M,
}
)
return sol

def _solveM(self, rhs):
self.factor()
sol = []
for icol in range(rhs.shape[1]):
sol.append(self.solver(self.A, rhs[:, icol].flatten(),
tol=self.tol, maxiter=self.maxiter, M=self.M)[0])
sol.append(
self.solver(
self.A,
rhs[:, icol].flatten(),
**{
TOL_ARG_NAME: self.tol,
"maxiter": self.maxiter,
"M": self.M,
}
)[0]
)
out = np.hstack(sol)
out.shape
return out
Expand Down
4 changes: 4 additions & 0 deletions requirements_docs.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
sphinx
numpydoc

# Restrict pydata-sphinx-theme on older versions of Python on Windows.
# Otherwise we get doc build failures.
pydata-sphinx-theme~=0.14.4,<0.15 ; python_version <= '3.9' and platform_system == "Windows"
pydata-sphinx-theme
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
packages=find_packages(exclude=["*mumps", "tests"]),
install_requires=[
'numpy>=1.7',
'scipy>=0.13',
'scipy>=1.8',
],
author="Rowan Cockett",
author_email="[email protected]",
Expand Down
Loading