Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
b6db6eb
Update README.md
Perksey Oct 6, 2019
b096e57
Merge pull request #103 from john-h-k/Perksey-patch-1
john-h-k Oct 7, 2019
479c902
Merge pull request #104 from john-h-k/dev-john
john-h-k Oct 13, 2019
693438b
Merge pull request #105 from john-h-k/dev
john-h-k Oct 13, 2019
ed36392
Merge pull request #106 from john-h-k/dev-john
john-h-k Oct 13, 2019
433c58a
Merge pull request #107 from john-h-k/dev-john
john-h-k Oct 13, 2019
105c682
Merge pull request #108 from john-h-k/dev
john-h-k Oct 13, 2019
f0d082f
Merge pull request #109 from john-h-k/dev-john
john-h-k Oct 13, 2019
e6430bf
Update FUNDING.yml
john-h-k Oct 14, 2019
f4dada9
Update FUNDING.yml
john-h-k Oct 14, 2019
a96c264
Update README.md
john-h-k Oct 14, 2019
0b48fb8
Update README.md
john-h-k Oct 14, 2019
50bbfe5
Update README.md
john-h-k Oct 14, 2019
5ca3b63
Update README.md
john-h-k Oct 14, 2019
18f12e8
Update README.md
john-h-k Oct 14, 2019
f8ea184
Add files via upload
john-h-k Oct 14, 2019
55ab4c4
Update README.md
john-h-k Oct 14, 2019
aaa3735
Update README.md
john-h-k Oct 14, 2019
90f13be
Update README.md
john-h-k Oct 14, 2019
55083d4
Update README.md
john-h-k Oct 14, 2019
a8cb877
Update README.md
john-h-k Oct 14, 2019
6e0c201
Update README.md
john-h-k Oct 14, 2019
e175379
Update README.md
john-h-k Oct 14, 2019
f8701dc
Update README.md
john-h-k Oct 14, 2019
4a42220
Update README.md
john-h-k Oct 14, 2019
9ad1c76
Update README.md
john-h-k Oct 14, 2019
8c5f148
Update FUNDING.yml
john-h-k Oct 14, 2019
02b4556
Update README.md
john-h-k Oct 14, 2019
8ae029a
Update README.md
john-h-k Oct 14, 2019
e612b48
Update FUNDING.yml
john-h-k Oct 14, 2019
5c1add7
Update Logical.cs
macaba Oct 20, 2019
9bbdb60
Update Trigonometry.cs
macaba Oct 20, 2019
273a8eb
Update README.md
john-h-k Oct 27, 2019
8f2bcc0
Merge pull request #112 from macaba/master
john-h-k Oct 28, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -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]
15 changes: 12 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -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.

Expand Down Expand 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))

Expand Down
Binary file added assets/buymecoffee.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ public static partial class Vector
[MethodImpl(MaxOpt)]
public static Vector256<double> 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);
Expand All @@ -42,10 +42,11 @@ public static Vector256<double> PermuteWithW(Vector4DParam1_3 vector)
[MethodImpl(MaxOpt)]
public static Vector256<double> 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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ public static partial class Vector
private static readonly Vector256<double> 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<double> Sin(Vector4DParam1_3 vector)
{
Expand Down Expand Up @@ -74,7 +71,6 @@ static Vector256<double> SoftwareFallback(Vector4DParam1_3 vector)
}
}

[Obsolete(DoNotUse, true)]
[MethodImpl(MaxOpt)]
public static Vector256<double> SinApprox(Vector4DParam1_3 vector)
{
Expand Down Expand Up @@ -117,7 +113,6 @@ public static Vector256<double> SinApprox(Vector4DParam1_3 vector)
private static readonly Vector256<double> 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<double> Cos(Vector4DParam1_3 vector)
{
Expand Down Expand Up @@ -175,7 +170,6 @@ static Vector256<double> SoftwareFallback(Vector4DParam1_3 vector)
}
}

[Obsolete(DoNotUse, true)]
[MethodImpl(MaxOpt)]
public static Vector256<double> CosApprox(Vector4DParam1_3 vector)
{
Expand Down Expand Up @@ -220,8 +214,7 @@ public static Vector256<double> CosApprox(Vector4DParam1_3 vector)
private static readonly Vector256<double> TanCoefficients0D = Vector256.Create(1.0d, -4.667168334e-1d, 2.566383229e-2d, -3.118153191e-4d);
private static readonly Vector256<double> TanCoefficients1D = Vector256.Create(4.981943399e-7d, -1.333835001e-1d, 3.424887824e-3d, -1.786170734e-5d);
private static readonly Vector256<double> TanConstantsD = Vector256.Create(1.570796371d, 6.077100628e-11d, 0.000244140625d, 0.63661977228d);

[Obsolete(DoNotUse, true)]

[MethodImpl(MaxOpt)]
public static Vector256<double> Tan(Vector4DParam1_3 vector)
{
Expand Down Expand Up @@ -299,7 +292,6 @@ static Vector256<double> SoftwareFallback(Vector4DParam1_3 vector)
}
}

[Obsolete(DoNotUse, true)]
[MethodImpl(MaxOpt)]
private static Vector256<long> CompareBitwiseEqualInt64(Vector256<long> left, Vector256<long> right)
{
Expand All @@ -321,9 +313,8 @@ static Vector256<long> SoftwareFallback(Vector256<long> left, Vector256<long> ri
}
}

private static readonly Vector256<double> TanEstCoefficientsD = Vector256.Create(2.484d, -1.954923183e-1d, 2.467401101d, ScalarDoubleConstants.OneDivPi);

[Obsolete(DoNotUse, true)]
private static readonly Vector256<double> TanEstCoefficientsD = Vector256.Create(2.484d, -1.954923183e-1d, 2.467401101d, ScalarDoubleConstants.OneDivPi);

[MethodImpl(MaxOpt)]
public static Vector256<double> TanApprox(Vector4DParam1_3 vector)
{
Expand Down Expand Up @@ -354,7 +345,6 @@ public static Vector256<double> TanApprox(Vector4DParam1_3 vector)
return Tan(vector);
}

[Obsolete(DoNotUse, true)]
[MethodImpl(MaxOpt)]
public static void SinCos(Vector4DParam1_3 vector, out Vector256<double> sin, out Vector256<double> cos)
{
Expand Down Expand Up @@ -432,7 +422,6 @@ static void SoftwareFallback(Vector4DParam1_3 vector, out Vector256<double> sin,
}
}

[Obsolete(DoNotUse, true)]
[MethodImpl(MaxOpt)]
public static void SinCosApprox(Vector4DParam1_3 vector, out Vector256<double> sin, out Vector256<double> cos)
{
Expand Down