ILNumerics Ultimate VS

ConcreteArrayT1, LocalT, InT, OutT, RetT, StorageTSubarray Method (DimSpec)

ILNumerics Ultimate VS Documentation
ILNumerics - Technical Application Development
Extract part of this array. Matlab® and numpy indexing.

[ILNumerics Core Module]

Namespace:  ILNumerics.Core.Arrays
Assembly:  ILNumerics.Core (in ILNumerics.Core.dll) Version: (5.5.7503.3146)

public RetT Subarray(
	params DimSpec[] dims


Type: ILNumericsDimSpec
Range specification for arbitrary dimensions as vector.

Return Value

Type: RetT
New array with parts of this array as specified by dims.

IndexOutOfRangeException if the range provided in a specifier dims addresses a non existing element.
NotSupportedException if any of dims attempts to use an indexing feature which is not supported in the current ArrayStyle mode. For example, if dims[0] was provided as newaxis while being in ILNumericsV4 mode.

This method considers the given dimensional range specifiers to extract a subarray from this array. Both indexing styles: numpy and Matlab® indexing (ILNumericsV4) are supported. For such indexing features specific to one or the other style the current setting of ArrayStyle is considered. For example, in ILNumericsV4 array style (default) the last given dimension specifier may refer to elements inside merged, trailing, unspecified dimensions of this array (and not only inside this dimension) in the same manner as the 'linear indexing' feature known from Matlab®, Octave, ILNumerics version 4 et al.

Due to the simplicity of the individual specifiers dims the subarray creation is optimized to be fast and efficient, often without requiring new memory for copying elements. Note, that the array returned may use the same element storage as this array. Only when trying to modify either one of this array or the subarray a copy will be made.

The setting MinNumberOfArrayDimensions (as controlled by ArrayStyle) is respected for the array returned.

This overload of Subarray() allows to define range specifiers for individual dimensions as a system array. It is convenient when subarrays are to be created without knowing the number of dimensions and the concrete range parameters in advance. It is not recommended for situations where high performance is crucial. Note, that individual DimSpec objects for each dimension addressed in dims can be used in exactly one call to Subarray(DimSpec) and are released in the function automatically. Thus, when calling Subarray(DimSpec) in loops make sure to recreate all dimension specifier prior to each call to Subarray(DimSpec).

[ILNumerics Core Module]

See Also


Other Resources