Home > tt2 > @qtt_tucker > subsasgn.m

subsasgn

PURPOSE ^

Assign fields of the QTT-Tucker structure

SYNOPSIS ^

function t = subsasgn(t,s,b)

DESCRIPTION ^

Assign fields of the QTT-Tucker structure

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function t = subsasgn(t,s,b)
0002 %Assign fields of the QTT-Tucker structure
0003  switch s(1).type
0004      case '.'
0005          switch s(1).subs
0006              case 'dphys'
0007                  t.dphys = b;
0008              case 'd'
0009                  t.dphys = b;                 
0010              case 'core'
0011                  if (numel(s)>1)
0012                      % Dispatch extra indexing gracefully
0013                      t.core = subsasgn(t.core, s(2:end), b);
0014                  else
0015                      t.core = b;
0016                  end;                 
0017              case 'tuck'
0018                  if (numel(s)>1)
0019                      % Dispatch extra indexing gracefully <-BULLSHIT! IT
0020                      % DOESN'T WORK!!!
0021                      s = s(2:end);
0022                      if (strcmp(s(1).type, '{}'))
0023                          i = s(1).subs{1};
0024                          if (numel(s)>1)
0025                              t.tuck{i} = subsasgn(t.tuck{i}, s(2:end), b);
0026                          else
0027                              t.tuck{i} = b;
0028                          end;
0029                      end;
0030                  else
0031                      t.tuck = b;
0032                  end;
0033              case 'sz'
0034                  if (numel(s)>1)
0035                      % Dispatch extra indexing gracefully
0036                      t.sz = subsasgn(t.sz, s(2:end), b);
0037                  else
0038                      t.sz = b;
0039                  end;
0040              otherwise
0041                  error(['Cannot change field ', s.subs, ' directly.']);
0042          end
0043      otherwise
0044          error('Invalid subsasgn.');
0045  end
0046 
0047

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