97 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 (82)
System\Numerics\Complex.cs (82)
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); 71return new Complex(magnitude * cos, magnitude * sin); 141return new Complex(-value.m_real, -value.m_imaginary); 146return new Complex(left.m_real + right.m_real, left.m_imaginary + right.m_imaginary); 151return new Complex(left.m_real + right, left.m_imaginary); 156return new Complex(left + right.m_real, right.m_imaginary); 161return new Complex(left.m_real - right.m_real, left.m_imaginary - right.m_imaginary); 166return new Complex(left.m_real - right, left.m_imaginary); 171return new Complex(left - right.m_real, -right.m_imaginary); 179return new Complex(result_realpart, result_imaginarypart); 188return new Complex(double.NaN, double.NaN); 191return new Complex(left.m_real * right, double.NaN); 196return new Complex(double.NaN, left.m_imaginary * right); 199return new Complex(left.m_real * right, left.m_imaginary * right); 208return new Complex(double.NaN, double.NaN); 211return new Complex(left * right.m_real, double.NaN); 216return new Complex(double.NaN, left * right.m_imaginary); 219return new Complex(left * right.m_real, left * right.m_imaginary); 234return new Complex((a + b * doc) / (c + d * doc), (b - a * doc) / (c + d * doc)); 239return new Complex((b + a * cod) / (d + c * cod), (-a + b * cod) / (d + c * cod)); 250return new Complex(double.NaN, double.NaN); 257return new Complex(double.NaN, double.NaN); 260return new Complex(left.m_real / right, double.NaN); 265return new Complex(double.NaN, left.m_imaginary / right); 269return new Complex(left.m_real / right, left.m_imaginary / right); 283return new Complex(a / (c + d * doc), (-a * doc) / (c + d * doc)); 288return new Complex(a * cod / (d + c * cod), -a / (d + c * cod)); 326return new Complex(value.m_real, -value.m_imaginary); 382return new Complex(sin * Math.Cosh(value.m_imaginary), cos * Math.Sinh(value.m_imaginary)); 392Complex sin = Sin(new Complex(-value.m_imaginary, value.m_real)); 393return new Complex(sin.m_imaginary, -sin.m_real); 413return new Complex(u, v); 419return new Complex(cos * Math.Cosh(value.m_imaginary), -sin * Math.Sinh(value.m_imaginary)); 425return Cos(new Complex(-value.m_imaginary, value.m_real)); 445return new Complex(u, v); 466return new Complex(sin / D, Math.Sinh(y2) / D); 471return new Complex(sin / cosh / D, Math.Tanh(y2) / D); 478Complex tan = Tan(new Complex(-value.m_imaginary, value.m_real)); 479return new Complex(tan.m_imaginary, -tan.m_real); 484Complex two = new(2.0, 0.0); 614return new Complex(Math.Log(Abs(value)), Math.Atan2(value.m_imaginary, value.m_real)); 642return new Complex(double.PositiveInfinity, value.m_imaginary); 644return new Complex(double.NaN, double.NaN); 650return new Complex(double.NaN, double.PositiveInfinity); 654return new Complex(double.PositiveInfinity, double.NaN); 656return new Complex(double.NaN, double.NaN); 664return new Complex(0.0, Math.Sqrt(-value.m_real)); 667return new Complex(Math.Sqrt(value.m_real), 0.0); 705return (new Complex(double.PositiveInfinity, imaginaryCopy)); 733return new Complex(x, y); 764return Pow(value, new Complex(power, 0)); 771return new Complex(realResult, imaginaryResuilt); 780return new Complex((double)value, 0.0); 788return new Complex((double)value, 0.0); 793return new Complex((double)value, 0.0); 802return new Complex((double)value, 0.0); 811return new Complex(value, 0.0); 819return new Complex(value, 0.0); 824return new Complex(value, 0.0); 832return new Complex((double)value, 0.0); 840return new Complex((double)value, 0.0); 845return new Complex(value, 0.0); 850return new Complex(value, 0.0); 855return new Complex(value, 0.0); 863return new Complex(value, 0.0); 869return new Complex(value, 0.0); 874return new Complex(value, 0.0); 880return new Complex(value, 0.0); 886return new Complex(value, 0.0); 892return new Complex(value, 0.0); 901return new Complex(value, 0.0); 909static Complex IAdditiveIdentity<Complex, Complex>.AdditiveIdentity => new(0.0, 0.0); 930static Complex IMultiplicativeIdentity<Complex, Complex>.MultiplicativeIdentity => new(1.0, 0.0); 937static Complex INumberBase<Complex>.One => new(1.0, 0.0); 943static Complex INumberBase<Complex>.Zero => new(0.0, 0.0); 1462return new Complex(result_realpart, result_imaginarypart); 2205result = new Complex(real, imaginary); 2254static Complex ISignedNumber<Complex>.NegativeOne => new(-1.0, 0.0);
279 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 (252)
System\Numerics\BigInteger.cs (11)
2307/// <summary>Explicitly converts a <see cref="Complex" /> value to a big integer.</summary> 2310public static explicit operator BigInteger(Complex value) 4302else if (typeof(TOther) == typeof(Complex)) 4304Complex actualResult = (Complex)value; 4475else if (typeof(TOther) == typeof(Complex)) 4477Complex actualResult = (Complex)value; 4783else if (typeof(TOther) == typeof(Complex)) 4785Complex actualResult = (Complex)value;
System\Numerics\Complex.cs (241)
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); 68public static Complex FromPolarCoordinates(double magnitude, double phase) 74public static Complex Negate(Complex value) 79public static Complex Add(Complex left, Complex right) 84public static Complex Add(Complex left, double right) 89public static Complex Add(double left, Complex right) 94public static Complex Subtract(Complex left, Complex right) 99public static Complex Subtract(Complex left, double right) 104public static Complex Subtract(double left, Complex right) 109public static Complex Multiply(Complex left, Complex right) 114public static Complex Multiply(Complex left, double right) 119public static Complex Multiply(double left, Complex right) 124public static Complex Divide(Complex dividend, Complex divisor) 129public static Complex Divide(Complex dividend, double divisor) 134public static Complex Divide(double dividend, Complex divisor) 139public static Complex operator -(Complex value) /* Unary negation of a complex number */ 144public static Complex operator +(Complex left, Complex right) 149public static Complex operator +(Complex left, double right) 154public static Complex operator +(double left, Complex right) 159public static Complex operator -(Complex left, Complex right) 164public static Complex operator -(Complex left, double right) 169public static Complex operator -(double left, Complex right) 174public static Complex operator *(Complex left, Complex right) 182public static Complex operator *(Complex left, double right) 202public static Complex operator *(double left, Complex right) 222public static Complex operator /(Complex left, Complex right) 243public static Complex operator /(Complex left, double right) 272public static Complex operator /(double left, Complex right) 292public static double Abs(Complex value) 323public static Complex Conjugate(Complex value) 329public static Complex Reciprocal(Complex value) 339public static bool operator ==(Complex left, Complex right) 344public static bool operator !=(Complex left, Complex right) 351return obj is Complex other && Equals(other); 354public bool Equals(Complex value) 379public static Complex Sin(Complex value) 389public static Complex Sinh(Complex value) 392Complex sin = Sin(new Complex(-value.m_imaginary, value.m_real)); 396public static Complex Asin(Complex value) 416public static Complex Cos(Complex value) 422public static Complex Cosh(Complex value) 428public static Complex Acos(Complex value) 448public static Complex Tan(Complex value) 475public static Complex Tanh(Complex value) 478Complex tan = Tan(new Complex(-value.m_imaginary, value.m_real)); 482public static Complex Atan(Complex value) 484Complex two = new(2.0, 0.0); 606public static bool IsFinite(Complex value) => double.IsFinite(value.m_real) && double.IsFinite(value.m_imaginary); 608public static bool IsInfinity(Complex value) => double.IsInfinity(value.m_real) || double.IsInfinity(value.m_imaginary); 610public static bool IsNaN(Complex value) => !IsInfinity(value) && !IsFinite(value); 612public static Complex Log(Complex value) 617public static Complex Log(Complex value, double baseValue) 622public static Complex Log10(Complex value) 624Complex tempLog = Log(value); 628public static Complex Exp(Complex value) 634public static Complex Sqrt(Complex value) 736public static Complex Pow(Complex value, Complex power) 762public static Complex Pow(Complex value, double power) 767private static Complex Scale(Complex value, double factor) 778public static explicit operator Complex(decimal value) 786public static explicit operator Complex(Int128 value) 791public static explicit operator Complex(BigInteger value) 800public static explicit operator Complex(UInt128 value) 809public static implicit operator Complex(byte value) 817public static implicit operator Complex(char value) 822public static implicit operator Complex(double value) 830public static implicit operator Complex(Half value) 838public static implicit operator Complex(BFloat16 value) 843public static implicit operator Complex(short value) 848public static implicit operator Complex(int value) 853public static implicit operator Complex(long value) 861public static implicit operator Complex(nint value) 867public static implicit operator Complex(sbyte value) 872public static implicit operator Complex(float value) 878public static implicit operator Complex(ushort value) 884public static implicit operator Complex(uint value) 890public static implicit operator Complex(ulong value) 899public static implicit operator Complex(nuint value) 909static Complex IAdditiveIdentity<Complex, Complex>.AdditiveIdentity => new(0.0, 0.0); 916public static Complex operator --(Complex value) => value - One; 923public static Complex operator ++(Complex value) => value + One; 930static Complex IMultiplicativeIdentity<Complex, Complex>.MultiplicativeIdentity => new(1.0, 0.0); 937static Complex INumberBase<Complex>.One => new(1.0, 0.0); 940static int INumberBase<Complex>.Radix => 2; 943static Complex INumberBase<Complex>.Zero => new(0.0, 0.0); 946static Complex INumberBase<Complex>.Abs(Complex value) => Abs(value); 950public static Complex CreateChecked<TOther>(TOther value) 953Complex result; 955if (typeof(TOther) == typeof(Complex)) 957result = (Complex)(object)value; 969public static Complex CreateSaturating<TOther>(TOther value) 972Complex result; 974if (typeof(TOther) == typeof(Complex)) 976result = (Complex)(object)value; 988public static Complex CreateTruncating<TOther>(TOther value) 991Complex result; 993if (typeof(TOther) == typeof(Complex)) 995result = (Complex)(object)value; 1006static bool INumberBase<Complex>.IsCanonical(Complex value) => true; 1009public static bool IsComplexNumber(Complex value) => (value.m_real != 0.0) && (value.m_imaginary != 0.0); 1012public static bool IsEvenInteger(Complex value) => (value.m_imaginary == 0) && double.IsEvenInteger(value.m_real); 1015public static bool IsImaginaryNumber(Complex value) => (value.m_real == 0.0) && double.IsRealNumber(value.m_imaginary); 1018public static bool IsInteger(Complex value) => (value.m_imaginary == 0) && double.IsInteger(value.m_real); 1021public static bool IsNegative(Complex value) 1030public static bool IsNegativeInfinity(Complex value) 1039public static bool IsNormal(Complex value) 1049public static bool IsOddInteger(Complex value) => (value.m_imaginary == 0) && double.IsOddInteger(value.m_real); 1052public static bool IsPositive(Complex value) 1061public static bool IsPositiveInfinity(Complex value) 1070public static bool IsRealNumber(Complex value) => (value.m_imaginary == 0.0) && double.IsRealNumber(value.m_real); 1073public static bool IsSubnormal(Complex value) 1082static bool INumberBase<Complex>.IsZero(Complex value) => (value.m_real == 0.0) && (value.m_imaginary == 0.0); 1085public static Complex MaxMagnitude(Complex x, Complex y) 1175static Complex INumberBase<Complex>.MaxMagnitudeNumber(Complex x, Complex y) 1265public static Complex MinMagnitude(Complex x, Complex y) 1357static Complex INumberBase<Complex>.MinMagnitudeNumber(Complex x, Complex y) 1449static Complex INumberBase<Complex>.MultiplyAddEstimate(Complex left, Complex right, Complex addend) 1466public static Complex Parse(ReadOnlySpan<char> s, NumberStyles style, IFormatProvider? provider) 1468if (!TryParse(s, style, provider, out Complex result)) 1476public static Complex Parse(ReadOnlySpan<byte> utf8Text, NumberStyles style, IFormatProvider? provider) 1478if (!TryParse(utf8Text, style, provider, out Complex result)) 1486public static Complex Parse(string s, NumberStyles style, IFormatProvider? provider) 1494static bool INumberBase<Complex>.TryConvertFromChecked<TOther>(TOther value, out Complex result) 1501static bool INumberBase<Complex>.TryConvertFromSaturating<TOther>(TOther value, out Complex result) 1508static bool INumberBase<Complex>.TryConvertFromTruncating<TOther>(TOther value, out Complex result) 1513private static bool TryConvertFrom<TOther>(TOther value, out Complex result) 1534result = (Complex)actualValue; 1576result = (Complex)actualValue; 1618result = (Complex)actualValue; 1636static bool INumberBase<Complex>.TryConvertToChecked<TOther>(Complex value, [MaybeNullWhen(false)] out TOther result) 1841static bool INumberBase<Complex>.TryConvertToSaturating<TOther>(Complex value, [MaybeNullWhen(false)] out TOther result) 1991static bool INumberBase<Complex>.TryConvertToTruncating<TOther>(Complex value, [MaybeNullWhen(false)] out TOther result) 2132public static bool TryParse(ReadOnlySpan<char> s, NumberStyles style, IFormatProvider? provider, out Complex result) 2136public static bool TryParse(ReadOnlySpan<byte> utf8Text, NumberStyles style, IFormatProvider? provider, out Complex result) 2139private static bool TryParse<TChar>(ReadOnlySpan<TChar> text, NumberStyles style, IFormatProvider? provider, out Complex result) 2229public static bool TryParse([NotNullWhen(true)] string? s, NumberStyles style, IFormatProvider? provider, out Complex result) 2244public static Complex Parse(string s, IFormatProvider? provider) => Parse(s, DefaultNumberStyle, provider); 2247public static bool TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, out Complex result) => TryParse(s, DefaultNumberStyle, provider, out result); 2254static Complex ISignedNumber<Complex>.NegativeOne => new(-1.0, 0.0); 2314public static Complex Parse(ReadOnlySpan<char> s, IFormatProvider? provider) => Parse(s, DefaultNumberStyle, provider); 2317public static bool TryParse(ReadOnlySpan<char> s, IFormatProvider? provider, out Complex result) => TryParse(s, DefaultNumberStyle, provider, out result); 2324public static Complex operator +(Complex value) => value; 2331public static Complex Parse(ReadOnlySpan<byte> utf8Text, IFormatProvider? provider) => Parse(utf8Text, DefaultNumberStyle, provider); 2334public static bool TryParse(ReadOnlySpan<byte> utf8Text, IFormatProvider? provider, out Complex result) => TryParse(utf8Text, DefaultNumberStyle, provider, out result);