[ILNumerics Computing Engine]
Namespace: ILNumerics
Assembly: ILNumerics.Computing (in ILNumerics.Computing.dll) Version: 5.5.0.0 (5.5.7503.3146)
public static RetCell cell( InArray<long> size = null, IEnumerable<BaseArray> arrays = null, StorageOrders order = StorageOrders.ColumnMajor )
Parameters
- size (Optional)
- Type: ILNumericsInArrayInt64
[Optional] Size hint for the new cell array. Default: (null) Derive the size from arrays. - arrays (Optional)
- Type: System.Collections.GenericIEnumerableBaseArray
[Optional] Enumerable of arrays for the cell elements, column major order. Default: (null) creates cell with all 'null' elements. - order (Optional)
- Type: ILNumericsStorageOrders
[Optional] Storage order for the new cell. Default: ColumnMajor.
Return Value
Type: RetCellCell of specified size, initialized with given arrays.
Exception | Condition |
---|---|
ArgumentException | if size is not null and the number of elements found in arrays exceeds the expected number of elements as specified by size. |
If number of arrays given is smaller than the number of elements given by size then trailing elements in the cell returned are set to null.
If size is null a cell vector is produced with a length corresponding to the number of elements in arrays. Performance wise it is recommended to specify the size explicitly, though.
If arrays contains more elements than expected by size an error is generated.
The size(Int64, Int64, Int64, Int64) function or one of its overloads are convenient for the specification of dimensional size arguments.
Visit the online documentation for cell.
Note that when arrays is an ILNumerics array (as in the example where arrays was created by the vector``1(UMP, UMP, UMP, UMP) function) memory management is performed accordingly: arrays stored in the arrays object are released and the associated memory is released to the pool after the cell(InArrayInt64, IEnumerableBaseArray, StorageOrders) function returns. However, for arrays of other (non-ILNumerics) types proper memory management is not guaranteed. For example, when providing the target cell element values in a Array of BaseArray a copy of individual elements is made by the cell(InArrayInt64, IEnumerableBaseArray, StorageOrders) function before storing the new element into the cell object. The source object remains an element of the system array and is not released!
Therefore, in situations where performance is critical and inside loops use one of the ILNumerics array intialization functions for providing the arrays argument. Otherwise, temporary objects in the IEnumerableT may remain live and are left for the GC to clean up (which is fine, except for high performance demands).
[ILNumerics Computing Engine]