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