TVec.Split Method

Overload List

#SignatureDescription
1void Split(TVec Vec1, Int32 Offset, TVec Vec2)Copy the contents of the calling TVec object to Vec1 and Vec2 objects.
2TVec Split(TVec[] Dst)Splits the calling vector to an array of TVec objects.
3void Split(TVec[] Dst, Int32[] DstSize)Copy the contents of the calling TVec object to the TVec objects in Dst array.

Overload 1: void Split(TVec Vec1, Int32 Offset, TVec Vec2)

Copy the contents of the calling TVec object to Vec1 and Vec2 objects.

#NameTypeDescription
1Vec1TVecsource TVec
2OffsetInt32
3Vec2TVecsource TVec

Result: stored in self (calling object)

Remarks:

The Dew.Math.TMtxVecBase.Length and Dew.Math.TMtxVec.Complex properties of are set implicitly. An exception is raised, if Offset parameter exceeds the length of the calling vector. The Dew.Math.TMtxVecBase.Length property of Vec1 object is set to Offset and the Length of Vec2 is set to the rest.

Overload 2: TVec Split(TVec[] Dst)

Splits the calling vector to an array of TVec objects.

#NameTypeDescription
1DstTVec[]

Result: stored in self (calling object), returns self for chaining

Remarks:

Copy the contents of the calling TVec object to the TVec objects in Dst array. The Dew.Math.TMtxVecBase.Length and Dew.Math.TMtxVec.Complex properties of vectors in Dst array must be set explicitly. An exception is raised, if Dew.Math.TMtxVec.Complex properties of TVec objects do not match or the sum of TVec lengths exceeds the Dew.Math.TMtxVecBase.Length of the calling vector.

Examples
TVec a;
TVec b;
TVec c;
TVec d;
MtxVec.CreateIt(out a, out b, out c, out d);
try
    {
        a.SetIt(false,new double[] {0,0,0,0,1,2,3,1,2,3});
        a.Split([b,c,d],new double[] {4,3,3});
        // b = [0,0,0,0], c = [1,2,3], d = [1,2,3]
    }
finally
    {
        MtxVec.FreeIt(ref a, ref b, ref c, ref d);
    }
See Also: TVec.Concat, TVec.Copy, TVec.Resize

Overload 3: void Split(TVec[] Dst, Int32[] DstSize)

Copy the contents of the calling TVec object to the TVec objects in Dst array.

#NameTypeDescription
1DstTVec[]
2DstSizeInt32[]

Result: stored in self (calling object)

Remarks:

The Length of objects in Dst array is defined in the DstSize array. The Dew.Math.TMtxVecBase.Length and Dew.Math.TMtxVec.Complex properties of vectors in Dst array are set implicitly. An exception is raised if the sum of DstSize lengths exceeds the Dew.Math.TMtxVecBase.Length of the calling vector.