Skip to content

Commit

Permalink
Fix rtol for scipy iterative solver, bump version (theislab#1237)
Browse files Browse the repository at this point in the history
* Fix rtol for sciPy iterative solver, bump version

* Test on 3.13

* Try patching `.A`

* Add 3.13 runner

* Don't run on 3.13 (numba)

* Test on `macos-15`
  • Loading branch information
michalk8 authored Dec 14, 2024
1 parent 82248b2 commit bf27c94
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
python: ['3.9', '3.10', '3.11', '3.12']
slepc: [noslepc]
include:
- os: macos-14
- os: macos-15
python: '3.10'
slepc: noslepc
- os: ubuntu-latest
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ dependencies = [
"pygpcca>=1.0.4",
"scanpy>=1.7.2",
"scikit-learn>=0.24.0",
"scipy>=1.2.0",
"scipy>=1.12.0",
"scvelo>=0.2.5",
"seaborn>=0.10.0",
"wrapt>=1.12.1",
Expand Down Expand Up @@ -239,7 +239,7 @@ legacy_tox_ini = """
# TODO(michalk8): upgrade to `tox>=4.0` once `tox-conda` supports it
requires = tox-conda
isolated_build = true
envlist = lint-code,py{3.9,3.10,3.11,3.12}-{slepc,noslepc}
envlist = lint-code,py{3.9,3.10,3.11,3.12,3.13}-{slepc,noslepc}
skip_missing_interpreters = true
[testenv]
Expand Down
7 changes: 6 additions & 1 deletion src/cellrank/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from importlib import metadata

import scipy.sparse as sp

from cellrank import datasets, estimators, kernels, logging, models, pl
from cellrank._utils._lineage import Lineage
from cellrank.settings import settings
Expand All @@ -14,4 +16,7 @@
except ImportError:
md = None

del metadata, md
# pygam uses `.A`
sp.spmatrix.A = property(lambda self: self.toarray())

del metadata, md, sp
4 changes: 1 addition & 3 deletions src/cellrank/_utils/_linear_solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,11 +223,9 @@ def _solve_many_sparse_problems(
"""
# initialise solution list and info list
x_list, n_converged = [], 0
kwargs = {} if solver is not sp.linalg.gmres else {"atol": "legacy"} # get rid of the warning

for b in mat_b:
# actually call the solver for the current sub-problem
x, info = solver(mat_a, b.toarray().flatten(), tol=tol, x0=None, **kwargs)
x, info = solver(mat_a, b.toarray().flatten(), rtol=tol, x0=None)

# append solution and info
x_list.append(np.atleast_1d(x))
Expand Down

0 comments on commit bf27c94

Please sign in to comment.