84 instantiations of Complex
Microsoft.Gen.Logging.Generated.Tests (1)
LogPropertiesTests.cs (1)
101P11 = new Complex(1.2, 3.4),
Microsoft.ML.TimeSeries (14)
AdaptiveSingularSpectrumSequenceModeler.cs (6)
842_info.RootsBeforeStabilization = new[] { new Complex(_alpha[0], 0) }; 852_info.RootsAfterStabilization = new[] { new Complex(_alpha[0], 0) }; 917roots[i] = new Complex(roots[i].Real, 0); 1064roots[i] = new Complex(roots[i].Magnitude, 0); 1066roots[i] = new Complex(-roots[i].Magnitude, 0); 1068roots[i] = new Complex(-roots[i].Magnitude, 0);
PolynomialUtils.cs (6)
32root1 = new Complex((-b + sqrtDelta) / 2, 0); 33root2 = new Complex((-b - sqrtDelta) / 2, 0); 37root1 = new Complex(-b / 2, sqrtDelta / 2); 38root2 = new Complex(-b / 2, -sqrtDelta / 2); 97roots[0] = new Complex(-coefficients[i], 0); 127roots[j] = new Complex(realPart[j], imaginaryPart[j]);
SeasonalityDetector.cs (2)
88var energies = fftRe.Select((m, i) => new Complex(m, fftIm[i])).ToArray(); 105var values = ifftRe.Select((t, i) => new Complex(t, ifftIm[i])).ToArray();
System.Runtime.Numerics (69)
System\Numerics\Complex.cs (66)
35public static readonly Complex Zero = new(0.0, 0.0); 36public static readonly Complex One = new(1.0, 0.0); 37public static readonly Complex ImaginaryOne = new(0.0, 1.0); 38public static readonly Complex NaN = new(double.NaN, double.NaN); 39public static readonly Complex Infinity = new(double.PositiveInfinity, double.PositiveInfinity); 60return new Complex(magnitude * cos, magnitude * sin); 130return new Complex(-value.m_real, -value.m_imaginary); 135return new Complex(left.m_real + right.m_real, left.m_imaginary + right.m_imaginary); 140return new Complex(left.m_real + right, left.m_imaginary); 145return new Complex(left + right.m_real, right.m_imaginary); 150return new Complex(left.m_real - right.m_real, left.m_imaginary - right.m_imaginary); 155return new Complex(left.m_real - right, left.m_imaginary); 160return new Complex(left - right.m_real, -right.m_imaginary); 166return new Complex(result.Real, result.Imaginary); 172return new Complex(result.Real, result.Imaginary); 178return new Complex(result.Real, result.Imaginary); 184return new Complex(result.Real, result.Imaginary); 190return new Complex(result.Real, result.Imaginary); 196return new Complex(result.Real, result.Imaginary); 207return new Complex(value.m_real, -value.m_imaginary); 254return new Complex(result.Real, result.Imaginary); 260return new Complex(result.Real, result.Imaginary); 266return new Complex(result.Real, result.Imaginary); 272return new Complex(result.Real, result.Imaginary); 278return new Complex(result.Real, result.Imaginary); 284return new Complex(result.Real, result.Imaginary); 290return new Complex(result.Real, result.Imaginary); 296return new Complex(result.Real, result.Imaginary); 302return new Complex(result.Real, result.Imaginary); 314return new Complex(result.Real, result.Imaginary); 325return new Complex(result.Real, result.Imaginary); 331return new Complex(result.Real, result.Imaginary); 337return new Complex(result.Real, result.Imaginary); 343return new Complex(result.Real, result.Imaginary); 348return Pow(value, new Complex(power, 0)); 357return new Complex((double)value, 0.0); 365return new Complex((double)value, 0.0); 370return new Complex((double)value, 0.0); 379return new Complex((double)value, 0.0); 388return new Complex(value, 0.0); 396return new Complex(value, 0.0); 401return new Complex(value, 0.0); 409return new Complex((double)value, 0.0); 417return new Complex((double)value, 0.0); 422return new Complex(value, 0.0); 427return new Complex(value, 0.0); 432return new Complex(value, 0.0); 440return new Complex(value, 0.0); 446return new Complex(value, 0.0); 451return new Complex(value, 0.0); 457return new Complex(value, 0.0); 463return new Complex(value, 0.0); 469return new Complex(value, 0.0); 478return new Complex(value, 0.0); 486static Complex IAdditiveIdentity<Complex, Complex>.AdditiveIdentity => new(0.0, 0.0); 507static Complex IMultiplicativeIdentity<Complex, Complex>.MultiplicativeIdentity => new(1.0, 0.0); 514static Complex INumberBase<Complex>.One => new(1.0, 0.0); 520static Complex INumberBase<Complex>.Zero => new(0.0, 0.0); 665return new Complex(result.Real, result.Imaginary); 672return new Complex(result.Real, result.Imaginary); 679return new Complex(result.Real, result.Imaginary); 686return new Complex(result.Real, result.Imaginary); 693return new Complex(result.Real, result.Imaginary); 750result = new Complex(actualValue.Real, actualValue.Imaginary); 756result = new Complex(intermediate.Real, intermediate.Imaginary); 859static Complex ISignedNumber<Complex>.NegativeOne => new(-1.0, 0.0);
System\Numerics\Complex.Generic.cs (3)
1793result = (TOther)(object)new Complex(double.CreateChecked(value.m_real), double.CreateChecked(value.m_imaginary)); 1839result = (TOther)(object)new Complex(double.CreateSaturating(value.m_real), double.CreateSaturating(value.m_imaginary)); 1870result = (TOther)(object)new Complex(double.CreateTruncating(value.m_real), double.CreateTruncating(value.m_imaginary));
297 references to Complex
Microsoft.Gen.Logging.Generated.Tests (1)
test\Generators\Microsoft.Gen.Logging\TestClasses\LogPropertiesSpecialTypesExtensions.cs (1)
28public Complex P11 { get; set; }
Microsoft.ML.TimeSeries (24)
AdaptiveSingularSpectrumSequenceModeler.cs (10)
78public Complex[] RootsAfterStabilization; 83public Complex[] RootsBeforeStabilization; 861Complex[] roots = null; 881_info.RootsBeforeStabilization = new Complex[_windowSize - 1]; 971roots[sortedComponents[j].Index] = Complex.FromPolarCoordinates(avgMagnitude, 1012roots[ind1] = Complex.FromPolarCoordinates(1, 0); 1013roots[ind2] = Complex.FromPolarCoordinates(1, 0); 1023roots[ind] = Complex.FromPolarCoordinates(0.99, roots[ind].Phase); 1053roots[i] = Complex.FromPolarCoordinates(smallTrendMagnitude, roots[i].Phase); 1055roots[i] = Complex.FromPolarCoordinates(maxTrendMagnitude, roots[i].Phase);
PolynomialUtils.cs (10)
25internal static void FindQuadraticRoots(Double b, Double c, out Complex root1, out Complex root2) 69public static bool FindPolynomialRoots(Double[] coefficients, ref Complex[] roots, 82roots = new Complex[n]; 88roots[n - i - 1] = Complex.Zero; 279public static bool FindPolynomialCoefficients(Complex[] roots, ref Double[] coefficients) 285var hash = new Dictionary<Complex, FactorMultiplicity>(); 296if (roots[i].Equals(Complex.Zero)) // Zero roots 305var conj = Complex.Conjugate(roots[i]);
SeasonalityDetector.cs (4)
94var periodogram = energies.Select((t, i) => t * Complex.Conjugate(t)).ToArray(); 130private static int FindActualPeriod(Complex[] values, int bestFrequency, int secondFrequency, int timeSeriesLength, double randomnessThreshold) 212private static void FindBestTwoFrequencies(Complex[] values, int timeSeriesLength, out int bestFrequency, out int secondFrequency) 304private static int FindBestPeriod(Complex[] values, int frequency, int timeSeriesLength, out double energy)
netstandard (1)
netstandard.cs (1)
1332[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Numerics.Complex))]
System.Numerics (1)
System.Numerics.cs (1)
5[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Numerics.Complex))]
System.Runtime.Numerics (270)
System\Numerics\BigInteger.cs (11)
2499/// <summary>Explicitly converts a <see cref="Complex" /> value to a big integer.</summary> 2502public static explicit operator BigInteger(Complex value) 4706else if (typeof(TOther) == typeof(Complex)) 4708Complex actualResult = (Complex)value; 4879else if (typeof(TOther) == typeof(Complex)) 4881Complex actualResult = (Complex)value; 5187else if (typeof(TOther) == typeof(Complex)) 5189Complex actualResult = (Complex)value;
System\Numerics\Complex.cs (239)
21: IEquatable<Complex>, 23INumberBase<Complex>, 24ISignedNumber<Complex>, 35public static readonly Complex Zero = new(0.0, 0.0); 36public static readonly Complex One = new(1.0, 0.0); 37public static readonly Complex ImaginaryOne = new(0.0, 1.0); 38public static readonly Complex NaN = new(double.NaN, double.NaN); 39public static readonly Complex Infinity = new(double.PositiveInfinity, double.PositiveInfinity); 57public static Complex FromPolarCoordinates(double magnitude, double phase) 63public static Complex Negate(Complex value) 68public static Complex Add(Complex left, Complex right) 73public static Complex Add(Complex left, double right) 78public static Complex Add(double left, Complex right) 83public static Complex Subtract(Complex left, Complex right) 88public static Complex Subtract(Complex left, double right) 93public static Complex Subtract(double left, Complex right) 98public static Complex Multiply(Complex left, Complex right) 103public static Complex Multiply(Complex left, double right) 108public static Complex Multiply(double left, Complex right) 113public static Complex Divide(Complex dividend, Complex divisor) 118public static Complex Divide(Complex dividend, double divisor) 123public static Complex Divide(double dividend, Complex divisor) 128public static Complex operator -(Complex value) /* Unary negation of a complex number */ 133public static Complex operator +(Complex left, Complex right) 138public static Complex operator +(Complex left, double right) 143public static Complex operator +(double left, Complex right) 148public static Complex operator -(Complex left, Complex right) 153public static Complex operator -(Complex left, double right) 158public static Complex operator -(double left, Complex right) 163public static Complex operator *(Complex left, Complex right) 169public static Complex operator *(Complex left, double right) 175public static Complex operator *(double left, Complex right) 181public static Complex operator /(Complex left, Complex right) 187public static Complex operator /(Complex left, double right) 193public static Complex operator /(double left, Complex right) 199public static double Abs(Complex value) 204public static Complex Conjugate(Complex value) 210public static Complex Reciprocal(Complex value) 220public static bool operator ==(Complex left, Complex right) 225public static bool operator !=(Complex left, Complex right) 232return obj is Complex other && Equals(other); 235public bool Equals(Complex value) 251public static Complex Sin(Complex value) 257public static Complex Sinh(Complex value) 263public static Complex Asin(Complex value) 269public static Complex Cos(Complex value) 275public static Complex Cosh(Complex value) 281public static Complex Acos(Complex value) 287public static Complex Tan(Complex value) 293public static Complex Tanh(Complex value) 299public static Complex Atan(Complex value) 305public static bool IsFinite(Complex value) => double.IsFinite(value.m_real) && double.IsFinite(value.m_imaginary); 307public static bool IsInfinity(Complex value) => double.IsInfinity(value.m_real) || double.IsInfinity(value.m_imaginary); 309public static bool IsNaN(Complex value) => !IsInfinity(value) && !IsFinite(value); 311public static Complex Log(Complex value) 317public static Complex Log(Complex value, double baseValue) 322public static Complex Log10(Complex value) 328public static Complex Exp(Complex value) 334public static Complex Sqrt(Complex value) 340public static Complex Pow(Complex value, Complex power) 346public static Complex Pow(Complex value, double power) 355public static explicit operator Complex(decimal value) 363public static explicit operator Complex(Int128 value) 368public static explicit operator Complex(BigInteger value) 377public static explicit operator Complex(UInt128 value) 386public static implicit operator Complex(byte value) 394public static implicit operator Complex(char value) 399public static implicit operator Complex(double value) 407public static implicit operator Complex(Half value) 415public static implicit operator Complex(BFloat16 value) 420public static implicit operator Complex(short value) 425public static implicit operator Complex(int value) 430public static implicit operator Complex(long value) 438public static implicit operator Complex(nint value) 444public static implicit operator Complex(sbyte value) 449public static implicit operator Complex(float value) 455public static implicit operator Complex(ushort value) 461public static implicit operator Complex(uint value) 467public static implicit operator Complex(ulong value) 476public static implicit operator Complex(nuint value) 486static Complex IAdditiveIdentity<Complex, Complex>.AdditiveIdentity => new(0.0, 0.0); 493public static Complex operator --(Complex value) => value - One; 500public static Complex operator ++(Complex value) => value + One; 507static Complex IMultiplicativeIdentity<Complex, Complex>.MultiplicativeIdentity => new(1.0, 0.0); 514static Complex INumberBase<Complex>.One => new(1.0, 0.0); 517static int INumberBase<Complex>.Radix => 2; 520static Complex INumberBase<Complex>.Zero => new(0.0, 0.0); 523static Complex INumberBase<Complex>.Abs(Complex value) => Abs(value); 527public static Complex CreateChecked<TOther>(TOther value) 530Complex result; 532if (typeof(TOther) == typeof(Complex)) 534result = (Complex)(object)value; 546public static Complex CreateSaturating<TOther>(TOther value) 549Complex result; 551if (typeof(TOther) == typeof(Complex)) 553result = (Complex)(object)value; 565public static Complex CreateTruncating<TOther>(TOther value) 568Complex result; 570if (typeof(TOther) == typeof(Complex)) 572result = (Complex)(object)value; 583static bool INumberBase<Complex>.IsCanonical(Complex value) => true; 586public static bool IsComplexNumber(Complex value) => (value.m_real != 0.0) && (value.m_imaginary != 0.0); 589public static bool IsEvenInteger(Complex value) => (value.m_imaginary == 0) && double.IsEvenInteger(value.m_real); 592public static bool IsImaginaryNumber(Complex value) => (value.m_real == 0.0) && double.IsRealNumber(value.m_imaginary); 595public static bool IsInteger(Complex value) => (value.m_imaginary == 0) && double.IsInteger(value.m_real); 598public static bool IsNegative(Complex value) 607public static bool IsNegativeInfinity(Complex value) 616public static bool IsNormal(Complex value) 626public static bool IsOddInteger(Complex value) => (value.m_imaginary == 0) && double.IsOddInteger(value.m_real); 629public static bool IsPositive(Complex value) 638public static bool IsPositiveInfinity(Complex value) 647public static bool IsRealNumber(Complex value) => (value.m_imaginary == 0.0) && double.IsRealNumber(value.m_real); 650public static bool IsSubnormal(Complex value) 659static bool INumberBase<Complex>.IsZero(Complex value) => (value.m_real == 0.0) && (value.m_imaginary == 0.0); 662public static Complex MaxMagnitude(Complex x, Complex y) 669static Complex INumberBase<Complex>.MaxMagnitudeNumber(Complex x, Complex y) 676public static Complex MinMagnitude(Complex x, Complex y) 683static Complex INumberBase<Complex>.MinMagnitudeNumber(Complex x, Complex y) 690static Complex INumberBase<Complex>.MultiplyAddEstimate(Complex left, Complex right, Complex addend) 697public static Complex Parse(ReadOnlySpan<char> s, NumberStyles style, IFormatProvider? provider) 699if (!TryParse(s, style, provider, out Complex result)) 707public static Complex Parse(ReadOnlySpan<byte> utf8Text, NumberStyles style, IFormatProvider? provider) 709if (!TryParse(utf8Text, style, provider, out Complex result)) 717public static Complex Parse(string s, NumberStyles style, IFormatProvider? provider) 725static bool INumberBase<Complex>.TryConvertFromChecked<TOther>(TOther value, out Complex result) 732static bool INumberBase<Complex>.TryConvertFromSaturating<TOther>(TOther value, out Complex result) 739static bool INumberBase<Complex>.TryConvertFromTruncating<TOther>(TOther value, out Complex result) 744private static bool TryConvertFrom<TOther>(TOther value, out Complex result) 766static bool INumberBase<Complex>.TryConvertToChecked<TOther>(Complex value, [MaybeNullWhen(false)] out TOther result) 779static bool INumberBase<Complex>.TryConvertToSaturating<TOther>(Complex value, [MaybeNullWhen(false)] out TOther result) 792static bool INumberBase<Complex>.TryConvertToTruncating<TOther>(Complex value, [MaybeNullWhen(false)] out TOther result) 804public static bool TryParse(ReadOnlySpan<char> s, NumberStyles style, IFormatProvider? provider, out Complex result) 807return Complex<double>.TryParse(MemoryMarshal.Cast<char, Utf16Char>(s), style, provider, out Unsafe.As<Complex, Complex<double>>(ref result), out _); 811public static bool TryParse(ReadOnlySpan<byte> utf8Text, NumberStyles style, IFormatProvider? provider, out Complex result) 814return Complex<double>.TryParse(MemoryMarshal.Cast<byte, Utf8Char>(utf8Text), style, provider, out Unsafe.As<Complex, Complex<double>>(ref result), out _); 818public static bool TryParsePartial([NotNullWhen(true)] string? s, NumberStyles style, IFormatProvider? provider, out Complex result, out int charsConsumed) 821return Complex<double>.TryParsePartial(MemoryMarshal.Cast<char, Utf16Char>(s.AsSpan()), style, provider, out Unsafe.As<Complex, Complex<double>>(ref result), out charsConsumed); 825public static bool TryParsePartial(ReadOnlySpan<byte> utf8Text, NumberStyles style, IFormatProvider? provider, out Complex result, out int bytesConsumed) 828return Complex<double>.TryParsePartial(MemoryMarshal.Cast<byte, Utf8Char>(utf8Text), style, provider, out Unsafe.As<Complex, Complex<double>>(ref result), out bytesConsumed); 832public static bool TryParsePartial(ReadOnlySpan<char> s, NumberStyles style, IFormatProvider? provider, out Complex result, out int charsConsumed) 835return Complex<double>.TryParsePartial(MemoryMarshal.Cast<char, Utf16Char>(s), style, provider, out Unsafe.As<Complex, Complex<double>>(ref result), out charsConsumed); 839public static bool TryParse([NotNullWhen(true)] string? s, NumberStyles style, IFormatProvider? provider, out Complex result) 849public static Complex Parse(string s, IFormatProvider? provider) => Parse(s, DefaultNumberStyle, provider); 852public static bool TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, out Complex result) => TryParse(s, DefaultNumberStyle, provider, out result); 859static Complex ISignedNumber<Complex>.NegativeOne => new(-1.0, 0.0); 919public static Complex Parse(ReadOnlySpan<char> s, IFormatProvider? provider) => Parse(s, DefaultNumberStyle, provider); 922public static bool TryParse(ReadOnlySpan<char> s, IFormatProvider? provider, out Complex result) => TryParse(s, DefaultNumberStyle, provider, out result); 929public static Complex operator +(Complex value) => value; 936public static Complex Parse(ReadOnlySpan<byte> utf8Text, IFormatProvider? provider) => Parse(utf8Text, DefaultNumberStyle, provider); 939public static bool TryParse(ReadOnlySpan<byte> utf8Text, IFormatProvider? provider, out Complex result) => TryParse(utf8Text, DefaultNumberStyle, provider, out result);
System\Numerics\Complex.Generic.cs (20)
1655if (typeof(TOther) == typeof(Complex)) 1657Complex actualValue = (Complex)(object)value; 1687if (typeof(TOther) == typeof(Complex)) 1689Complex actualValue = (Complex)(object)value; 1719if (typeof(TOther) == typeof(Complex)) 1721Complex actualValue = (Complex)(object)value; 1791if (typeof(TOther) == typeof(Complex)) 1837if (typeof(TOther) == typeof(Complex)) 1868if (typeof(TOther) == typeof(Complex)) 2023if ((style & (Complex.InvalidNumberStyles | NumberStyles.AllowHexSpecifier)) != 0) 2029if ((value & Complex.InvalidNumberStyles) != 0) 2055public static Complex<T> Parse(string s, IFormatProvider? provider) => Parse(s, Complex.DefaultNumberStyle, provider); 2058public static bool TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, out Complex<T> result) => TryParse(s, Complex.DefaultNumberStyle, provider, out result); 2125public static Complex<T> Parse(ReadOnlySpan<char> s, IFormatProvider? provider) => Parse(s, Complex.DefaultNumberStyle, provider); 2128public static bool TryParse(ReadOnlySpan<char> s, IFormatProvider? provider, out Complex<T> result) => TryParse(s, Complex.DefaultNumberStyle, provider, out result); 2142public static Complex<T> Parse(ReadOnlySpan<byte> utf8Text, IFormatProvider? provider) => Parse(utf8Text, Complex.DefaultNumberStyle, provider); 2145public static bool TryParse(ReadOnlySpan<byte> utf8Text, IFormatProvider? provider, out Complex<T> result) => TryParse(utf8Text, Complex.DefaultNumberStyle, provider, out result);