Skip to content

Commit ada9b18

Browse files
committed
Add most of the remaining methods from MathF
Adds vectorized implementations everywhere - CopySign - Reciprocal{Sqrt}{Estimate} - Sqrt Adds vectorized implementations on .NET 7+ and scalar elsewhere - Ceiling - Floor - Truncate Adds scalar implementations everywhere: - Log10 - Log(x, y) (with y as both span and scalar) - Pow(x, y) (with y as both span and scalar) - Cbrt - IEEERemainder - Acos - Acosh - Cos - Asin - Asinh - Sin - Atan - Atan2 - Atanh - Tan There are several methods remaining on MathF that I've not included: - Because they don't seem as relevant: BitDecrement/BitIncrement - Because a non-floating point argument would be a new pattern: ScaleB - Because a non-floating point result would be a new pattern: ILogB/Sign - Because two destinations would be a new pattern: SinCos - Because overloads with ints and enums would be a new pattern: Round
1 parent 4101144 commit ada9b18

File tree

5 files changed

+1525
-8
lines changed

5 files changed

+1525
-8
lines changed

src/libraries/System.Numerics.Tensors/ref/System.Numerics.Tensors.cs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,40 @@ namespace System.Numerics.Tensors
99
public static partial class TensorPrimitives
1010
{
1111
public static void Abs(System.ReadOnlySpan<float> x, System.Span<float> destination) { }
12+
public static void Acos(System.ReadOnlySpan<float> x, System.Span<float> destination) { }
13+
public static void Acosh(System.ReadOnlySpan<float> x, System.Span<float> destination) { }
1214
public static void Add(System.ReadOnlySpan<float> x, System.ReadOnlySpan<float> y, System.Span<float> destination) { }
1315
public static void Add(System.ReadOnlySpan<float> x, float y, System.Span<float> destination) { }
1416
public static void AddMultiply(System.ReadOnlySpan<float> x, System.ReadOnlySpan<float> y, System.ReadOnlySpan<float> multiplier, System.Span<float> destination) { }
1517
public static void AddMultiply(System.ReadOnlySpan<float> x, System.ReadOnlySpan<float> y, float multiplier, System.Span<float> destination) { }
1618
public static void AddMultiply(System.ReadOnlySpan<float> x, float y, System.ReadOnlySpan<float> multiplier, System.Span<float> destination) { }
19+
public static void Asin(System.ReadOnlySpan<float> x, System.Span<float> destination) { }
20+
public static void Asinh(System.ReadOnlySpan<float> x, System.Span<float> destination) { }
21+
public static void Atan(System.ReadOnlySpan<float> x, System.Span<float> destination) { }
22+
public static void Atan2(System.ReadOnlySpan<float> y, System.ReadOnlySpan<float> x, System.Span<float> destination) { }
23+
public static void Atanh(System.ReadOnlySpan<float> x, System.Span<float> destination) { }
24+
public static void Cbrt(System.ReadOnlySpan<float> x, System.Span<float> destination) { }
25+
public static void Ceiling(System.ReadOnlySpan<float> x, System.Span<float> destination) { }
26+
public static void CopySign(System.ReadOnlySpan<float> x, System.ReadOnlySpan<float> y, System.Span<float> destination) { }
27+
public static void Cos(System.ReadOnlySpan<float> x, System.Span<float> destination) { }
1728
public static void Cosh(System.ReadOnlySpan<float> x, System.Span<float> destination) { }
1829
public static float CosineSimilarity(System.ReadOnlySpan<float> x, System.ReadOnlySpan<float> y) { throw null; }
1930
public static float Distance(System.ReadOnlySpan<float> x, System.ReadOnlySpan<float> y) { throw null; }
2031
public static void Divide(System.ReadOnlySpan<float> x, System.ReadOnlySpan<float> y, System.Span<float> destination) { }
2132
public static void Divide(System.ReadOnlySpan<float> x, float y, System.Span<float> destination) { }
2233
public static float Dot(System.ReadOnlySpan<float> x, System.ReadOnlySpan<float> y) { throw null; }
2334
public static void Exp(System.ReadOnlySpan<float> x, System.Span<float> destination) { }
35+
public static void Floor(System.ReadOnlySpan<float> x, System.Span<float> destination) { }
36+
public static void IEEERemainder(System.ReadOnlySpan<float> x, System.ReadOnlySpan<float> y, System.Span<float> destination) { }
2437
public static int IndexOfMax(System.ReadOnlySpan<float> x) { throw null; }
2538
public static int IndexOfMaxMagnitude(System.ReadOnlySpan<float> x) { throw null; }
2639
public static int IndexOfMin(System.ReadOnlySpan<float> x) { throw null; }
2740
public static int IndexOfMinMagnitude(System.ReadOnlySpan<float> x) { throw null; }
2841
public static float Norm(System.ReadOnlySpan<float> x) { throw null; }
2942
public static void Log(System.ReadOnlySpan<float> x, System.Span<float> destination) { }
43+
public static void Log(System.ReadOnlySpan<float> x, System.ReadOnlySpan<float> y, System.Span<float> destination) { }
44+
public static void Log(System.ReadOnlySpan<float> x, float y, System.Span<float> destination) { }
45+
public static void Log10(System.ReadOnlySpan<float> x, System.Span<float> destination) { }
3046
public static void Log2(System.ReadOnlySpan<float> x, System.Span<float> destination) { }
3147
public static float Max(System.ReadOnlySpan<float> x) { throw null; }
3248
public static void Max(System.ReadOnlySpan<float> x, System.ReadOnlySpan<float> y, System.Span<float> destination) { throw null; }
@@ -42,17 +58,27 @@ public static void MultiplyAdd(System.ReadOnlySpan<float> x, System.ReadOnlySpan
4258
public static void MultiplyAdd(System.ReadOnlySpan<float> x, System.ReadOnlySpan<float> y, float addend, System.Span<float> destination) { }
4359
public static void MultiplyAdd(System.ReadOnlySpan<float> x, float y, System.ReadOnlySpan<float> addend, System.Span<float> destination) { }
4460
public static void Negate(System.ReadOnlySpan<float> x, System.Span<float> destination) { }
61+
public static void Pow(System.ReadOnlySpan<float> x, System.ReadOnlySpan<float> y, System.Span<float> destination) { }
62+
public static void Pow(System.ReadOnlySpan<float> x, float y, System.Span<float> destination) { }
4563
public static float Product(System.ReadOnlySpan<float> x) { throw null; }
4664
public static float ProductOfDifferences(System.ReadOnlySpan<float> x, System.ReadOnlySpan<float> y) { throw null; }
4765
public static float ProductOfSums(System.ReadOnlySpan<float> x, System.ReadOnlySpan<float> y) { throw null; }
66+
public static void Reciprocal(System.ReadOnlySpan<float> x, System.Span<float> destination) { }
67+
public static void ReciprocalEstimate(System.ReadOnlySpan<float> x, System.Span<float> destination) { }
68+
public static void ReciprocalSqrt(System.ReadOnlySpan<float> x, System.Span<float> destination) { }
69+
public static void ReciprocalSqrtEstimate(System.ReadOnlySpan<float> x, System.Span<float> destination) { }
4870
public static void Sigmoid(System.ReadOnlySpan<float> x, System.Span<float> destination) { }
71+
public static void Sin(System.ReadOnlySpan<float> x, System.Span<float> destination) { }
4972
public static void Sinh(System.ReadOnlySpan<float> x, System.Span<float> destination) { }
5073
public static void SoftMax(System.ReadOnlySpan<float> x, System.Span<float> destination) { }
74+
public static void Sqrt(System.ReadOnlySpan<float> x, System.Span<float> destination) { }
5175
public static void Subtract(System.ReadOnlySpan<float> x, System.ReadOnlySpan<float> y, System.Span<float> destination) { }
5276
public static void Subtract(System.ReadOnlySpan<float> x, float y, System.Span<float> destination) { }
5377
public static float Sum(System.ReadOnlySpan<float> x) { throw null; }
5478
public static float SumOfMagnitudes(System.ReadOnlySpan<float> x) { throw null; }
5579
public static float SumOfSquares(System.ReadOnlySpan<float> x) { throw null; }
80+
public static void Tan(System.ReadOnlySpan<float> x, System.Span<float> destination) { }
5681
public static void Tanh(System.ReadOnlySpan<float> x, System.Span<float> destination) { }
82+
public static void Truncate(System.ReadOnlySpan<float> x, System.Span<float> destination) { }
5783
}
5884
}

0 commit comments

Comments
 (0)