Skip to content
Snippets Groups Projects
Commit a60d562e authored by Michele Nottoli's avatar Michele Nottoli
Browse files

Linted.

parent e0ad7c65
No related branches found
No related tags found
No related merge requests found
......@@ -5,14 +5,16 @@ import numpy as np
def linear(vectors: List[np.ndarray], target: np.ndarray):
"""Simple least square minimization fitting."""
A = np.vstack(vectors).T
coefficients, _, _, _ = np.linalg.lstsq(A, target, rcond=None)
matrix = np.vstack(vectors).T
coefficients, _, _, _ = np.linalg.lstsq(matrix, target, rcond=None)
return np.array(coefficients, dtype=np.float64)
def quasi_time_reversible():
"""Time reversible least square minimization fitting."""
def linear_combination(vectors: List[np.ndarray], coefficients: np.ndarray) -> np.ndarray:
"""Given a set of vectors (or matrices) and the corresponding
coefficients, build their linear combination."""
result = np.zeros(vectors[0].shape, dtype=np.float64)
for coeff, vector in zip(coefficients, vectors):
result += vector*coeff
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment