e = tt.matrix(e,1e-12) #Generate ssx, ssz ssp = [gen_1d(sp,e,i,d) for i in xrange(d)] ssz = [gen_1d(sz,e,i,d) for i in xrange(d)] ssm = [gen_1d(sm,e,i,d) for i in xrange(d)] A = None for i in xrange(d-1): A = A + 0.5 * (ssp[i] * ssm[i+1] + ssm[i] * ssp[i+1]) + (ssz[i] * ssz[i+1]) A = A.round(1e-8) return A if __name__ == '__main__': d = 20 #The dimension of the problem (number of spins) B = 3 # Number of eigenvalues sought eps = 1e-6 #Accuracy of the computations A = gen_heisen(d) n = A.n d = A.tt.d r = [2]*(d+1) r[0] = 1 r[d] = B x0 = tt.rand(n,d,r) t1 = time.time() print 'Matrices are done' y, lam = eigb(A, x0, eps) t2 = time.time() print 'Elapsed time: %3.1f' % (t2 - t1) print 'Eigenvalues:', lam
e = tt.matrix(e,1e-12) #Generate ssx, ssz ssp = [gen_1d(sp,e,i,d) for i in xrange(d)] ssz = [gen_1d(sz,e,i,d) for i in xrange(d)] ssm = [gen_1d(sm,e,i,d) for i in xrange(d)] A = None for i in xrange(d-1): A = A + 0.5 * (ssp[i] * ssm[i+1] + ssm[i] * ssp[i+1]) + (ssz[i] * ssz[i+1]) A = A.round(1e-8) return A if __name__ == '__main__': d = 60 #The dimension of the problem (number of spins) B = 5 # Number of eigenvalues sought eps = 1e-5 #Accuracy of the computations A = gen_heisen(d) n = A.n d = A.tt.d r = [B]*(d+1) r[0] = 1 r[d] = B x0 = tt.rand(n,d,r) t1 = time.time() print('Matrices are done') y, lam = eigb(A, x0, eps, max_full_size = 1000) t2 = time.time() print('Elapsed time: %3.1f' % (t2 - t1)) print('Eigenvalues: ', lam)
sp = tt.matrix(sp,1e-12) sm = tt.matrix(sm,1e-12) e = tt.matrix(e,1e-12) #Generate ssx, ssz ssp = [gen_1d(sp,e,i,d) for i in xrange(d)] ssz = [gen_1d(sz,e,i,d) for i in xrange(d)] ssm = [gen_1d(sm,e,i,d) for i in xrange(d)] A = None for i in xrange(d-1): A = A + 0.5 * (ssp[i] * ssm[i+1] + ssm[i] * ssp[i+1]) + (ssz[i] * ssz[i+1]) A = A.round(1e-8) return A es = [] lm = [] ds = [20] for d in ds: B = 3 A = gen_heisen(d) n = A.n d = A.tt.d r = [2]*(d+1) r[0] = 1 r[d] = B x0 = tt.rand(n,d,r) t1 = time.time() print 'Matrices are done' y, lam = eigb(A,x0,1e-3) es.append(lam[0]/d) lm.append(d) t2 = time.time()