Sequential index access

If a range for a subarray is created by ILBaseArray's, and there is only one array specified, the values for that dimension are interpreted as 'sequential indices'. Those indices reflect the position of array elements from the physical storage point of view. Since all arrays - indepedent of its size and dimension numbers - are stored as 1 dimensional arrays in the memory, sequential indices determine the position of elements into that 1-dimensional array. Therefore it is possible for them to cross dimension limits by specifying values larger than the length of the first dimension but less than the absolute number of elements in the array. Keep in mind, ILNumerics.Net stores arrays in column major order!

Example 6 (C#)
ILArray<double> A = ILMath.counter(4,6);
/* this creates a matrix : 
A
{<double> 15645912 [4x6] Phys. 
(:,:)
1,00000  5,00000   9,00000  13,00000  17,00000  21,00000
2,00000  6,00000  10,00000  14,00000  18,00000  22,00000 
3,00000  7,00000  11,00000  15,00000  19,00000  23,00000 
4,00000  8,00000  12,00000  16,00000  20,00000  24,00000
A[0] -> evaluates to scalar array: 1,00000
A[3] -> evaluates to scalar array: 4,00000
A[4] -> evaluates to scalar array: 5,00000
A[23]-> evaluates to scalar array: 24,00000 ...
A["0,1,20"] -> evaluates to vector: 
{<double> 7588182 [3x1] Phys. (:,:) 1,00000 2,00000 21,00000 }

ILArray<int> ind = new ILArray<int>(0,1,20);
A[ind] -> also evaluates to: 
{<double> 35567111 [1x3] Phys. (:,:) 1,00000 2,00000 21,00000 }.

The last example can be further extended. ind may have arbitrary shape here. It might as well be an n-dimensional array. Elements of ind are taken as sequential indices into the matrix A. Corresponding elements will be copied into the new subarray which will get the same size as ind.
// create 3 dim. array of size [4 x 3 x 2] counting from 0.0, step 1.0
ILArray<double> inddbl = ILMath.counter(0.0,1.0,4,3,2);
/* A[inddbl] -> evaluates to:
A[inddbl]
{<double> 65248697 [4x3x2] Phys. 
(:,:,0) 
1,00000 5,00000 9,00000
2,00000 6,00000 10,00000
3,00000 7,00000 11,00000
4,00000 8,00000 12,00000

(:,:,1) 
13,00000 17,00000 21,00000
14,00000 18,00000 22,00000
15,00000 19,00000 23,00000
16,00000 20,00000 24,00000
}

The same result - even on a totaly different way - in this case we would have gotten from:
ILMath.reshape(A,4,3,2);

Valid CSS! Valid XHTML 1.0 Transitional