Пример #1
0
    def alat(self, A):
        ## if A.shape[-1] == 1:
        ##     assert self.dim == 1
        ##     A_ = A[..., :, 0]
        ##     Q = A_ / np.sqrt((A_ ** 2).sum(-1))[..., nax]
        ##     d = (A_ ** 2).sum(-1) * self._s
        ##     return FixedEigMatrix(d[..., nax], Q[..., nax], 0.)

        return FullMatrix(dot(A, transp(A)) * self._s[..., nax, nax])
Пример #2
0
 def alat(self, A):
     ## if A.shape[-1] == 1:
     ##     assert self.dim == 1
     ##     A_ = A[..., :, 0]
     ##     Q = A_ / np.sqrt((A_ ** 2).sum(-1))[..., nax]
     ##     d = (A_ ** 2).sum(-1) * self._s
     ##     return FixedEigMatrix(d[..., nax], Q[..., nax], 0.)
     
     return FullMatrix(dot(A, transp(A)) * self._s[..., nax, nax])
 def qform(self, x):
     temp = dot(self._S, x)
     return (temp * x).sum(-1)
Пример #4
0
 def transform(self, A):
     J = dot(transp(A), self._J)
     Lambda = self._Lambda.alat(transp(A))
     return Potential(J, Lambda, self._Z)
Пример #5
0
 def qform(self, x):
     #temp = array_map(np.dot, [self._S, x], self.ndim)
     temp = dot(self._S, x)
     return (temp * x).sum(-1)
Пример #6
0
 def dot(self, x):
     #return array_map(np.dot, [self._S, x], self.ndim)
     return dot(self._S, x)
Пример #7
0
 def dot(self, x):
     result = dot(self._Q, self._d * dot(transp(self._Q), x))
     x_perp = x - dot(self._Q, dot(transp(self._Q), x))
     result += x_perp * self._s_perp[..., nax]
     return result
Пример #8
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)
Пример #9
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)
Пример #10
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)))
Пример #11
0
 def alat(self, A):
     return FullMatrix(dot(A, dot(self._S, transp(A))))
 def transform(self, A):
     return Distribution(dot(A, self._mu), self._Sigma.alat(A), self._Z)
 def transform(self, A):
     J = dot(transp(A), self._J)
     Lambda = self._Lambda.alat(transp(A))
     return Potential(J, Lambda, self._Z)
Пример #14
0
 def qform(self, x):
     temp = dot(self._S, x)
     return (temp * x).sum(-1)
Пример #15
0
 def dot(self, x):
     return dot(self._S, x)
Пример #16
0
 def qform(self, x):
     #temp = array_map(np.dot, [self._S, x], self.ndim)
     temp = dot(self._S, x)
     return (temp * x).sum(-1)
Пример #17
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)))
Пример #18
0
 def random(shape, dim, rank=None):
     if rank is None:
         rank = dim
     A = np.random.normal(size=shape + (dim, rank))
     S = dot(A, transp(A))
     return FullMatrix(S)
Пример #19
0
 def random(shape, dim, rank=None):
     if rank is None:
         rank = dim
     A = np.random.normal(size=shape + (dim, rank))
     S = dot(A, transp(A))
     return FullMatrix(S)
Пример #20
0
 def full(self):
     S = dot(self._Q, self._d[..., nax] * transp(self._Q))
     S += (np.eye(self.dim) -
           dot(self._Q, transp(self._Q))) * self._s_perp[..., nax, nax]
     return FullMatrix(S)
Пример #21
0
 def full(self):
     S = dot(self._Q, self._d[..., nax] * transp(self._Q))
     S += (np.eye(self.dim) - dot(self._Q, transp(self._Q))) * self._s_perp[..., nax, nax]
     return FullMatrix(S)
Пример #22
0
 def dot(self, x):
     result = dot(self._Q, self._d * dot(transp(self._Q), x))
     x_perp = x - dot(self._Q, dot(transp(self._Q), x))
     result += x_perp * self._s_perp[..., nax]
     return result
Пример #23
0
 def qform(self, x):
     result = (self._d * dot(transp(self._Q), x) ** 2).sum(-1)
     x_perp = x - dot(self._Q, dot(transp(self._Q), x))
     result += (x_perp ** 2).sum(-1) * self._s_perp
     return result
Пример #24
0
 def qform(self, x):
     result = (self._d * dot(transp(self._Q), x)**2).sum(-1)
     x_perp = x - dot(self._Q, dot(transp(self._Q), x))
     result += (x_perp**2).sum(-1) * self._s_perp
     return result
Пример #25
0
 def sqrt_dot(self, x):
     result = dot(self._Q, np.sqrt(self._d) * dot(transp(self._Q), x))
     x_perp = x - dot(self._Q, dot(transp(self._Q), x))
     result += x_perp * np.sqrt(self._s_perp[..., nax])
     return result
Пример #26
0
 def dot(self, x):
     #return array_map(np.dot, [self._S, x], self.ndim)
     return dot(self._S, x)
Пример #27
0
 def alat(self, A):
     return FullMatrix(dot(A, dot(self._S, transp(A))))
Пример #28
0
 def sqrt_dot(self, x):
     result = dot(self._Q, np.sqrt(self._d) * dot(transp(self._Q), x))
     x_perp = x - dot(self._Q, dot(transp(self._Q), x))
     result += x_perp * np.sqrt(self._s_perp[..., nax])
     return result
Пример #29
0
 def transform(self, A):
     return Distribution(dot(A, self._mu), self._Sigma.alat(A), self._Z)
 def dot(self, x):
     return dot(self._S, x)