Returns a reversed TT representation [TT2]=TT_REVERSE(TT,PHD) January 25, 2011 Vladimir Kazeev vladimir.kazeev@gmail.com INM RAS Moscow, Russia
0001 function [tt2]=tt_reverse(tt,phd) 0002 % Returns a reversed TT representation 0003 % [TT2]=TT_REVERSE(TT,PHD) 0004 % January 25, 2011 0005 % Vladimir Kazeev 0006 % vladimir.kazeev@gmail.com 0007 % INM RAS 0008 % Moscow, Russia 0009 % 0010 0011 d=size(tt,1); 0012 tt2=cell(d,1); 0013 0014 tt2{1}=tt{d}; 0015 for k=2:d-1 0016 prm=(1:phd+2); 0017 prm(phd+1)=phd+2; 0018 prm(phd+2)=phd+1; 0019 tt2{k}=permute(tt{d+1-k},prm); 0020 end 0021 tt2{d}=tt{1}; 0022 0023 return 0024 end