test code for tt_qlaplacex_dn() 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_qlaplacex_dn() 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_qlaplacex_dn(d); 0021 tt=tt_mat_to_vec(tt); 0022 0023 0024 full=nd_to_full(tt); 0025 0026 disp('inv computation... '); 0027 Li=cell(D,1); 0028 for k=1 : D 0029 L=2*eye(2^d(k)); 0030 for i=1 : 2^d(k)-1 0031 L(i,i+1)=-1; 0032 L(i+1,i)=-1; 0033 end 0034 L(2^d(k),2^d(k))=1; 0035 Li{k}=inv(L); 0036 end 0037 disp('OK'); 0038 0039 disp('kron computation... '); 0040 Z=Li{1}; 0041 for k=2 : D 0042 Z=kron(Z,Li{k}); 0043 end 0044 disp('OK'); 0045 0046 err=norm(full-Z,'fro'); 0047 fprintf('fro err = %e\n', err);