0001
0002 d=10;
0003
0004 p=0:d-1; p = 2.^p;
0005 a=-5;b=5;
0006 n=2^d;
0007 h=(b-a)/(n-1);
0008
0009 mv=@(x) sqrt(x)+abs(x);
0010
0011
0012
0013
0014 x=tt_x(d,2); x=tt_tensor(x);
0015 e=tt_ones(d,2);e=tt_tensor(e);
0016 x=a*e+h*x; x=round(x,1e-13);
0017 x1=kron(e,x); x2=kron(x,e);
0018 rs=x1.^2+x2.^2; rs=round(rs,1e-13);
0019
0020
0021 fun=@(x) exp(-x.^4);
0022
0023 rs=x;
0024
0025
0026
0027 elem_fun = @(ind) fun(rs(ind));
0028 eps=1e-6;
0029 D=ndims(rs);
0030
0031 y=tt_rc(D,2,elem_fun,1e-6,'nswp',40);
0032
0033
0034
0035
0036 z=funcrs2(rs,fun,1e-6,rs,20);
0037 z=round(z,1e-12);
0038 z1=tt_rc(D,2,elem_fun,1e-8,'nswp',40,'x0',z);
0039
0040