Skip to content

Commit

Permalink
align definition of sort functions between arnoldi and lanczos
Browse files Browse the repository at this point in the history
  • Loading branch information
lehner committed Jan 22, 2025
1 parent e58b75d commit 6381c05
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/gpt/algorithms/eigen/irl.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def __call__(self, mat, src, ckpt=None):
Nstop = self.params["Nstop"]
sort_eigenvalues = self.params["sort_eigenvalues"]
if sort_eigenvalues is None:
sort_eigenvalues = lambda x: reversed(sorted(x))
sort_eigenvalues = lambda x: sorted(x)

Check failure on line 70 in lib/gpt/algorithms/eigen/irl.py

View workflow job for this annotation

GitHub Actions / lint

E731:do not assign a lambda expression, use a def
rotate_use_accelerator = self.params["rotate_use_accelerator"]
assert Nm >= Nk and Nstop <= Nk

Expand Down Expand Up @@ -120,7 +120,7 @@ def __call__(self, mat, src, ckpt=None):

# sort
ev2_copy = ev2.copy()
ev2 = list(sort_eigenvalues(ev2))
ev2 = list(reversed(sort_eigenvalues(ev2)))

# implicitly shifted QR transformations
Qt = np.identity(Nm, dtype)
Expand Down
2 changes: 1 addition & 1 deletion tests/algorithms/implicitly_restarted_lanczos.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"maxiter": 20,
"Nminres": 7,
# "maxapply" : 100
"sort_eigenvalues": lambda x: reversed(sorted(x))
"sort_eigenvalues": lambda x: sorted(x)
}
)

Expand Down

0 comments on commit 6381c05

Please sign in to comment.