IGLib  1.7.2
The IGLib base library EXTENDED - with other lilbraries and applications.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros
IG.Num.complex Struct Reference

Complex number. More...

+ Inheritance diagram for IG.Num.complex:
+ Collaboration diagram for IG.Num.complex:

Public Member Functions

 complex (double real)
 Initializes a complex number with specified real part and imaginary part 0. More...
 
 complex (double real, double imaginary)
 Initializes a complex number with specified real and imaginary part. More...
 
 complex (complex a)
 Initializes a complex number with another complex number. More...
 
override int GetHashCode ()
 Overrides the GetHashCode() appropriately. More...
 
override bool Equals (Object obj)
 Overrides the Equals() appropriately. More...
 
override string ToString ()
 Returns a string representation of the complec number in the form "(2.3+4.5*i)". More...
 
double Absolute ()
 Returns an absolute value of the complex number. More...
 
complex Conjugate ()
 Complex conjugate. More...
 

Static Public Member Functions

static bool operator== (complex a, complex b)
 
static bool operator!= (complex a, complex b)
 
static complex operator+ (complex a, complex b)
 Binary operator + for summation of two complex numbers. More...
 
static complex operator- (complex a, complex b)
 Binary operator - subtraction of two complex numbers. More...
 
static complex operator- (complex a)
 Unary operator - changing sign of a complex number. More...
 
static complex operator* (double a, complex c)
 Left multiplication of a complex number by a real number. More...
 
static complex operator* (complex c, double a)
 Right multiplication of a complex number by a real number. More...
 
static complex operator* (complex a, complex b)
 Complex multiplication. More...
 
static complex operator/ (complex a, complex b)
 Complex division. More...
 
static implicit operator complex (double number)
 Implicit conversion between from double to Complex. More...
 
static complex Polar (double r, double fi)
 
static double Absolute (complex a)
 Returns an absolute value of the specified complex number. More...
 
static complex Conjugate (complex a)
 Returns a complex conjugate of the argument. More...
 
static int Compare (complex c1, complex c2)
 Compares two complex numbers and returns -1 if the first number is "smaller" than the second one, 0 if they are equal and 1 if the first number is "greater" than the second one. Comparison is artificial and does not have mathematical meaning. 0 is returned if and only if numbers are equal. More...
 
static void Example ()
 Example of using the complex class. More...
 

Public Attributes

double _imaginary
 

Properties

double Re [get, private set]
 Gets (public access) or sets (protected access) the real part of the complex number. More...
 
double Im [get, private set]
 Gets (public access) or sets (protected access) the imaginary part of the complex number. More...
 
double SquaredAbs [get]
 Returns squared absolute value of the current complex number. More...
 
double Abs [get]
 Gets modulus (absolute value) of the complex number. More...
 
double Fi [get]
 Argument of the complex number. More...
 
static complex Zero [get]
 Complex constant 0 + 0*i (summation unit) More...
 
static complex One [get]
 Complex constant 1 + 0*i (multiplication unit). More...
 
static complex I [get]
 Complex constant 1 + 0*i (summation unit) More...
 
double this[int index] [get, set]
 Index operator - index 0 for real part and 1 for imaginary part of a complex number. More...
 
double this[string index] [get, set]
 Index operator where a string index defines what to get or to set. Possible indices read/write: re, Re, real, Real: real part of the complex number im, Im, imaginary, Imaginary: imaginary part of the complex number Possible indices - read only: r, R: modulus (absolute value) of the complex number fi, Fi: argument of the complex number More...
 
- Properties inherited from IG.Num.IComplex
double Re [get]
 Real part of the current complex number. More...
 
double Im [get]
 Imaginary part of the current complex number. More...
 
double SquaredAbs [get]
 Returns squared absolute value of the current complex number. More...
 
double Abs [get]
 Modulus (absolute value) of the current complex number. More...
 
double Fi [get]
 Argument of the current complex number. More...
 

Private Attributes

double _real
 

Detailed Description

Complex number.

$A Igor Sep08;

Constructor & Destructor Documentation

IG.Num.complex.complex ( double  real)
inline

Initializes a complex number with specified real part and imaginary part 0.

Parameters
realValue assigned to the real part of the created complex number.
imaginaryValue assigned to the imaginary part of the created complex number.
IG.Num.complex.complex ( double  real,
double  imaginary 
)
inline

Initializes a complex number with specified real and imaginary part.

Parameters
realValue assigned to the real part of the created complex number.
imaginaryValue assigned to the imaginary part of the created complex number.
IG.Num.complex.complex ( complex  a)
inline

Initializes a complex number with another complex number.

Parameters
aComplex number whose copy is created in this constructor.

Member Function Documentation

static bool IG.Num.complex.operator== ( complex  a,
complex  b 
)
inlinestatic
static bool IG.Num.complex.operator!= ( complex  a,
complex  b 
)
inlinestatic
static complex IG.Num.complex.operator+ ( complex  a,
complex  b 
)
inlinestatic

Binary operator + for summation of two complex numbers.

References IG.Num.complex.Im, and IG.Num.complex.Re.

static complex IG.Num.complex.operator- ( complex  a,
complex  b 
)
inlinestatic

Binary operator - subtraction of two complex numbers.

References IG.Num.complex.Im, and IG.Num.complex.Re.

static complex IG.Num.complex.operator- ( complex  a)
inlinestatic

Unary operator - changing sign of a complex number.

References IG.Num.complex.Im, and IG.Num.complex.Re.

static complex IG.Num.complex.operator* ( double  a,
complex  c 
)
inlinestatic

Left multiplication of a complex number by a real number.

References IG.Num.complex.Im, and IG.Num.complex.Re.

static complex IG.Num.complex.operator* ( complex  c,
double  a 
)
inlinestatic

Right multiplication of a complex number by a real number.

References IG.Num.complex.Im, and IG.Num.complex.Re.

static complex IG.Num.complex.operator* ( complex  a,
complex  b 
)
inlinestatic

Complex multiplication.

References IG.Num.complex.Im, and IG.Num.complex.Re.

static complex IG.Num.complex.operator/ ( complex  a,
complex  b 
)
inlinestatic

Complex division.

References IG.Num.complex.Im, and IG.Num.complex.Re.

static implicit IG.Num.complex.operator complex ( double  number)
inlinestatic

Implicit conversion between from double to Complex.

Parameters
numberNumber that is converted.
Returns
Complex number that is a result of conversion from the specified number..
override int IG.Num.complex.GetHashCode ( )
inline

Overrides the GetHashCode() appropriately.

Returns
override bool IG.Num.complex.Equals ( Object  obj)
inline

Overrides the Equals() appropriately.

References IG.Num.ComplexClass.Im, and IG.Num.ComplexClass.Re.

static complex IG.Num.complex.Polar ( double  r,
double  fi 
)
inlinestatic
override string IG.Num.complex.ToString ( )
inline

Returns a string representation of the complec number in the form "(2.3+4.5*i)".

Referenced by IG.Num.complex.Example(), and IG.Num.ComplexClass.ToString().

double IG.Num.complex.Absolute ( )
inline

Returns an absolute value of the complex number.

Implements IG.Num.IComplex.

Referenced by IG.Num.ComplexClass.Absolute().

static double IG.Num.complex.Absolute ( complex  a)
inlinestatic

Returns an absolute value of the specified complex number.

Parameters
aComplex number whose absolute value is returned.

References IG.Num.complex.Abs.

complex IG.Num.complex.Conjugate ( )
inline
static complex IG.Num.complex.Conjugate ( complex  a)
inlinestatic

Returns a complex conjugate of the argument.

References IG.Num.complex.Conjugate().

static int IG.Num.complex.Compare ( complex  c1,
complex  c2 
)
inlinestatic

Compares two complex numbers and returns -1 if the first number is "smaller" than the second one, 0 if they are equal and 1 if the first number is "greater" than the second one. Comparison is artificial and does not have mathematical meaning. 0 is returned if and only if numbers are equal.

Parameters
c1First number to be compared.
c2Second number to be compared.
Returns

References IG.Num.complex.Im, and IG.Num.complex.Re.

static void IG.Num.complex.Example ( )
inlinestatic

Example of using the complex class.

Complex class will be seldom used, usually the complex struct will be used instead (which is a value type).

References IG.Num.complex.Conjugate(), and IG.Num.complex.ToString().

Member Data Documentation

double IG.Num.complex._real
private
double IG.Num.complex._imaginary

Property Documentation

double IG.Num.complex.Re
getprivate set
double IG.Num.complex.Im
getprivate set

Gets (public access) or sets (protected access) the imaginary part of the complex number.

Referenced by IG.Num.complex.Compare(), IG.Num.complex.operator!=(), IG.Num.complex.operator*(), IG.Num.complex.operator+(), IG.Num.complex.operator-(), IG.Num.complex.operator/(), and IG.Num.complex.operator==().

double IG.Num.complex.SquaredAbs
get

Returns squared absolute value of the current complex number.

double IG.Num.complex.Abs
get

Gets modulus (absolute value) of the complex number.

Referenced by IG.Num.ComplexClass.Absolute(), and IG.Num.complex.Absolute().

double IG.Num.complex.Fi
get

Argument of the complex number.

complex IG.Num.complex.Zero
staticget

Complex constant 0 + 0*i (summation unit)

complex IG.Num.complex.One
staticget

Complex constant 1 + 0*i (multiplication unit).

complex IG.Num.complex.I
staticget

Complex constant 1 + 0*i (summation unit)

double IG.Num.complex.this[int index]
getset

Index operator - index 0 for real part and 1 for imaginary part of a complex number.

Parameters
indexInteger index that can be 0 (for real part of the complex number) or 1 (for imaginary part).
double IG.Num.complex.this[string index]
getset

Index operator where a string index defines what to get or to set. Possible indices read/write: re, Re, real, Real: real part of the complex number im, Im, imaginary, Imaginary: imaginary part of the complex number Possible indices - read only: r, R: modulus (absolute value) of the complex number fi, Fi: argument of the complex number

Parameters
indexString that defines what to get or to set.

The documentation for this struct was generated from the following file: