Home > tt2 > exp > test_qlaplacez_dn.m

test_qlaplacez_dn

PURPOSE ^

test code for tt_qlaplacez_dn()

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

 test code for tt_qlaplacez_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

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 % test code for tt_qlaplacez_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_qlaplacez_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=zeros(2^sum(d));
0041 for k=1 : D
0042     L=eye(2^d(k));
0043     for m=k-1 : -1: 1
0044         L=kron(Li{m},L);
0045     end
0046     for m=k+1 : D
0047         L=kron(L,Li{m});
0048     end
0049     Z=Z+L;
0050 end
0051 disp('OK');
0052 
0053 err=norm(full-Z,'fro');
0054 fprintf('fro err = %e\n', err);

Generated on Wed 08-Feb-2012 18:20:24 by m2html © 2005