Skip to content

Commit 8b8dda7

Browse files
Prefer mT to T
1 parent 610b380 commit 8b8dda7

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

pymc_extras/statespace/filters/kalman_smoother.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import pytensor
22
import pytensor.tensor as pt
33

4-
from pytensor.tensor.nlinalg import matrix_dot
5-
64
from pymc_extras.statespace.filters.utilities import (
75
quad_form_sym,
86
split_vars_into_seq_and_nonseq,
@@ -105,7 +103,7 @@ def smoother_step(self, *args):
105103
a_hat, P_hat = self.predict(a, P, T, R, Q)
106104

107105
# Use pinv, otherwise P_hat is singular when there is missing data
108-
smoother_gain = matrix_dot(pt.linalg.pinv(P_hat, hermitian=True), T, P).T
106+
smoother_gain = (pt.linalg.pinv(P_hat, hermitian=True) @ T @ P).mT
109107
a_smooth_next = a + smoother_gain @ (a_smooth - a_hat)
110108

111109
P_smooth_next = P + quad_form_sym(smoother_gain, P_smooth - P_hat)

0 commit comments

Comments
 (0)