Skip to content

Commit

Permalink
Changed parameter eigvals to subset_by_value in scipy.linalg.eigh() f…
Browse files Browse the repository at this point in the history
…unction. Now support scipy==1.14.0.
  • Loading branch information
Fred2371218232 committed Aug 2, 2024
1 parent c2efce0 commit 5e3c3be
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/build-code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,8 @@ jobs:
- name: Test with pytest
run: |
# conda install -yq -c ${CONDA_PREFIX}/conda-bld/ msmbuilder2022
pip install pytest==8.0.2
conda install scipy=1.13.1
conda install -yq numdifftools hmmlearn
pip install pytest==8.0.2
mkdir ../../pkgs
cp -r msmbuilder/tests ../../pkgs
cd ../../pkgs
Expand Down
4 changes: 2 additions & 2 deletions msmbuilder/decomposition/_speigh.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def speigh(double[:, ::1] A, double[:, ::1] B, double rho, double eps=1e-6,
cdef double[::1] b = np.empty(N)
# Initialize solver from dominant generalized eigenvector (unregularized
# solution)
x = scipy.linalg.eigh(A, B, eigvals=(N-1, N-1))[1][:,0]
x = scipy.linalg.eigh(A, B, subset_by_index=[N-1, N-1])[1][:,0]

cdef double[::1] B_eigvals
cdef double[:, ::1] B_eigvecs
Expand Down Expand Up @@ -182,7 +182,7 @@ def speigh(double[:, ::1] A, double[:, ::1] B, double rho, double eps=1e-6,
u = Ak[0,0] / Bk[0,0]
else:
gevals, gevecs = scipy.linalg.eigh(
Ak, Bk, eigvals=(Ak.shape[0]-1, Ak.shape[0]-1))
Ak, Bk, subset_by_index=[Ak.shape[0]-1, Ak.shape[0]-1])
# Usually slower to use sparse linear algebra here
# gevals, gevecs = scipy.sparse.linalg.eigsh(
# A=Ak, M=Bk, k=1, v0=x[mask], which='LA')
Expand Down
2 changes: 1 addition & 1 deletion msmbuilder/decomposition/tica.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ def _solve(self):
raise RuntimeError('correlation matrix is not symmetric')

vals, vecs = scipy.linalg.eigh(lhs, b=rhs,
eigvals=(self.n_features-self.n_components, self.n_features-1))
subset_by_index=[self.n_features-self.n_components, self.n_features-1])

# sort in order of decreasing value
ind = np.argsort(vals)[::-1]
Expand Down

0 comments on commit 5e3c3be

Please sign in to comment.