85 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 (70)
System\Numerics\Complex.cs (67)
36public static readonly Complex Zero = new(0.0, 0.0); 37public static readonly Complex One = new(1.0, 0.0); 38public static readonly Complex ImaginaryOne = new(0.0, 1.0); 39public static readonly Complex NaN = new(double.NaN, double.NaN); 40public static readonly Complex Infinity = new(double.PositiveInfinity, double.PositiveInfinity); 63return new Complex(magnitude * cos, magnitude * sin); 133return new Complex(-value.m_real, -value.m_imaginary); 138return new Complex(left.m_real + right.m_real, left.m_imaginary + right.m_imaginary); 143return new Complex(left.m_real + right, left.m_imaginary); 148return new Complex(left + right.m_real, right.m_imaginary); 153return new Complex(left.m_real - right.m_real, left.m_imaginary - right.m_imaginary); 158return new Complex(left.m_real - right, left.m_imaginary); 163return new Complex(left - right.m_real, -right.m_imaginary); 171return new Complex(result_realpart, result_imaginarypart); 177return new Complex(result.Real, result.Imaginary); 183return new Complex(result.Real, result.Imaginary); 189return new Complex(result.Real, result.Imaginary); 195return new Complex(result.Real, result.Imaginary); 201return new Complex(result.Real, result.Imaginary); 212return new Complex(value.m_real, -value.m_imaginary); 259return new Complex(sin * Math.Cosh(value.m_imaginary), cos * Math.Sinh(value.m_imaginary)); 269Complex sin = Sin(new Complex(-value.m_imaginary, value.m_real)); 270return new Complex(sin.m_imaginary, -sin.m_real); 276return new Complex(result.Real, result.Imaginary); 282return new Complex(cos * Math.Cosh(value.m_imaginary), -sin * Math.Sinh(value.m_imaginary)); 288return Cos(new Complex(-value.m_imaginary, value.m_real)); 294return new Complex(result.Real, result.Imaginary); 300return new Complex(result.Real, result.Imaginary); 306Complex tan = Tan(new Complex(-value.m_imaginary, value.m_real)); 307return new Complex(tan.m_imaginary, -tan.m_real); 312Complex two = new(2.0, 0.0); 324return new Complex(Math.Log(Abs(value)), Math.Atan2(value.m_imaginary, value.m_real)); 347return new Complex(result.Real, result.Imaginary); 353return new Complex(result.Real, result.Imaginary); 358return Pow(value, new Complex(power, 0)); 365return new Complex(realResult, imaginaryResuilt); 374return new Complex((double)value, 0.0); 382return new Complex((double)value, 0.0); 387return new Complex((double)value, 0.0); 396return new Complex((double)value, 0.0); 405return new Complex(value, 0.0); 413return new Complex(value, 0.0); 418return new Complex(value, 0.0); 426return new Complex((double)value, 0.0); 434return new Complex((double)value, 0.0); 439return new Complex(value, 0.0); 444return new Complex(value, 0.0); 449return new Complex(value, 0.0); 457return new Complex(value, 0.0); 463return new Complex(value, 0.0); 468return new Complex(value, 0.0); 474return new Complex(value, 0.0); 480return new Complex(value, 0.0); 486return new Complex(value, 0.0); 495return new Complex(value, 0.0); 503static Complex IAdditiveIdentity<Complex, Complex>.AdditiveIdentity => new(0.0, 0.0); 524static Complex IMultiplicativeIdentity<Complex, Complex>.MultiplicativeIdentity => new(1.0, 0.0); 531static Complex INumberBase<Complex>.One => new(1.0, 0.0); 537static Complex INumberBase<Complex>.Zero => new(0.0, 0.0); 682return new Complex(result.Real, result.Imaginary); 689return new Complex(result.Real, result.Imaginary); 696return new Complex(result.Real, result.Imaginary); 703return new Complex(result.Real, result.Imaginary); 710return new Complex(result.Real, result.Imaginary); 767result = new Complex(actualValue.Real, actualValue.Imaginary); 773result = new Complex(intermediate.Real, intermediate.Imaginary); 876static Complex ISignedNumber<Complex>.NegativeOne => new(-1.0, 0.0);
System\Numerics\Complex.Generic.cs (3)
1357result = (TOther)(object)new Complex(double.CreateChecked(value.m_real), double.CreateChecked(value.m_imaginary)); 1403result = (TOther)(object)new Complex(double.CreateSaturating(value.m_real), double.CreateSaturating(value.m_imaginary)); 1434result = (TOther)(object)new Complex(double.CreateTruncating(value.m_real), double.CreateTruncating(value.m_imaginary));
306 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 (279)
System\Numerics\BigInteger.cs (11)
2390/// <summary>Explicitly converts a <see cref="Complex" /> value to a big integer.</summary> 2393public static explicit operator BigInteger(Complex value) 4597else if (typeof(TOther) == typeof(Complex)) 4599Complex actualResult = (Complex)value; 4770else if (typeof(TOther) == typeof(Complex)) 4772Complex actualResult = (Complex)value; 5078else if (typeof(TOther) == typeof(Complex)) 5080Complex actualResult = (Complex)value;
System\Numerics\Complex.cs (248)
21: IEquatable<Complex>, 23INumberBase<Complex>, 24ISignedNumber<Complex>, 36public static readonly Complex Zero = new(0.0, 0.0); 37public static readonly Complex One = new(1.0, 0.0); 38public static readonly Complex ImaginaryOne = new(0.0, 1.0); 39public static readonly Complex NaN = new(double.NaN, double.NaN); 40public static readonly Complex Infinity = new(double.PositiveInfinity, double.PositiveInfinity); 60public static Complex FromPolarCoordinates(double magnitude, double phase) 66public static Complex Negate(Complex value) 71public static Complex Add(Complex left, Complex right) 76public static Complex Add(Complex left, double right) 81public static Complex Add(double left, Complex right) 86public static Complex Subtract(Complex left, Complex right) 91public static Complex Subtract(Complex left, double right) 96public static Complex Subtract(double left, Complex right) 101public static Complex Multiply(Complex left, Complex right) 106public static Complex Multiply(Complex left, double right) 111public static Complex Multiply(double left, Complex right) 116public static Complex Divide(Complex dividend, Complex divisor) 121public static Complex Divide(Complex dividend, double divisor) 126public static Complex Divide(double dividend, Complex divisor) 131public static Complex operator -(Complex value) /* Unary negation of a complex number */ 136public static Complex operator +(Complex left, Complex right) 141public static Complex operator +(Complex left, double right) 146public static Complex operator +(double left, Complex right) 151public static Complex operator -(Complex left, Complex right) 156public static Complex operator -(Complex left, double right) 161public static Complex operator -(double left, Complex right) 166public static Complex operator *(Complex left, Complex right) 174public static Complex operator *(Complex left, double right) 180public static Complex operator *(double left, Complex right) 186public static Complex operator /(Complex left, Complex right) 192public static Complex operator /(Complex left, double right) 198public static Complex operator /(double left, Complex right) 204public static double Abs(Complex value) 209public static Complex Conjugate(Complex value) 215public static Complex Reciprocal(Complex value) 225public static bool operator ==(Complex left, Complex right) 230public static bool operator !=(Complex left, Complex right) 237return obj is Complex other && Equals(other); 240public bool Equals(Complex value) 256public static Complex Sin(Complex value) 266public static Complex Sinh(Complex value) 269Complex sin = Sin(new Complex(-value.m_imaginary, value.m_real)); 273public static Complex Asin(Complex value) 279public static Complex Cos(Complex value) 285public static Complex Cosh(Complex value) 291public static Complex Acos(Complex value) 297public static Complex Tan(Complex value) 303public static Complex Tanh(Complex value) 306Complex tan = Tan(new Complex(-value.m_imaginary, value.m_real)); 310public static Complex Atan(Complex value) 312Complex two = new(2.0, 0.0); 316public static bool IsFinite(Complex value) => double.IsFinite(value.m_real) && double.IsFinite(value.m_imaginary); 318public static bool IsInfinity(Complex value) => double.IsInfinity(value.m_real) || double.IsInfinity(value.m_imaginary); 320public static bool IsNaN(Complex value) => !IsInfinity(value) && !IsFinite(value); 322public static Complex Log(Complex value) 327public static Complex Log(Complex value, double baseValue) 332public static Complex Log10(Complex value) 334Complex tempLog = Log(value); 338public static Complex Exp(Complex value) 344public static Complex Sqrt(Complex value) 350public static Complex Pow(Complex value, Complex power) 356public static Complex Pow(Complex value, double power) 361private static Complex Scale(Complex value, double factor) 372public static explicit operator Complex(decimal value) 380public static explicit operator Complex(Int128 value) 385public static explicit operator Complex(BigInteger value) 394public static explicit operator Complex(UInt128 value) 403public static implicit operator Complex(byte value) 411public static implicit operator Complex(char value) 416public static implicit operator Complex(double value) 424public static implicit operator Complex(Half value) 432public static implicit operator Complex(BFloat16 value) 437public static implicit operator Complex(short value) 442public static implicit operator Complex(int value) 447public static implicit operator Complex(long value) 455public static implicit operator Complex(nint value) 461public static implicit operator Complex(sbyte value) 466public static implicit operator Complex(float value) 472public static implicit operator Complex(ushort value) 478public static implicit operator Complex(uint value) 484public static implicit operator Complex(ulong value) 493public static implicit operator Complex(nuint value) 503static Complex IAdditiveIdentity<Complex, Complex>.AdditiveIdentity => new(0.0, 0.0); 510public static Complex operator --(Complex value) => value - One; 517public static Complex operator ++(Complex value) => value + One; 524static Complex IMultiplicativeIdentity<Complex, Complex>.MultiplicativeIdentity => new(1.0, 0.0); 531static Complex INumberBase<Complex>.One => new(1.0, 0.0); 534static int INumberBase<Complex>.Radix => 2; 537static Complex INumberBase<Complex>.Zero => new(0.0, 0.0); 540static Complex INumberBase<Complex>.Abs(Complex value) => Abs(value); 544public static Complex CreateChecked<TOther>(TOther value) 547Complex result; 549if (typeof(TOther) == typeof(Complex)) 551result = (Complex)(object)value; 563public static Complex CreateSaturating<TOther>(TOther value) 566Complex result; 568if (typeof(TOther) == typeof(Complex)) 570result = (Complex)(object)value; 582public static Complex CreateTruncating<TOther>(TOther value) 585Complex result; 587if (typeof(TOther) == typeof(Complex)) 589result = (Complex)(object)value; 600static bool INumberBase<Complex>.IsCanonical(Complex value) => true; 603public static bool IsComplexNumber(Complex value) => (value.m_real != 0.0) && (value.m_imaginary != 0.0); 606public static bool IsEvenInteger(Complex value) => (value.m_imaginary == 0) && double.IsEvenInteger(value.m_real); 609public static bool IsImaginaryNumber(Complex value) => (value.m_real == 0.0) && double.IsRealNumber(value.m_imaginary); 612public static bool IsInteger(Complex value) => (value.m_imaginary == 0) && double.IsInteger(value.m_real); 615public static bool IsNegative(Complex value) 624public static bool IsNegativeInfinity(Complex value) 633public static bool IsNormal(Complex value) 643public static bool IsOddInteger(Complex value) => (value.m_imaginary == 0) && double.IsOddInteger(value.m_real); 646public static bool IsPositive(Complex value) 655public static bool IsPositiveInfinity(Complex value) 664public static bool IsRealNumber(Complex value) => (value.m_imaginary == 0.0) && double.IsRealNumber(value.m_real); 667public static bool IsSubnormal(Complex value) 676static bool INumberBase<Complex>.IsZero(Complex value) => (value.m_real == 0.0) && (value.m_imaginary == 0.0); 679public static Complex MaxMagnitude(Complex x, Complex y) 686static Complex INumberBase<Complex>.MaxMagnitudeNumber(Complex x, Complex y) 693public static Complex MinMagnitude(Complex x, Complex y) 700static Complex INumberBase<Complex>.MinMagnitudeNumber(Complex x, Complex y) 707static Complex INumberBase<Complex>.MultiplyAddEstimate(Complex left, Complex right, Complex addend) 714public static Complex Parse(ReadOnlySpan<char> s, NumberStyles style, IFormatProvider? provider) 716if (!TryParse(s, style, provider, out Complex result)) 724public static Complex Parse(ReadOnlySpan<byte> utf8Text, NumberStyles style, IFormatProvider? provider) 726if (!TryParse(utf8Text, style, provider, out Complex result)) 734public static Complex Parse(string s, NumberStyles style, IFormatProvider? provider) 742static bool INumberBase<Complex>.TryConvertFromChecked<TOther>(TOther value, out Complex result) 749static bool INumberBase<Complex>.TryConvertFromSaturating<TOther>(TOther value, out Complex result) 756static bool INumberBase<Complex>.TryConvertFromTruncating<TOther>(TOther value, out Complex result) 761private static bool TryConvertFrom<TOther>(TOther value, out Complex result) 783static bool INumberBase<Complex>.TryConvertToChecked<TOther>(Complex value, [MaybeNullWhen(false)] out TOther result) 796static bool INumberBase<Complex>.TryConvertToSaturating<TOther>(Complex value, [MaybeNullWhen(false)] out TOther result) 809static bool INumberBase<Complex>.TryConvertToTruncating<TOther>(Complex value, [MaybeNullWhen(false)] out TOther result) 821public static bool TryParse(ReadOnlySpan<char> s, NumberStyles style, IFormatProvider? provider, out Complex result) 824return Complex<double>.TryParse(MemoryMarshal.Cast<char, Utf16Char>(s), style, provider, out Unsafe.As<Complex, Complex<double>>(ref result), out _); 828public static bool TryParse(ReadOnlySpan<byte> utf8Text, NumberStyles style, IFormatProvider? provider, out Complex result) 831return Complex<double>.TryParse(MemoryMarshal.Cast<byte, Utf8Char>(utf8Text), style, provider, out Unsafe.As<Complex, Complex<double>>(ref result), out _); 835static bool INumberBase<Complex>.TryParse([NotNullWhen(true)] string? s, NumberStyles style, IFormatProvider? provider, out Complex result, out int charsConsumed) 838return Complex<double>.TryParse(MemoryMarshal.Cast<char, Utf16Char>(s.AsSpan()), style, provider, out Unsafe.As<Complex, Complex<double>>(ref result), out charsConsumed); 842static bool INumberBase<Complex>.TryParse(ReadOnlySpan<byte> utf8Text, NumberStyles style, IFormatProvider? provider, out Complex result, out int bytesConsumed) 845return Complex<double>.TryParse(MemoryMarshal.Cast<byte, Utf8Char>(utf8Text), style, provider, out Unsafe.As<Complex, Complex<double>>(ref result), out bytesConsumed); 849static bool INumberBase<Complex>.TryParse(ReadOnlySpan<char> s, NumberStyles style, IFormatProvider? provider, out Complex result, out int charsConsumed) 852return Complex<double>.TryParse(MemoryMarshal.Cast<char, Utf16Char>(s), style, provider, out Unsafe.As<Complex, Complex<double>>(ref result), out charsConsumed); 856public static bool TryParse([NotNullWhen(true)] string? s, NumberStyles style, IFormatProvider? provider, out Complex result) 866public static Complex Parse(string s, IFormatProvider? provider) => Parse(s, DefaultNumberStyle, provider); 869public static bool TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, out Complex result) => TryParse(s, DefaultNumberStyle, provider, out result); 876static Complex ISignedNumber<Complex>.NegativeOne => new(-1.0, 0.0); 936public static Complex Parse(ReadOnlySpan<char> s, IFormatProvider? provider) => Parse(s, DefaultNumberStyle, provider); 939public static bool TryParse(ReadOnlySpan<char> s, IFormatProvider? provider, out Complex result) => TryParse(s, DefaultNumberStyle, provider, out result); 946public static Complex operator +(Complex value) => value; 953public static Complex Parse(ReadOnlySpan<byte> utf8Text, IFormatProvider? provider) => Parse(utf8Text, DefaultNumberStyle, provider); 956public static bool TryParse(ReadOnlySpan<byte> utf8Text, IFormatProvider? provider, out Complex result) => TryParse(utf8Text, DefaultNumberStyle, provider, out result);
System\Numerics\Complex.Generic.cs (20)
1219if (typeof(TOther) == typeof(Complex)) 1221Complex actualValue = (Complex)(object)value; 1251if (typeof(TOther) == typeof(Complex)) 1253Complex actualValue = (Complex)(object)value; 1283if (typeof(TOther) == typeof(Complex)) 1285Complex actualValue = (Complex)(object)value; 1355if (typeof(TOther) == typeof(Complex)) 1401if (typeof(TOther) == typeof(Complex)) 1432if (typeof(TOther) == typeof(Complex)) 1572if ((style & (Complex.InvalidNumberStyles | NumberStyles.AllowHexSpecifier)) != 0) 1578if ((value & Complex.InvalidNumberStyles) != 0) 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); 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); 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);