Vector.Copy Method

Overload List

#SignatureDescription
1TMtxVec Copy(TMtxVec Vec)Copy object values.
└ indexed: TMtxVec Copy(TMtxVec Vec, Int32 VecIndex, Int32 Index, Int32 Len)
2TMtxVec Copy(TMtxVec Src, TMtxFloatPrecision dstFloatPrecision)Copy object values.
3TVec Copy(TMtxVec Vec1, TMtxVec Vec2)Copies values from Vec1 and Vec2 (concatenate).
4TMtxVec Copy(TVecInt Src)Copy and convert values from TVecInt.
└ indexed: TMtxVec Copy(TVecInt Src, Int32 SrcIndex, Int32 Index, Int32 Len)
5TMtxVec Copy(TVecInt Src, TMtxFloatPrecision dstFloatPrecision)Copy and convert values from TVecInt.

Overload 1: TMtxVec Copy(TMtxVec Vec)

Copy object values.

#NameTypeDescription
1VecTMtxVecsource TVec or TMtx

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

Remarks:

Copy each of Vec elements to the calling object. Size and Dew.Math.Vector.Complex properties of the calling object are set implicitly to match Vec object.

Examples
Vector a = new Vector();
Vector x = new Vector();
x.SetIt(new double[] { 1.0, 2.0, 3.0, 4.0 });
a.Copy(x);
if (!a.IsEqual(x, 1e-10, TCompare.cmpAbsolute))
    throw new Exception("Vector.Copy: mismatch");
Vector a;
Vector b;
Vector c;
a.SetIt(true,new double[] {1,2,3,4});  // a = new double[] {1,2,3,4}
b.Copy(a);                // b = new double[] {1,2,3,4}
c.Copy(a,b);  //concatenate a and b and store in c = new double[] {1,2,3,4,1,2,3,4}
See Also: Vector.Assign

Indexed: TMtxVec Copy(TMtxVec Vec, Int32 VecIndex, Int32 Index, Int32 Len)

Copy Vec elements [VecIndex]..[VecIndex+Len-1] in the calling object elements [Index]..[Index+Len-1].

#NameTypeDescription
1VecTMtxVecsource TVec or TMtx
2VecIndexInt32
3IndexInt32start index
4LenInt32element count

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

Remarks:

Size and Dew.Math.Vector.Complex properties must be set explicitly. An exception is raised if Dew.Math.Vector.ConditionCheck is True and array borders are overrun or underrun.

Overload 2: TMtxVec Copy(TMtxVec Src, TMtxFloatPrecision dstFloatPrecision)

Copy object values.

#NameTypeDescription
1SrcTMtxVecsource TVec or TMtx
2dstFloatPrecisionTMtxFloatPrecision

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

Remarks:

Copy each of Src elements to the calling object. Size and Dew.Math.Vector.Complex properties of the calling object are set implicitly to match Src object.

Examples
using Dew.Math;
using Dew.Math.Units;

namespace Dew.Examples
{
    void Example()
    {
        TVec a,b,c;
        MtxVec.CreateIt(out a, out b, out c);
        try
        {
            a.SetIt(true,new double[] {1,2,3,4});  // a = [1,2,3,4] i.e 1+2i ; 3+4i
            b.Copy(a, mvSingle);                // convert to single precision
        }
        finally
        {
            MtxVec.FreeIt(ref a,ref b,ref c);
        }
    }
}
See Also: Vector.Assign

Overload 3: TVec Copy(TMtxVec Vec1, TMtxVec Vec2)

Copies values from Vec1 and Vec2 (concatenate).

#NameTypeDescription
1Vec1TMtxVecsource TVec or TMtx
2Vec2TMtxVecsource TVec or TMtx

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

Remarks:

Copy each of Vec1 and Vec2 elements to the calling vector (concatenate). The Dew.Math.Vector.Length and Dew.Math.Vector.Complex properties of the calling vector are set implicitly to match Vec1 and Vec2 vector.

Examples
Vector a;
Vector b;
Vector c;
a.SetIt(true,new double[] {1,2,3,4});
b.Copy(a);
c.Copy(a,b);  //concatenate a and b and store in c
// c = [1,2,3,4,1,2,3,4]
See Also: Vector.Assign

Overload 4: TMtxVec Copy(TVecInt Src)

Copy and convert values from TVecInt.

#NameTypeDescription
1SrcTVecIntsource TVecInt

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

Remarks:

Applies appropriate conversion and copy data from TVecInt. Existing value of FloatPrecision is preserved.

Indexed: TMtxVec Copy(TVecInt Src, Int32 SrcIndex, Int32 Index, Int32 Len)

Copy and convert values from TVecInt at indexes [SrcIndex]...[SrcIndex+Len-1].

#NameTypeDescription
1SrcTVecIntsource TVecInt
2SrcIndexInt32source start index
3IndexInt32start index
4LenInt32element count

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

Remarks:

Applies appropriate conversion and copy data from TVecInt. The results are stored in calling object elements [Index]...[Index+Len-1]. Size and Dew.Math.Vector.Complex properties of the calling object must be set explicitly. An exception is raised if array borders are overrun.

Overload 5: TMtxVec Copy(TVecInt Src, TMtxFloatPrecision dstFloatPrecision)

Copy and convert values from TVecInt.

#NameTypeDescription
1SrcTVecIntsource TVecInt
2dstFloatPrecisionTMtxFloatPrecision

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

Remarks:

Applies appropriate conversion and copy data from TVecInt.