Home > tt2 > @tt_tensor > kron.m

kron

PURPOSE ^

Kronecker product of two TT-tensors

SYNOPSIS ^

function [c] = kron(a,b)

DESCRIPTION ^

Kronecker product of two TT-tensors
   [C]=KRON(A,B)


 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 [c] = kron(a,b)
0002 %Kronecker product of two TT-tensors
0003 %   [C]=KRON(A,B)
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 %Time to replace it by something meaningful
0017 if ( isempty(a) )
0018   c=b;
0019   return
0020 elseif ( isempty(b) )
0021   c=a;
0022   return
0023 end
0024 if ( size(a.core,1) == 1 ) 
0025    a.core=(a.core).';
0026 end
0027 if ( size(b.core,1) == 1 ) 
0028    b.core=(b.core).';
0029 end
0030 
0031 c=tt_tensor;
0032 c.d=a.d+b.d;
0033 c.core=[a.core;b.core];
0034 c.n=[a.n;b.n];
0035 c.r=[a.r(1:a.d);b.r];
0036 
0037 c.ps=cumsum([1;c.n.*c.r(1:c.d).*c.r(2:c.d+1)]);
0038 
0039 return
0040 end

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