TVec.CopyMtx Method

Overload List

#SignatureDescription
1void CopyMtx(TMtx Mtx)Copy values from matrix.
2TVec CopyMtx(TMtx Mtx, Int32 Index, Int32 Row, Int32 Col, Int32 Len)Desc Copy Mtx elements Values1D[Row*fCols+Col]..Values1D[Row*fCols+Col+Len] in the calling vector elements [Index]..[Index+Len-1].

Overload 1: void CopyMtx(TMtx Mtx)

Copy values from matrix.

#NameTypeDescription
1MtxTMtxsource TMtx

Result: stored in self (calling object)

Remarks:

Copy each of Mtx Dew.Math.TMtx elements to the calling vector. The Dew.Math.TMtxVecBase.Length and Dew.Math.TMtxVec.Complex properties of the calling vector are set implicitly to match Mtx matrix. The same can be achieved by calling the Dew.Math.TVec.Copy method.

Examples
TVec b;
TVec c;
TMtx A;
MtxVec.CreateIt(out b, out c);
MtxVec.CreateIt(out A);
try
    {
        a.SetIt(2,2,false,new double[] {1,2,3,4});
        b.CopyMtx(a);   // b = new double[] {1,2,3,4}
    }
finally
    {
        MtxVec.FreeIt(ref A);
        MtxVec.FreeIt(ref b, ref c);
    }
See Also: TVec.Copy, Int32)

Overload 2: TVec CopyMtx(TMtx Mtx, Int32 Index, Int32 Row, Int32 Col, Int32 Len)

Desc Copy Mtx elements Values1D[Row*fCols+Col]..Values1D[Row*fCols+Col+Len] in the calling vector elements [Index]..[Index+Len-1].

#NameTypeDescription
1MtxTMtxsource TMtx
2IndexInt32start index
3RowInt32
4ColInt32
5LenInt32element count

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

Remarks:

The Dew.Math.TMtxVecBase.Length and Dew.Math.TMtxVec.Complex properties must be set explicitly. An exception is raised if Dew.Math.TMtxVecBase.ConditionCheck is True and array borders are overrun or underrun. The same can be achieved by calling the Copy method.