Performance considerations

Since subarray creation is very often used for low level functionality, some performance considerations could be taken into account.

Shift while creation

For practical situations it is often needed, to transpose an subarray after creation. This process can significantly speed up by immediatly creating a transposed version right from the start. This is done by using one of the overloaded versions of the Subarray(int shift, params ...) member, wihch takes an integer parameter on first position. That parameter specifies the number of dimensions to shift the result after creation. Internally this is done not sequentially but simultanously.

Defining full dimensions

If a full dimension needs to be addressed, from a performance point of view it is much better to use the null or the ":" parameter specifications. For example
Example 8 (C#)
ILArray<double> B,C,A = ILMath.counter(100,200,2);
B = A[":;:;0"];
C = A[null,null,1];

is much faster than
// DO NOT USE THIS! THIS IS NO GOOD CODING!
B = A["0:end,0:end,0"];
// DO NOT USE THIS EITHER! THIS IS NOT GOOD CODING!
C = A[ILMath.vector(0,99),ILMath.vector(0,199),1];

Not only the syntax in the first box of example 8 gets much shorter, internally the range does not have to be expanded in advance in order to be used for addressing. Also, Subarrays created with 'null' or ':' addressing, will remember this information over their livetime and automatically benefit from it, whenever possible.

Valid CSS! Valid XHTML 1.0 Transitional