Home > tt2 > @tt_matrix > subsasgn.m

subsasgn

PURPOSE ^

Indexing of cores of TT-format: T{I}=B

SYNOPSIS ^

function t = subsasgn(t,s,b)

DESCRIPTION ^

Indexing of cores of TT-format: T{I}=B
   T{I} = B Set i-th core to be equal to 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 t = subsasgn(t,s,b)
0002 %Indexing of cores of TT-format: T{I}=B
0003 %   T{I} = B Set i-th core to be equal to 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 switch s(1).type
0016     case '.'
0017         switch s(1).subs
0018             case 'n'
0019                 t.n=b;
0020             case 'm'
0021                 t.m=b;
0022             case 'r'
0023                 t.tt.r=b;
0024             case 'core'
0025                 t.tt.core=b;
0026             case 'ps'
0027                 t.tt.ps=b;
0028             case 'tt'
0029                 t.tt=b;
0030             case 'd'
0031                 t.tt.d=b;
0032             otherwise
0033                 error(['Cannot change field ', s.subs, ' directly.']);
0034         end
0035     case '{}'
0036         i = s.subs{1};
0037         r1 = size(b,1);
0038         n1 = size(b,2);
0039         m1 = size(b,3);
0040         r2 = size(b,4);
0041         b = reshape(b, r1, n1*m1, r2);
0042         t.tt{i} = b;
0043         t.n(i) = n1;
0044         t.m(i) = m1;
0045     otherwise
0046         error('Invalid subsasgn.');
0047 end
0048 
0049 end

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