Class MathC
- Namespace
- CMath
- Assembly
- QuantumLibrary.dll
A collection of common complex math functions.
public static class MathC
- Inheritance
-
MathC
- Inherited Members
Methods
Abs(ComplexF)
Returns the magnitude of the specified complex number.
public static float Abs(ComplexF z)
Parameters
zComplexFThe complex number.
Returns
- float
The magnitude of
z.
AbsSqr(ComplexF)
Returns the squared magnitude of the specified complex number.
public static float AbsSqr(ComplexF z)
Parameters
zComplexFThe complex number.
Returns
- float
The squared magnitude of
z.
Approximately(ComplexF, ComplexF, float)
Returns whether two complex numbers are within the specified tolerance.
public static bool Approximately(ComplexF a, ComplexF b, float tolerance = 1E-05)
Parameters
aComplexFThe first complex number.
bComplexFThe second complex number.
tolerancefloatThe maximum allowed distance between the two values.
Returns
Exceptions
- ArgumentOutOfRangeException
Thrown if
toleranceis less or equal to zero.
Arg(ComplexF)
Returns the argument of the specified complex number.
public static float Arg(ComplexF z)
Parameters
zComplexFThe complex number.
Returns
- float
The phase angle of
z, in radians.
Cis(float)
Returns cos(angle) + i sin(angle).
public static ComplexF Cis(float angle)
Parameters
anglefloatThe angle, in radians.
Returns
- ComplexF
A complex number on the unit circle with the specified argument.
Clamp(ComplexF, ComplexF, ComplexF)
Clamps the given value component-wise between the given minimum and maximum values.
public static ComplexF Clamp(ComplexF value, ComplexF min, ComplexF max)
Parameters
valueComplexFThe complex value to clamp.
minComplexFThe minimum component values.
maxComplexFThe maximum component values.
Returns
- ComplexF
The component-wise clamped complex value.
Clamp01(ComplexF)
Clamps the value component-wise between 0 and 1.
public static ComplexF Clamp01(ComplexF value)
Parameters
valueComplexFThe complex value to clamp.
Returns
- ComplexF
The component-wise clamped complex value.
Cos(ComplexF)
Returns the cosine of the specified complex number.
public static ComplexF Cos(ComplexF z)
Parameters
zComplexFThe complex number.
Returns
- ComplexF
The cosine of
z.
Exp(ComplexF)
Returns e raised to the specified complex power.
public static ComplexF Exp(ComplexF z)
Parameters
zComplexFThe complex exponent.
Returns
- ComplexF
The value of e raised to
z.
FromPolar(float, float)
Returns a complex number based on its polar form.
public static ComplexF FromPolar(float radius, float angle)
Parameters
Returns
- ComplexF
The complex number represented by the specified polar coordinates.
Lerp(ComplexF, ComplexF, float)
Linearly interpolates component-wise between two complex numbers.
public static ComplexF Lerp(ComplexF a, ComplexF b, float t)
Parameters
Returns
- ComplexF
The component-wise interpolated complex value.
Remarks
The interpolation factor t is clamped to the range [0, 1].
LerpUnclamped(ComplexF, ComplexF, float)
Linearly interpolates component-wise between two complex numbers without clamping the interpolation factor.
public static ComplexF LerpUnclamped(ComplexF a, ComplexF b, float t)
Parameters
Returns
- ComplexF
The component-wise interpolated complex value.
Ln(ComplexF)
Returns the natural logarithm of the specified complex number.
public static ComplexF Ln(ComplexF z)
Parameters
zComplexFThe complex number.
Returns
- ComplexF
The principal natural logarithm of
z.
Remarks
Returns the principal value of the complex logarithm.
Log(ComplexF, ComplexF)
Returns the logarithm of a specified complex value in a specified base.
public static ComplexF Log(ComplexF value, ComplexF baseValue)
Parameters
valueComplexFThe complex value whose logarithm is calculated.
baseValueComplexFThe base of the logarithm.
Returns
- ComplexF
The logarithm of
valuein basebaseValue.
Remarks
Equivalent to Ln(value) / Ln(baseValue). Uses the principal value of the complex logarithm.
Pow(ComplexF, ComplexF)
Returns the result of raising a complex number to a complex power.
public static ComplexF Pow(ComplexF baseValue, ComplexF exponent)
Parameters
Returns
- ComplexF
The result of the exponentiation operation.
Remarks
Uses the principal value of the complex logarithm.
Sin(ComplexF)
Returns the sine of the specified complex number.
public static ComplexF Sin(ComplexF z)
Parameters
zComplexFThe complex number.
Returns
- ComplexF
The sine of
z.
Sqrt(ComplexF)
Returns the principal square root of the specified complex number.
public static ComplexF Sqrt(ComplexF z)
Parameters
zComplexFThe complex number.
Returns
- ComplexF
The principal value whose square is equal to
z.
Tan(ComplexF)
Returns the tangent of the specified complex number.
public static ComplexF Tan(ComplexF z)
Parameters
zComplexFThe complex number.
Returns
- ComplexF
The tangent of
z.
Remarks
If the cosine of z has zero components returns NaN.
ToPolar(ComplexF)
Returns the polar representation of a complex number.
public static (float radius, float angle) ToPolar(ComplexF z)
Parameters
zComplexFThe complex number.