mirror of
https://github.com/ahwootech/BRUTAL.git
synced 2026-11-25 20:48:24 +01:00
443 lines
17 KiB
C#
443 lines
17 KiB
C#
// <auto-generated /> - edit Vector.numerics-floating.tt to modify
|
|
#nullable enable
|
|
|
|
namespace Brutal.Numerics;
|
|
|
|
// IFloatingPointConstants
|
|
public partial struct double4 : IFloatingPointConstants<double4>
|
|
{
|
|
/// <inheritdoc />
|
|
public static double4 E => new(double.E);
|
|
|
|
/// <inheritdoc />
|
|
public static double4 Pi => new(double.Pi);
|
|
|
|
/// <inheritdoc />
|
|
public static double4 Tau => new(double.Tau);
|
|
}
|
|
|
|
// IExponentialFunctions
|
|
public partial struct double4 : IExponentialFunctions<double4>
|
|
{
|
|
/// <inheritdoc />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static double4 Exp(double4 value)
|
|
{
|
|
return new(double.Exp(value.X), double.Exp(value.Y), double.Exp(value.Z), double.Exp(value.W));
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static double4 Exp2(double4 value)
|
|
{
|
|
return new double4(double.Exp2(value.X), double.Exp2(value.Y), double.Exp2(value.Z), double.Exp2(value.W));
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static double4 Exp10(double4 value)
|
|
{
|
|
return new double4(double.Exp10(value.X), double.Exp10(value.Y), double.Exp10(value.Z), double.Exp10(value.W));
|
|
}
|
|
}
|
|
|
|
// ILogarithmicFunctions
|
|
public partial struct double4 : ILogarithmicFunctions<double4>
|
|
{
|
|
/// <inheritdoc />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static double4 Log(double4 value)
|
|
{
|
|
return new(double.Log(value.X), double.Log(value.Y), double.Log(value.Z), double.Log(value.W));
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static double4 Log(double4 value, double4 newBase)
|
|
{
|
|
return new double4(double.Log(value.X, newBase.X), double.Log(value.Y, newBase.Y), double.Log(value.Z, newBase.Z), double.Log(value.W, newBase.W));
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static double4 Log2(double4 value)
|
|
{
|
|
return new(double.Log2(value.X), double.Log2(value.Y), double.Log2(value.Z), double.Log2(value.W));
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static double4 Log10(double4 value)
|
|
{
|
|
return new double4(double.Log10(value.X), double.Log10(value.Y), double.Log10(value.Z), double.Log10(value.W));
|
|
}
|
|
}
|
|
|
|
// IPowerFunctions
|
|
public partial struct double4 : IPowerFunctions<double4>
|
|
{
|
|
/// <inheritdoc />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static double4 Pow(double4 value, double4 power)
|
|
{
|
|
return new double4(double.Pow(value.X, power.X), double.Pow(value.Y, power.Y), double.Pow(value.Z, power.Z), double.Pow(value.W, power.W));
|
|
}
|
|
}
|
|
|
|
// IRootFunctions
|
|
public partial struct double4 : IRootFunctions<double4>
|
|
{
|
|
/// <inheritdoc />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static double4 Cbrt(double4 value)
|
|
{
|
|
return new double4(double.Cbrt(value.X), double.Cbrt(value.Y), double.Cbrt(value.Z), double.Cbrt(value.W));
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static double4 Hypot(double4 a, double4 b)
|
|
{
|
|
return new(double.Hypot(a.X, b.X), double.Hypot(a.Y, b.Y), double.Hypot(a.Z, b.Z), double.Hypot(a.W, b.W));
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static double4 RootN(double4 value, int n)
|
|
{
|
|
return new double4(double.RootN(value.X, n), double.RootN(value.Y, n), double.RootN(value.Z, n), double.RootN(value.W, n));
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static double4 Sqrt(double4 value)
|
|
{
|
|
return new(double.Sqrt(value.X), double.Sqrt(value.Y), double.Sqrt(value.Z), double.Sqrt(value.W));
|
|
}
|
|
}
|
|
|
|
// ITrigonometricFunctions
|
|
public partial struct double4 : ITrigonometricFunctions<double4>
|
|
{
|
|
/// <inheritdoc />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static double4 Sin(double4 value)
|
|
{
|
|
return new(double.Sin(value.X), double.Sin(value.Y), double.Sin(value.Z), double.Sin(value.W));
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static double4 Cos(double4 value)
|
|
{
|
|
return new(double.Cos(value.X), double.Cos(value.Y), double.Cos(value.Z), double.Cos(value.W));
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static (double4 Sin, double4 Cos) SinCos(double4 value)
|
|
{
|
|
var (sinX, cosX) = double.SinCos(value.X);
|
|
var (sinY, cosY) = double.SinCos(value.Y);
|
|
var (sinZ, cosZ) = double.SinCos(value.Z);
|
|
var (sinW, cosW) = double.SinCos(value.W);
|
|
return (new(sinX, sinY, sinZ, sinW), new(cosX, cosY, cosZ, cosW));
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static double4 Tan(double4 value)
|
|
{
|
|
return new double4(double.Tan(value.X), double.Tan(value.Y), double.Tan(value.Z), double.Tan(value.W));
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static double4 Asin(double4 value)
|
|
{
|
|
return new double4(double.Asin(value.X), double.Asin(value.Y), double.Asin(value.Z), double.Asin(value.W));
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static double4 Acos(double4 value)
|
|
{
|
|
return new double4(double.Acos(value.X), double.Acos(value.Y), double.Acos(value.Z), double.Acos(value.W));
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static double4 Atan(double4 value)
|
|
{
|
|
return new double4(double.Atan(value.X), double.Atan(value.Y), double.Atan(value.Z), double.Atan(value.W));
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static double4 SinPi(double4 value)
|
|
{
|
|
return new double4(double.SinPi(value.X), double.SinPi(value.Y), double.SinPi(value.Z), double.SinPi(value.W));
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static double4 CosPi(double4 value)
|
|
{
|
|
return new double4(double.CosPi(value.X), double.CosPi(value.Y), double.CosPi(value.Z), double.CosPi(value.W));
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static double4 TanPi(double4 value)
|
|
{
|
|
return new double4(double.TanPi(value.X), double.TanPi(value.Y), double.TanPi(value.Z), double.TanPi(value.W));
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static double4 AsinPi(double4 value)
|
|
{
|
|
return new double4(double.AsinPi(value.X), double.AsinPi(value.Y), double.AsinPi(value.Z), double.AsinPi(value.W));
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static double4 AcosPi(double4 value)
|
|
{
|
|
return new double4(double.AcosPi(value.X), double.AcosPi(value.Y), double.AcosPi(value.Z), double.AcosPi(value.W));
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static double4 AtanPi(double4 value)
|
|
{
|
|
return new double4(double.AtanPi(value.X), double.AtanPi(value.Y), double.AtanPi(value.Z), double.AtanPi(value.W));
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static (double4 SinPi, double4 CosPi) SinCosPi(double4 value)
|
|
{
|
|
return (SinPi(value), CosPi(value));
|
|
}
|
|
|
|
/// <inheritdoc cref="double.DegreesToRadians" />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static double4 DegreesToRadians(double4 degrees)
|
|
{
|
|
return new(double.DegreesToRadians(degrees.X), double.DegreesToRadians(degrees.Y), double.DegreesToRadians(degrees.Z), double.DegreesToRadians(degrees.W));
|
|
}
|
|
|
|
/// <inheritdoc cref="double.RadiansToDegrees" />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static double4 RadiansToDegrees(double4 radians)
|
|
{
|
|
return new(double.RadiansToDegrees(radians.X), double.RadiansToDegrees(radians.Y), double.RadiansToDegrees(radians.Z), double.RadiansToDegrees(radians.W));
|
|
}
|
|
}
|
|
|
|
// IHyperbolicFunctions
|
|
public partial struct double4 : IHyperbolicFunctions<double4>
|
|
{
|
|
/// <inheritdoc />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static double4 Sinh(double4 value)
|
|
{
|
|
return new double4(double.Sinh(value.X), double.Sinh(value.Y), double.Sinh(value.Z), double.Sinh(value.W));
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static double4 Cosh(double4 value)
|
|
{
|
|
return new double4(double.Cosh(value.X), double.Cosh(value.Y), double.Cosh(value.Z), double.Cosh(value.W));
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static double4 Tanh(double4 value)
|
|
{
|
|
return new double4(double.Tanh(value.X), double.Tanh(value.Y), double.Tanh(value.Z), double.Tanh(value.W));
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static double4 Asinh(double4 value)
|
|
{
|
|
return new double4(double.Asinh(value.X), double.Asinh(value.Y), double.Asinh(value.Z), double.Asinh(value.W));
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static double4 Acosh(double4 value)
|
|
{
|
|
return new double4(double.Acosh(value.X), double.Acosh(value.Y), double.Acosh(value.Z), double.Acosh(value.W));
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static double4 Atanh(double4 value)
|
|
{
|
|
return new double4(double.Atanh(value.X), double.Atanh(value.Y), double.Atanh(value.Z), double.Atanh(value.W));
|
|
}
|
|
}
|
|
|
|
// IFloatingPoint
|
|
public partial struct double4 : IFloatingPoint<double4>
|
|
{
|
|
/// <inheritdoc cref="double.Floor(double)" />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static double4 Floor(double4 value)
|
|
{
|
|
return new(double.Floor(value.X), double.Floor(value.Y), double.Floor(value.Z), double.Floor(value.W));
|
|
}
|
|
|
|
/// <inheritdoc cref="double.Ceiling(double)" />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static double4 Ceiling(double4 value)
|
|
{
|
|
return new(double.Ceiling(value.X), double.Ceiling(value.Y), double.Ceiling(value.Z), double.Ceiling(value.W));
|
|
}
|
|
|
|
/// <inheritdoc cref="double.Round(double)" />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static double4 Round(double4 value)
|
|
{
|
|
return new(double.Round(value.X), double.Round(value.Y), double.Round(value.Z), double.Round(value.W));
|
|
}
|
|
|
|
/// <inheritdoc cref="double.Truncate(double)" />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static double4 Truncate(double4 value)
|
|
{
|
|
return new(double.Truncate(value.X), double.Truncate(value.Y), double.Truncate(value.Z), double.Truncate(value.W));
|
|
}
|
|
|
|
/// <inheritdoc cref="double.Round(double, int, MidpointRounding)" />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static double4 Round(double4 value, int digits, MidpointRounding mode)
|
|
{
|
|
return new double4(double.Round(value.X, digits, mode), double.Round(value.Y, digits, mode), double.Round(value.Z, digits, mode), double.Round(value.W, digits, mode));
|
|
}
|
|
|
|
// One exponent and significand PER LANE, so there is no single honest answer: explicit and throwing.
|
|
|
|
int IFloatingPoint<double4>.GetExponentByteCount() =>
|
|
throw new NotSupportedException($"{nameof(double4)} has one exponent per component.");
|
|
|
|
int IFloatingPoint<double4>.GetExponentShortestBitLength() =>
|
|
throw new NotSupportedException($"{nameof(double4)} has one exponent per component.");
|
|
|
|
int IFloatingPoint<double4>.GetSignificandBitLength() =>
|
|
throw new NotSupportedException($"{nameof(double4)} has one significand per component.");
|
|
|
|
int IFloatingPoint<double4>.GetSignificandByteCount() =>
|
|
throw new NotSupportedException($"{nameof(double4)} has one significand per component.");
|
|
|
|
bool IFloatingPoint<double4>.TryWriteExponentBigEndian(Span<byte> destination, out int bytesWritten) =>
|
|
throw new NotSupportedException($"{nameof(double4)} has one exponent per component.");
|
|
|
|
bool IFloatingPoint<double4>.TryWriteExponentLittleEndian(Span<byte> destination, out int bytesWritten) =>
|
|
throw new NotSupportedException($"{nameof(double4)} has one exponent per component.");
|
|
|
|
bool IFloatingPoint<double4>.TryWriteSignificandBigEndian(Span<byte> destination, out int bytesWritten) =>
|
|
throw new NotSupportedException($"{nameof(double4)} has one significand per component.");
|
|
|
|
bool IFloatingPoint<double4>.TryWriteSignificandLittleEndian(Span<byte> destination, out int bytesWritten) =>
|
|
throw new NotSupportedException($"{nameof(double4)} has one significand per component.");
|
|
}
|
|
|
|
// IFloatingPointIeee754
|
|
public partial struct double4 : IFloatingPointIeee754<double4>
|
|
{
|
|
/// <summary>Gets a vector whose components are NaN.</summary>
|
|
public static double4 NaN => new(double.NaN);
|
|
|
|
/// <inheritdoc cref="double.Epsilon" />
|
|
public static double4 Epsilon => new(double.Epsilon);
|
|
|
|
/// <inheritdoc cref="double.NegativeZero" />
|
|
public static double4 NegativeZero => new(double.NegativeZero);
|
|
|
|
/// <inheritdoc cref="double.PositiveInfinity" />
|
|
public static double4 PositiveInfinity => new(double.PositiveInfinity);
|
|
|
|
/// <inheritdoc cref="double.NegativeInfinity" />
|
|
public static double4 NegativeInfinity => new(double.NegativeInfinity);
|
|
|
|
/// <inheritdoc cref="double.Atan2" />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static double4 Atan2(double4 y, double4 x)
|
|
{
|
|
return new double4(double.Atan2(y.X, x.X), double.Atan2(y.Y, x.Y), double.Atan2(y.Z, x.Z), double.Atan2(y.W, x.W));
|
|
}
|
|
|
|
/// <inheritdoc cref="double.Atan2Pi" />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static double4 Atan2Pi(double4 y, double4 x)
|
|
{
|
|
return new double4(double.Atan2Pi(y.X, x.X), double.Atan2Pi(y.Y, x.Y), double.Atan2Pi(y.Z, x.Z), double.Atan2Pi(y.W, x.W));
|
|
}
|
|
|
|
/// <inheritdoc cref="double.BitDecrement" />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static double4 BitDecrement(double4 value)
|
|
{
|
|
return new double4(double.BitDecrement(value.X), double.BitDecrement(value.Y), double.BitDecrement(value.Z), double.BitDecrement(value.W));
|
|
}
|
|
|
|
/// <inheritdoc cref="double.BitIncrement" />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static double4 BitIncrement(double4 value)
|
|
{
|
|
return new double4(double.BitIncrement(value.X), double.BitIncrement(value.Y), double.BitIncrement(value.Z), double.BitIncrement(value.W));
|
|
}
|
|
|
|
/// <inheritdoc cref="double.FusedMultiplyAdd" />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static double4 FusedMultiplyAdd(double4 a, double4 b, double4 addend)
|
|
{
|
|
return new(double.FusedMultiplyAdd(a.X, b.X, addend.X), double.FusedMultiplyAdd(a.Y, b.Y, addend.Y), double.FusedMultiplyAdd(a.Z, b.Z, addend.Z), double.FusedMultiplyAdd(a.W, b.W, addend.W));
|
|
}
|
|
|
|
/// <inheritdoc cref="double.MultiplyAddEstimate" />
|
|
/// <remarks>Permitted but not required to fuse; use <see cref="FusedMultiplyAdd" /> where the single rounding is required.</remarks>
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static double4 MultiplyAddEstimate(double4 a, double4 b, double4 addend)
|
|
{
|
|
return new(double.MultiplyAddEstimate(a.X, b.X, addend.X), double.MultiplyAddEstimate(a.Y, b.Y, addend.Y), double.MultiplyAddEstimate(a.Z, b.Z, addend.Z), double.MultiplyAddEstimate(a.W, b.W, addend.W));
|
|
}
|
|
|
|
/// <inheritdoc cref="double.Ieee754Remainder" />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static double4 Ieee754Remainder(double4 a, double4 b)
|
|
{
|
|
return new double4(double.Ieee754Remainder(a.X, b.X), double.Ieee754Remainder(a.Y, b.Y), double.Ieee754Remainder(a.Z, b.Z), double.Ieee754Remainder(a.W, b.W));
|
|
}
|
|
|
|
/// <inheritdoc cref="double.ScaleB" />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static double4 ScaleB(double4 value, int n)
|
|
{
|
|
return new double4(double.ScaleB(value.X, n), double.ScaleB(value.Y, n), double.ScaleB(value.Z, n), double.ScaleB(value.W, n));
|
|
}
|
|
|
|
// ILogB's int return cannot hold one exponent per lane - same shape as Sign
|
|
static int IFloatingPointIeee754<double4>.ILogB(double4 value) =>
|
|
throw new NotSupportedException($"{nameof(double4)} has one exponent per component.");
|
|
|
|
/// <inheritdoc cref="Vector4.Lerp(Vector4, Vector4, float)" />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static double4 Lerp(double4 a, double4 b, double amount)
|
|
{
|
|
return new(double.Lerp(a.X, b.X, amount), double.Lerp(a.Y, b.Y, amount), double.Lerp(a.Z, b.Z, amount), double.Lerp(a.W, b.W, amount));
|
|
}
|
|
|
|
/// <inheritdoc cref="Sqrt" />
|
|
[Obsolete("Renamed to Sqrt (the generic-math name; SquareRoot was the System.Numerics vector spelling).")]
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static double4 SquareRoot(double4 value)
|
|
{
|
|
return Sqrt(value);
|
|
}
|
|
}
|