Home > tt2 > @tt_tensor > full.m

full

PURPOSE ^

Converts TT-tensor to the full tensor

SYNOPSIS ^

function [a] = full(tt, sizes)

DESCRIPTION ^

Converts TT-tensor to the full tensor
   [A]=FULL(TT) --- full tensor from TT-tensor

   [A]=FULL(TT,SIZES) --- full tensor from TT-tensor reshaped into
       a tensor with dimensions SIZES


 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
---------------------------

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [a] = full(tt, sizes)
0002 %Converts TT-tensor to the full tensor
0003 %   [A]=FULL(TT) --- full tensor from TT-tensor
0004 %
0005 %   [A]=FULL(TT,SIZES) --- full tensor from TT-tensor reshaped into
0006 %       a tensor with dimensions SIZES
0007 %
0008 %
0009 % TT-Toolbox 2.2, 2009-2012
0010 %
0011 %This is TT Toolbox, written by Ivan Oseledets et al.
0012 %Institute of Numerical Mathematics, Moscow, Russia
0013 %webpage: http://spring.inm.ras.ru/osel
0014 %
0015 %For all questions, bugs and suggestions please mail
0016 %ivan.oseledets@gmail.com
0017 %---------------------------
0018 
0019 d=tt.d; n=tt.n; ps=tt.ps; core=tt.core; r=tt.r;
0020 a=core(ps(1):ps(2)-1);
0021 for i=2:d
0022   cr=core(ps(i):ps(i+1)-1);
0023   cr=reshape(cr,[r(i),n(i)*r(i+1)]);
0024   a=reshape(a,[numel(a)/r(i),r(i)]);
0025   a=a*cr;
0026 end
0027 if ( r(1) ~= 1 )
0028   a=reshape(a,[r(1),n',r(d+1)]);
0029 else
0030   a=reshape(a,[n',r(d+1)]);    
0031 end
0032 
0033 if (nargin>1)&&(~isempty(sizes))
0034     if (numel(sizes)==1)
0035         sizes = [sizes,1];
0036     end;
0037     a = reshape(a, sizes);
0038 end;
0039 
0040 return;

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