mirror of
https://github.com/TheAlgorithms/Python.git
synced 2024-11-27 15:01:08 +00:00
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
parent
d2afa4cc8b
commit
7977b61135
|
@ -3,20 +3,20 @@ import numpy as np
|
||||||
|
|
||||||
def lanczos(a: np.ndarray) -> tuple[list[float], list[float]]:
|
def lanczos(a: np.ndarray) -> tuple[list[float], list[float]]:
|
||||||
"""
|
"""
|
||||||
Implements the Lanczos algorithm for a symmetric matrix.
|
Implements the Lanczos algorithm for a symmetric matrix.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
-----------
|
-----------
|
||||||
matrix : numpy.ndarray
|
matrix : numpy.ndarray
|
||||||
Symmetric matrix of size (n, n).
|
Symmetric matrix of size (n, n).
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
--------
|
--------
|
||||||
alpha : [float]
|
alpha : [float]
|
||||||
List of diagonal elements of the resulting tridiagonal matrix.
|
List of diagonal elements of the resulting tridiagonal matrix.
|
||||||
beta : [float]
|
beta : [float]
|
||||||
List of off-diagonal elements of the resulting tridiagonal matrix.
|
List of off-diagonal elements of the resulting tridiagonal matrix.
|
||||||
"""
|
"""
|
||||||
n = a.shape[0]
|
n = a.shape[0]
|
||||||
v = np.zeros((n, n))
|
v = np.zeros((n, n))
|
||||||
rng = np.random.default_rng()
|
rng = np.random.default_rng()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user