103 instantiations of Complex
System.Runtime.Numerics (103)
System\Numerics\Complex.cs (30)
176Complex<double> result = new Complex<double>(left.m_real, left.m_imaginary) * right;
182Complex<double> result = left * new Complex<double>(right.m_real, right.m_imaginary);
188Complex<double> result = new Complex<double>(left.m_real, left.m_imaginary) / new Complex<double>(right.m_real, right.m_imaginary);
194Complex<double> result = new Complex<double>(left.m_real, left.m_imaginary) / right;
200Complex<double> result = left / new Complex<double>(right.m_real, right.m_imaginary);
254=> new Complex<double>(m_real, m_imaginary).ToString(format, provider);
275Complex<double> result = Complex<double>.Asin(new Complex<double>(value.m_real, value.m_imaginary));
293Complex<double> result = Complex<double>.Acos(new Complex<double>(value.m_real, value.m_imaginary));
299Complex<double> result = Complex<double>.Tan(new Complex<double>(value.m_real, value.m_imaginary));
346Complex<double> result = Complex<double>.Sqrt(new Complex<double>(value.m_real, value.m_imaginary));
352Complex<double> result = Complex<double>.Pow(new Complex<double>(value.m_real, value.m_imaginary), new Complex<double>(power.m_real, power.m_imaginary));
681Complex<double> result = Complex<double>.MaxMagnitude(new Complex<double>(x.m_real, x.m_imaginary), new Complex<double>(y.m_real, y.m_imaginary));
688Complex<double> result = Complex<double>.MaxMagnitudeNumber(new Complex<double>(x.m_real, x.m_imaginary), new Complex<double>(y.m_real, y.m_imaginary));
695Complex<double> result = Complex<double>.MinMagnitude(new Complex<double>(x.m_real, x.m_imaginary), new Complex<double>(y.m_real, y.m_imaginary));
702Complex<double> result = Complex<double>.MinMagnitudeNumber(new Complex<double>(x.m_real, x.m_imaginary), new Complex<double>(y.m_real, y.m_imaginary));
709Complex<double> result = Complex<double>.MultiplyAddEstimate(new Complex<double>(left.m_real, left.m_imaginary), new Complex<double>(right.m_real, right.m_imaginary), new Complex<double>(addend.m_real, addend.m_imaginary));
787result = (TOther)(object)new Complex<double>(value.m_real, value.m_imaginary);
791return Complex<double>.TryConvertToCheckedCore(new Complex<double>(value.m_real, value.m_imaginary), out result);
800result = (TOther)(object)new Complex<double>(value.m_real, value.m_imaginary);
804return Complex<double>.TryConvertToSaturatingCore(new Complex<double>(value.m_real, value.m_imaginary), out result);
813result = (TOther)(object)new Complex<double>(value.m_real, value.m_imaginary);
817return Complex<double>.TryConvertToTruncatingCore(new Complex<double>(value.m_real, value.m_imaginary), out result);
System\Numerics\Complex.Generic.cs (73)
26public static Complex<T> Zero => new(T.Zero, T.Zero);
27public static Complex<T> One => new(T.One, T.Zero);
28public static Complex<T> ImaginaryOne => new(T.Zero, T.One);
29public static Complex<T> NaN => new(T.NaN, T.NaN);
30public static Complex<T> Infinity => new(T.PositiveInfinity, T.PositiveInfinity);
62return new Complex<T>(magnitude * cos, magnitude * sin);
132return new Complex<T>(-value.m_real, -value.m_imaginary);
137return new Complex<T>(left.m_real + right.m_real, left.m_imaginary + right.m_imaginary);
142return new Complex<T>(left.m_real + right, left.m_imaginary);
147return new Complex<T>(left + right.m_real, right.m_imaginary);
152return new Complex<T>(left.m_real - right.m_real, left.m_imaginary - right.m_imaginary);
157return new Complex<T>(left.m_real - right, left.m_imaginary);
162return new Complex<T>(left - right.m_real, -right.m_imaginary);
170return new Complex<T>(result_realpart, result_imaginarypart);
179return new Complex<T>(T.NaN, T.NaN);
182return new Complex<T>(left.m_real * right, T.NaN);
187return new Complex<T>(T.NaN, left.m_imaginary * right);
190return new Complex<T>(left.m_real * right, left.m_imaginary * right);
199return new Complex<T>(T.NaN, T.NaN);
202return new Complex<T>(left * right.m_real, T.NaN);
207return new Complex<T>(T.NaN, left * right.m_imaginary);
210return new Complex<T>(left * right.m_real, left * right.m_imaginary);
225return new Complex<T>((a + b * doc) / (c + d * doc), (b - a * doc) / (c + d * doc));
230return new Complex<T>((b + a * cod) / (d + c * cod), (-a + b * cod) / (d + c * cod));
241return new Complex<T>(T.NaN, T.NaN);
248return new Complex<T>(T.NaN, T.NaN);
251return new Complex<T>(left.m_real / right, T.NaN);
256return new Complex<T>(T.NaN, left.m_imaginary / right);
260return new Complex<T>(left.m_real / right, left.m_imaginary / right);
274return new Complex<T>(a / (c + d * doc), (-a * doc) / (c + d * doc));
279return new Complex<T>(a * cod / (d + c * cod), -a / (d + c * cod));
316return new Complex<T>(value.m_real, -value.m_imaginary);
372return new Complex<T>(sin * T.Cosh(value.m_imaginary), cos * T.Sinh(value.m_imaginary));
378Complex<T> sin = Sin(new Complex<T>(-value.m_imaginary, value.m_real));
379return new Complex<T>(sin.m_imaginary, -sin.m_real);
399return new Complex<T>(u, v);
405return new Complex<T>(cos * T.Cosh(value.m_imaginary), -sin * T.Sinh(value.m_imaginary));
411return Cos(new Complex<T>(-value.m_imaginary, value.m_real));
431return new Complex<T>(u, v);
453return new Complex<T>(sin / D, T.Sinh(y2) / D);
458return new Complex<T>(sin / cosh / D, T.Tanh(y2) / D);
465Complex<T> tan = Tan(new Complex<T>(-value.m_imaginary, value.m_real));
466return new Complex<T>(tan.m_imaginary, -tan.m_real);
471Complex<T> two = new(T.CreateChecked(2), T.Zero);
566return new Complex<T>(T.Log(Abs(value)), T.Atan2(value.m_imaginary, value.m_real));
571return Log(value) / Log(new Complex<T>(baseValue, T.Zero));
593return new Complex<T>(T.PositiveInfinity, value.m_imaginary);
595return new Complex<T>(T.NaN, T.NaN);
601return new Complex<T>(T.NaN, T.PositiveInfinity);
605return new Complex<T>(T.PositiveInfinity, T.NaN);
607return new Complex<T>(T.NaN, T.NaN);
615return new Complex<T>(T.Zero, T.Sqrt(-value.m_real));
618return new Complex<T>(T.Sqrt(value.m_real), T.Zero);
633return new Complex<T>(T.PositiveInfinity, imaginaryCopy);
663return new Complex<T>(x, y);
694return Pow(value, new Complex<T>(power, T.Zero));
701return new Complex<T>(realResult, imaginaryResult);
710return new Complex<T>(value, T.Zero);
1155return new Complex<T>(result_realpart, result_imaginarypart);
1215result = new Complex<T>((T)(object)value, T.Zero);
1222result = new Complex<T>(T.CreateChecked(actualValue.Real), T.CreateChecked(actualValue.Imaginary));
1228result = new Complex<T>(realResult, T.Zero);
1234result = new Complex<T>(realResult2, T.Zero);
1247result = new Complex<T>((T)(object)value, T.Zero);
1254result = new Complex<T>(T.CreateSaturating(actualValue.Real), T.CreateSaturating(actualValue.Imaginary));
1260result = new Complex<T>(realResult, T.Zero);
1266result = new Complex<T>(realResult2, T.Zero);
1279result = new Complex<T>((T)(object)value, T.Zero);
1286result = new Complex<T>(T.CreateTruncating(actualValue.Real), T.CreateTruncating(actualValue.Imaginary));
1292result = new Complex<T>(realResult, T.Zero);
1298result = new Complex<T>(realResult2, T.Zero);
1564result = new Complex<T>(real!, imaginary!);
1614static Complex<T> ISignedNumber<Complex<T>>.NegativeOne => new(-T.One, T.Zero);
286 references to Complex
System.Runtime.Numerics (286)
System\Numerics\Complex.cs (46)
176Complex<double> result = new Complex<double>(left.m_real, left.m_imaginary) * right;
182Complex<double> result = left * new Complex<double>(right.m_real, right.m_imaginary);
188Complex<double> result = new Complex<double>(left.m_real, left.m_imaginary) / new Complex<double>(right.m_real, right.m_imaginary);
194Complex<double> result = new Complex<double>(left.m_real, left.m_imaginary) / right;
200Complex<double> result = left / new Complex<double>(right.m_real, right.m_imaginary);
275Complex<double> result = Complex<double>.Asin(new Complex<double>(value.m_real, value.m_imaginary));
293Complex<double> result = Complex<double>.Acos(new Complex<double>(value.m_real, value.m_imaginary));
299Complex<double> result = Complex<double>.Tan(new Complex<double>(value.m_real, value.m_imaginary));
346Complex<double> result = Complex<double>.Sqrt(new Complex<double>(value.m_real, value.m_imaginary));
352Complex<double> result = Complex<double>.Pow(new Complex<double>(value.m_real, value.m_imaginary), new Complex<double>(power.m_real, power.m_imaginary));
681Complex<double> result = Complex<double>.MaxMagnitude(new Complex<double>(x.m_real, x.m_imaginary), new Complex<double>(y.m_real, y.m_imaginary));
688Complex<double> result = Complex<double>.MaxMagnitudeNumber(new Complex<double>(x.m_real, x.m_imaginary), new Complex<double>(y.m_real, y.m_imaginary));
695Complex<double> result = Complex<double>.MinMagnitude(new Complex<double>(x.m_real, x.m_imaginary), new Complex<double>(y.m_real, y.m_imaginary));
702Complex<double> result = Complex<double>.MinMagnitudeNumber(new Complex<double>(x.m_real, x.m_imaginary), new Complex<double>(y.m_real, y.m_imaginary));
709Complex<double> result = Complex<double>.MultiplyAddEstimate(new Complex<double>(left.m_real, left.m_imaginary), new Complex<double>(right.m_real, right.m_imaginary), new Complex<double>(addend.m_real, addend.m_imaginary));
764if (typeof(TOther) == typeof(Complex<double>))
766Complex<double> actualValue = (Complex<double>)(object)value;
771if (Complex<double>.TryConvertFromCheckedCore(value, out Complex<double> intermediate))
785if (typeof(TOther) == typeof(Complex<double>))
791return Complex<double>.TryConvertToCheckedCore(new Complex<double>(value.m_real, value.m_imaginary), out result);
798if (typeof(TOther) == typeof(Complex<double>))
804return Complex<double>.TryConvertToSaturatingCore(new Complex<double>(value.m_real, value.m_imaginary), out result);
811if (typeof(TOther) == typeof(Complex<double>))
817return Complex<double>.TryConvertToTruncatingCore(new Complex<double>(value.m_real, value.m_imaginary), out result);
824return Complex<double>.TryParse(MemoryMarshal.Cast<char, Utf16Char>(s), style, provider, out Unsafe.As<Complex, Complex<double>>(ref result), out _);
831return Complex<double>.TryParse(MemoryMarshal.Cast<byte, Utf8Char>(utf8Text), style, provider, out Unsafe.As<Complex, Complex<double>>(ref result), out _);
838return Complex<double>.TryParse(MemoryMarshal.Cast<char, Utf16Char>(s.AsSpan()), style, provider, out Unsafe.As<Complex, Complex<double>>(ref result), out charsConsumed);
845return Complex<double>.TryParse(MemoryMarshal.Cast<byte, Utf8Char>(utf8Text), style, provider, out Unsafe.As<Complex, Complex<double>>(ref result), out bytesConsumed);
852return Complex<double>.TryParse(MemoryMarshal.Cast<char, Utf16Char>(s), style, provider, out Unsafe.As<Complex, Complex<double>>(ref result), out charsConsumed);
System\Numerics\Complex.Generic.cs (240)
19: IEquatable<Complex<T>>,
21INumberBase<Complex<T>>,
22ISignedNumber<Complex<T>>,
26public static Complex<T> Zero => new(T.Zero, T.Zero);
27public static Complex<T> One => new(T.One, T.Zero);
28public static Complex<T> ImaginaryOne => new(T.Zero, T.One);
29public static Complex<T> NaN => new(T.NaN, T.NaN);
30public static Complex<T> Infinity => new(T.PositiveInfinity, T.PositiveInfinity);
59public static Complex<T> FromPolarCoordinates(T magnitude, T phase)
65public static Complex<T> Negate(Complex<T> value)
70public static Complex<T> Add(Complex<T> left, Complex<T> right)
75public static Complex<T> Add(Complex<T> left, T right)
80public static Complex<T> Add(T left, Complex<T> right)
85public static Complex<T> Subtract(Complex<T> left, Complex<T> right)
90public static Complex<T> Subtract(Complex<T> left, T right)
95public static Complex<T> Subtract(T left, Complex<T> right)
100public static Complex<T> Multiply(Complex<T> left, Complex<T> right)
105public static Complex<T> Multiply(Complex<T> left, T right)
110public static Complex<T> Multiply(T left, Complex<T> right)
115public static Complex<T> Divide(Complex<T> dividend, Complex<T> divisor)
120public static Complex<T> Divide(Complex<T> dividend, T divisor)
125public static Complex<T> Divide(T dividend, Complex<T> divisor)
130public static Complex<T> operator -(Complex<T> value)
135public static Complex<T> operator +(Complex<T> left, Complex<T> right)
140public static Complex<T> operator +(Complex<T> left, T right)
145public static Complex<T> operator +(T left, Complex<T> right)
150public static Complex<T> operator -(Complex<T> left, Complex<T> right)
155public static Complex<T> operator -(Complex<T> left, T right)
160public static Complex<T> operator -(T left, Complex<T> right)
165public static Complex<T> operator *(Complex<T> left, Complex<T> right)
173public static Complex<T> operator *(Complex<T> left, T right)
193public static Complex<T> operator *(T left, Complex<T> right)
213public static Complex<T> operator /(Complex<T> left, Complex<T> right)
234public static Complex<T> operator /(Complex<T> left, T right)
263public static Complex<T> operator /(T left, Complex<T> right)
283public static T Abs(Complex<T> value)
313public static Complex<T> Conjugate(Complex<T> value)
319public static Complex<T> Reciprocal(Complex<T> value)
329public static bool operator ==(Complex<T> left, Complex<T> right)
334public static bool operator !=(Complex<T> left, Complex<T> right)
341return obj is Complex<T> other && Equals(other);
344public bool Equals(Complex<T> value)
369public static Complex<T> Sin(Complex<T> value)
375public static Complex<T> Sinh(Complex<T> value)
378Complex<T> sin = Sin(new Complex<T>(-value.m_imaginary, value.m_real));
382public static Complex<T> Asin(Complex<T> value)
402public static Complex<T> Cos(Complex<T> value)
408public static Complex<T> Cosh(Complex<T> value)
414public static Complex<T> Acos(Complex<T> value)
434public static Complex<T> Tan(Complex<T> value)
462public static Complex<T> Tanh(Complex<T> value)
465Complex<T> tan = Tan(new Complex<T>(-value.m_imaginary, value.m_real));
469public static Complex<T> Atan(Complex<T> value)
471Complex<T> two = new(T.CreateChecked(2), T.Zero);
558public static bool IsFinite(Complex<T> value) => T.IsFinite(value.m_real) && T.IsFinite(value.m_imaginary);
560public static bool IsInfinity(Complex<T> value) => T.IsInfinity(value.m_real) || T.IsInfinity(value.m_imaginary);
562public static bool IsNaN(Complex<T> value) => !IsInfinity(value) && !IsFinite(value);
564public static Complex<T> Log(Complex<T> value)
569public static Complex<T> Log(Complex<T> value, T baseValue)
574public static Complex<T> Log10(Complex<T> value)
576Complex<T> tempLog = Log(value);
580public static Complex<T> Exp(Complex<T> value)
586public static Complex<T> Sqrt(Complex<T> value)
666public static Complex<T> Pow(Complex<T> value, Complex<T> power)
692public static Complex<T> Pow(Complex<T> value, T power)
697private static Complex<T> Scale(Complex<T> value, T factor)
708public static implicit operator Complex<T>(T value)
718static Complex<T> IAdditiveIdentity<Complex<T>, Complex<T>>.AdditiveIdentity => Zero;
725public static Complex<T> operator --(Complex<T> value) => value - One;
732public static Complex<T> operator ++(Complex<T> value) => value + One;
739static Complex<T> IMultiplicativeIdentity<Complex<T>, Complex<T>>.MultiplicativeIdentity => One;
746static int INumberBase<Complex<T>>.Radix => T.Radix;
749static Complex<T> INumberBase<Complex<T>>.Abs(Complex<T> value) => Abs(value);
753public static Complex<T> CreateChecked<TOther>(TOther value)
756Complex<T> result;
758if (typeof(TOther) == typeof(Complex<T>))
760result = (Complex<T>)(object)value;
772public static Complex<T> CreateSaturating<TOther>(TOther value)
775Complex<T> result;
777if (typeof(TOther) == typeof(Complex<T>))
779result = (Complex<T>)(object)value;
791public static Complex<T> CreateTruncating<TOther>(TOther value)
794Complex<T> result;
796if (typeof(TOther) == typeof(Complex<T>))
798result = (Complex<T>)(object)value;
809static bool INumberBase<Complex<T>>.IsCanonical(Complex<T> value) => true;
812public static bool IsComplexNumber(Complex<T> value) => (value.m_real != T.Zero) && (value.m_imaginary != T.Zero);
815public static bool IsEvenInteger(Complex<T> value) => (value.m_imaginary == T.Zero) && T.IsEvenInteger(value.m_real);
818public static bool IsImaginaryNumber(Complex<T> value) => (value.m_real == T.Zero) && T.IsRealNumber(value.m_imaginary);
821public static bool IsInteger(Complex<T> value) => (value.m_imaginary == T.Zero) && T.IsInteger(value.m_real);
824public static bool IsNegative(Complex<T> value)
833public static bool IsNegativeInfinity(Complex<T> value)
842public static bool IsNormal(Complex<T> value)
852public static bool IsOddInteger(Complex<T> value) => (value.m_imaginary == T.Zero) && T.IsOddInteger(value.m_real);
855public static bool IsPositive(Complex<T> value)
864public static bool IsPositiveInfinity(Complex<T> value)
873public static bool IsRealNumber(Complex<T> value) => (value.m_imaginary == T.Zero) && T.IsRealNumber(value.m_real);
876public static bool IsSubnormal(Complex<T> value)
885static bool INumberBase<Complex<T>>.IsZero(Complex<T> value) => (value.m_real == T.Zero) && (value.m_imaginary == T.Zero);
888public static Complex<T> MaxMagnitude(Complex<T> x, Complex<T> y)
957internal static Complex<T> MaxMagnitudeNumber(Complex<T> x, Complex<T> y)
1014static Complex<T> INumberBase<Complex<T>>.MaxMagnitudeNumber(Complex<T> x, Complex<T> y)
1018public static Complex<T> MinMagnitude(Complex<T> x, Complex<T> y)
1078internal static Complex<T> MinMagnitudeNumber(Complex<T> x, Complex<T> y)
1139static Complex<T> INumberBase<Complex<T>>.MinMagnitudeNumber(Complex<T> x, Complex<T> y)
1142internal static Complex<T> MultiplyAddEstimate(Complex<T> left, Complex<T> right, Complex<T> addend)
1159static Complex<T> INumberBase<Complex<T>>.MultiplyAddEstimate(Complex<T> left, Complex<T> right, Complex<T> addend)
1163public static Complex<T> Parse(ReadOnlySpan<char> s, NumberStyles style, IFormatProvider? provider)
1165if (!TryParse(s, style, provider, out Complex<T> result))
1173public static Complex<T> Parse(ReadOnlySpan<byte> utf8Text, NumberStyles style, IFormatProvider? provider)
1175if (!TryParse(utf8Text, style, provider, out Complex<T> result))
1183public static Complex<T> Parse(string s, NumberStyles style, IFormatProvider? provider)
1191static bool INumberBase<Complex<T>>.TryConvertFromChecked<TOther>(TOther value, out Complex<T> result)
1198static bool INumberBase<Complex<T>>.TryConvertFromSaturating<TOther>(TOther value, out Complex<T> result)
1205static bool INumberBase<Complex<T>>.TryConvertFromTruncating<TOther>(TOther value, out Complex<T> result)
1210internal static bool TryConvertFromCheckedCore<TOther>(TOther value, out Complex<T> result)
1242internal static bool TryConvertFromSaturatingCore<TOther>(TOther value, out Complex<T> result)
1274internal static bool TryConvertFromTruncatingCore<TOther>(TOther value, out Complex<T> result)
1308static bool INumberBase<Complex<T>>.TryConvertToChecked<TOther>(Complex<T> value, [MaybeNullWhen(false)] out TOther result)
1310if (typeof(TOther) == typeof(Complex<T>))
1321static bool INumberBase<Complex<T>>.TryConvertToSaturating<TOther>(Complex<T> value, [MaybeNullWhen(false)] out TOther result)
1323if (typeof(TOther) == typeof(Complex<T>))
1334static bool INumberBase<Complex<T>>.TryConvertToTruncating<TOther>(Complex<T> value, [MaybeNullWhen(false)] out TOther result)
1336if (typeof(TOther) == typeof(Complex<T>))
1345internal static bool TryConvertToCheckedCore<TOther>(Complex<T> value, [MaybeNullWhen(false)] out TOther result)
1392internal static bool TryConvertToSaturatingCore<TOther>(Complex<T> value, [MaybeNullWhen(false)] out TOther result)
1423internal static bool TryConvertToTruncatingCore<TOther>(Complex<T> value, [MaybeNullWhen(false)] out TOther result)
1455public static bool TryParse(ReadOnlySpan<char> s, NumberStyles style, IFormatProvider? provider, out Complex<T> result)
1459public static bool TryParse(ReadOnlySpan<byte> utf8Text, NumberStyles style, IFormatProvider? provider, out Complex<T> result)
1463static bool INumberBase<Complex<T>>.TryParse([NotNullWhen(true)] string? s, NumberStyles style, IFormatProvider? provider, out Complex<T> result, out int charsConsumed)
1467static bool INumberBase<Complex<T>>.TryParse(ReadOnlySpan<byte> utf8Text, NumberStyles style, IFormatProvider? provider, out Complex<T> result, out int bytesConsumed)
1471static bool INumberBase<Complex<T>>.TryParse(ReadOnlySpan<char> s, NumberStyles style, IFormatProvider? provider, out Complex<T> result, out int charsConsumed)
1474internal static bool TryParse<TChar>(ReadOnlySpan<TChar> text, NumberStyles style, IFormatProvider? provider, out Complex<T> result, out int elementsConsumed)
1589public static bool TryParse([NotNullWhen(true)] string? s, NumberStyles style, IFormatProvider? provider, out Complex<T> result)
1604public static Complex<T> Parse(string s, IFormatProvider? provider) => Parse(s, Complex.DefaultNumberStyle, provider);
1607public static bool TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, out Complex<T> result) => TryParse(s, Complex.DefaultNumberStyle, provider, out result);
1614static Complex<T> ISignedNumber<Complex<T>>.NegativeOne => new(-T.One, T.Zero);
1674public static Complex<T> Parse(ReadOnlySpan<char> s, IFormatProvider? provider) => Parse(s, Complex.DefaultNumberStyle, provider);
1677public static bool TryParse(ReadOnlySpan<char> s, IFormatProvider? provider, out Complex<T> result) => TryParse(s, Complex.DefaultNumberStyle, provider, out result);
1684public static Complex<T> operator +(Complex<T> value) => value;
1691public static Complex<T> Parse(ReadOnlySpan<byte> utf8Text, IFormatProvider? provider) => Parse(utf8Text, Complex.DefaultNumberStyle, provider);
1694public static bool TryParse(ReadOnlySpan<byte> utf8Text, IFormatProvider? provider, out Complex<T> result) => TryParse(utf8Text, Complex.DefaultNumberStyle, provider, out result);