depot/third_party/nixpkgs/pkgs/development/python-modules/pykalman/fix-masked-arrays-not-supported.patch

15 lines
645 B
Diff
Raw Normal View History

--- 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)