Home > tt2 > exp > tt_exp2.m

tt_exp2

PURPOSE ^

Computation of the matrix exponential of a matrix in TT format

SYNOPSIS ^

function [tt]=tt_exp2(mat,eps,N,rmax)

DESCRIPTION ^

Computation of the matrix exponential of a matrix in TT format
   [TT]=TT_EXP2(MAT,EPS,N,RMAX) This function computes matrix exponential
   using scaling and squaring method of the TT-matrix TT. EPS is the
   accuracy parameter, N is the number of summand for the local Taylor
   series (N=10 is usually enough). RMAX is the TT-rank bound and TT_MAT
   is the result


 TT-Toolbox 2.2, 2009-2011

This is TT Toolbox, written by Ivan Oseledets, Olga Lebedeva
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
---------------------------
d=size(tt,1);
n=size(tt{1},1); %Warning: only equal sizes are valid here
e=tt_eye(n,d);
xs=tt_random(n*n,d,rmax); 
xs=tt_vec_to_mat(xs,n,n);

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [tt]=tt_exp2(mat,eps,N,rmax)
0002 %Computation of the matrix exponential of a matrix in TT format
0003 %   [TT]=TT_EXP2(MAT,EPS,N,RMAX) This function computes matrix exponential
0004 %   using scaling and squaring method of the TT-matrix TT. EPS is the
0005 %   accuracy parameter, N is the number of summand for the local Taylor
0006 %   series (N=10 is usually enough). RMAX is the TT-rank bound and TT_MAT
0007 %   is the result
0008 %
0009 %
0010 % TT-Toolbox 2.2, 2009-2011
0011 %
0012 %This is TT Toolbox, written by Ivan Oseledets, Olga Lebedeva
0013 %Institute of Numerical Mathematics, Moscow, Russia
0014 %webpage: http://spring.inm.ras.ru/osel
0015 %
0016 %For all questions, bugs and suggestions please mail
0017 %ivan.oseledets@gmail.com
0018 %---------------------------
0019 %d=size(tt,1);
0020 %n=size(tt{1},1); %Warning: only equal sizes are valid here
0021 %e=tt_eye(n,d);
0022 %xs=tt_random(n*n,d,rmax);
0023 %xs=tt_vec_to_mat(xs,n,n);
0024 if ( nargin == 3) 
0025   rmax=1000;
0026 end
0027 nrm=abs(norm2(mat));
0028 
0029 n0=floor(max(floor(log2(10*nrm)),0))+1;
0030 w0=mat*(1.0/2^n0);
0031 sz=size(mat); sz=sz(:,1);
0032 e=tt_eye(sz,ndims(mat)); e=tt_matrix(e);
0033 tt=e;
0034 
0035 for k=(N-1):-1:1
0036     %fprintf('Iteration %d/1 \n',k);
0037     %if ( tt_erank(tt_mat)*tt_erank(w0) > rmax )
0038     %  tt_mat=ttm_add(tt_scal(tt_mmals(tt_mat,w0,xs,3),1.0/k),e);
0039     %else
0040     %  tt_mat=ttm_add(tt_scal(tt_mm(tt_mat,w0),1.0/k),e);
0041     %end
0042     tt=e+(tt*w0)/k;
0043     tt=round(tt,eps);
0044     %tt_mat=tt_mat_compr(tt_mat,eps);
0045 end
0046 %keyboard;
0047 for k=1:n0
0048    % reff=sqrt(tt_mem(tt_mat)/(n*n*d));
0049    %fprintf('Iteration %d/%d Rank=%3.2f\n',k,n0,reff);
0050    tt=round(tt*tt,eps,rmax);
0051    %else
0052    %  tt_mat=tt_mm(tt_mat,tt_mat);
0053    %end
0054    %tt_mat=tt_mat_compr(tt_mat,eps);
0055    %fprintf('nrm=%3.2e \n',tt_dot(tt_mat1,tt_mat1));
0056 end
0057 
0058 return
0059 end

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