Home > tt2 > core > sub_to_ind.m

sub_to_ind

PURPOSE ^

Converts a multiindex to a linear index

SYNOPSIS ^

function [mult]=sub_to_ind(ind,sz1)

DESCRIPTION ^

Converts a multiindex to a linear index
   [MULT] = SUB_TO_IND(IND,SZ)


 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
---------------------------sz1=[1,cumprod(sz(1:numel(sz)-1))];

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [mult]=sub_to_ind(ind,sz1)
0002 %Converts a multiindex to a linear index
0003 %   [MULT] = SUB_TO_IND(IND,SZ)
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 %---------------------------sz1=[1,cumprod(sz(1:numel(sz)-1))];
0015 mult=dot((ind-1),sz1);%(ind-1).*sz;
0016 mult = mult+1;
0017 end

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