def solve_with_moments(M1, M2, M3, K): W, Wt = get_whitener( M2, K ) M3_ = sc.einsum( 'ijk,ia,jb,kc->abc', M3, W, W, W ) #print "M3", M3 pi_, M_, _, _ = candecomp(M3_, K) #print "mu", M_ mu = Wt.dot(M_.dot(np.diag(pi_))) return mu
def solve_with_moments(M1, M2, M3, K): W, Wt = get_whitener(M2, K) M3_ = sc.einsum('ijk,ia,jb,kc->abc', M3, W, W, W) #print "M3", M3 pi_, M_, _, _ = candecomp(M3_, K) #print "mu", M_ mu = Wt.dot(M_.dot(np.diag(pi_))) return mu
def solve_with_moments(m1, M2, M3, K): """ Whiten and unwhiten appropriately """ assert symmetric_skew(M2) < 1e-2 assert symmetric_skew(M3) < 1e-2 W, Wt = get_whitener( M2, K ) M3_ = sc.einsum( 'ijk,ia,jb,kc->abc', M3, W, W, W ) #print "M3", M3 pi_, M_, _, _ = candecomp(M3_, K) #print "mu", M_ mu = Wt.dot(M_.dot(diag(pi_))) return mu