Home > tt2 > @qtt_tucker > subsref.m

subsref

PURPOSE ^

Evaluate fields of the QTT-Tucker structure

SYNOPSIS ^

function [elem] = subsref(tt,s)

DESCRIPTION ^

Evaluate fields of the QTT-Tucker structure
[ELEM]=SUBSREF(TT,S)
Used to evaluate element of a tensor,
and also --- get fields D,R,N,PS,CORE of the TT tensor

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [elem] = subsref(tt,s)
0002 %Evaluate fields of the QTT-Tucker structure
0003 %[ELEM]=SUBSREF(TT,S)
0004 %Used to evaluate element of a tensor,
0005 %and also --- get fields D,R,N,PS,CORE of the TT tensor
0006 
0007 switch s(1).type    
0008     case '()'
0009         error('Element evaluation not implemented yet!');
0010     case '.'
0011         switch s(1).subs
0012             case 'core'
0013                 elem = tt.core;
0014                 if (numel(s)>1)
0015                     s = s(2:end);
0016                     elem = subsref(elem, s);
0017                 end;                
0018             case 'tuck'
0019                 elem = tt.tuck;
0020                 if (numel(s)>1)
0021                     s = s(2:end);
0022                     elem = subsref(elem, s);
0023                 end;
0024             case 'd'
0025                 elem = tt.dphys;
0026             case 'dphys'
0027                 elem = tt.dphys;
0028             case 'sz'
0029                 elem = tt.sz;
0030                 if (numel(s)>1)
0031                     s = s(2:end);
0032                     elem = subsref(elem, s);
0033                 end;              
0034             otherwise
0035                 error(['No field ', s.subs, ' is here.']);
0036         end
0037     case '{}'
0038 %         %Return the core in the old (not exactly!!! r1-n-r2 here) format
0039         elem = subsref(tt.tuck, s);
0040 %         pp=s.subs;
0041 %         mn=numel(pp);
0042 %         if ( mn > 1 )
0043 %           error('Invalid number of cores asked');
0044 %         end
0045 %         elem=core(tt,pp{1});
0046 % %         if (pp{1}~=1)
0047 % %             elem=permute(elem,[2,1,3]);
0048 % %         end;
0049         
0050     otherwise        
0051         error('Invalid subsref.');
0052 end

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