ILNumerics - Technical Computing Tools

High Performance Framework for Visualization

and Computing in Industry and Science

tgt

# ILNumerics® Arrays

Whenever this documentation refers to 'arrays', it means the ILNumerics array from the core part. These computational arrays are used from any function of ILNumerics and are the base of all algorithms. Those arrays may contain any number of dimensions and therefore reflect scalars, vectors, matrices and even n-dimensional tensors.

ILArray<T> is a generic class: it is able to hold elements of arbitrary inner type. However, mostly numerical system types like double, int or float will be used. This page summerizes the areas of importance. Details are found in subsequent pages of this section.

The following list shows some examples for common arrays and a way of creating them.

Like almost all examples in this documentation, we expect the code to be defined in the context of a class which is derived from ILNumerics.ILMath. When used in the context of some other class, you may have to prefix all corrsponding methods with the class specifier: ILMath.zeros(...

matrix of size 4x3

element type: System.Double

ILArray<double> A = zeros(4,3)

row vectorof length 100

element type: System.Int16

ILArray<short> A = zeros<short>(1,100)

square matrix of size 10x10

element type: System.Single

element values: 1.0f

ILArray<float> A = ones<float>(10,10)

3-dimens.array of size 100x200x4

element type: double

values: all pi

 ILArray A =zeros(100,200,4) + pi A = array(pi,100,200,4)

4-dimens.array of size 5x4x3x4

element type: double

values counting from 1...240

ILArray<double> A = counter(5,4,3,4)

The inner type T for ILArray<T> does not neccessarily need to be a numeric type. One may use ILArray<T> to hold arbitrary elements of any reference type and still profit from the ability to derive subarrays from it or use reshaping, replication and serialization to manage those objects. However, mathematical calculations are of course possible for numeric inner types only.

The most common way to create such arrays is by utilizing a matching Initialization Function from the ILMath class. However, arrays may be created as Subarrays, derived from existing arrays or by Casting from system types.

ILArray<T> is a mutable type. Once created, it can be altered in various ways easily. The spectrum ranges from simple value changes to size expansion and reshapes. Details are found in the Altering Arrays section.

ILArray<T> also plays an important role for the memory management of ILNumerics. By defining distinct array types for parameter lists in functions, ILNumerics is able to drastically optimize memory usage. The technique is described in detail in the General Rules section.