Matrix.SetSubRange Method

Overload List

#SignatureDescription
1void SetSubRangeSets the subarray size to full size. This method is the same as the Dew.Math.Matrix.SetFullRange method.
└ indexed: void SetSubRange(Int32 Index, Int32 Len)
2void SetSubRange(TDenseMtxVec Src, Int32 Index, Int32 Len)Defines a sub Matrix/matrix.
3void SetSubRange(TMtxVec Src, Int32 Index, Int32 aRows, Int32 aCols)Defines a sub vector/matrix.

Overload 1: void SetSubRange

Sets the subarray size to full size. This method is the same as the Dew.Math.Matrix.SetFullRange method.

Result: stored in self (calling object)

Indexed: void SetSubRange(Int32 Index, Int32 Len)

Defines a sub Matrix/matrix.

#NameTypeDescription
1IndexInt32start index
2LenInt32element count

Result: stored in self (calling object)

Remarks:

The method will define a subarray starting at Index and ending at Index+Len-1. No copying will occur, only pointers will be shifted. All values of the original Dew.Math.Vector will be preserved. An exception will be raised if an attempt is made to change the size of calling object.

A sub-Matrix/matrix is Matrix/matrix which does not neccessarily have its own memory allocated. Instead it adopts the memory of the source object and all operations done on the either of the objects affect the same elements. The use of subvectors/submatrices increases CPU cache reuse, lower's memory requirements, increases application performance and improves code readability.

To again obtain a view of the full Matrix/matrix, see Dew.Math.Matrix.SetFullRange

Overload 2: void SetSubRange(TDenseMtxVec Src, Int32 Index, Int32 Len)

Defines a sub Matrix/matrix.

#NameTypeDescription
1SrcTDenseMtxVecsource TVec or TMtx
2IndexInt32start index
3LenInt32element count

Result: stored in self (calling object)

Overload 3: void SetSubRange(TMtxVec Src, Int32 Index, Int32 aRows, Int32 aCols)

Defines a sub vector/matrix.

#NameTypeDescription
1SrcTMtxVecsource TVec or TMtx
2IndexInt32start index
3aRowsInt32
4aColsInt32

Result: stored in self (calling object)

Remarks:

The method will define a subarray starting at Index and ending at Index + (aRows*aCols)-1. No copying will occur, only pointers will be shifted or indices adjusted. The subranged matrix will have the size aRows and aCols. Length will be equal to aRows*aCols.

All values of the original Dew.Math.TMtxVecBase will be preserved. An exception will be raised if an attempt is made to change the size of calling object.

A sub-vector/matrix is vector/matrix, which does not have its own memory allocated. Instead it adopts the memory of the source object and all operations done on either of the objects affect the same elements. The use of subvectors/submatrices increases CPU cache reuse, lower's memory requirements, increases application performance and improves code readability.

To again obtain a view of the full vector/matrix, see Dew.Math.TMtxVecBase.SetFullRange

The routine only makes sense to be used where aCols matches Src.Cols. MtxVec has only limited support for matrices where the matrix rows are not stored strictly consecutively. This overload is to be used with great caution.

The routine should not be mixed with other SetSubRange routines or subrange stack.