depot/third_party/nixpkgs/pkgs/development/python-modules/pykalman/fix-masked-arrays-not-supported.patch
Default email 5e7c2d6cef Project import generated by Copybara.
GitOrigin-RevId: f99e5f03cc0aa231ab5950a15ed02afec45ed51a
2023-10-09 21:29:22 +02:00

14 lines
645 B
Diff

--- a/pykalman/utils.py
+++ b/pykalman/utils.py
@@ -70,7 +70,10 @@
cv_chol = linalg.cholesky(cv + min_covar * np.eye(n_dim),
lower=True)
cv_log_det = 2 * np.sum(np.log(np.diagonal(cv_chol)))
- cv_sol = solve_triangular(cv_chol, (X - mu).T, lower=True).T
+ try:
+ cv_sol = solve_triangular(cv_chol, (X - mu).T, lower=True).T
+ except ValueError:
+ cv_sol = np.linalg.solve(cv_chol, (X - mu).T).T
log_prob[:, c] = - .5 * (np.sum(cv_sol ** 2, axis=1) + \
n_dim * np.log(2 * np.pi) + cv_log_det)