Skip to content

Commit d2afa4c

Browse files
committed
Changed the structure to correspond with PEP8 convention.
1 parent baf934f commit d2afa4c

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

linear_algebra/lanczos_algorithm.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import numpy as np
2+
3+
24
def lanczos(a: np.ndarray) -> tuple[list[float], list[float]]:
35
"""
46
Implements the Lanczos algorithm for a symmetric matrix.
@@ -20,8 +22,8 @@ def lanczos(a: np.ndarray) -> tuple[list[float], list[float]]:
2022
rng = np.random.default_rng()
2123
v[:, 0] = rng.standard_normal(n)
2224
v[:, 0] /= np.linalg.norm(v[:, 0])
23-
alpha : list[float] = []
24-
beta : list[float] = []
25+
alpha: list[float] = []
26+
beta: list[float] = []
2527
for j in range(n):
2628
w = np.dot(a, v[:, j])
2729
alpha.append(np.dot(w, v[:, j]))
@@ -32,4 +34,4 @@ def lanczos(a: np.ndarray) -> tuple[list[float], list[float]]:
3234
w -= beta[j - 1] * v[:, j - 1]
3335
beta.append(np.linalg.norm(w))
3436
v[:, j + 1] = w / beta[j]
35-
return alpha, beta
37+
return alpha, beta

0 commit comments

Comments
 (0)