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

Lint.

parent 7dfaccc0
Branches
Tags
1 merge request!6QTR
Pipeline #1959 passed
......@@ -61,11 +61,11 @@ class LeastSquare(AbstractFitting):
"""Given a set of vectors and a target return the fitting
coefficients."""
matrix = np.array(vectors).T
A = matrix.T @ matrix
a = matrix.T @ matrix
b = matrix.T @ target
if self.options["regularization"] > 0.0:
A += np.identity(len(b))*self.options["regularization"]
coefficients = np.linalg.solve(A, b)
a += np.identity(len(b))*self.options["regularization"]
coefficients = np.linalg.solve(a, b)
return np.array(coefficients, dtype=np.float64)
class QuasiTimeReversible(AbstractFitting):
......@@ -98,12 +98,12 @@ class QuasiTimeReversible(AbstractFitting):
else:
time_reversible_matrix = matrix[:, :q//2+1] + matrix[:, :q//2-1:-1]
A = time_reversible_matrix.T @ time_reversible_matrix
a = time_reversible_matrix.T @ time_reversible_matrix
b = time_reversible_matrix.T @ (target + past_target)
if self.options["regularization"] > 0.0:
A += np.identity(len(b))*self.options["regularization"]
coefficients = np.linalg.solve(A, b)
a += np.identity(len(b))*self.options["regularization"]
coefficients = np.linalg.solve(a, b)
if q == 1:
full_coefficients = np.concatenate(([-1.0], coefficients))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment