def update(self, z=None, u=None):
        # Check and convert inputs
        m = self.m
        b = self.b
        d = self.d
        
        
        if u == None:
            u = np.zeros((b,))
        u = np.array(u,dtype=np.float64).reshape(b,1)
        
        # Predict step
        x_k = np.dot(self.F,self.x_k) + np.dot(self.B,u)
        #print "Pred X:\n",x_k
        
        P_k = np.dot(np.dot(self.F,self.P_k),self.F.T) + self.Q
        #print "Pred P:\n",P_k

        if z == None:
            self.x_k = x_k
            self.P_k = P_k
            return self.x_k

        z = np.array(z,dtype=np.float64).reshape(m,1)
        
        # Update Step
        y_k = z - np.dot(self.H,x_k)
        #print "Innovation Resid:\n",y_k
        
        S_k = np.dot(np.dot(self.H,P_k),self.H.T) + self.R
        #print "Innonvation Cov:\n",S_k
        
        K = np.dot(np.dot(P_k,self.H.T),np.linalg.inv(S_k))
        #print "Kalman Gain:\n",K

        x_k = x_k + np.dot(K,y_k)
        #print "Postieriori state:\n",x_k
        
        P_k = np.dot(np.eye(d) - np.dot(K,self.H),P_k)
        #print "Posteriori Cov:",P_k
        
        self.x_k = x_k
        self.P_k = P_k
        
        return self.x_k
@param z: measurement
dataset/ETHPy150Open bolme/pyvision/src/pyvision/surveillance/kalman.py/KalmanFilter.update