2.2.3.19.22 vectorbase::GetReal

Description

Get the real part of a complex vector.

Syntax

int GetReal( vector & vReal )

Parameters

vReal
[output] vector containing the real part of a complex vector

Return

Returns 0 on success or -1 on failure.

Examples

EX1

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

Remark

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

See Also

vectorbase::GetImaginary, vectorbase::GetPhase, vectorbase::GetAmplitude, vectorbase::Conjugate, vectorbase::MakeComplex

Header to Include

origin.h