Skip to content

Commit 806a990

Browse files
PERF: treat kernel matrix as pos definite in solver
1 parent 2124997 commit 806a990

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

derivative/dglobal.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import numpy as np
66
from numpy.linalg import inv
77
from scipy import interpolate, sparse
8+
from scipy.linalg import solve
89
from scipy.special import legendre
910
from sklearn.linear_model import Lasso
1011

@@ -299,7 +300,7 @@ def _global(self, t, z, sigma, lmbd, kernel):
299300
kernel = self._create_gram(k_fun, t)
300301
kernel_dt = self._create_gram(k_fun_dt, t)
301302
noisy_kernel = kernel + lmbd * np.eye(len(t))
302-
alpha = np.linalg.solve(noisy_kernel, z)
303+
alpha = solve(noisy_kernel, z, assume_a="pos")
303304
x_hat = kernel @ alpha
304305
x_dot_hat = kernel_dt @ alpha
305306
return x_hat, x_dot_hat

0 commit comments

Comments
 (0)