Skip to content

Commit

Permalink
Make operators public
Browse files Browse the repository at this point in the history
  • Loading branch information
aalmada committed Feb 27, 2024
1 parent ba3b69e commit f3ab532
Show file tree
Hide file tree
Showing 33 changed files with 189 additions and 188 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
<Using Include="System.Numerics" />
<Using Include="System.Runtime.CompilerServices" />
<Using Include="System.Runtime.InteropServices" />
<Using Include="NetFabric.Numerics.Tensors.Operators" />
</ItemGroup>

<PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public static void LessThanOrEqual(ReadOnlySpan<int> x, ValueTuple<int, int> y,
public static void LessThanOrEqual(ReadOnlySpan<int> x, ValueTuple<int, int, int> y, Span<int> destination)
=> Tensor.Apply<int, LessThanOrEqualInt32Operator>(x, y, destination);

public static void LessThanOrEqual(ReadOnlySpan<int> x, ReadOnlySpan<int> y, Span<int> destination)
public static void LessThanOrEqual(ReadOnlySpan<int> x, ReadOnlySpan<int> y, Span<int> destination)
=> Tensor.Apply<int, LessThanOrEqualInt32Operator>(x, y, destination);

// long
Expand Down
4 changes: 2 additions & 2 deletions src/NetFabric.Numerics.Tensors/Operators/AbsOperator.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace NetFabric.Numerics.Tensors;
namespace NetFabric.Numerics.Tensors.Operators;

readonly struct AbsOperator<T>
public readonly struct AbsOperator<T>
: IUnaryOperator<T, T>
where T : struct, INumberBase<T>
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace NetFabric.Numerics.Tensors;
namespace NetFabric.Numerics.Tensors.Operators;

readonly struct AddMultiplyOperator<T>
public readonly struct AddMultiplyOperator<T>
: ITernaryOperator<T, T, T, T>
where T : struct, IAdditionOperators<T, T, T>, IMultiplyOperators<T, T, T>
{
Expand Down
6 changes: 3 additions & 3 deletions src/NetFabric.Numerics.Tensors/Operators/AdditionOperators.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace NetFabric.Numerics.Tensors;
namespace NetFabric.Numerics.Tensors.Operators;

readonly struct AddOperator<T>
public readonly struct AddOperator<T>
: IBinaryOperator<T, T, T>
where T : struct, IAdditionOperators<T, T, T>
{
Expand All @@ -13,7 +13,7 @@ public static Vector<T> Invoke(ref readonly Vector<T> x, ref readonly Vector<T>
=> x + y;
}

readonly struct CheckedAddOperator<T>
public readonly struct CheckedAddOperator<T>
: IBinaryOperator<T, T, T>
where T : struct, IAdditionOperators<T, T, T>
{
Expand Down
12 changes: 6 additions & 6 deletions src/NetFabric.Numerics.Tensors/Operators/BitwiseOperators.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace NetFabric.Numerics.Tensors;
namespace NetFabric.Numerics.Tensors.Operators;

readonly struct BitwiseAndOperator<T>
public readonly struct BitwiseAndOperator<T>
: IBinaryOperator<T, T, T>
where T : struct, IBitwiseOperators<T, T, T>
{
Expand All @@ -13,7 +13,7 @@ public static Vector<T> Invoke(ref readonly Vector<T> x, ref readonly Vector<T>
=> x & y;
}

readonly struct BitwiseAndNotOperator<T>
public readonly struct BitwiseAndNotOperator<T>
: IBinaryOperator<T, T, T>
where T : struct, IBitwiseOperators<T, T, T>
{
Expand All @@ -26,7 +26,7 @@ public static Vector<T> Invoke(ref readonly Vector<T> x, ref readonly Vector<T>
=> Vector.AndNot(x, y);
}

readonly struct BitwiseOrOperator<T>
public readonly struct BitwiseOrOperator<T>
: IBinaryOperator<T, T, T>
where T : struct, IBitwiseOperators<T, T, T>
{
Expand All @@ -39,7 +39,7 @@ public static Vector<T> Invoke(ref readonly Vector<T> x, ref readonly Vector<T>
=> x | y;
}

readonly struct XorOperator<T>
public readonly struct XorOperator<T>
: IBinaryOperator<T, T, T>
where T : struct, IBitwiseOperators<T, T, T>
{
Expand All @@ -53,7 +53,7 @@ public static Vector<T> Invoke(ref readonly Vector<T> x, ref readonly Vector<T>
}


readonly struct OnesComplementOperator<T>
public readonly struct OnesComplementOperator<T>
: IUnaryOperator<T, T>
where T : struct, IBitwiseOperators<T, T, T>
{
Expand Down
58 changes: 29 additions & 29 deletions src/NetFabric.Numerics.Tensors/Operators/ComparisonOperators.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace NetFabric.Numerics.Tensors;
namespace NetFabric.Numerics.Tensors.Operators;

readonly struct GreaterThanOperator<T>
public readonly struct GreaterThanOperator<T>
: IBinaryOperator<T, T, T>
where T : struct, IComparisonOperators<T, T, bool>, IMultiplicativeIdentity<T, T>
{
Expand All @@ -17,7 +17,7 @@ public static Vector<T> Invoke(ref readonly Vector<T> x, ref readonly Vector<T>
=> Vector.GreaterThan(x, y);
}

readonly struct GreaterThanInt32Operator
public readonly struct GreaterThanInt32Operator
: IBinaryOperator<int, int, int>
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
Expand All @@ -29,7 +29,7 @@ public static Vector<int> Invoke(ref readonly Vector<int> x, ref readonly Vector
=> Vector.GreaterThan(x, y);
}

readonly struct GreaterThanInt64Operator
public readonly struct GreaterThanInt64Operator
: IBinaryOperator<long, long, long>
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
Expand All @@ -41,7 +41,7 @@ public static Vector<long> Invoke(ref readonly Vector<long> x, ref readonly Vect
=> Vector.GreaterThan(x, y);
}

readonly struct GreaterThanSingleOperator
public readonly struct GreaterThanSingleOperator
: IBinaryOperator<float, float, int>
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
Expand All @@ -53,7 +53,7 @@ public static Vector<int> Invoke(ref readonly Vector<float> x, ref readonly Vect
=> Vector.GreaterThan(x, y);
}

readonly struct GreaterThanDoubleOperator
public readonly struct GreaterThanDoubleOperator
: IBinaryOperator<double, double, long>
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
Expand All @@ -65,7 +65,7 @@ public static Vector<long> Invoke(ref readonly Vector<double> x, ref readonly Ve
=> Vector.GreaterThan(x, y);
}

readonly struct GreaterThanAllOperator<T>
public readonly struct GreaterThanAllOperator<T>
: IBinaryToScalarOperator<T, T, bool>
where T : struct, IComparisonOperators<T, T, bool>
{
Expand All @@ -78,7 +78,7 @@ public static bool Invoke(ref readonly Vector<T> x, ref readonly Vector<T> y)
=> Vector.GreaterThanAll(x, y);
}

readonly struct GreaterThanAnyOperator<T>
public readonly struct GreaterThanAnyOperator<T>
: IBinaryToScalarOperator<T, T, bool>
where T : struct, IComparisonOperators<T, T, bool>
{
Expand All @@ -91,7 +91,7 @@ public static bool Invoke(ref readonly Vector<T> x, ref readonly Vector<T> y)
=> Vector.GreaterThanAny(x, y);
}

readonly struct GreaterThanOrEqualOperator<T>
public readonly struct GreaterThanOrEqualOperator<T>
: IBinaryOperator<T, T, T>
where T : struct, IComparisonOperators<T, T, bool>, IMultiplicativeIdentity<T, T>
{
Expand All @@ -108,7 +108,7 @@ public static Vector<T> Invoke(ref readonly Vector<T> x, ref readonly Vector<T>
=> Vector.GreaterThanOrEqual(x, y);
}

readonly struct GreaterThanOrEqualInt32Operator
public readonly struct GreaterThanOrEqualInt32Operator
: IBinaryOperator<int, int, int>
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
Expand All @@ -120,7 +120,7 @@ public static Vector<int> Invoke(ref readonly Vector<int> x, ref readonly Vector
=> Vector.GreaterThanOrEqual(x, y);
}

readonly struct GreaterThanOrEqualInt64Operator
public readonly struct GreaterThanOrEqualInt64Operator
: IBinaryOperator<long, long, long>
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
Expand All @@ -132,7 +132,7 @@ public static Vector<long> Invoke(ref readonly Vector<long> x, ref readonly Vect
=> Vector.GreaterThanOrEqual(x, y);
}

readonly struct GreaterThanOrEqualSingleOperator
public readonly struct GreaterThanOrEqualSingleOperator
: IBinaryOperator<float, float, int>
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
Expand All @@ -144,7 +144,7 @@ public static Vector<int> Invoke(ref readonly Vector<float> x, ref readonly Vect
=> Vector.GreaterThanOrEqual(x, y);
}

readonly struct GreaterThanOrEqualDoubleOperator
public readonly struct GreaterThanOrEqualDoubleOperator
: IBinaryOperator<double, double, long>
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
Expand All @@ -156,7 +156,7 @@ public static Vector<long> Invoke(ref readonly Vector<double> x, ref readonly Ve
=> Vector.GreaterThanOrEqual(x, y);
}

readonly struct GreaterThanOrEqualAllOperator<T>
public readonly struct GreaterThanOrEqualAllOperator<T>
: IBinaryToScalarOperator<T, T, bool>
where T : struct, IComparisonOperators<T, T, bool>
{
Expand All @@ -169,7 +169,7 @@ public static bool Invoke(ref readonly Vector<T> x, ref readonly Vector<T> y)
=> Vector.GreaterThanOrEqualAll(x, y);
}

readonly struct GreaterThanOrEqualAnyOperator<T>
public readonly struct GreaterThanOrEqualAnyOperator<T>
: IBinaryToScalarOperator<T, T, bool>
where T : struct, IComparisonOperators<T, T, bool>
{
Expand All @@ -182,7 +182,7 @@ public static bool Invoke(ref readonly Vector<T> x, ref readonly Vector<T> y)
=> Vector.GreaterThanOrEqualAny(x, y);
}

readonly struct LessThanOperator<T>
public readonly struct LessThanOperator<T>
: IBinaryOperator<T, T, T>
where T : struct, IComparisonOperators<T, T, bool>, IMultiplicativeIdentity<T, T>
{
Expand All @@ -199,7 +199,7 @@ public static Vector<T> Invoke(ref readonly Vector<T> x, ref readonly Vector<T>
=> Vector.LessThan(x, y);
}

readonly struct LessThanInt32Operator
public readonly struct LessThanInt32Operator
: IBinaryOperator<int, int, int>
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
Expand All @@ -211,7 +211,7 @@ public static Vector<int> Invoke(ref readonly Vector<int> x, ref readonly Vector
=> Vector.LessThan(x, y);
}

readonly struct LessThanInt64Operator
public readonly struct LessThanInt64Operator
: IBinaryOperator<long, long, long>
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
Expand All @@ -223,7 +223,7 @@ public static Vector<long> Invoke(ref readonly Vector<long> x, ref readonly Vect
=> Vector.LessThan(x, y);
}

readonly struct LessThanSingleOperator
public readonly struct LessThanSingleOperator
: IBinaryOperator<float, float, int>
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
Expand All @@ -235,7 +235,7 @@ public static Vector<int> Invoke(ref readonly Vector<float> x, ref readonly Vect
=> Vector.LessThan(x, y);
}

readonly struct LessThanDoubleOperator
public readonly struct LessThanDoubleOperator
: IBinaryOperator<double, double, long>
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
Expand All @@ -247,7 +247,7 @@ public static Vector<long> Invoke(ref readonly Vector<double> x, ref readonly Ve
=> Vector.LessThan(x, y);
}

readonly struct LessThanOrEqualOperator<T>
public readonly struct LessThanOrEqualOperator<T>
: IBinaryOperator<T, T, T>
where T : struct, IComparisonOperators<T, T, bool>, IMultiplicativeIdentity<T, T>
{
Expand All @@ -264,7 +264,7 @@ public static Vector<T> Invoke(ref readonly Vector<T> x, ref readonly Vector<T>
=> Vector.LessThanOrEqual(x, y);
}

readonly struct LessThanAllOperator<T>
public readonly struct LessThanAllOperator<T>
: IBinaryToScalarOperator<T, T, bool>
where T : struct, IComparisonOperators<T, T, bool>
{
Expand All @@ -277,7 +277,7 @@ public static bool Invoke(ref readonly Vector<T> x, ref readonly Vector<T> y)
=> Vector.LessThanAll(x, y);
}

readonly struct LessThanAnyOperator<T>
public readonly struct LessThanAnyOperator<T>
: IBinaryToScalarOperator<T, T, bool>
where T : struct, IComparisonOperators<T, T, bool>
{
Expand All @@ -290,7 +290,7 @@ public static bool Invoke(ref readonly Vector<T> x, ref readonly Vector<T> y)
=> Vector.LessThanAny(x, y);
}

readonly struct LessThanOrEqualInt32Operator
public readonly struct LessThanOrEqualInt32Operator
: IBinaryOperator<int, int, int>
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
Expand All @@ -302,7 +302,7 @@ public static Vector<int> Invoke(ref readonly Vector<int> x, ref readonly Vector
=> Vector.LessThanOrEqual(x, y);
}

readonly struct LessThanOrEqualInt64Operator
public readonly struct LessThanOrEqualInt64Operator
: IBinaryOperator<long, long, long>
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
Expand All @@ -314,7 +314,7 @@ public static Vector<long> Invoke(ref readonly Vector<long> x, ref readonly Vect
=> Vector.LessThanOrEqual(x, y);
}

readonly struct LessThanOrEqualSingleOperator
public readonly struct LessThanOrEqualSingleOperator
: IBinaryOperator<float, float, int>
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
Expand All @@ -326,7 +326,7 @@ public static Vector<int> Invoke(ref readonly Vector<float> x, ref readonly Vect
=> Vector.LessThanOrEqual(x, y);
}

readonly struct LessThanOrEqualDoubleOperator
public readonly struct LessThanOrEqualDoubleOperator
: IBinaryOperator<double, double, long>
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
Expand All @@ -339,7 +339,7 @@ public static Vector<long> Invoke(ref readonly Vector<double> x, ref readonly Ve
}


readonly struct LessThanOrEqualAllOperator<T>
public readonly struct LessThanOrEqualAllOperator<T>
: IBinaryToScalarOperator<T, T, bool>
where T : struct, IComparisonOperators<T, T, bool>
{
Expand All @@ -352,7 +352,7 @@ public static bool Invoke(ref readonly Vector<T> x, ref readonly Vector<T> y)
=> Vector.LessThanOrEqualAll(x, y);
}

readonly struct LessThanOrEqualAnyOperator<T>
public readonly struct LessThanOrEqualAnyOperator<T>
: IBinaryToScalarOperator<T, T, bool>
where T : struct, IComparisonOperators<T, T, bool>
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace NetFabric.Numerics.Tensors;
namespace NetFabric.Numerics.Tensors.Operators;

readonly struct DecrementOperator<T>
public readonly struct DecrementOperator<T>
: IUnaryOperator<T, T>
where T : struct, IDecrementOperators<T>
{
Expand All @@ -15,7 +15,7 @@ public static Vector<T> Invoke(ref readonly Vector<T> x)
=> Throw.InvalidOperationException<Vector<T>>();
}

readonly struct CheckedDecrementOperator<T>
public readonly struct CheckedDecrementOperator<T>
: IUnaryOperator<T, T>
where T : struct, IDecrementOperators<T>
{
Expand Down
6 changes: 3 additions & 3 deletions src/NetFabric.Numerics.Tensors/Operators/DivisionOperators.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace NetFabric.Numerics.Tensors;
namespace NetFabric.Numerics.Tensors.Operators;

readonly struct DivideOperator<T>
public readonly struct DivideOperator<T>
: IBinaryOperator<T, T, T>
where T : struct, IDivisionOperators<T, T, T>
{
Expand All @@ -13,7 +13,7 @@ public static Vector<T> Invoke(ref readonly Vector<T> x, ref readonly Vector<T>
=> x / y;
}

readonly struct CheckedDivideOperator<T>
public readonly struct CheckedDivideOperator<T>
: IBinaryOperator<T, T, T>
where T : struct, IDivisionOperators<T, T, T>
{
Expand Down
Loading

0 comments on commit f3ab532

Please sign in to comment.