fix(mypy): type annotations for linear algebra algorithms (#4317)

* fix(mypy): type annotations for linear algebra algorithms

* refactor: remove linear algebra directory from mypy exclude
This commit is contained in:
Dhruv Manilawala
2021-04-05 19:07:38 +05:30
committed by GitHub
parent 20c7518028
commit 8c2986026b
8 changed files with 100 additions and 74 deletions

View File

@ -2,8 +2,11 @@ import numpy as np
def power_iteration(
input_matrix: np.array, vector: np.array, error_tol=1e-12, max_iterations=100
) -> [float, np.array]:
input_matrix: np.ndarray,
vector: np.ndarray,
error_tol: float = 1e-12,
max_iterations: int = 100,
) -> tuple[float, np.ndarray]:
"""
Power Iteration.
Find the largest eignevalue and corresponding eigenvector