BGC Tools
Public Member Functions | Static Public Member Functions | Data Fields | Static Public Attributes | Properties | Static Private Member Functions | Private Attributes
BGC.Mathematics.Complex64 Struct Reference

Represents a complex number with double-precision floating point components More...

Inheritance diagram for BGC.Mathematics.Complex64:
Inheritance graph
[legend]
Collaboration diagram for BGC.Mathematics.Complex64:
Collaboration graph
[legend]

Public Member Functions

 Complex64 (double real, double imaginary)
 Initializes a new Complex64 structure using the specified real and imaginary values. More...
 
Complex64 Square ()
 The Square (power 2) of this Complex64 More...
 
Complex64 Rotation (double phase)
 Retuns the Complex64 number, rotated by phase radians, or exp(i*phase) More...
 
double RealRotation (double phase)
 Retuns the real value of the Complex64 number after rotation by phase radians, or exp(i*phase) More...
 
bool Equals (in Complex64 value)
 Returns a value that indicates whether the current instance and a specified complex number have the same value. More...
 
bool IEquatable< Complex64 >. Equals (Complex64 other)
 Returns a value that indicates whether the current instance and a specified complex number have the same value. More...
 
override bool Equals (object obj)
 Returns a value that indicates whether the current instance and a specified object have the same value. More...
 
override int GetHashCode ()
 Returns the hash code for the current Complex64 object. More...
 
string ToString (string format)
 Converts the value of the current complex number to its equivalent string representation in Cartesian form by using the specified format for its real and imaginary parts. More...
 
string ToString (IFormatProvider provider)
 Converts the value of the current complex number to its equivalent string representation in Cartesian form by using the specified culture-specific formatting information. More...
 
string ToString (string format, IFormatProvider provider)
 Converts the value of the current complex number to its equivalent string representation in Cartesian form by using the specified format and culture-specific format information for its real and imaginary parts. More...
 
override string ToString ()
 Converts the value of the current complex number to its equivalent string representation in Cartesian form. More...
 
bool IsReal ()
 Gets a value indicating whether the provided Complex64 is real. More...
 
bool IsRealNonNegative ()
 Gets a value indicating whether the provided Complex64 is real and not negative, that is >= 0. More...
 
bool IsZero ()
 Gets a value indicating whether the Complex64 is zero. More...
 
bool IsOne ()
 Gets a value indicating whether the Complex64 is one. More...
 
bool IsImaginaryOne ()
 Gets a value indicating whether the Complex64 is the imaginary unit. More...
 
bool IsInfinity ()
 Gets a value indicating whether the provided Complex64 evaluates to an infinite value. More...
 
bool IsNaN ()
 Gets a value indicating whether the provided Complex64evaluates to a value that is not a number. More...
 
Complex64 Power (in Complex64 exponent)
 Raise this Complex64 to the given value. More...
 
Complex64 NaturalLogarithm ()
 Natural Logarithm of this Complex64 (Base E). More...
 
Complex64 CommonLogarithm ()
 Common Logarithm of this Complex64 (Base 10). More...
 
Complex64 Logarithm (double baseValue)
 Logarithm of this Complex64 with custom base. More...
 
Complex64 Exponential ()
 Exponential of this Complex64 (exp(x), E^x). More...
 
double RealProduct (in Complex64 other)
 Returns the real component of the product of this Complex64 with other. More...
 
Complex64 Conjugate ()
 Computes the conjugate of a complex number and returns the result. More...
 
Complex64 Reciprocal ()
 Returns the multiplicative inverse of a complex number. More...
 
Complex64 SquareRoot ()
 The Square Root (power 1/2) of this Complex64 More...
 

Static Public Member Functions

static double Abs (in Complex64 value)
 Gets the absolute value (or magnitude) of a complex number. More...
 
static Complex64 Acos (in Complex64 value)
 Trigonometric principal Arc Cosine of this Complex64 number. More...
 
static Complex64 Add (in Complex64 left, in Complex64 right)
 Returns the sum of the two Complex64 inputs More...
 
static Complex64 Asin (in Complex64 value)
 Trigonometric principal Arc Sine of this Complex64 number. More...
 
static Complex64 Atan (in Complex64 value)
 Trigonometric principal Arc Tangent of this Complex64 number. More...
 
static Complex64 Conjugate (in Complex64 value)
 Computes the conjugate of a complex number and returns the result. More...
 
static Complex64 Cos (in Complex64 value)
 Trigonometric Cosine of a Complex64 number. More...
 
static Complex64 Cosh (in Complex64 value)
 Hyperbolic Cosine of a Complex64 number. More...
 
static Complex64 Divide (in Complex64 dividend, in Complex64 divisor)
 Divides one complex number by another and returns the result. More...
 
static Complex64 Exp (in Complex64 value)
 Returns e raised to the power specified by a complex number. More...
 
static Complex64 FromPolarCoordinates (double magnitude, double phase)
 Creates a complex number from a point's polar coordinates. More...
 
static Complex64 Log (in Complex64 value)
 Returns the natural (base e) logarithm of a specified complex number. More...
 
static Complex64 Log (in Complex64 value, double baseValue)
 Returns the logarithm of a specified complex number in a specified base. More...
 
static Complex64 Log10 (in Complex64 value)
 Returns the base-10 logarithm of a specified complex number. More...
 
static Complex64 Multiply (in Complex64 left, in Complex64 right)
 Returns the product of two complex numbers. More...
 
static Complex64 Negate (in Complex64 value)
 Returns the additive inverse of a specified complex number. More...
 
static Complex64 Pow (in Complex64 value, double power)
 Returns a specified complex number raised to a power specified by a double-precision doubleing-point number. More...
 
static Complex64 Pow (in Complex64 value, in Complex64 power)
 Returns a specified complex number raised to a power specified by a complex number. More...
 
static Complex64 Reciprocal (in Complex64 value)
 Returns the multiplicative inverse of a complex number. More...
 
static Complex64 Sin (in Complex64 value)
 Trigonometric Sine of a Complex64 number. More...
 
static Complex64 Sinh (in Complex64 value)
 Hyperbolic Sine of a Complex64 number. More...
 
static Complex64 Sqrt (in Complex64 value)
 The Square Root of a complex number More...
 
static Complex64 Subtract (in Complex64 left, Complex64 right)
 The difference between two Complex64 numbers; More...
 
static Complex64 Tan (in Complex64 value)
 Trigonometric Tangent of a Complex64 number. More...
 
static Complex64 Tanh (in Complex64 value)
 Hyperbolic Tangent of a Complex64 number. More...
 
static Complex64 operator+ (in Complex64 left, in Complex64 right)
 Adds two complex numbers. More...
 
static Complex64 operator- (in Complex64 value)
 Returns the additive inverse of a specified complex number. More...
 
static Complex64 operator- (in Complex64 left, in Complex64 right)
 Subtracts a complex number from another complex number. More...
 
static Complex64 operator* (in Complex64 left, in Complex64 right)
 Multiplies two specified complex numbers. More...
 
static Complex64 operator/ (in Complex64 dividend, in Complex64 divisor)
 Divides a specified complex number by another specified complex number. More...
 
static bool operator== (in Complex64 left, in Complex64 right)
 Returns a value that indicates whether two complex numbers are equal. More...
 
static bool operator!= (in Complex64 left, in Complex64 right)
 Returns a value that indicates whether two complex numbers are not equal. More...
 
static implicit operator Complex64 (Complex32 value)
 Defines an implicit conversion of an unsigned byte to a complex number. More...
 
static implicit operator Complex64 (byte value)
 Defines an implicit conversion of an unsigned byte to a complex number. More...
 
static implicit operator Complex64 (float value)
 Defines an implicit conversion of a single-precision floating-point number to a complex number. More...
 
static implicit operator Complex64 (double value)
 Defines an implicit conversion of a double-precision floating-point number to a complex number. More...
 
static implicit operator Complex64 (sbyte value)
 Defines an implicit conversion of a signed byte to a complex number. More...
 
static implicit operator Complex64 (ulong value)
 Defines an implicit conversion of a 64-bit unsigned integer to a complex number. More...
 
static implicit operator Complex64 (uint value)
 Defines an implicit conversion of a 32-bit unsigned integer to a complex number. More...
 
static implicit operator Complex64 (ushort value)
 Defines an implicit conversion of a 16-bit unsigned integer to a complex number. More...
 
static implicit operator Complex64 (long value)
 Defines an implicit conversion of a 64-bit signed integer to a complex number. More...
 
static implicit operator Complex64 (int value)
 Defines an implicit conversion of a 32-bit signed integer to a complex number. More...
 
static implicit operator Complex64 (short value)
 Defines an implicit conversion of a 16-bit signed integer to a complex number. More...
 
static operator Complex64 (decimal value)
 Defines an explicit conversion of a System.Decimal value to a complex number. More...
 

Data Fields

double Imaginary => _imag
 Gets the imaginary component of the current System.Numerics.Complex64 object. More...
 
double Real => _real
 Gets the real component of the current System.Numerics.Complex64 object. More...
 
double Phase => _imag == 0.0 && _real < 0.0 ? Math.PI : Math.Atan2(_imag, _real)
 Gets the phase of a complex number in radians. More...
 
double MagnitudeSquared => (_real * _real) + (_imag * _imag)
 Gets the squared magnitude (or squared absolute value) of a complex number. More...
 

Static Public Attributes

static readonly Complex64 Zero = new Complex64(0.0, 0.0)
 Returns a new Complex64 instance with a real number equal to zero and an imaginary number equal to zero. More...
 
static readonly Complex64 One = new Complex64(1.0, 0.0)
 Returns a new Complex64 instance with a real number equal to one and an imaginary number equal to zero. More...
 
static readonly Complex64 ImaginaryOne = new Complex64(0.0, 1.0)
 Returns a new Complex64 instance with a real number equal to zero and an imaginary number equal to one. More...
 
static readonly Complex64 PositiveInfinity = new Complex64(double.PositiveInfinity, double.PositiveInfinity)
 Returns a new Complex64 instance with real and imaginary numbers positive infinite. More...
 
static readonly Complex64 NaN = new Complex64(double.NaN, double.NaN)
 Returns a new Complex64 instance with real and imaginary numbers not a number. More...
 

Properties

double Magnitude [get]
 Gets the magnitude (or absolute value) of a complex number. More...
 

Static Private Member Functions

static Complex64 InternalDiv (double a, double b, double c, double d, bool swapped)
 Helper method for dividing. More...
 

Private Attributes

readonly double _real
 The real component of the complex number. More...
 
readonly double _imag
 The imaginary component of the complex number. More...
 

Detailed Description

Represents a complex number with double-precision floating point components

Definition at line 39 of file Complex64.cs.

Constructor & Destructor Documentation

◆ Complex64()

BGC.Mathematics.Complex64.Complex64 ( double  real,
double  imaginary 
)
inline

Initializes a new Complex64 structure using the specified real and imaginary values.

Definition at line 82 of file Complex64.cs.

83  {
84  _real = real;
85  _imag = imaginary;
86  }
readonly double _imag
The imaginary component of the complex number.
Definition: Complex64.cs:51
readonly double _real
The real component of the complex number.
Definition: Complex64.cs:45

Member Function Documentation

◆ Abs()

static double BGC.Mathematics.Complex64.Abs ( in Complex64  value)
static

Gets the absolute value (or magnitude) of a complex number.

Referenced by BGC.Mathematics.Complex64.SquareRoot().

Here is the caller graph for this function:

◆ Acos()

static Complex64 BGC.Mathematics.Complex64.Acos ( in Complex64  value)
inlinestatic

Trigonometric principal Arc Cosine of this Complex64 number.

Parameters
valueThe complex value.
Returns
The arc cosine of a complex number.

Definition at line 152 of file Complex64.cs.

153  {
154  if (value.Imaginary < 0.0 || value.Imaginary == 0.0 && value.Real > 0.0)
155  {
156  return Math.PI - Acos(-value);
157  }
158 
159  return -ImaginaryOne * (value + (ImaginaryOne * (1.0 - value.Square()).SquareRoot())).NaturalLogarithm();
160  }
static Complex64 Acos(in Complex64 value)
Trigonometric principal Arc Cosine of this Complex64 number.
Definition: Complex64.cs:152
static readonly Complex64 ImaginaryOne
Returns a new Complex64 instance with a real number equal to zero and an imaginary number equal to on...
Definition: Complex64.cs:67
Complex64 NaturalLogarithm()
Natural Logarithm of this Complex64 (Base E).
Definition: Complex64.cs:752
Complex64 SquareRoot()
The Square Root (power 1/2) of this Complex64
Definition: Complex64.cs:824

◆ Add()

static Complex64 BGC.Mathematics.Complex64.Add ( in Complex64  left,
in Complex64  right 
)
static

Returns the sum of the two Complex64 inputs

◆ Asin()

static Complex64 BGC.Mathematics.Complex64.Asin ( in Complex64  value)
inlinestatic

Trigonometric principal Arc Sine of this Complex64 number.

Parameters
valueThe complex value.
Returns
The arc sine of a complex number.

Definition at line 173 of file Complex64.cs.

174  {
175  if (value.Imaginary > 0.0 || value.Imaginary == 0.0 && value.Real < 0.0)
176  {
177  return -Asin(-value);
178  }
179 
180  return -ImaginaryOne * ((1.0 - value.Square()).SquareRoot() + (ImaginaryOne * value)).NaturalLogarithm();
181  }
static Complex64 Asin(in Complex64 value)
Trigonometric principal Arc Sine of this Complex64 number.
Definition: Complex64.cs:173
static readonly Complex64 ImaginaryOne
Returns a new Complex64 instance with a real number equal to zero and an imaginary number equal to on...
Definition: Complex64.cs:67
Complex64 NaturalLogarithm()
Natural Logarithm of this Complex64 (Base E).
Definition: Complex64.cs:752
Complex64 SquareRoot()
The Square Root (power 1/2) of this Complex64
Definition: Complex64.cs:824

◆ Atan()

static Complex64 BGC.Mathematics.Complex64.Atan ( in Complex64  value)
inlinestatic

Trigonometric principal Arc Tangent of this Complex64 number.

Parameters
valueThe complex value.
Returns
The arc tangent of a complex number.

Definition at line 189 of file Complex64.cs.

References BGC.Mathematics.Complex64.Conjugate().

190  {
191  Complex64 iz = new Complex64(-value.Imaginary, value.Real); // I*this
192  return new Complex64(0.0, 0.5) * ((1.0 - iz).NaturalLogarithm() - (1.0 + iz).NaturalLogarithm());
193  }
Complex64(double real, double imaginary)
Initializes a new Complex64 structure using the specified real and imaginary values.
Definition: Complex64.cs:82
Complex64 NaturalLogarithm()
Natural Logarithm of this Complex64 (Base E).
Definition: Complex64.cs:752
Here is the call graph for this function:

◆ CommonLogarithm()

Complex64 BGC.Mathematics.Complex64.CommonLogarithm ( )
inline

Common Logarithm of this Complex64 (Base 10).

Returns
The common logarithm of this complex number.

Definition at line 766 of file Complex64.cs.

References BGC.Mathematics.Complex64.Log().

Referenced by BGC.Mathematics.Complex64.Cosh().

767  {
768  if (IsRealNonNegative())
769  {
770  return new Complex64(Math.Log10(_real), 0.0);
771  }
772 
773  return new Complex64(0.5 * Math.Log10(MagnitudeSquared), Phase);
774  }
readonly double _real
The real component of the complex number.
Definition: Complex64.cs:45
double Phase
Gets the phase of a complex number in radians.
Definition: Complex64.cs:139
Complex64(double real, double imaginary)
Initializes a new Complex64 structure using the specified real and imaginary values.
Definition: Complex64.cs:82
double MagnitudeSquared
Gets the squared magnitude (or squared absolute value) of a complex number.
Definition: Complex64.cs:710
bool IsRealNonNegative()
Gets a value indicating whether the provided Complex64 is real and not negative, that is >= 0...
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Conjugate() [1/2]

static Complex64 BGC.Mathematics.Complex64.Conjugate ( in Complex64  value)
static

Computes the conjugate of a complex number and returns the result.

Referenced by BGC.Mathematics.Complex64.Atan(), and BGC.Mathematics.Fourier.BluesteinForward().

Here is the caller graph for this function:

◆ Conjugate() [2/2]

Complex64 BGC.Mathematics.Complex64.Conjugate ( )

Computes the conjugate of a complex number and returns the result.

◆ Cos()

static Complex64 BGC.Mathematics.Complex64.Cos ( in Complex64  value)
inlinestatic

Trigonometric Cosine of a Complex64 number.

Parameters
valueThe complex value.
Returns
The cosine of a complex number.

Definition at line 206 of file Complex64.cs.

References BGC.Mathematics.GeneralMath.Cosh(), and BGC.Mathematics.GeneralMath.Sinh().

Referenced by BGC.Audio.Filters.PhaseVocoder.PhaseVocoder(), and BGC.Mathematics.Complex64.Rotation().

207  {
208  if (value.IsReal())
209  {
210  return new Complex64(Math.Cos(value.Real), 0.0);
211  }
212 
213  return new Complex64(
214  Math.Cos(value.Real) * GeneralMath.Cosh(value.Imaginary),
215  -Math.Sin(value.Real) * GeneralMath.Sinh(value.Imaginary));
216  }
Complex64(double real, double imaginary)
Initializes a new Complex64 structure using the specified real and imaginary values.
Definition: Complex64.cs:82
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Cosh()

static Complex64 BGC.Mathematics.Complex64.Cosh ( in Complex64  value)
inlinestatic

Hyperbolic Cosine of a Complex64 number.

Parameters
valueThe complex value.
Returns
The hyperbolic cosine of a complex number.

Definition at line 224 of file Complex64.cs.

References BGC.Mathematics.Complex64.CommonLogarithm(), BGC.Mathematics.GeneralMath.Cosh(), BGC.Mathematics.Complex64.Exponential(), BGC.Mathematics.Complex64.Logarithm(), BGC.Mathematics.Complex64.NaturalLogarithm(), BGC.Mathematics.Complex64.Power(), BGC.Mathematics.Complex64.Reciprocal(), and BGC.Mathematics.GeneralMath.Sinh().

225  {
226  if (value.IsReal())
227  {
228  return new Complex64(GeneralMath.Cosh(value.Real), 0.0);
229  }
230 
231  // cosh(x + j*y) = cosh(x)*cos(y) + j*sinh(x)*sin(y)
232  // if x > huge, cosh(x + j*y) = exp(|x|)/2*cos(y) + j*sign(x)*exp(|x|)/2*sin(y)
233 
234  if (Math.Abs(value.Real) >= 22.0) // Taken from the msun library in FreeBSD
235  {
236  double h = Math.Exp(Math.Abs(value.Real)) * 0.5;
237  return new Complex64(
238  h * Math.Cos(value.Imaginary),
239  Math.Sign(value.Real) * h * Math.Sin(value.Imaginary));
240  }
241 
242  return new Complex64(
243  GeneralMath.Cosh(value.Real) * Math.Cos(value.Imaginary),
244  GeneralMath.Sinh(value.Real) * Math.Sin(value.Imaginary));
245  }
Complex64(double real, double imaginary)
Initializes a new Complex64 structure using the specified real and imaginary values.
Definition: Complex64.cs:82
Here is the call graph for this function:

◆ Divide()

static Complex64 BGC.Mathematics.Complex64.Divide ( in Complex64  dividend,
in Complex64  divisor 
)
static

Divides one complex number by another and returns the result.

◆ Equals() [1/3]

bool BGC.Mathematics.Complex64.Equals ( in Complex64  value)
inline

Returns a value that indicates whether the current instance and a specified complex number have the same value.

Definition at line 467 of file Complex64.cs.

References BGC.Mathematics.GeneralMath.Approximately().

468  {
469  if (IsNaN() || value.IsNaN())
470  {
471  return false;
472  }
473 
474  if (IsInfinity() && value.IsInfinity())
475  {
476  return true;
477  }
478 
479  return GeneralMath.Approximately(_real, value._real) &&
480  GeneralMath.Approximately(_imag, value._imag);
481  }
readonly double _imag
The imaginary component of the complex number.
Definition: Complex64.cs:51
readonly double _real
The real component of the complex number.
Definition: Complex64.cs:45
bool IsInfinity()
Gets a value indicating whether the provided Complex64 evaluates to an infinite value.
bool IsNaN()
Gets a value indicating whether the provided Complex64evaluates to a value that is not a number...
Here is the call graph for this function:

◆ Equals() [2/3]

bool IEquatable<Complex64>. BGC.Mathematics.Complex64.Equals ( Complex64  other)

Returns a value that indicates whether the current instance and a specified complex number have the same value.

◆ Equals() [3/3]

override bool BGC.Mathematics.Complex64.Equals ( object  obj)

Returns a value that indicates whether the current instance and a specified object have the same value.

◆ Exp()

static Complex64 BGC.Mathematics.Complex64.Exp ( in Complex64  value)
static

Returns e raised to the power specified by a complex number.

Referenced by BGC.Mathematics.Complex64.Exponential().

Here is the caller graph for this function:

◆ Exponential()

Complex64 BGC.Mathematics.Complex64.Exponential ( )
inline

Exponential of this Complex64 (exp(x), E^x).

Returns
The exponential of this complex number.

Definition at line 788 of file Complex64.cs.

References BGC.Mathematics.Complex64._real, and BGC.Mathematics.Complex64.Exp().

Referenced by BGC.Mathematics.Complex64.Cosh().

789  {
790  double exp = Math.Exp(_real);
791  if (IsReal())
792  {
793  return new Complex64(exp, 0.0);
794  }
795 
796  return new Complex64(exp * Math.Cos(_imag), exp * Math.Sin(_imag));
797  }
readonly double _imag
The imaginary component of the complex number.
Definition: Complex64.cs:51
readonly double _real
The real component of the complex number.
Definition: Complex64.cs:45
Complex64(double real, double imaginary)
Initializes a new Complex64 structure using the specified real and imaginary values.
Definition: Complex64.cs:82
bool IsReal()
Gets a value indicating whether the provided Complex64 is real.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ FromPolarCoordinates()

static Complex64 BGC.Mathematics.Complex64.FromPolarCoordinates ( double  magnitude,
double  phase 
)
static

Creates a complex number from a point's polar coordinates.

Referenced by BGC.Audio.Filters.CarlileShuffler._Initialize(), BGC.Audio.AnalyticStreams.AnalyticFrequencyModulationFilter.AnalyticFrequencyModulationFilter(), BGC.Audio.AnalyticStreams.AnalyticStreamFrequencyShifter.AnalyticStreamFrequencyShifter(), BGC.Audio.AnalyticStreams.AnalyticWave.AnalyticWave(), BGC.Audio.ComplexCarrierTone.ComplexCarrierTone(), BGC.Audio.Synthesis.NoiseAudioClip.CreateSideBands(), BGC.Audio.AnalyticStreams.AnalyticNoiseStream.CreateSideBands(), BGC.Audio.Synthesis.STMAudioClip.CreateSideBands(), BGC.Audio.Synthesis.STMAudioClip.ExpCarrierToneSideBands(), BGC.Audio.Filters.FramedPhaseReencoder.FramedPhaseReencoder(), BGC.Audio.Filters.FrequencyModulationFilter.FrequencyModulationFilter(), BGC.Audio.Filters.PhaseVocoder.PhaseVocoder(), BGC.Audio.FrequencyDomain.Populate(), BGC.Audio.AnalyticStreams.AnalyticStreamFrequencyShifter.Read(), BGC.Audio.AnalyticStreams.AnalyticWave.Read(), BGC.Audio.Synthesis.SineWave.Read(), BGC.Audio.Synthesis.SineWave.ReadNextSample(), BGC.Audio.AnalyticStreams.AnalyticStreamFrequencyShifter.Reset(), BGC.Audio.AnalyticStreams.AnalyticWave.Reset(), BGC.Audio.Synthesis.SineWave.Reset(), BGC.Audio.AnalyticStreams.AnalyticStreamFrequencyShifter.Seek(), BGC.Audio.AnalyticStreams.AnalyticWave.Seek(), BGC.Audio.Synthesis.SineWave.Seek(), BGC.Audio.Synthesis.SineWave.SineWave(), BGC.Tests.SynthesisTests.TestFDComposer(), BGC.Tests.SynthesisTests.TestFDComposerPure(), BGC.Audio.Filters.SinglePassPhaseReencoder.TimeShift(), and BGC.Tests.SynthesisTests.TryAllpassFilters().

Here is the caller graph for this function:

◆ GetHashCode()

override int BGC.Mathematics.Complex64.GetHashCode ( )
inline

Returns the hash code for the current Complex64 object.

Definition at line 496 of file Complex64.cs.

497  {
498  int hash = 27;
499  hash = (13 * hash) + _real.GetHashCode();
500  hash = (13 * hash) + _imag.GetHashCode();
501  return hash;
502  }
readonly double _imag
The imaginary component of the complex number.
Definition: Complex64.cs:51
readonly double _real
The real component of the complex number.
Definition: Complex64.cs:45

◆ InternalDiv()

static Complex64 BGC.Mathematics.Complex64.InternalDiv ( double  a,
double  b,
double  c,
double  d,
bool  swapped 
)
inlinestaticprivate

Helper method for dividing.

Parameters
aRe first
bIm first
cRe second
dIm second

Definition at line 870 of file Complex64.cs.

871  {
872  double r = d / c;
873  double t = 1 / (c + d * r);
874  double e, f;
875 
876  if (r != 0.0) // one can use r >= double.Epsilon || r <= double.Epsilon instead
877  {
878  e = (a + b * r) * t;
879  f = (b - a * r) * t;
880  }
881  else
882  {
883  e = (a + d * (b / c)) * t;
884  f = (b - d * (a / c)) * t;
885  }
886 
887  if (swapped)
888  {
889  f = -f;
890  }
891 
892  return new Complex64(e, f);
893  }
Complex64(double real, double imaginary)
Initializes a new Complex64 structure using the specified real and imaginary values.
Definition: Complex64.cs:82

◆ IsImaginaryOne()

bool BGC.Mathematics.Complex64.IsImaginaryOne ( )

Gets a value indicating whether the Complex64 is the imaginary unit.

Returns
true if this instance is ImaginaryOne; otherwise, false.

◆ IsInfinity()

bool BGC.Mathematics.Complex64.IsInfinity ( )

Gets a value indicating whether the provided Complex64 evaluates to an infinite value.

Returns
true if this instance is infinite; otherwise, false.

True if it either evaluates to a complex infinity or to a directed infinity.

◆ IsNaN()

bool BGC.Mathematics.Complex64.IsNaN ( )

Gets a value indicating whether the provided Complex64evaluates to a value that is not a number.

Returns
true if this instance is NaN; otherwise, false.

◆ IsOne()

bool BGC.Mathematics.Complex64.IsOne ( )

Gets a value indicating whether the Complex64 is one.

Returns
true if this instance is one; otherwise, false.

◆ IsReal()

bool BGC.Mathematics.Complex64.IsReal ( )

Gets a value indicating whether the provided Complex64 is real.

Returns
true if this instance is a real number; otherwise, false.

◆ IsRealNonNegative()

bool BGC.Mathematics.Complex64.IsRealNonNegative ( )

Gets a value indicating whether the provided Complex64 is real and not negative, that is >= 0.

Returns
true if this instance is real nonnegative number; otherwise, false.

◆ IsZero()

bool BGC.Mathematics.Complex64.IsZero ( )

Gets a value indicating whether the Complex64 is zero.

Returns
true if this instance is zero; otherwise, false.

◆ Log() [1/2]

static Complex64 BGC.Mathematics.Complex64.Log ( in Complex64  value)
static

Returns the natural (base e) logarithm of a specified complex number.

Referenced by BGC.Audio.Synthesis.STMAudioClip._Initialize(), and BGC.Mathematics.Complex64.CommonLogarithm().

Here is the caller graph for this function:

◆ Log() [2/2]

static Complex64 BGC.Mathematics.Complex64.Log ( in Complex64  value,
double  baseValue 
)
static

Returns the logarithm of a specified complex number in a specified base.

◆ Log10()

static Complex64 BGC.Mathematics.Complex64.Log10 ( in Complex64  value)
static

Returns the base-10 logarithm of a specified complex number.

◆ Logarithm()

Complex64 BGC.Mathematics.Complex64.Logarithm ( double  baseValue)

Logarithm of this Complex64 with custom base.

Returns
The logarithm of this complex number.

Referenced by BGC.Mathematics.Complex64.Cosh().

Here is the caller graph for this function:

◆ Multiply()

static Complex64 BGC.Mathematics.Complex64.Multiply ( in Complex64  left,
in Complex64  right 
)
static

Returns the product of two complex numbers.

◆ NaturalLogarithm()

Complex64 BGC.Mathematics.Complex64.NaturalLogarithm ( )
inline

Natural Logarithm of this Complex64 (Base E).

Returns
The natural logarithm of this complex number.

Definition at line 752 of file Complex64.cs.

Referenced by BGC.Mathematics.Complex64.Cosh().

753  {
754  if (IsRealNonNegative())
755  {
756  return new Complex64(Math.Log(_real), 0.0);
757  }
758 
759  return new Complex64(0.5 * Math.Log(MagnitudeSquared), Phase);
760  }
readonly double _real
The real component of the complex number.
Definition: Complex64.cs:45
double Phase
Gets the phase of a complex number in radians.
Definition: Complex64.cs:139
Complex64(double real, double imaginary)
Initializes a new Complex64 structure using the specified real and imaginary values.
Definition: Complex64.cs:82
double MagnitudeSquared
Gets the squared magnitude (or squared absolute value) of a complex number.
Definition: Complex64.cs:710
bool IsRealNonNegative()
Gets a value indicating whether the provided Complex64 is real and not negative, that is >= 0...
Here is the caller graph for this function:

◆ Negate()

static Complex64 BGC.Mathematics.Complex64.Negate ( in Complex64  value)
static

Returns the additive inverse of a specified complex number.

◆ operator Complex64() [1/12]

static implicit BGC.Mathematics.Complex64.operator Complex64 ( Complex32  value)
static

Defines an implicit conversion of an unsigned byte to a complex number.

◆ operator Complex64() [2/12]

static implicit BGC.Mathematics.Complex64.operator Complex64 ( byte  value)
static

Defines an implicit conversion of an unsigned byte to a complex number.

◆ operator Complex64() [3/12]

static implicit BGC.Mathematics.Complex64.operator Complex64 ( float  value)
static

Defines an implicit conversion of a single-precision floating-point number to a complex number.

◆ operator Complex64() [4/12]

static implicit BGC.Mathematics.Complex64.operator Complex64 ( double  value)
static

Defines an implicit conversion of a double-precision floating-point number to a complex number.

Parameters
value

◆ operator Complex64() [5/12]

static implicit BGC.Mathematics.Complex64.operator Complex64 ( sbyte  value)
static

Defines an implicit conversion of a signed byte to a complex number.

◆ operator Complex64() [6/12]

static implicit BGC.Mathematics.Complex64.operator Complex64 ( ulong  value)
static

Defines an implicit conversion of a 64-bit unsigned integer to a complex number.

◆ operator Complex64() [7/12]

static implicit BGC.Mathematics.Complex64.operator Complex64 ( uint  value)
static

Defines an implicit conversion of a 32-bit unsigned integer to a complex number.

◆ operator Complex64() [8/12]

static implicit BGC.Mathematics.Complex64.operator Complex64 ( ushort  value)
static

Defines an implicit conversion of a 16-bit unsigned integer to a complex number.

◆ operator Complex64() [9/12]

static implicit BGC.Mathematics.Complex64.operator Complex64 ( long  value)
static

Defines an implicit conversion of a 64-bit signed integer to a complex number.

◆ operator Complex64() [10/12]

static implicit BGC.Mathematics.Complex64.operator Complex64 ( int  value)
static

Defines an implicit conversion of a 32-bit signed integer to a complex number.

◆ operator Complex64() [11/12]

static implicit BGC.Mathematics.Complex64.operator Complex64 ( short  value)
static

Defines an implicit conversion of a 16-bit signed integer to a complex number.

◆ operator Complex64() [12/12]

static BGC.Mathematics.Complex64.operator Complex64 ( decimal  value)
explicitstatic

Defines an explicit conversion of a System.Decimal value to a complex number.

◆ operator!=()

static bool BGC.Mathematics.Complex64.operator!= ( in Complex64  left,
in Complex64  right 
)
static

Returns a value that indicates whether two complex numbers are not equal.

◆ operator*()

static Complex64 BGC.Mathematics.Complex64.operator* ( in Complex64  left,
in Complex64  right 
)
static

Multiplies two specified complex numbers.

◆ operator+()

static Complex64 BGC.Mathematics.Complex64.operator+ ( in Complex64  left,
in Complex64  right 
)
static

Adds two complex numbers.

◆ operator-() [1/2]

static Complex64 BGC.Mathematics.Complex64.operator- ( in Complex64  value)
static

Returns the additive inverse of a specified complex number.

◆ operator-() [2/2]

static Complex64 BGC.Mathematics.Complex64.operator- ( in Complex64  left,
in Complex64  right 
)
static

Subtracts a complex number from another complex number.

◆ operator/()

static Complex64 BGC.Mathematics.Complex64.operator/ ( in Complex64  dividend,
in Complex64  divisor 
)
inlinestatic

Divides a specified complex number by another specified complex number.

Definition at line 556 of file Complex64.cs.

References BGC.Mathematics.Complex32.Imaginary, BGC.Mathematics.Complex64.Real, and BGC.Mathematics.Complex32.Real.

557  {
558  if (dividend.IsZero() && divisor.IsZero())
559  {
560  return NaN;
561  }
562 
563  if (divisor.IsZero())
564  {
565  return PositiveInfinity;
566  }
567 
568  double a = dividend.Real;
569  double b = dividend.Imaginary;
570  double c = divisor.Real;
571  double d = divisor.Imaginary;
572  if (Math.Abs(d) <= Math.Abs(c))
573  {
574  return InternalDiv(a, b, c, d, false);
575  }
576 
577  return InternalDiv(b, a, d, c, true);
578  }
static readonly Complex64 NaN
Returns a new Complex64 instance with real and imaginary numbers not a number.
Definition: Complex64.cs:77
double Real
Gets the real component of the current System.Numerics.Complex64 object.
Definition: Complex64.cs:96
static readonly Complex64 PositiveInfinity
Returns a new Complex64 instance with real and imaginary numbers positive infinite.
Definition: Complex64.cs:72
static Complex64 InternalDiv(double a, double b, double c, double d, bool swapped)
Helper method for dividing.
Definition: Complex64.cs:870

◆ operator==()

static bool BGC.Mathematics.Complex64.operator== ( in Complex64  left,
in Complex64  right 
)
static

Returns a value that indicates whether two complex numbers are equal.

◆ Pow() [1/2]

static Complex64 BGC.Mathematics.Complex64.Pow ( in Complex64  value,
double  power 
)
static

Returns a specified complex number raised to a power specified by a double-precision doubleing-point number.

◆ Pow() [2/2]

static Complex64 BGC.Mathematics.Complex64.Pow ( in Complex64  value,
in Complex64  power 
)
static

Returns a specified complex number raised to a power specified by a complex number.

◆ Power()

Complex64 BGC.Mathematics.Complex64.Power ( in Complex64  exponent)
inline

Raise this Complex64 to the given value.

Parameters
exponentThe exponent.
Returns
The complex number raised to the given exponent.

Definition at line 721 of file Complex64.cs.

References BGC.Mathematics.Complex64.Imaginary.

Referenced by BGC.Mathematics.Complex64.Cosh().

722  {
723  if (IsZero())
724  {
725  if (exponent.IsZero())
726  {
727  return One;
728  }
729 
730  if (exponent.Real > 0.0)
731  {
732  return Zero;
733  }
734 
735  if (exponent.Real < 0.0)
736  {
737  return exponent.Imaginary == 0.0
738  ? new Complex64(double.PositiveInfinity, 0.0)
739  : new Complex64(double.PositiveInfinity, double.PositiveInfinity);
740  }
741 
742  return NaN;
743  }
744 
745  return (exponent * NaturalLogarithm()).Exponential();
746  }
bool IsZero()
Gets a value indicating whether the Complex64 is zero.
static readonly Complex64 NaN
Returns a new Complex64 instance with real and imaginary numbers not a number.
Definition: Complex64.cs:77
Complex64 Exponential()
Exponential of this Complex64 (exp(x), E^x).
Definition: Complex64.cs:788
static readonly Complex64 Zero
Returns a new Complex64 instance with a real number equal to zero and an imaginary number equal to ze...
Definition: Complex64.cs:57
Complex64(double real, double imaginary)
Initializes a new Complex64 structure using the specified real and imaginary values.
Definition: Complex64.cs:82
double Imaginary
Gets the imaginary component of the current System.Numerics.Complex64 object.
Definition: Complex64.cs:91
static readonly Complex64 PositiveInfinity
Returns a new Complex64 instance with real and imaginary numbers positive infinite.
Definition: Complex64.cs:72
Complex64 NaturalLogarithm()
Natural Logarithm of this Complex64 (Base E).
Definition: Complex64.cs:752
static readonly Complex64 One
Returns a new Complex64 instance with a real number equal to one and an imaginary number equal to zer...
Definition: Complex64.cs:62
Here is the caller graph for this function:

◆ RealProduct()

double BGC.Mathematics.Complex64.RealProduct ( in Complex64  other)

Returns the real component of the product of this Complex64 with other.

Returns
The real component of the product.

Referenced by BGC.Audio.Filters.FrequencyModulationFilter.Read().

Here is the caller graph for this function:

◆ RealRotation()

double BGC.Mathematics.Complex64.RealRotation ( double  phase)

Retuns the real value of the Complex64 number after rotation by phase radians, or exp(i*phase)

◆ Reciprocal() [1/2]

static Complex64 BGC.Mathematics.Complex64.Reciprocal ( in Complex64  value)
static

Returns the multiplicative inverse of a complex number.

Referenced by BGC.Mathematics.Complex64.Cosh().

Here is the caller graph for this function:

◆ Reciprocal() [2/2]

Complex64 BGC.Mathematics.Complex64.Reciprocal ( )

Returns the multiplicative inverse of a complex number.

◆ Rotation()

Complex64 BGC.Mathematics.Complex64.Rotation ( double  phase)
inline

Retuns the Complex64 number, rotated by phase radians, or exp(i*phase)

Definition at line 450 of file Complex64.cs.

References BGC.Mathematics.Complex64.Cos(), and BGC.Mathematics.Complex64.Sin().

451  {
452  double cosPhase = Math.Cos(phase);
453  double sinePhase = Math.Sin(phase);
454  return new Complex64(
455  _real * cosPhase - _imag * sinePhase,
456  _real * sinePhase + _imag * cosPhase);
457  }
readonly double _imag
The imaginary component of the complex number.
Definition: Complex64.cs:51
readonly double _real
The real component of the complex number.
Definition: Complex64.cs:45
Complex64(double real, double imaginary)
Initializes a new Complex64 structure using the specified real and imaginary values.
Definition: Complex64.cs:82
Here is the call graph for this function:

◆ Sin()

static Complex64 BGC.Mathematics.Complex64.Sin ( in Complex64  value)
inlinestatic

Trigonometric Sine of a Complex64 number.

Parameters
valueThe complex value.
Returns
The sine of the complex number.

Definition at line 309 of file Complex64.cs.

References BGC.Mathematics.GeneralMath.Cosh(), and BGC.Mathematics.GeneralMath.Sinh().

Referenced by BGC.Mathematics.Complex64.Rotation().

310  {
311  if (value.IsReal())
312  {
313  return new Complex64(Math.Sin(value.Real), 0.0);
314  }
315 
316  return new Complex64(
317  Math.Sin(value.Real) * GeneralMath.Cosh(value.Imaginary),
318  Math.Cos(value.Real) * GeneralMath.Sinh(value.Imaginary));
319  }
Complex64(double real, double imaginary)
Initializes a new Complex64 structure using the specified real and imaginary values.
Definition: Complex64.cs:82
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Sinh()

static Complex64 BGC.Mathematics.Complex64.Sinh ( in Complex64  value)
inlinestatic

Hyperbolic Sine of a Complex64 number.

Parameters
valueThe complex value.
Returns
The hyperbolic sine of a complex number.

Definition at line 327 of file Complex64.cs.

References BGC.Mathematics.GeneralMath.Cosh(), and BGC.Mathematics.GeneralMath.Sinh().

328  {
329  if (value.IsReal())
330  {
331  return new Complex64(GeneralMath.Sinh(value.Real), 0.0);
332  }
333 
334  // sinh(x + j y) = sinh(x)*cos(y) + j*cosh(x)*sin(y)
335  // if x > huge, sinh(x + jy) = sign(x)*exp(|x|)/2*cos(y) + j*exp(|x|)/2*sin(y)
336 
337  if (Math.Abs(value.Real) >= 22.0) // Taken from the msun library in FreeBSD
338  {
339  double h = Math.Exp(Math.Abs(value.Real)) * 0.5;
340  return new Complex64(
341  Math.Sign(value.Real) * h * Math.Cos(value.Imaginary),
342  h * Math.Sin(value.Imaginary));
343  }
344 
345  return new Complex64(
346  GeneralMath.Sinh(value.Real) * Math.Cos(value.Imaginary),
347  GeneralMath.Cosh(value.Real) * Math.Sin(value.Imaginary));
348  }
Complex64(double real, double imaginary)
Initializes a new Complex64 structure using the specified real and imaginary values.
Definition: Complex64.cs:82
Here is the call graph for this function:

◆ Sqrt()

static Complex64 BGC.Mathematics.Complex64.Sqrt ( in Complex64  value)
static

The Square Root of a complex number

Referenced by BGC.Audio.FrequencyDomain.Populate().

Here is the caller graph for this function:

◆ Square()

Complex64 BGC.Mathematics.Complex64.Square ( )
inline

The Square (power 2) of this Complex64

Returns
The square of this complex number.

Definition at line 356 of file Complex64.cs.

References BGC.Mathematics.Complex64.SquareRoot().

357  {
358  if (IsReal())
359  {
360  return new Complex64(_real * _real, 0.0);
361  }
362 
363  return new Complex64((_real * _real) - (_imag * _imag), 2 * _real * _imag);
364  }
readonly double _imag
The imaginary component of the complex number.
Definition: Complex64.cs:51
readonly double _real
The real component of the complex number.
Definition: Complex64.cs:45
Complex64(double real, double imaginary)
Initializes a new Complex64 structure using the specified real and imaginary values.
Definition: Complex64.cs:82
bool IsReal()
Gets a value indicating whether the provided Complex64 is real.
Here is the call graph for this function:

◆ SquareRoot()

Complex64 BGC.Mathematics.Complex64.SquareRoot ( )
inline

The Square Root (power 1/2) of this Complex64

Returns
The square root of this complex number.

Definition at line 824 of file Complex64.cs.

References BGC.Mathematics.Complex64.Abs().

Referenced by BGC.Mathematics.Complex64.Square().

825  {
826  if (IsRealNonNegative())
827  {
828  return new Complex64(Math.Sqrt(_real), 0.0);
829  }
830 
831  Complex64 result;
832 
833  double absReal = Math.Abs(Real);
834  double absImag = Math.Abs(Imaginary);
835  double w;
836  if (absReal >= absImag)
837  {
838  double ratio = Imaginary / Real;
839  w = Math.Sqrt(absReal) * Math.Sqrt(0.5 * (1.0 + Math.Sqrt(1.0 + (ratio * ratio))));
840  }
841  else
842  {
843  double ratio = Real / Imaginary;
844  w = Math.Sqrt(absImag) * Math.Sqrt(0.5 * (Math.Abs(ratio) + Math.Sqrt(1.0 + (ratio * ratio))));
845  }
846 
847  if (Real >= 0.0)
848  {
849  result = new Complex64(w, (Imaginary / (2.0 * w)));
850  }
851  else if (Imaginary >= 0.0)
852  {
853  result = new Complex64((absImag / (2.0 * w)), w);
854  }
855  else
856  {
857  result = new Complex64((absImag / (2.0 * w)), -w);
858  }
859 
860  return result;
861  }
readonly double _real
The real component of the complex number.
Definition: Complex64.cs:45
double Real
Gets the real component of the current System.Numerics.Complex64 object.
Definition: Complex64.cs:96
Complex64(double real, double imaginary)
Initializes a new Complex64 structure using the specified real and imaginary values.
Definition: Complex64.cs:82
double Imaginary
Gets the imaginary component of the current System.Numerics.Complex64 object.
Definition: Complex64.cs:91
bool IsRealNonNegative()
Gets a value indicating whether the provided Complex64 is real and not negative, that is >= 0...
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Subtract()

static Complex64 BGC.Mathematics.Complex64.Subtract ( in Complex64  left,
Complex64  right 
)
static

The difference between two Complex64 numbers;

Returns
The complex difference.

◆ Tan()

static Complex64 BGC.Mathematics.Complex64.Tan ( in Complex64  value)
inlinestatic

Trigonometric Tangent of a Complex64 number.

Parameters
valueThe complex value.
Returns
The tangent of the complex number.

Definition at line 385 of file Complex64.cs.

References BGC.Mathematics.Complex64.Imaginary, and BGC.Mathematics.Complex64.Real.

Referenced by BGC.Mathematics.Complex64.Tanh().

386  {
387  if (value.IsReal())
388  {
389  return new Complex64(Math.Tan(value.Real), 0.0);
390  }
391 
392  // tan(z) = - j*tanh(j*z)
393 
394  Complex64 z = Tanh(new Complex64(-value.Imaginary, value.Real));
395  return new Complex64(z.Imaginary, -z.Real);
396  }
static Complex64 Tanh(in Complex64 value)
Hyperbolic Tangent of a Complex64 number.
Definition: Complex64.cs:404
Complex64(double real, double imaginary)
Initializes a new Complex64 structure using the specified real and imaginary values.
Definition: Complex64.cs:82
Here is the caller graph for this function:

◆ Tanh()

static Complex64 BGC.Mathematics.Complex64.Tanh ( in Complex64  value)
inlinestatic

Hyperbolic Tangent of a Complex64 number.

Parameters
valueThe complex value.
Returns
The hyperbolic tangent of a complex number.

Definition at line 404 of file Complex64.cs.

References BGC.Mathematics.GeneralMath.Cosh(), BGC.Mathematics.GeneralMath.Sinh(), BGC.Mathematics.Complex64.Tan(), and BGC.Mathematics.GeneralMath.Tanh().

405  {
406  if (value.IsReal())
407  {
408  return new Complex64(GeneralMath.Tanh(value.Real), 0.0);
409  }
410 
411  // tanh(x + j*y) = (cosh(x)*sinh(x)/cos^2(y) + j*tan(y))/(1 + sinh^2(x)/cos^2(y))
412  // if |x| > huge, tanh(z) = sign(x) + j*4*cos(y)*sin(y)*exp(-2*|x|)
413  // if exp(-|x|) = 0, tanh(z) = sign(x)
414  // if tan(y) = +/- oo or 1/cos^2(y) = 1 + tan^2(y) = oo, tanh(z) = cosh(x)/sinh(x)
415  //
416  // The algorithm is based on Kahan.
417 
418  if (Math.Abs(value.Real) >= 22) // Taken from the msun library in FreeBSD
419  {
420  double e = Math.Exp(-Math.Abs(value.Real));
421  if (e == 0.0)
422  {
423  return new Complex64(Math.Sign(value.Real), 0.0);
424  }
425  else
426  {
427  return new Complex64(
428  Math.Sign(value.Real),
429  4.0 * Math.Cos(value.Imaginary) * Math.Sin(value.Imaginary) * e * e);
430  }
431  }
432 
433  double tani = Math.Tan(value.Imaginary);
434  double beta = 1 + tani * tani; // beta = 1/cos^2(y) = 1 + t^2
435  double sinhr = GeneralMath.Sinh(value.Real);
436  double coshr = GeneralMath.Cosh(value.Real);
437 
438  if (double.IsInfinity(tani))
439  {
440  return new Complex64(coshr / sinhr, 0.0);
441  }
442 
443  double denom = 1.0 + beta * sinhr * sinhr;
444  return new Complex64(beta * coshr * sinhr / denom, tani / denom);
445  }
Complex64(double real, double imaginary)
Initializes a new Complex64 structure using the specified real and imaginary values.
Definition: Complex64.cs:82
bool IsInfinity()
Gets a value indicating whether the provided Complex64 evaluates to an infinite value.
Here is the call graph for this function:

◆ ToString() [1/4]

string BGC.Mathematics.Complex64.ToString ( string  format)

Converts the value of the current complex number to its equivalent string representation in Cartesian form by using the specified format for its real and imaginary parts.

◆ ToString() [2/4]

string BGC.Mathematics.Complex64.ToString ( IFormatProvider  provider)

Converts the value of the current complex number to its equivalent string representation in Cartesian form by using the specified culture-specific formatting information.

◆ ToString() [3/4]

string BGC.Mathematics.Complex64.ToString ( string  format,
IFormatProvider  provider 
)

Converts the value of the current complex number to its equivalent string representation in Cartesian form by using the specified format and culture-specific format information for its real and imaginary parts.

◆ ToString() [4/4]

override string BGC.Mathematics.Complex64.ToString ( )

Converts the value of the current complex number to its equivalent string representation in Cartesian form.

Returns

Field Documentation

◆ _imag

readonly double BGC.Mathematics.Complex64._imag
private

The imaginary component of the complex number.

Definition at line 51 of file Complex64.cs.

◆ _real

readonly double BGC.Mathematics.Complex64._real
private

The real component of the complex number.

Definition at line 45 of file Complex64.cs.

Referenced by BGC.Mathematics.Complex64.Exponential().

◆ Imaginary

double BGC.Mathematics.Complex64.Imaginary => _imag

Gets the imaginary component of the current System.Numerics.Complex64 object.

Definition at line 91 of file Complex64.cs.

Referenced by BGC.Mathematics.Complex64.Power(), and BGC.Mathematics.Complex64.Tan().

◆ ImaginaryOne

readonly Complex64 BGC.Mathematics.Complex64.ImaginaryOne = new Complex64(0.0, 1.0)
static

Returns a new Complex64 instance with a real number equal to zero and an imaginary number equal to one.

Definition at line 67 of file Complex64.cs.

◆ MagnitudeSquared

double BGC.Mathematics.Complex64.MagnitudeSquared => (_real * _real) + (_imag * _imag)

Gets the squared magnitude (or squared absolute value) of a complex number.

Returns
The squared magnitude of the current instance.

Definition at line 710 of file Complex64.cs.

◆ NaN

readonly Complex64 BGC.Mathematics.Complex64.NaN = new Complex64(double.NaN, double.NaN)
static

Returns a new Complex64 instance with real and imaginary numbers not a number.

Definition at line 77 of file Complex64.cs.

◆ One

readonly Complex64 BGC.Mathematics.Complex64.One = new Complex64(1.0, 0.0)
static

Returns a new Complex64 instance with a real number equal to one and an imaginary number equal to zero.

Definition at line 62 of file Complex64.cs.

◆ Phase

double BGC.Mathematics.Complex64.Phase => _imag == 0.0 && _real < 0.0 ? Math.PI : Math.Atan2(_imag, _real)

Gets the phase of a complex number in radians.

Definition at line 139 of file Complex64.cs.

◆ PositiveInfinity

readonly Complex64 BGC.Mathematics.Complex64.PositiveInfinity = new Complex64(double.PositiveInfinity, double.PositiveInfinity)
static

Returns a new Complex64 instance with real and imaginary numbers positive infinite.

Definition at line 72 of file Complex64.cs.

◆ Real

double BGC.Mathematics.Complex64.Real => _real

◆ Zero

readonly Complex64 BGC.Mathematics.Complex64.Zero = new Complex64(0.0, 0.0)
static

Returns a new Complex64 instance with a real number equal to zero and an imaginary number equal to zero.

Definition at line 57 of file Complex64.cs.

Property Documentation

◆ Magnitude

double BGC.Mathematics.Complex64.Magnitude
get

Gets the magnitude (or absolute value) of a complex number.

Definition at line 102 of file Complex64.cs.


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