Reshapes the cores of the input (Q)TT representation. s (scalar) is the number of mode indices in each core of the input representation; sz is a matrix of size d x s1, where d is the number of cores and s1 is the number of mode indices in each core of the output representation; sz(k,alpha) is the mode size of the alpha-th index in the k-th core of the output representation. k-th component of prod(sz,2) is the overall numbers of mode degrees of freedom of the k-th core of the output representation April 26, 2011 Vladimir Kazeev vladimir.kazeev@gmail.com INM RAS Moscow, Russia
0001 function [tt]=tt_qreshape(tt,s,sz) 0002 0003 % Reshapes the cores of the input (Q)TT representation. 0004 % s (scalar) is the number of mode indices in each core of the input representation; 0005 % sz is a matrix of size d x s1, where d is the number of cores and s1 is the number of mode indices in each core of the output representation; 0006 % sz(k,alpha) is the mode size of the alpha-th index in the k-th core of the output representation. 0007 % k-th component of prod(sz,2) is the overall numbers of mode degrees of freedom of the k-th core of the output representation 0008 % 0009 % April 26, 2011 0010 % Vladimir Kazeev 0011 % vladimir.kazeev@gmail.com 0012 % INM RAS 0013 % Moscow, Russia 0014 % 0015 0016 d=size(tt,1); 0017 for k=1:d 0018 szk=size(tt{k}); 0019 szk=[szk,ones(1,s)]; 0020 szkr=szk(s+1:numel(szk)); 0021 tt{k}=reshape(tt{k},[sz(k,:),szkr]); 0022 end 0023 0024 return 0025 end