ILNumerics Ultimate VS

ConcreteRetArrayT1, LocalT, InT, OutT, RetT, StorageTGetArrayForRead Method

ILNumerics Ultimate VS Documentation
ILNumerics - Technical Application Development
Gets a copy of the array elements for read access.

[ILNumerics Core Module]

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

public override T1[] GetArrayForRead(
	StorageOrders order = StorageOrders.ColumnMajor
)

Parameters

order (Optional)
Type: ILNumericsStorageOrders
[Optional] The order used for copying the elements into the returned System array. Default: ColumnMajor.

Return Value

Type: T1
Managed System.Array with copies of the elements contained in this ILNumerics array.
Exceptions

ExceptionCondition
ArgumentExceptionif order is none of column major or row major.
OutOfMemoryExceptionif this array is too large to fit into a managed array or if there is not enough memory currently available to allocate the return array.
Remarks

This method is provided for experts only! Use this array only for reading! Changes will not populate back to the internal array storage. Note the default element storage format: column major.

Keep in mind, the length of the array may exceeds the number of elements!

The range of elements addresses by this ILNumerics array starts with index 0 of the Array returned. Any BaseOffset of this ILNumerics array is removed when copying the elements to the managed array. The internal elements will be read in order.

The semantic of this method has changed with ILNumerics version 5. It now creates a copy of the internal elements in column major element storage order layout. The copy uses new memory from the regular, GC managed heap. This fact and the required memory copy introduce a computational effort which disqualifies this method for high performance algorithms.

The recommended way for experts to access internal elements directly, is now, to acquire a pointer to the memory and to use the pointer in your unsafe code.

In order to save the allocation of the managed array returned, consider using the method ExportValues(T1, StorageOrders).

The order parameter allows to control the order of the elements returned. Valid values are ColumnMajor and RowMajor. The default value is ColumnMajor.

This method is now partly obsolete but it will remain here since it serves its purpose still: by copying the elements one enables compatibility with other .NET APIs, at the same time it ensures that the values returned will still be around and will not be affected by the cleanup mechanisms all internal array storage is subject of. BUT: note the size limitation all Array in .NET undergo! Attempts to acquire the elements of such arrays which exceed the maximum sizes of .NET objects will trigger an exception.

The former versions (< 5) method 'GetArrayForWrite()' has been replaced by GetHostPointerForWrite(NullableStorageOrders).

[ILNumerics Core Module]

See Also

Reference