def prior_to_filtered(self, y):
        r"""
        Updates the moments (x_hat, Sigma) of the time t prior to the
        time t filtering distribution, using current measurement y_t.

        The updates are according to

            x_{hat}^F = x_{hat} + Sigma G' (G Sigma G' + R)^{-1}
                (y - G x_{hat})
            Sigma^F = Sigma - Sigma G' (G Sigma G' + R)^{-1} G
                Sigma

        Parameters
        ----------
        y : scalar or array_like(float)
            The current measurement

        """
        # === simplify notation === #
        G, H = self.ss.G, self.ss.H
        R = np.dot(H, H.T)

        # === and then update === #
        y = np.atleast_2d(y)
        y.shape = self.ss.k, 1
        E = dot(self.Sigma, G.T)
        F = dot(dot(G, self.Sigma), G.T) + R
        M = dot(E, inv(F))
        self.x_hat = self.x_hat + dot(M, (y - dot(G, self.x_hat)))
        self.Sigma = self.Sigma - dot(M, dot(G,  self.Sigma))
dataset/ETHPy150Open QuantEcon/QuantEcon.py/quantecon/kalman.py/Kalman.prior_to_filtered/original