def sigma_init(self): if hasattr(self,'_sigma_init'): return self._sigma_init try: import pydare return pydare.dlyap(self.A, self.sigma_states) except ImportError: return np.linalg.solve( np.eye(self.n**2) - np.kron(self.A,self.A), self.sigma_states.ravel())\ .reshape(self.n,self.n)
def sigma_init(self): if hasattr(self, '_sigma_init'): return self._sigma_init try: import pydare return pydare.dlyap(self.A, self.sigma_states) except ImportError: return np.linalg.solve( np.eye(self.n**2) - np.kron(self.A,self.A), self.sigma_states.ravel())\ .reshape(self.n,self.n)
def fisher_memory_matrix(W, v, npts = 15, use_dlyap=False): J = np.zeros([npts, npts]) if use_dlyap: Cn = dlyap(W, np.eye(W.shape[0])) else: Cn = gaussian_covariance_matrix(W) v = v.reshape([W.shape[0], 1]) Cninv = np.linalg.inv(Cn) Wmat = np.matrix(W) for k in range(npts): for j in range(npts): v1 = Wmat**(j+1) * v #print 'v1.shape,',v1.shape v2 = Cninv * v1 #print 'v2.shape,',v2.shape v3 = np.transpose(Wmat**(k+1)) * v2 #print 'v3.shape,',v3.shape v4 = np.transpose(v) * v3 #print 'v4.shape,',v4.shape J[k, j] = np.array(v4).squeeze() return J
def process_cov(update, injected_cov): return pydare.dlyap(update, injected_cov)