Simple script to test the stabilized dmrg-cross method
0001 %Simple script to test the stabilized dmrg-cross method 0002 0003 d=10; 0004 %fun = @(ind) (sum(ind)+1i*ind(1)); 0005 a=10; 0006 n=2^d; h=2*a/(n-1); 0007 x=-a:h:a; 0008 f=exp(-10*x.^2); f=tt_tensor(reshape(f,2*ones(1,d)),1e-9); 0009 fun = @(ind) f(ind); 0010 %fun = @(ind) 1; 0011 %n=2:d+1; 0012 n=2; 0013 %y=tt_ones(n); 0014 %r=ones(d+1,1); 0015 %r(2:d-1)=2:d-1; 0016 %y=tt_rand(n,d,r); 0017 %fun = @(ind) y(ind); 0018 tt=dmrg_cross(d,n,fun,1e-7,'nswp',20);