From 0776ae96c860dfdfd6d3bdba4628aaa2f2c060d9 Mon Sep 17 00:00:00 2001 From: Lucas Weber Date: Wed, 15 Nov 2023 11:45:37 +0100 Subject: [PATCH] bugfix within sst: array indexing went out of bounds in lanczos method --- changepoynt/utils/linalg.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/changepoynt/utils/linalg.py b/changepoynt/utils/linalg.py index 09c2cd9..82d834b 100644 --- a/changepoynt/utils/linalg.py +++ b/changepoynt/utils/linalg.py @@ -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 @@ -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]