def random(d_shape, Q_shape, sp_shape, dim, rank=None):
     if rank is None:
         rank = dim
     ndim = len(d_shape)
     temp = np.random.normal(size=Q_shape + (dim, rank))
     Q, _ = array_map(np.linalg.qr, [temp], ndim)
     d = np.random.gamma(1., 1., size=d_shape + (rank, ))
     sp = np.random.gamma(1., 1., size=sp_shape)
     return FixedEigMatrix(d, Q, sp)
Esempio n. 2
0
 def random(d_shape, Q_shape, sp_shape, dim, rank=None):
     if rank is None:
         rank = dim
     ndim = len(d_shape)
     temp = np.random.normal(size=Q_shape + (dim, rank))
     Q, _ = array_map(np.linalg.qr, [temp], ndim)
     d = np.random.gamma(1., 1., size=d_shape + (rank,))
     sp = np.random.gamma(1., 1., size=sp_shape)
     return FixedEigMatrix(d, Q, sp)
Esempio n. 3
0
 def pinv(self):
     try:
         return FullMatrix(array_map(my_inv, [self._S], self.ndim))
     except np.linalg.LinAlgError:
         return FullMatrix(array_map(np.linalg.pinv, [self._S], self.ndim))
Esempio n. 4
0
 def full(self):
     S = array_map(np.diag, [self._s], self.ndim)
     return FullMatrix(S)
Esempio n. 5
0
 def to_eig(self):
     d, Q = array_map(np.linalg.eigh, [self._S], self.ndim)
     return FixedEigMatrix(d, Q, 0)
Esempio n. 6
0
 def sqrt_dot(self, x):
     L = array_map(np.linalg.cholesky, [self._S + 1e-10 * np.eye(self.dim)], self.ndim)
     return dot(L, x)
Esempio n. 7
0
 def conv(self, other):
     other = other.full()
     P = array_map(my_inv, [self._S + other._S], self.ndim)
     return FullMatrix(dot(self._S, dot(P, other._S)))
Esempio n. 8
0
 def inv(self):
     return FullMatrix(array_map(np.linalg.inv, [self._S], self.ndim))
 def inv(self):
     return FullMatrix(array_map(my_inv, [self._S], self.ndim))
 def pinv(self):
     try:
         return FullMatrix(array_map(my_inv, [self._S], self.ndim))
     except np.linalg.LinAlgError:
         return FullMatrix(array_map(np.linalg.pinv, [self._S], self.ndim))
 def full(self):
     S = array_map(np.diag, [self._s], self.ndim)
     return FullMatrix(S)
 def to_eig(self):
     d, Q = array_map(np.linalg.eigh, [self._S], self.ndim)
     return FixedEigMatrix(d, Q, 0)
 def sqrt_dot(self, x):
     L = array_map(np.linalg.cholesky, [self._S + 1e-10 * np.eye(self.dim)],
                   self.ndim)
     return dot(L, x)
 def conv(self, other):
     other = other.full()
     P = array_map(my_inv, [self._S + other._S], self.ndim)
     return FullMatrix(dot(self._S, dot(P, other._S)))
Esempio n. 15
0
 def inv(self):
     return FullMatrix(array_map(my_inv, [self._S], self.ndim))
 def logdet(self):
     _, ld = array_map(np.linalg.slogdet, [self._S], self.ndim)
     return ld
Esempio n. 17
0
 def logdet(self):
     _, ld = array_map(np.linalg.slogdet, [self._S], self.ndim)
     return ld
 def inv(self):
     return FullMatrix(array_map(np.linalg.inv, [self._S], self.ndim))