Home > tt2 > @tt_tensor > chunk.m

chunk

PURPOSE ^

Cut the (i,j) part out of the TT-tensor

SYNOPSIS ^

function [b]=chunk(b,i,j)

DESCRIPTION ^

Cut the (i,j) part out of the TT-tensor
   [B]=CHUNK(B,I,J)


 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 [b]=chunk(b,i,j)
0002 %Cut the (i,j) part out of the TT-tensor
0003 %   [B]=CHUNK(B,I,J)
0004 %
0005 %
0006 % TT-Toolbox 2.2, 2009-2012
0007 %
0008 %This is TT Toolbox, written by Ivan Oseledets et al.
0009 %Institute of Numerical Mathematics, Moscow, Russia
0010 %webpage: http://spring.inm.ras.ru/osel
0011 %
0012 %For all questions, bugs and suggestions please mail
0013 %ivan.oseledets@gmail.com
0014 %---------------------------
0015 
0016 if ( i > j ) 
0017  tmp=j; 
0018  j=i;
0019  i=tmp;
0020 end
0021 ps=b.ps;
0022 r=b.r;
0023 n=b.n;
0024 cr=b.core;
0025 r=r(i:j+1); 
0026 n=n(i:j);
0027 cr=cr(ps(i):ps(j+1)-1);
0028 ps=ps(i:j+1);
0029 ps=ps-ps(1)+1;
0030 b.r=r;
0031 b.n=n;
0032 b.ps=ps;
0033 b.core=cr;
0034 b.d=numel(n);
0035 return
0036 end

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