diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index d037c87..3ede6e9 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1,3 +1,3 @@ # These are supported funding model platforms -custom: paypal.me/johnhkelly +custom: [paypal.me/johnhkelly, buymeacoffee.com/johnhk, ko-fi.com/johnhk] diff --git a/README.md b/README.md index 30da15b..d4960a5 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,18 @@ # MathSharp +[![ko-fi](https://www.ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/johnhk) +[![Buy Me A Coffee](/assets/buymecoffee.png)](https://www.buymeacoffee.com/johnhk) + +[![MIT license](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/john-h-k/MathSharp/blob/master/LICENSE) +[![GitHub issues](https://img.shields.io/github/issues/john-h-k/MathSharp.svg)](https://GitHub.com/john-h-k/MathSharp/issues/) +[![GitHub stars](https://img.shields.io/github/stars/john-h-k/MathSharp.svg?style=social&label=Star&maxAge=2592000)](https://GitHub.com/john-h-k/MathSharp/stargazers/) + + + |Configuration|Windows x86|Windows x64|Ubuntu 1604 x64|Mac OS x64| |:--:|:--:|:--:|:--:|:--:| -|**Debug**|[![Build Status](https://johnkellyoxford.visualstudio.com/MathSharp/_apis/build/status/scripts/john-h-k.MathSharp?branchName=master&jobName=windows_debug_x86)](https://johnkellyoxford.visualstudio.com/MathSharp/_build/latest?definitionId=3&branchName=master)|[![Build Status](https://johnkellyoxford.visualstudio.com/MathSharp/_apis/build/status/scripts/john-h-k.MathSharp?branchName=master&jobName=windows_debug_x64)](https://johnkellyoxford.visualstudio.com/MathSharp/_build/latest?definitionId=3&branchName=master)|[![Build Status](https://johnkellyoxford.visualstudio.com/MathSharp/_apis/build/status/scripts/john-h-k.MathSharp?branchName=master&jobName=ubuntu_1604_debug_x64)](https://johnkellyoxford.visualstudio.com/MathSharp/_build/latest?definitionId=3&branchName=master)|[![Build Status](https://johnkellyoxford.visualstudio.com/MathSharp/_apis/build/status/scripts/john-h-k.MathSharp?branchName=master&jobName=macOS_debug_x64)](https://johnkellyoxford.visualstudio.com/MathSharp/_build/latest?definitionId=3&branchName=master)| -|**Release**|[![Build Status](https://johnkellyoxford.visualstudio.com/MathSharp/_apis/build/status/scripts/john-h-k.MathSharp?branchName=master&jobName=windows_release_x86)](https://johnkellyoxford.visualstudio.com/MathSharp/_build/latest?definitionId=3&branchName=master)|[![Build Status](https://johnkellyoxford.visualstudio.com/MathSharp/_apis/build/status/scripts/john-h-k.MathSharp?branchName=master&jobName=windows_release_x64)](https://johnkellyoxford.visualstudio.com/MathSharp/_build/latest?definitionId=3&branchName=master)|[![Build Status](https://johnkellyoxford.visualstudio.com/MathSharp/_apis/build/status/scripts/john-h-k.MathSharp?branchName=master&jobName=ubuntu_1604_release_x64)](https://johnkellyoxford.visualstudio.com/MathSharp/_build/latest?definitionId=3&branchName=master)|[![Build Status](https://johnkellyoxford.visualstudio.com/MathSharp/_apis/build/status/scripts/john-h-k.MathSharp?branchName=master&jobName=macOS_release_x64)](https://johnkellyoxford.visualstudio.com/MathSharp/_build/latest?definitionId=3&branchName=master)| +|**Debug**|[![Build Status](https://john-h-k.visualstudio.com/MathSharp/_apis/build/status/scripts/john-h-k.MathSharp?branchName=master&jobName=windows_debug_x86)](https://john-h-k.visualstudio.com/MathSharp/_build/latest?definitionId=3&branchName=master)|[![Build Status](https://john-h-k.visualstudio.com/MathSharp/_apis/build/status/scripts/john-h-k.MathSharp?branchName=master&jobName=windows_debug_x64)](https://john-h-k.visualstudio.com/MathSharp/_build/latest?definitionId=3&branchName=master)|[![Build Status](https://john-h-k.visualstudio.com/MathSharp/_apis/build/status/scripts/john-h-k.MathSharp?branchName=master&jobName=ubuntu_1604_debug_x64)](https://john-h-k.visualstudio.com/MathSharp/_build/latest?definitionId=3&branchName=master)|[![Build Status](https://john-h-k.visualstudio.com/MathSharp/_apis/build/status/scripts/john-h-k.MathSharp?branchName=master&jobName=macOS_debug_x64)](https://john-h-k.visualstudio.com/MathSharp/_build/latest?definitionId=3&branchName=master)| +|**Release**|[![Build Status](https://john-h-k.visualstudio.com/MathSharp/_apis/build/status/scripts/john-h-k.MathSharp?branchName=master&jobName=windows_release_x86)](https://john-h-k.visualstudio.com/MathSharp/_build/latest?definitionId=3&branchName=master)|[![Build Status](https://john-h-k.visualstudio.com/MathSharp/_apis/build/status/scripts/john-h-k.MathSharp?branchName=master&jobName=windows_release_x64)](https://john-h-k.visualstudio.com/MathSharp/_build/latest?definitionId=3&branchName=master)|[![Build Status](https://john-h-k.visualstudio.com/MathSharp/_apis/build/status/scripts/john-h-k.MathSharp?branchName=master&jobName=ubuntu_1604_release_x64)](https://johnkellyoxford.visualstudio.com/MathSharp/_build/latest?definitionId=3&branchName=master)|[![Build Status](https://john-h-k.visualstudio.com/MathSharp/_apis/build/status/scripts/john-h-k.MathSharp?branchName=master&jobName=macOS_release_x64)](https://john-h-k.visualstudio.com/MathSharp/_build/latest?definitionId=3&branchName=master)| MathSharp is a vector and matrix library written in C# using hardware intrinsics. Thanks to hardware acceleration, MathSharp is significantly faster than most mathematics libraries out there, but only supports .NET Core 3.0 and up. @@ -121,7 +130,7 @@ Vector4 + Vector4; | SystemNumerics | 0.0510 ns | 0.0080 ns | 0.0075 ns | | MathSharp | 0.0426 ns | 0.0043 ns | 0.0040 ns | -## Disclaimer +## Authors MathSharp is a library written, managed, and maintained by John Kelly ([@john-h-k](https://github.com/john-h-k)) diff --git a/assets/buymecoffee.png b/assets/buymecoffee.png new file mode 100644 index 0000000..12adbc5 Binary files /dev/null and b/assets/buymecoffee.png differ diff --git a/sources/MathSharp/Vector/VectorFloatingPoint/VectorDouble/Logical.cs b/sources/MathSharp/Vector/VectorFloatingPoint/VectorDouble/Logical.cs index 1eb27e9..18bf1bc 100644 --- a/sources/MathSharp/Vector/VectorFloatingPoint/VectorDouble/Logical.cs +++ b/sources/MathSharp/Vector/VectorFloatingPoint/VectorDouble/Logical.cs @@ -15,9 +15,9 @@ public static partial class Vector [MethodImpl(MaxOpt)] public static Vector256 Permute(Vector4DParam1_3 vector, byte control) { - if (Avx.IsSupported) + if (Avx2.IsSupported) { - return Avx.Permute(vector, control); + return Avx2.Permute4x64(vector, control); } return Shuffle(vector, vector, control); @@ -42,10 +42,11 @@ public static Vector256 PermuteWithW(Vector4DParam1_3 vector) [MethodImpl(MaxOpt)] public static Vector256 Shuffle(Vector4DParam1_3 left, Vector4DParam1_3 right, byte control) { - if (Avx.IsSupported) - { - return Avx.Shuffle(left, right, control); - } + //There is a way to do Permute4x64 with a few AVX instructions but haven't figured it out yet + //if (Avx.IsSupported) + //{ + // return Avx.Shuffle(left, right, control); + //} return Shuffle_Software(left, right, control); } diff --git a/sources/MathSharp/Vector/VectorFloatingPoint/VectorDouble/Trigonometry.cs b/sources/MathSharp/Vector/VectorFloatingPoint/VectorDouble/Trigonometry.cs index 476bca5..0451075 100644 --- a/sources/MathSharp/Vector/VectorFloatingPoint/VectorDouble/Trigonometry.cs +++ b/sources/MathSharp/Vector/VectorFloatingPoint/VectorDouble/Trigonometry.cs @@ -17,9 +17,6 @@ public static partial class Vector private static readonly Vector256 SinCoefficient1D = Vector256.Create(-2.3889859e-08d, -0.16665852d, +0.0083139502d, -0.00018524670d); private const double SinCoefficient1DScalar = -2.3889859e-08d; - private const string DoNotUse = "DO NOT USE!! Double precision trig is currently non-working"; - - [Obsolete(DoNotUse, true)] [MethodImpl(MaxOpt)] public static Vector256 Sin(Vector4DParam1_3 vector) { @@ -74,7 +71,6 @@ static Vector256 SoftwareFallback(Vector4DParam1_3 vector) } } - [Obsolete(DoNotUse, true)] [MethodImpl(MaxOpt)] public static Vector256 SinApprox(Vector4DParam1_3 vector) { @@ -117,7 +113,6 @@ public static Vector256 SinApprox(Vector4DParam1_3 vector) private static readonly Vector256 CosCoefficient1D = Vector256.Create(-2.6051615e-07d, -0.49992746d, +0.041493919d, -0.0012712436d); private const double CosCoefficient1DScalar = -2.6051615e-07d; - [Obsolete(DoNotUse, true)] [MethodImpl(MaxOpt)] public static Vector256 Cos(Vector4DParam1_3 vector) { @@ -175,7 +170,6 @@ static Vector256 SoftwareFallback(Vector4DParam1_3 vector) } } - [Obsolete(DoNotUse, true)] [MethodImpl(MaxOpt)] public static Vector256 CosApprox(Vector4DParam1_3 vector) { @@ -220,8 +214,7 @@ public static Vector256 CosApprox(Vector4DParam1_3 vector) private static readonly Vector256 TanCoefficients0D = Vector256.Create(1.0d, -4.667168334e-1d, 2.566383229e-2d, -3.118153191e-4d); private static readonly Vector256 TanCoefficients1D = Vector256.Create(4.981943399e-7d, -1.333835001e-1d, 3.424887824e-3d, -1.786170734e-5d); private static readonly Vector256 TanConstantsD = Vector256.Create(1.570796371d, 6.077100628e-11d, 0.000244140625d, 0.63661977228d); - - [Obsolete(DoNotUse, true)] + [MethodImpl(MaxOpt)] public static Vector256 Tan(Vector4DParam1_3 vector) { @@ -299,7 +292,6 @@ static Vector256 SoftwareFallback(Vector4DParam1_3 vector) } } - [Obsolete(DoNotUse, true)] [MethodImpl(MaxOpt)] private static Vector256 CompareBitwiseEqualInt64(Vector256 left, Vector256 right) { @@ -321,9 +313,8 @@ static Vector256 SoftwareFallback(Vector256 left, Vector256 ri } } - private static readonly Vector256 TanEstCoefficientsD = Vector256.Create(2.484d, -1.954923183e-1d, 2.467401101d, ScalarDoubleConstants.OneDivPi); - - [Obsolete(DoNotUse, true)] + private static readonly Vector256 TanEstCoefficientsD = Vector256.Create(2.484d, -1.954923183e-1d, 2.467401101d, ScalarDoubleConstants.OneDivPi); + [MethodImpl(MaxOpt)] public static Vector256 TanApprox(Vector4DParam1_3 vector) { @@ -354,7 +345,6 @@ public static Vector256 TanApprox(Vector4DParam1_3 vector) return Tan(vector); } - [Obsolete(DoNotUse, true)] [MethodImpl(MaxOpt)] public static void SinCos(Vector4DParam1_3 vector, out Vector256 sin, out Vector256 cos) { @@ -432,7 +422,6 @@ static void SoftwareFallback(Vector4DParam1_3 vector, out Vector256 sin, } } - [Obsolete(DoNotUse, true)] [MethodImpl(MaxOpt)] public static void SinCosApprox(Vector4DParam1_3 vector, out Vector256 sin, out Vector256 cos) {