コード例 #1
0
ファイル: hh_hermite.py プロジェクト: jaidevd/ttpy
#Henon-Heiles correction
V = None
for s in xrange(f-1):
    V = V + (xx[s]*xx[s]*xx[s+1] - (1.0/3)*xx[s+1]*xx[s+1]*xx[s+1])
    V = V.round(eps)
B = 4


A = 0.5*lp2 + tt.diag(0.5*harm + lm*V)
A0 = 0.5*lp2 + tt.diag(0.5*harm)
A = A.round(eps) 

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-6)
#y,lam = eigb(A0,y,1e-6)
#y,lam = eigb(A,y,1e-6,nswp=1)
#y,lam = eigb(A,y,1e-5)
#y,lam = eigb(A,y,1e-6)
t2 = time.time()
print 'Eigenvalues:',lam    
print 'Elapsed time:', t2-t1

コード例 #2
0
ファイル: test_eigb.py プロジェクト: Bihaqo/ttpy
import sys
sys.path.append('../')
import numpy as np
import tt
from tt.eigb import *
import time

""" This code computes many eigenvalus of the Laplacian operator """

d = 8
f = 8
A = tt.qlaplace_dd([d]*f)
#A = (-1)*A
#A = tt.eye(2,d)
n = [2] *(d * f)
r = [8] *(d * f + 1)
r[0] = 1
r[d * f] = 8 #Number of eigenvalues sought
x = tt.rand(n, d * f, r)
#x = tt_ones(2,d)
t = time.time()
y, lam = eigb(A, x, 1e-6)

t1 = time.time()
print 'Eigenvalues:', lam
print 'Time is:', t1-t
コード例 #3
0
#%%

from __future__ import print_function, absolute_import, division
import sys
sys.path.append('../')
import numpy as np
import tt
from tt.eigb import *
import time
""" This code computes many eigenvalus of the Laplacian operator """

d = 8
f = 8
A = tt.qlaplace_dd([d] * f)
#A = (-1)*A
#A = tt.eye(2,d)
n = [2] * (d * f)
r = [8] * (d * f + 1)
r[0] = 1
r[d * f] = 8  #Number of eigenvalues sought
x = tt.rand(n, d * f, r)
#x = tt_ones(2,d)
t = time.time()
y, lam = eigb(A, x, 1e-6)

t1 = time.time()
print('Eigenvalues:', lam)
print('Time is:', t1 - t)

# %%