Home > tt2 > exp > test_qlaplacez_dd.m

test_qlaplacez_dd

PURPOSE ^

test code for tt_qlaplacez_dd()

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

 test code for tt_qlaplacez_dd()

 January 17, 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_dd()
0002 %
0003 % January 17, 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_dd(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     Li{k}=inv(L);
0035 end
0036 disp('OK');
0037 
0038 disp('kron computation... ');
0039 Z=zeros(2^sum(d));
0040 for k=1 : D
0041     L=eye(2^d(k));
0042     for m=k-1 : -1: 1
0043         L=kron(Li{m},L);
0044     end
0045     for m=k+1 : D
0046         L=kron(L,Li{m});
0047     end
0048     Z=Z+L;
0049 end
0050 disp('OK');
0051 
0052 err=norm(full-Z,'fro');
0053 fprintf('fro err = %e\n', err);

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