test code for tt_qlaplace_dd() September 22, 2010 Vladimir Kazeev vladimir.kazeev@gmail.com INM RAS Moscow, Russia Look for details in the Preprint No. 75, 2010 of Max-Planck Institute for Mathematics in the Sciences Vladimir A. Kazeev and Boris N. Khoromskij On explicit QTT representation of Laplace operator and its inverse http://www.mis.mpg.de/publications/preprints/2010/prepr2010-75.html
0001 % test code for tt_qlaplace_dd() 0002 % 0003 % September 22, 2010 0004 % Vladimir Kazeev 0005 % vladimir.kazeev@gmail.com 0006 % INM RAS 0007 % Moscow, Russia 0008 % 0009 % Look for details in the Preprint No. 75, 2010 of 0010 % Max-Planck Institute for Mathematics in the Sciences 0011 % Vladimir A. Kazeev and Boris N. Khoromskij 0012 % On explicit QTT representation of Laplace operator and its inverse 0013 % http://www.mis.mpg.de/publications/preprints/2010/prepr2010-75.html 0014 0015 % d is the only parameter 0016 d=[3,4,5]; 0017 % 0018 0019 D=size(d,2); 0020 tt=tt_qlaplace_dd(d); 0021 tt=tt_mat_to_vec(tt); 0022 0023 0024 full=nd_to_full(tt); 0025 0026 Z=zeros(2^sum(d)); 0027 for k=1 : D 0028 L=2*eye(2^d(k)); 0029 for i=1 : 2^d(k)-1 0030 L(i,i+1)=-1; 0031 L(i+1,i)=-1; 0032 end 0033 for m=k-1 : -1: 1 0034 L=kron(eye(2^d(m)),L); 0035 end 0036 for m=k+1 : D 0037 L=kron(L,eye(2^d(m))); 0038 end 0039 Z=Z+L; 0040 end 0041 err=norm(full-Z,'fro'); 0042 fprintf('fro err = %e\n', err);