2.2.3.19.15 vectorbase::GetImaginary

Description

Get the imaginary part of a complex vector.

Syntax

int GetImaginary( vector & vImag )

Parameters

vImag
[output] vector containing the Imaginary part of this Complex vector

Return

Returns 0 on success or -1 on failure.

Examples

EX1

void vectorbase_GetImaginary_ex1()
{
    vector<complex> vecC = {1+2i, 3+4i, 5+6i, 7+8i};
    vector vecR;
    vecC.GetImaginary(vecR);
    for (int ii = 0; ii < vecR.GetSize(); ii++)
    	printf("%.0f ",vecR[ii]);
    // Result:
    //        vecR = {2, 4, 6, 8};
}

Remark

Get the imaginary part of a complex vector. Causes a runtime error if the underlying base type of the vector is not complex.

See Also

vectorbase::GetReal, vectorbase::GetPhase, vectorbase::GetAmplitude, vectorbase::Conjugate, vectorbase::MakeComplex

Header to Include

origin.h