A special bidiagonal matrix in the QTT-format [M]=IPAS(D, A) Generates I+a*S_{-1} matrix in the QTT-format: 1 0 0 0 a 1 0 0 0 a 1 0 0 0 a 1 Convenient for Crank-Nicolson and time gradient matrices TT-Toolbox 2.2, 2009-2012 This is TT Toolbox, written by Ivan Oseledets et al. Institute of Numerical Mathematics, Moscow, Russia webpage: http://spring.inm.ras.ru/osel For all questions, bugs and suggestions please mail ivan.oseledets@gmail.com ---------------------------
0001 function [M]=IpaS(d, a) 0002 %A special bidiagonal matrix in the QTT-format 0003 % [M]=IPAS(D, A) 0004 % Generates I+a*S_{-1} matrix in the QTT-format: 0005 % 1 0 0 0 0006 % a 1 0 0 0007 % 0 a 1 0 0008 % 0 0 a 1 0009 % Convenient for Crank-Nicolson and time gradient matrices 0010 % 0011 % 0012 % TT-Toolbox 2.2, 2009-2012 0013 % 0014 %This is TT Toolbox, written by Ivan Oseledets et al. 0015 %Institute of Numerical Mathematics, Moscow, Russia 0016 %webpage: http://spring.inm.ras.ru/osel 0017 % 0018 %For all questions, bugs and suggestions please mail 0019 %ivan.oseledets@gmail.com 0020 %--------------------------- 0021 0022 0023 M = cell(d,1); 0024 M{1} = zeros(2,2,0); 0025 M{1}(:,:,1)=[1,0;a,1]; 0026 if (d>1) 0027 M{1}(:,:,2)=[0,a;0,0]; 0028 end; 0029 for i=2:d-1 0030 M{i}=zeros(2,2,2,2); 0031 M{i}(:,:,1,1)=eye(2); 0032 M{i}(:,:,2,1)=[0,0;1,0]; 0033 M{i}(:,:,2,2)=[0,1;0,0]; 0034 end; 0035 if (d>1) 0036 M{d} = zeros(2,2,2); 0037 M{d}(:,:,1)=eye(2); 0038 M{d}(:,:,2)=[0,0;1,0]; 0039 end; 0040 M=tt_matrix(M); %Bydlocode 0041 end