2.2.3.3 complex

Name

complex

Remark

The Origin C complex class implements a complex number data type containing both a Real and an Imaginary component.

Hierarchy

  • complex

Examples

EX1

void complex_complex_ex1()
{
    complex cc(4.5, 7.8);
    out_double("Real part = ", cc.m_re); //Result is "Real part = 4.5"
    out_double("Imaginary part = ", cc.m_im); //Result is "Imaginary part = 7.8"

    cc  = cc.Conjugate();
    out_double("Real part = ", cc.m_re); //Result is "Real part = 4.5"
    out_double("Imaginary part = ", cc.m_im); //Result is "Imaginary part = -7.8"
}

Header to Include

origin.h

Reference

Members

Name Brief Example
complex default constructor which constructs a complex value with both the real and the imaginary part being zero. Examples
Conjugate it returns the complex conjugate of the value Examples
GetAmplitude returns the amplitude(modulus) of the complex value. Examples
GetPhase returns the phase in radians, of the complex value. Examples

Property

Name Brief Example
m_im the property representing the imaginary part of the complex value. Examples
m_re the property representing the real part of the complex value. Examples