Skip to content

Commit da70b2b

Browse files
Prefer mT to T in kalman filters
1 parent c24b796 commit da70b2b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

pymc_extras/statespace/filters/kalman_filter.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -630,9 +630,9 @@ def predict(self, a, P, c, T, R, Q):
630630
a_hat = T.dot(a) + c
631631
Q_chol = pt.linalg.cholesky(Q, lower=True)
632632

633-
M = pt.horizontal_stack(T @ P_chol, R @ Q_chol).T
633+
M = pt.horizontal_stack(T @ P_chol, R @ Q_chol).mT
634634
R_decomp = pt.linalg.qr(M, mode="r")
635-
P_chol_hat = R_decomp[: self.n_states, : self.n_states].T
635+
P_chol_hat = R_decomp[: self.n_states, : self.n_states].mT
636636

637637
return a_hat, P_chol_hat
638638

@@ -665,7 +665,7 @@ def update(self, a, P, y, d, Z, H, all_nan_flag):
665665
upper = pt.horizontal_stack(H_chol, Z @ P_chol)
666666
lower = pt.horizontal_stack(zeros, P_chol)
667667
A_T = pt.vertical_stack(upper, lower)
668-
B = pt.linalg.qr(A_T.T, mode="r").T
668+
B = pt.linalg.qr(A_T.mT, mode="r").mT
669669

670670
F_chol = B[: self.n_endog, : self.n_endog]
671671
K_F_chol = B[self.n_endog :, : self.n_endog]

0 commit comments

Comments
 (0)