IOLink C# 1.11.0
Loading...
Searching...
No Matches
IOLink.Indexer Class Reference

This class is used to index a classic array into a multi dimensional array. More...

Inheritance diagram for IOLink.Indexer:

Public Member Functions

 Indexer (global::System.IntPtr cPtr, bool cMemoryOwn)
 
void Dispose ()
 
 Indexer (VectorXu64 shape, VectorXu64 stride, VectorXu64 layout)
 Create an indexer by giving all its informations.
 
 Indexer (VectorXu64 shape, VectorXu64 stride, MemoryLayout standardLayout)
 Create an indexer by giving all its informations.
 
 Indexer (VectorXu64 shape, VectorXu64 layout)
 Initialize the indexer using a custom memory layout.
 
 Indexer (VectorXu64 shape, MemoryLayout standardLayout)
 Auto compute the Indexer's strides from shape and standard layout.
 
 Indexer (VectorXu64 shape)
 Simpliest way to initialize an indexer from a shape.
 
 Indexer (VectorXu64 shape, DataType dtype)
 The default byte stride being computed from the shape and data type. The default layout being the Fortran array layout.
 
 Indexer (VectorXu64 shape, DataType dtype, MemoryLayout standardLayout)
 The default byte stride being computed from the shape, datatype, and standard layout.
 
 Indexer (VectorXu64 shape, DataType dtype, VectorXu64 byteStride)
 The default layout being the Fortran array layout.
 
 Indexer (VectorXu64 shape, DataType dtype, VectorXu64 byteStride, VectorXu64 layout)
 
 Indexer (Indexer other)
 
uint DimensionCount ()
 The number of dimensions managed by this indexer.
 
VectorXu64 Shape ()
 Return the shape.
 
DataType Dtype ()
 
Returns
the data type of this Indexer.

 
VectorXu64 Stride ()
 Return the stride.
 
VectorXu64 ByteStride ()
 
Returns
the stride in bytes of this Indexer.

 
VectorXu64 Layout ()
 Return the layout dimension order.
 
uint Shape (uint index)
 Return the current size for given dimension.
 
uint Stride (uint index)
 Return the current stride for given dimension.
 
uint ByteStride (uint index)
 
Returns
the stride in bytes for the given dimension.

 
uint Layout (uint index)
 Return the dimension index of the nth one in order.
 
uint ElementCount ()
 Returns the number of elements managed by this Indexer.
 
uint ByteCount ()
 
uint Offset (VectorXu64 index)
 Return the computed 1D offset corresponding to indexed sample in multi dimensional array.
 
uint ByteOffset (VectorXu64 index)
 
bool IsContinuous ()
 Elements are considered contiguous if they follow each other without any padding.
 

Static Public Member Functions

static global::System.Runtime.InteropServices.HandleRef getCPtr (Indexer obj)
 
static global::System.Runtime.InteropServices.HandleRef swigRelease (Indexer obj)
 

Protected Member Functions

virtual void Dispose (bool disposing)
 

Protected Attributes

bool swigCMemOwn
 

Detailed Description

This class is used to index a classic array into a multi dimensional array.

Its main use is to convert a multi-dimensional index into the corresponding offset in the flat array used for storage. An indexer contains all the needed tools and describes how the data is really stored. The three main elements are: the shape, the stride, and the layout.

The shape is simply the size of the indexed array in each dimension, for example an array with two columns and two rows will have a shape of {2, 2}.

The stride contains the offset between each iteration of a dimension, in elements. For example, our {2, 2} array will usually have a stride of {1, 2}, as each column element is adjacent (hence the stride of one), and when iterating element on a line, you must skip one element on the underlying array (hence the stride of 2). The stride dimension are in the same order as the shape, but they do not have to be in ascendent order. Actually, reverse order arrays (C convention) will have inversed strides, for example, {2, 1} in our {2, 2} array case.

The layout describes in wich order each dimension is ordered internally, and can be used to enhance performance. The usual IOLink layout is {0, 1, ..., n - 1, n}. As we use the Fortran convention in IOLink, indexing a C array would use an inverted layout {n, n-1, ..., 1, 0}. This field enables user to easily know how data is organised without analysing the strides directly.

Constructor & Destructor Documentation

◆ Indexer() [1/9]

IOLink.Indexer.Indexer ( VectorXu64  shape,
VectorXu64  stride,
VectorXu64  layout 
)
inline

Create an indexer by giving all its informations.

Here all the arguments are given, and are not checked, so if they are not consistant, they will give an undefined behavior.

Parameters
shapeThe shape of the array to index.
strideThe stride of each dimension, the offset in elements between each increment in this dimension.
layoutThe internal order of dimensions, {0, 1} is row-major and {1, 0} is col-major for example.

<>Deprecated in 1.8, will be dropped in 2.0, you should use a constructor that specify the data type instead. </>

◆ Indexer() [2/9]

IOLink.Indexer.Indexer ( VectorXu64  shape,
VectorXu64  stride,
MemoryLayout  standardLayout 
)
inline

Create an indexer by giving all its informations.

Here all the arguments are given, and are not checked, so if they are not consistant, they will give an undefined behavior.

Parameters
shapeThe shape of the array to index.
strideThe stride of each dimension, the offset in elements between each increment in this dimension.
standardLayoutA standard layout for the array.
Exceptions
ErrorWhen the layout is unsupported

<>Deprecated in 1.8, will be dropped in 2.0, you should use a constructor that specify the data type instead. </>

◆ Indexer() [3/9]

IOLink.Indexer.Indexer ( VectorXu64  shape,
VectorXu64  layout 
)
inline

Initialize the indexer using a custom memory layout.

Parameters
shapeThe shape of the indexed array
layoutThe internal order of dimensions, {0, 1} is row-major and {1, 0} is col-major for example.

<>Deprecated in 1.8, will be dropped in 2.0, you should use a constructor that specify the data type instead. </>

◆ Indexer() [4/9]

IOLink.Indexer.Indexer ( VectorXu64  shape,
MemoryLayout  standardLayout 
)
inline

Auto compute the Indexer's strides from shape and standard layout.

Parameters
shapeThe narray sizes in each dimension
standardLayoutA standard layout for the array.
Exceptions
ErrorWhen the layout is unsupported

<>Deprecated in 1.8, will be dropped in 2.0, you should use a constructor that specify the data type instead. </>

◆ Indexer() [5/9]

IOLink.Indexer.Indexer ( VectorXu64  shape)
inline

Simpliest way to initialize an indexer from a shape.

The layout here is Fortran one, and the strides are computed according to it.

Parameters
shapeThe desired shape of the multi dimensional array.

<>Deprecated in 1.8, will be dropped in 2.0, you should use a constructor that specify the data type instead. </>

◆ Indexer() [6/9]

IOLink.Indexer.Indexer ( VectorXu64  shape,
DataType  dtype 
)
inline

The default byte stride being computed from the shape and data type. The default layout being the Fortran array layout.

Constructor with shape and datatype, using default layout and stride.

Parameters
shapeThe shape of the indexed array.
dtypeThe data type of the indexed array.

◆ Indexer() [7/9]

IOLink.Indexer.Indexer ( VectorXu64  shape,
DataType  dtype,
MemoryLayout  standardLayout 
)
inline

The default byte stride being computed from the shape, datatype, and standard layout.

Constructor with shape, datatype and standard layout, using default stride.

Parameters
shapeThe shape of the indexed array.
dtypeThe data type of the indexed array.
standardLayoutA standard layout for the array.

◆ Indexer() [8/9]

IOLink.Indexer.Indexer ( VectorXu64  shape,
DataType  dtype,
VectorXu64  byteStride 
)
inline

The default layout being the Fortran array layout.

Constructor with shape, datatype and byte stride, using default layout.

Parameters
shapeThe shape of the indexed array.
dtypeThe data type of the indexed array.
byteStrideThe stride in bytes of the indexed array.

◆ Indexer() [9/9]

IOLink.Indexer.Indexer ( VectorXu64  shape,
DataType  dtype,
VectorXu64  byteStride,
VectorXu64  layout 
)
inline

Constructor with shape, datatype, byte stride and layout.

Parameters
shapeThe shape of the indexed array.
dtypeThe data type of the indexed array.
byteStrideThe stride in bytes of the indexed array.
layoutThe layout of the indexed array.

Member Function Documentation

◆ ByteCount()

uint IOLink.Indexer.ByteCount ( )
inline

Get the total number of bytes needed to adress this indexer, taking the padding into account.

Returns
the number of bytes managed by this Indexer.

◆ ByteOffset()

uint IOLink.Indexer.ByteOffset ( VectorXu64  index)
inline

Computes the offset in bytes to the given index.

Parameters
indexThe index of the element for which the offset must be computed.
Returns
the offset in bytes to the given index.
Exceptions
InvalidArgumentIf the index is invalid.

◆ IsContinuous()

bool IOLink.Indexer.IsContinuous ( )
inline

Elements are considered contiguous if they follow each other without any padding.

Checks if the indexed elements are contiguous.

Returns
true if the indexed elements are continuous, false otherwise.

◆ Layout()

uint IOLink.Indexer.Layout ( uint  index)
inline

Return the dimension index of the nth one in order.

Parameters
indexIndex of the order dimension index.

◆ Offset()

uint IOLink.Indexer.Offset ( VectorXu64  index)
inline

Return the computed 1D offset corresponding to indexed sample in multi dimensional array.

Parameters
indexThe element's position for which offset must be computed.

<>Deprecated in 1.8, will be dropped in 2.0, you should use the byteOffset method instead. </>

◆ Shape()

uint IOLink.Indexer.Shape ( uint  index)
inline

Return the current size for given dimension.

Parameters
indexIndex of the dimension to consider

◆ Stride() [1/2]

VectorXu64 IOLink.Indexer.Stride ( )
inline

Return the stride.

<>Deprecated in 1.8, will be dropped in 2.0, you should use the byteStride method instead. </>

◆ Stride() [2/2]

uint IOLink.Indexer.Stride ( uint  index)
inline

Return the current stride for given dimension.

Parameters
indexIndex of the dimension to consider

<>Deprecated in 1.8, will be dropped in 2.0, you should use the byteStride method instead. </>


The documentation for this class was generated from the following file: