Skip to content

Commit

Permalink
bugfix within sst: array indexing went out of bounds in lanczos method
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucas Weber authored and Lucas Weber committed Nov 15, 2023
1 parent ab815f1 commit 0776ae9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions changepoynt/utils/linalg.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def power_method(a_matrix: np.ndarray, x_vector: np.ndarray, n_iterations: int)
return eigenvalue, (a_matrix @ x_vector)/eigenvalue


@jit(nopython=True)
# @jit(nopython=True)
def lanczos(a_matrix: np.ndarray, r_0: np.ndarray, k: int) -> (np.ndarray, np.ndarray):
"""
This function computes the tri-diagonalization matrix from the square matrix C which is the result of the lanczos
Expand Down Expand Up @@ -72,7 +72,7 @@ def lanczos(a_matrix: np.ndarray, r_0: np.ndarray, k: int) -> (np.ndarray, np.nd
betas = np.ones(shape=(k + 1,), dtype=np.float64)

# Subroutine 1 of the paper
for j in range(k + 1):
for j in range(k):
# compute r_(j+1)
new_q = r_i / betas[j]

Expand Down

0 comments on commit 0776ae9

Please sign in to comment.