vectorbase::MakeComplex

Description

Create a complex vector from two real vectors.

Syntax

int MakeComplex( vectorbase & vbReal, vectorbase & vbImag )

Parameters

vbReal
[input] The vector containing the Real part.
vbImag
[input] The vector containing the Imaginary part.

Return

Returns 0 on success or -1 on failure.

Examples

EX1

void vectorbase_MakeComplex_ex1()
{
    vector vec1 = {1, 3, -5, 7};
    vector vec2 = {2.5, -4, 6, 8};
    vector<complex> vecC;
    vecC.MakeComplex(vec1, vec2);
 
    for(int ii = 0; ii < vecC.GetSize(); ii++)
                out_complex("", vecC[ii]);
    // Result:
    //        vecC = {    1.000000+2.500000i
        //                                        3.000000-4.000000i
        //                                        -5.000000+6.000000i
        //                                        7.000000+8.000000i};
}

Remark

Create a complex vector from two real vectors. The real vectors must have the same dimension.

See Also

vectorbase::GetReal, vectorbase::GetImaginary, vectorbase::GetPhase, vectorbase::GetAmplitude, vectorbase::Conjugate

header to Include

origin.h