Skip to content

Commit 55ef77d

Browse files
authored
Merge pull request #53 from simpeg/0.4.0_updates
0.4.0 updates
2 parents 5b71ac4 + d788ce3 commit 55ef77d

File tree

9 files changed

+53
-126
lines changed

9 files changed

+53
-126
lines changed

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

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,6 @@
11
name: Testing
22

3-
on:
4-
push:
5-
branches:
6-
- 'main'
7-
tags:
8-
- 'v*'
9-
pull_request:
10-
branches:
11-
- '*'
3+
on: [push, pull_request]
124

135
jobs:
146
build-and-test:
@@ -20,10 +12,13 @@ jobs:
2012
strategy:
2113
fail-fast: false
2214
matrix:
23-
# NOTE: macOS-13 is the last Intel runner.
24-
os: [ubuntu-latest, windows-latest, macOS-13, macOS-latest]
15+
os: [ubuntu-latest, windows-latest, macOS-15-intel, macOS-latest]
2516
solver: [mumps, pardiso]
26-
python-version : ['3.10', '3.11', '3.12']
17+
python-version : ['3.11', '3.12', '3.13', '3.14']
18+
include:
19+
- os: ubuntu-latest
20+
python-version: '3.13'
21+
full-test: true
2722
exclude:
2823
- os: macOS-latest
2924
solver: pardiso
@@ -63,22 +58,22 @@ jobs:
6358
make coverage
6459
6560
- name: Generate Source Distribution
66-
if: ${{ (matrix.os == 'ubuntu-latest') && (matrix.python-version == '3.11') }}
61+
if: ${{ matrix.full-test }}
6762
run: |
6863
pip install build twine
6964
python -m build --sdist .
7065
twine check dist/*
7166
7267
- name: Test Documentation
73-
if: ${{ (matrix.os == 'ubuntu-latest') && (matrix.python-version == '3.11') }}
68+
if: ${{ matrix.full-test }}
7469
run: |
7570
pip install .[docs]
7671
cd docs
7772
make html
7873
cd ..
7974
8075
- name: Upload coverage
81-
if: ${{ (matrix.os == 'ubuntu-latest') && (matrix.python-version == '3.11') }}
76+
if: ${{ matrix.full-test }}
8277
uses: codecov/codecov-action@v4
8378
with:
8479
verbose: true # optional (default = false)
@@ -94,7 +89,7 @@ jobs:
9489
run:
9590
shell: bash -l {0}
9691
env:
97-
PYTHON_VERSION: '3.11'
92+
PYTHON_VERSION: '3.13'
9893

9994
steps:
10095
- uses: actions/checkout@v4

pymatsolver/direct/mumps.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,22 +28,18 @@ class Mumps(Base):
2828
The relative tolerance to check against for accuracy.
2929
check_atol : float, optional
3030
The absolute tolerance to check against for accuracy.
31-
accuracy_tol : float, optional
32-
Relative accuracy tolerance.
33-
.. deprecated:: 0.3.0
34-
`accuracy_tol` will be removed in pymatsolver 0.4.0. Use `check_rtol` and `check_atol` instead.
3531
**kwargs
3632
Extra keyword arguments. If there are any left here a warning will be raised.
3733
"""
3834
_transposed = False
3935

40-
def __init__(self, A, ordering=None, is_symmetric=None, is_positive_definite=False, check_accuracy=False, check_rtol=1e-6, check_atol=0, accuracy_tol=None, **kwargs):
36+
def __init__(self, A, ordering=None, is_symmetric=None, is_positive_definite=False, check_accuracy=False, check_rtol=1e-6, check_atol=0, **kwargs):
4137
if not _available:
4238
raise ImportError(
4339
"The Mumps solver requires the python-mumps package to be installed."
4440
)
4541
is_hermitian = kwargs.pop('is_hermitian', False)
46-
super().__init__(A, is_symmetric=is_symmetric, is_positive_definite=is_positive_definite, is_hermitian=is_hermitian, check_accuracy=check_accuracy, check_rtol=check_rtol, check_atol=check_atol, accuracy_tol=accuracy_tol, **kwargs)
42+
super().__init__(A, is_symmetric=is_symmetric, is_positive_definite=is_positive_definite, is_hermitian=is_hermitian, check_accuracy=check_accuracy, check_rtol=check_rtol, check_atol=check_atol, **kwargs)
4743
if ordering is None:
4844
ordering = "metis"
4945
self.ordering = ordering

pymatsolver/direct/pardiso.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,20 +32,16 @@ class Pardiso(Base):
3232
The relative tolerance to check against for accuracy.
3333
check_atol : float, optional
3434
The absolute tolerance to check against for accuracy.
35-
accuracy_tol : float, optional
36-
Relative accuracy tolerance.
37-
.. deprecated:: 0.3.0
38-
`accuracy_tol` will be removed in pymatsolver 0.4.0. Use `check_rtol` and `check_atol` instead.
3935
**kwargs
4036
Extra keyword arguments. If there are any left here a warning will be raised.
4137
"""
4238

4339
_transposed = False
4440

45-
def __init__(self, A, n_threads=None, is_symmetric=None, is_positive_definite=False, is_hermitian=None, check_accuracy=False, check_rtol=1e-6, check_atol=0, accuracy_tol=None, **kwargs):
41+
def __init__(self, A, n_threads=None, is_symmetric=None, is_positive_definite=False, is_hermitian=None, check_accuracy=False, check_rtol=1e-6, check_atol=0, **kwargs):
4642
if not _available:
4743
raise ImportError("Pardiso solver requires the pydiso package to be installed.")
48-
super().__init__(A, is_symmetric=is_symmetric, is_positive_definite=is_positive_definite, is_hermitian=is_hermitian, check_accuracy=check_accuracy, check_rtol=check_rtol, check_atol=check_atol, accuracy_tol=accuracy_tol, **kwargs)
44+
super().__init__(A, is_symmetric=is_symmetric, is_positive_definite=is_positive_definite, is_hermitian=is_hermitian, check_accuracy=check_accuracy, check_rtol=check_rtol, check_atol=check_atol, **kwargs)
4945
self.solver = MKLPardisoSolver(
5046
self.A,
5147
matrix_type=self._matrixType(),

pymatsolver/iterative.py

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@ class BiCGJacobi(Base):
2121
----------
2222
A : matrix
2323
The matrix to solve, must have a ``diagonal()`` method.
24-
symmetric: boolean, optional
25-
.. deprecated:: 0.3.0
26-
`symmetric` is deprecated. It is unused, and will be removed in pymatsolver 0.4.0.
2724
maxiter : int, optional
2825
The maximum number of BiCG iterations to perform.
2926
rtol : float, optional
@@ -36,21 +33,14 @@ class BiCGJacobi(Base):
3633
The relative tolerance to check against for accuracy.
3734
check_atol : float, optional
3835
The absolute tolerance to check against for accuracy.
39-
accuracy_tol : float, optional
40-
Relative accuracy tolerance.
41-
.. deprecated:: 0.3.0
42-
`accuracy_tol` will be removed in pymatsolver 0.4.0. Use `check_rtol` and `check_atol` instead.
4336
**kwargs
4437
Extra keyword arguments passed to the base class.
4538
"""
4639

47-
def __init__(self, A, symmetric=None, maxiter=1000, rtol=1E-6, atol=0.0, check_accuracy=False, check_rtol=1e-6, check_atol=0, accuracy_tol=None, **kwargs):
48-
if symmetric is not None:
49-
warnings.warn(
50-
"The symmetric keyword argument is unused and is deprecated. It will be removed in pymatsolver 0.4.0.",
51-
FutureWarning, stacklevel=2
52-
)
53-
super().__init__(A, check_accuracy=check_accuracy, check_rtol=check_rtol, check_atol=check_atol, accuracy_tol=accuracy_tol, **kwargs)
40+
def __init__(self, A, maxiter=1000, rtol=1E-6, atol=0.0, check_accuracy=False, check_rtol=1e-6, check_atol=0, **kwargs):
41+
if "symmetric" in kwargs:
42+
raise TypeError("The symmetric keyword argument was been removed in pymatsolver 0.4.0.")
43+
super().__init__(A, check_accuracy=check_accuracy, check_rtol=check_rtol, check_atol=check_atol, **kwargs)
5444
self._factored = False
5545
self.maxiter = maxiter
5646
self.rtol = rtol

pymatsolver/solvers.py

Lines changed: 11 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,6 @@ class Base(ABC):
3636
The relative tolerance to check against for accuracy.
3737
check_atol : float, optional
3838
The absolute tolerance to check against for accuracy.
39-
accuracy_tol : float, optional
40-
Relative accuracy tolerance.
41-
.. deprecated:: 0.3.0
42-
`accuracy_tol` will be removed in pymatsolver 0.4.0. Use `check_rtol` and `check_atol` instead.
4339
**kwargs
4440
Extra keyword arguments. If there are any left here a warning will be raised.
4541
"""
@@ -50,7 +46,7 @@ class Base(ABC):
5046
_is_conjugate = False
5147

5248
def __init__(
53-
self, A, is_symmetric=None, is_positive_definite=False, is_hermitian=None, check_accuracy=False, check_rtol=1e-6, check_atol=0, accuracy_tol=None, **kwargs
49+
self, A, is_symmetric=None, is_positive_definite=False, is_hermitian=None, check_accuracy=False, check_rtol=1e-6, check_atol=0, **kwargs
5450
):
5551
# don't make any assumptions on what A is, let the individual solvers handle that
5652
shape = A.shape
@@ -61,13 +57,8 @@ def __init__(
6157
self._A = A
6258
self._dtype = np.dtype(A.dtype)
6359

64-
if accuracy_tol is not None:
65-
warnings.warn(
66-
"accuracy_tol is deprecated and will be removed in v0.4.0, use check_rtol and check_atol.",
67-
FutureWarning,
68-
stacklevel=3
69-
)
70-
check_rtol = accuracy_tol
60+
if 'accuracy_tol' in kwargs:
61+
raise TypeError("'accuracy_tol' was removed in v0.4.0, use 'check_rtol' and 'check_atol'.")
7162

7263
self.check_accuracy = check_accuracy
7364
self.check_rtol = check_rtol
@@ -341,14 +332,6 @@ def solve(self, rhs):
341332
rhs = rhs.conjugate()
342333
x = self._solve_single(rhs)
343334
else:
344-
if ndim == 2 and rhs.shape[-1] == 1:
345-
warnings.warn(
346-
"In Future pymatsolver v0.4.0, passing a vector of shape (n, 1) to the solve method "
347-
"will return an array with shape (n, 1), instead of always returning a flattened array. "
348-
"This is to be consistent with numpy.linalg.solve broadcasting.",
349-
FutureWarning,
350-
stacklevel=2
351-
)
352335
if rhs.shape[-2] != n:
353336
raise ValueError(f'Second to last dimension should be {n}, got {rhs.shape}')
354337
do_broadcast = rhs.ndim > 2
@@ -377,10 +360,6 @@ def solve(self, rhs):
377360
if self.check_accuracy:
378361
self._compute_accuracy(rhs, x)
379362

380-
#TODO remove this in v0.4.0.
381-
if x.size == n:
382-
x = x.reshape(-1)
383-
384363
if self._is_conjugate:
385364
x = x.conjugate()
386365
return x
@@ -449,15 +428,11 @@ class Diagonal(Base):
449428
The relative tolerance to check against for accuracy.
450429
check_atol : float, optional
451430
The absolute tolerance to check against for accuracy.
452-
accuracy_tol : float, optional
453-
Relative accuracy tolerance.
454-
.. deprecated:: 0.3.0
455-
`accuracy_tol` will be removed in pymatsolver 0.4.0. Use `check_rtol` and `check_atol` instead.
456431
**kwargs
457432
Extra keyword arguments passed to the base class.
458433
"""
459434

460-
def __init__(self, A, check_accuracy=False, check_rtol=1e-6, check_atol=0, accuracy_tol=None, **kwargs):
435+
def __init__(self, A, check_accuracy=False, check_rtol=1e-6, check_atol=0, **kwargs):
461436
try:
462437
self._diagonal = np.asarray(A.diagonal())
463438
if not np.all(self._diagonal):
@@ -469,7 +444,7 @@ def __init__(self, A, check_accuracy=False, check_rtol=1e-6, check_atol=0, accur
469444
is_hermitian = kwargs.pop("is_hermitian", None)
470445
is_positive_definite = kwargs.pop("is_positive_definite", None)
471446
super().__init__(
472-
A, is_symmetric=True, is_hermitian=False, check_accuracy=check_accuracy, check_rtol=check_rtol, check_atol=check_atol, accuracy_tol=accuracy_tol, **kwargs
447+
A, is_symmetric=True, is_hermitian=False, check_accuracy=check_accuracy, check_rtol=check_rtol, check_atol=check_atol, **kwargs
473448
)
474449
if is_positive_definite is None:
475450
if self.is_real:
@@ -510,23 +485,19 @@ class Triangle(Base):
510485
The relative tolerance to check against for accuracy.
511486
check_atol : float, optional
512487
The absolute tolerance to check against for accuracy.
513-
accuracy_tol : float, optional
514-
Relative accuracy tolerance.
515-
.. deprecated:: 0.3.0
516-
`accuracy_tol` will be removed in pymatsolver 0.4.0. Use `check_rtol` and `check_atol` instead.
517488
**kwargs
518489
Extra keyword arguments passed to the base class.
519490
"""
520491

521-
def __init__(self, A, lower=True, check_accuracy=False, check_rtol=1e-6, check_atol=0, accuracy_tol=None, **kwargs):
492+
def __init__(self, A, lower=True, check_accuracy=False, check_rtol=1e-6, check_atol=0, **kwargs):
522493
# pop off unneeded keyword arguments.
523494
is_hermitian = kwargs.pop("is_hermitian", False)
524495
is_symmetric = kwargs.pop("is_symmetric", False)
525496
is_positive_definite = kwargs.pop("is_positive_definite", False)
526497
if not (sp.issparse(A) and A.format in ['csr', 'csc']):
527498
A = sp.csc_matrix(A)
528499
A.sum_duplicates()
529-
super().__init__(A, is_hermitian=is_hermitian, is_symmetric=is_symmetric, is_positive_definite=is_positive_definite, check_accuracy=check_accuracy, check_rtol=check_rtol, check_atol=check_atol, accuracy_tol=accuracy_tol, **kwargs)
500+
super().__init__(A, is_hermitian=is_hermitian, is_symmetric=is_symmetric, is_positive_definite=is_positive_definite, check_accuracy=check_accuracy, check_rtol=check_rtol, check_atol=check_atol, **kwargs)
530501

531502
self.lower = lower
532503

@@ -565,17 +536,13 @@ class Forward(Triangle):
565536
The relative tolerance to check against for accuracy.
566537
check_atol : float, optional
567538
The absolute tolerance to check against for accuracy.
568-
accuracy_tol : float, optional
569-
Relative accuracy tolerance.
570-
.. deprecated:: 0.3.0
571-
`accuracy_tol` will be removed in pymatsolver 0.4.0. Use `check_rtol` and `check_atol` instead.
572539
**kwargs
573540
Extra keyword arguments passed to the base class.
574541
"""
575542

576-
def __init__(self, A, check_accuracy=False, check_rtol=1e-6, check_atol=0, accuracy_tol=None, **kwargs):
543+
def __init__(self, A, check_accuracy=False, check_rtol=1e-6, check_atol=0, **kwargs):
577544
kwargs.pop("lower", None)
578-
super().__init__(A, lower=True, check_accuracy=check_accuracy, check_rtol=check_rtol, check_atol=check_atol, accuracy_tol=accuracy_tol, **kwargs)
545+
super().__init__(A, lower=True, check_accuracy=check_accuracy, check_rtol=check_rtol, check_atol=check_atol, **kwargs)
579546

580547

581548
class Backward(Triangle):
@@ -591,19 +558,15 @@ class Backward(Triangle):
591558
The relative tolerance to check against for accuracy.
592559
check_atol : float, optional
593560
The absolute tolerance to check against for accuracy.
594-
accuracy_tol : float, optional
595-
Relative accuracy tolerance.
596-
.. deprecated:: 0.3.0
597-
`accuracy_tol` will be removed in pymatsolver 0.4.0. Use `check_rtol` and `check_atol` instead.
598561
**kwargs
599562
Extra keyword arguments passed to the base class.
600563
"""
601564

602565
_transpose_class = Forward
603566

604-
def __init__(self, A, check_accuracy=False, check_rtol=1e-6, check_atol=0, accuracy_tol=None, **kwargs):
567+
def __init__(self, A, check_accuracy=False, check_rtol=1e-6, check_atol=0, **kwargs):
605568
kwargs.pop("lower", None)
606-
super().__init__(A, lower=False, check_accuracy=check_accuracy, check_rtol=check_rtol, check_atol=check_atol, accuracy_tol=accuracy_tol, **kwargs)
569+
super().__init__(A, lower=False, check_accuracy=check_accuracy, check_rtol=check_rtol, check_atol=check_atol, **kwargs)
607570

608571

609572
Forward._transpose_class = Backward

pymatsolver/wrappers.py

Lines changed: 5 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ def wrap_direct(fun, factorize=True, name=None):
7272
>>> SolverLU = pymatsolver.WrapDirect(splu, factorize=True)
7373
"""
7474

75-
def __init__(self, A, check_accuracy=False, check_rtol=1E-6, check_atol=0, accuracy_tol=None, **kwargs):
75+
def __init__(self, A, check_accuracy=False, check_rtol=1E-6, check_atol=0, **kwargs):
7676
Base.__init__(
77-
self, A, check_accuracy=check_accuracy, check_rtol=check_rtol, check_atol=check_atol, accuracy_tol=accuracy_tol,
77+
self, A, check_accuracy=check_accuracy, check_rtol=check_rtol, check_atol=check_atol,
7878
)
7979
self.kwargs = kwargs
8080
if factorize:
@@ -137,34 +137,20 @@ def clean(self):
137137
The relative tolerance to check against for accuracy.
138138
check_atol : float, optional
139139
The absolute tolerance to check against for accuracy.
140-
accuracy_tol : float, optional
141-
Relative accuracy tolerance.
142-
.. deprecated:: 0.3.0
143-
`accuracy_tol` will be removed in pymatsolver 0.4.0. Use `check_rtol` and `check_atol` instead.
144140
**kwargs
145141
Extra keyword arguments which will attempted to be passed to the wrapped function.
146142
"""
147143
return WrappedClass
148144

149145

150-
def wrap_iterative(fun, check_accuracy=None, accuracy_tol=None, name=None):
146+
def wrap_iterative(fun, name=None):
151147
"""
152148
Wraps an iterative Solver.
153149
154150
Parameters
155151
----------
156152
fun : callable
157153
The iterative Solver function.
158-
check_accuracy : bool, optional
159-
.. deprecated:: 0.3.0
160-
The `check_accuracy` argument was previously unused. This will be
161-
removed in a `pymatsolver` 0.4.0. Pass the relevant accuracy check parameters
162-
to the wrapped class.
163-
accuracy_tol : bool, optional
164-
.. deprecated:: 0.3.0
165-
The `check_accuracy` argument was previously unused. This will be
166-
removed in a `pymatsolver` 0.4.0. Pass the relevant accuracy check parameters
167-
to the wrapped class.
168154
name : string, optional
169155
The name of the wrapper class to construct. Defaults to the name of `fun`.
170156
@@ -185,14 +171,10 @@ def wrap_iterative(fun, check_accuracy=None, accuracy_tol=None, name=None):
185171
>>> SolverCG = pymatsolver.WrapIterative(cg)
186172
187173
"""
188-
if check_accuracy is not None or accuracy_tol is not None:
189-
warnings.warn('check_accuracy and accuracy_tol were unused and are now deprecated. They '
190-
'will be removed in pymatsolver v0.4.0. Please pass the keyword arguments `check_rtol` '
191-
'and check_atol directly to the wrapped solver class.', FutureWarning, stacklevel=2)
192174

193-
def __init__(self, A, check_accuracy=False, check_rtol=1E-6, check_atol=0, accuracy_tol=None, **kwargs):
175+
def __init__(self, A, check_accuracy=False, check_rtol=1E-6, check_atol=0, **kwargs):
194176
Base.__init__(
195-
self, A, check_accuracy=check_accuracy, check_rtol=check_rtol, check_atol=check_atol, accuracy_tol=accuracy_tol,
177+
self, A, check_accuracy=check_accuracy, check_rtol=check_rtol, check_atol=check_atol,
196178
)
197179
self.kwargs = kwargs
198180

@@ -245,10 +227,6 @@ def _solve_multiple(self, rhs):
245227
The relative tolerance to check against for accuracy.
246228
check_atol : float, optional
247229
The absolute tolerance to check against for accuracy.
248-
accuracy_tol : float, optional
249-
Relative accuracy tolerance.
250-
.. deprecated:: 0.3.0
251-
`accuracy_tol` will be removed in pymatsolver 0.4.0. Use `check_rtol` and `check_atol` instead.
252230
**kwargs
253231
Extra keyword arguments which will attempted to be passed to the wrapped function.
254232
"""

0 commit comments

Comments
 (0)