Home > tt2 > @tt_tensor > row.m

row

PURPOSE ^

Returns the k-the row of a TT-tensor

SYNOPSIS ^

function [tt]=row(tt,k)

DESCRIPTION ^

Returns the k-the row of a TT-tensor 
   [TT]=ROW(TT,K) Returns the k-the row of a block-row TT-tensor


 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 [tt]=row(tt,k)
0002 %Returns the k-the row of a TT-tensor
0003 %   [TT]=ROW(TT,K) Returns the k-the row of a block-row TT-tensor
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 
0017 cr=tt.core;
0018 ps=tt.ps;
0019 r=tt.r;
0020 n=tt.n;
0021 cr1=cr(ps(1):ps(2)-1);
0022 cr1=reshape(cr1,r(1),numel(cr1)/r(1));
0023 cr1=cr1(k,:);
0024 r(1)=size(cr1,1);
0025 cr(ps(1):ps(2)-1)=[];
0026 cr=[cr1(:); cr(:)];
0027 %ps=[1;r(1)*n(1)*r(2);ps(3:end)-ps(2)+r(1)*n(1)*r(2)+1];
0028 ps=cumsum([1;n.*r(1:end-1).*r(2:end)]);
0029 tt.r=r;
0030 tt.ps=ps;
0031 tt.core=cr;
0032 return
0033 end

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