From 7e6da5b162416e056a1888ed6a79258fd5d5006f Mon Sep 17 00:00:00 2001 From: Valentin Boettcher Date: Tue, 8 Feb 2022 11:11:39 +0100 Subject: [PATCH] minor fixes --- stocproc/stocproc.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/stocproc/stocproc.py b/stocproc/stocproc.py index ee914e1..bb8662e 100644 --- a/stocproc/stocproc.py +++ b/stocproc/stocproc.py @@ -875,28 +875,28 @@ class Cholesky(StocProc): if not cutoff_sol.success: raise RuntimeError( - f"Could not find a suitable cutoff time. Scipy says '{cutoff_sol.message}." + f"Could not find a suitable cutoff time. Scipy says '{cutoff_sol.message}'." ) self.t_chol = np.linspace( 0, cutoff_sol.x[0] * 2, - int(((cutoff_sol.x[0]) / intpl_tol) + 1) * 2 + 1, + int(((cutoff_sol.x[0]) / intpl_tol) + 1) * 2, dtype=np.float128, ) mat, tol = self.stable_cholesky(alpha, self.t_chol, max_iterations) - + log.info(f"Achieved a deviation of {tol} in the cholesky decomposition.") if mat is None or tol > chol_tol: raise RuntimeError( f"The tolerance of {chol_tol} could not be reached. We got as far as {tol}." ) - self.chol_matrix: NDArray[np.complex128] = mat[1:, 1:] + self.chol_matrix: NDArray[np.complex128] = mat if calc_deriv: - self.chol_deriv = np.gradient(mat, self.t, axis=0)[1:, 1:] + self.chol_deriv = np.gradient(mat, self.t, axis=0) - self.t_chol = self.t_chol[1:] + self.t_chol = self.t_chol self.chunk_size = len(self.t_chol) // 2 @@ -905,7 +905,6 @@ class Cholesky(StocProc): ) self.num_chunks = int(len(self.t) / self.chunk_size) + 1 - breakpoint() @staticmethod def stable_cholesky( @@ -921,7 +920,7 @@ class Cholesky(StocProc): L = None reversed = False for _ in range(max_iterations): - log.info(f"Trying ε={eps}.") + log.debug(f"Trying ε={eps}.") try: L = scipy.linalg.cholesky(Σ + eps * eye, lower=True, check_finite=False) @@ -935,7 +934,7 @@ class Cholesky(StocProc): eps = starteps or np.finfo(np.float64).eps * 4 else: eps = eps * 2 - reverse = True + reversed = True return L, (np.max(np.abs((L @ L.T.conj() - Σ) / Σ)) if L is not None else -1)