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