Converts a QTT-Tucker tensor the full tensor [A]=FULL(QTT_TUCKER,SIZES) Converts QTT_Tucker tensor into a tensor with mode sizes SIZES. The dimensions should be consistent. 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 [a] = full(tt, sizes) 0002 %Converts a QTT-Tucker tensor the full tensor 0003 % [A]=FULL(QTT_TUCKER,SIZES) Converts QTT_Tucker tensor into a tensor 0004 % with mode sizes SIZES. The dimensions should be consistent. 0005 % 0006 % 0007 % TT-Toolbox 2.2, 2009-2012 0008 % 0009 %This is TT Toolbox, written by Ivan Oseledets et al. 0010 %Institute of Numerical Mathematics, Moscow, Russia 0011 %webpage: http://spring.inm.ras.ru/osel 0012 % 0013 %For all questions, bugs and suggestions please mail 0014 %ivan.oseledets@gmail.com 0015 %--------------------------- 0016 0017 a=full(tt.core); 0018 fac=cell(tt.dphys,1); 0019 for i=1:tt.dphys 0020 ti=tt.tuck{i}; ri=rank(ti,ti.d+1); 0021 ti=full(ti); 0022 fac{i}=reshape(ti,[numel(ti)/ri,ri]); 0023 end 0024 %And now convert tucker representation to the full one 0025 n=size(tt.core); 0026 for i=1:tt.dphys 0027 a=reshape(a,[n(i),numel(a)/n(i)]); 0028 a=(fac{i}*a).'; %r1r2r3 -> n1r2r3 ->r2r3n1 0029 end 0030 if ( nargin > 1 && ~isempty(sizes) ) 0031 a=reshape(a,sizes); 0032 end 0033 return;