Returns a tensor _full_, given in a QTT decomposition _tt_, k-th core of which is indexed by i^{k}_{1} ,..., i^{k}_{s}, k=1,...,d, in the full-format representation. The output tensor _full_ is indexed by i^{1}_{1} ,..., i^{d}_{1} ,...,..., i^{1}_{s} ,..., i^{d}_{s}, April 26, 2011 Vladimir Kazeev vladimir.kazeev@gmail.com INM RAS Moscow, Russia
0001 function [ful]=tt_qtofull(tt,s) 0002 0003 % Returns a tensor _full_, given in a QTT decomposition _tt_, 0004 % k-th core of which is indexed by 0005 % i^{k}_{1} ,..., i^{k}_{s}, 0006 % k=1,...,d, 0007 % in the full-format representation. 0008 % The output tensor _full_ is indexed by 0009 % i^{1}_{1} ,..., i^{d}_{1} ,...,..., i^{1}_{s} ,..., i^{d}_{s}, 0010 % 0011 % April 26, 2011 0012 % Vladimir Kazeev 0013 % vladimir.kazeev@gmail.com 0014 % INM RAS 0015 % Moscow, Russia 0016 % 0017 0018 d=size(tt,1); 0019 sz=tt_qsize(tt,s); 0020 0021 tt=tt_qreshape(tt,s,prod(sz,2)); 0022 ful=full(tt_tensor(tt)); 0023 0024 ful=reshape(ful,reshape(sz',1,numel(sz))); 0025 0026 prm=zeros(1,s*d); 0027 for k=1:d 0028 for l=1:s 0029 prm(s*k+1-l)=k+(s-l)*d; 0030 end 0031 end 0032 0033 ful=ipermute(ful,prm); 0034 ful=reshape(ful,[prod(sz,1),1]); 0035 0036 return 0037 end