All Projects → john-h-k → Mathsharp

john-h-k / Mathsharp

Licence: mit
A vector and matrix library written in C# using hardware intrinsics

Programming Languages

csharp
926 projects

Projects that are alternatives of or similar to Mathsharp

JOLI.jl
Julia Operators LIbrary
Stars: ✭ 14 (-97.73%)
Mutual labels:  vector, matrix
geeks-for-geeks-solutions
✅ My own Amazon, Microsoft and Google SDE Coding challenge Solutions (offered by GeeksForGeeks).
Stars: ✭ 246 (-60.06%)
Mutual labels:  vector, matrix
ludigraphix.github.io
Documentation for Ludigraphix
Stars: ✭ 21 (-96.59%)
Mutual labels:  vector, vector-graphics
matlib
Matrix Functions for Teaching and Learning Linear Algebra and Multivariate Statistics, http://friendly.github.io/matlib/
Stars: ✭ 55 (-91.07%)
Mutual labels:  vector, matrix
Armadillo Code
Armadillo: fast C++ library for linear algebra & scientific computing - http://arma.sourceforge.net
Stars: ✭ 388 (-37.01%)
Mutual labels:  matrix, vector
vector
A javascript library for creating interactive graphics.
Stars: ✭ 154 (-75%)
Mutual labels:  vector, vector-graphics
Matrix
Easy-to-use Scientific Computing library in/for C++ available for Linux and Windows.
Stars: ✭ 20 (-96.75%)
Mutual labels:  vector, matrix
Mathematics for Machine Learning
Learn mathematics behind machine learning and explore different mathematics in machine learning.
Stars: ✭ 28 (-95.45%)
Mutual labels:  vector, matrix
Pyrr
3D mathematical functions using NumPy
Stars: ✭ 282 (-54.22%)
Mutual labels:  matrix, vector
Graphene
A thin layer of graphic data types
Stars: ✭ 268 (-56.49%)
Mutual labels:  matrix, vector
vec-la-fp
↗️ A tiny (functional) 2d linear algebra library
Stars: ✭ 21 (-96.59%)
Mutual labels:  vector, matrix
Libxsmm
Library for specialized dense and sparse matrix operations, and deep learning primitives.
Stars: ✭ 518 (-15.91%)
Mutual labels:  matrix, vector
glm
OpenGL Mathematics (GLM)
Stars: ✭ 6,667 (+982.31%)
Mutual labels:  vector, matrix
vectorshapes-unity
Library for drawing vector shapes in Unity.
Stars: ✭ 44 (-92.86%)
Mutual labels:  vector, vector-graphics
Tensor
A library and extension that provides objects for scientific computing in PHP.
Stars: ✭ 146 (-76.3%)
Mutual labels:  vector, matrix
Swiftish
A fully generic Swift vector & matrix library
Stars: ✭ 17 (-97.24%)
Mutual labels:  vector, matrix
LinAlg
实现一个线性代数库,为Python写扩展。《程序猿的数学3 线性代数》读后笔记
Stars: ✭ 17 (-97.24%)
Mutual labels:  vector, matrix
GenericTensor
The only library allowing to create Tensors (matrices extension) with custom types
Stars: ✭ 42 (-93.18%)
Mutual labels:  vector, matrix
Clarity
Customizable Monoshape Vector Icon Theme for GTK+
Stars: ✭ 37 (-93.99%)
Mutual labels:  vector, vector-graphics
Joml
A Java math library for OpenGL rendering calculations
Stars: ✭ 479 (-22.24%)
Mutual labels:  matrix, vector

MathSharp

ko-fi Buy Me A Coffee

MIT license GitHub issues

Configuration Windows x86 Windows x64 Ubuntu 1604 x64 Mac OS x64
Debug Build Status Build Status Build Status Build Status
Release Build Status Build Status Build Status Build Status

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.

MathSharp beats out all alternative for speed. Comparing it to the System.Numerics types and the OpenTk.Math types shows just how fast it is:

[All benchmarks were taken using BenchmarkDotNet on an i3-8350k at stock speeds with minimal background activity, with .NET Core 3.0.100]

Matrix Equality

Operation

Matrix4x4 == Matrix4x4

Results

Method Mean Error StdDev
OpenTk 10.984 ns 0.1087 ns 0.1017 ns
SystemNumerics 3.895 ns 0.0185 ns 0.0164 ns
MathSharp 1.622 ns 0.0109 ns 0.0102 ns

Matrix Transposition

Operation

Transpose(Matrix4x4)

Results

Method Mean Error StdDev
OpenTk 10.984 ns 0.1087 ns 0.1017 ns
SystemNumerics 3.895 ns 0.0185 ns 0.0164 ns
MathSharp 1.622 ns 0.0109 ns 0.0102 ns

Sine Wave Generation

Operation

const int SampleRate = 44100;
const float Tau = MathF.PI * 2;
const float Frequency = 440;

for (var i = 0; i < waveInputs.Length; i++)
{
    waveInputs[i] = Sin(Tau * Frequency * ((float)i / SampleRate));
}

Results

Method Mean Error StdDev
SystemMathF 412.30 us 1.6319 us 1.5265 us
MathSharp 80.37 us 0.6465 us 0.6048 us

Anchored Scale Operation

Operation

const Vector2 Translation = new Vector2(1.7f, 2.3f);
const Vector2 Anchor = new Vector2(1.0f, 0.0f);
const Vector2 Scale = new Vector2(7.0f, 3.6f);
const Vector2 Amount = new Vector2(0.5f, 0.25f);

Vector2 newScale = Scale * Amount;
Vector2 deltaT = Scale * (1 - Amount);
deltaT *= Anchor;
(Translation + deltaT) * newScale;

Results

Method Mean Error StdDev Rank
MathSharp 0.8542 ns 0.0084 ns 0.0079 ns 1
SystemNumerics 2.0281 ns 0.0123 ns 0.0115 ns 2
OpenTk 37.4250 ns 0.1585 ns 0.1483 ns 3

Vector addition

Operation

Vector4 + Vector4;

Results (within margin of error between MathSharp and System.Numerics)

Method Mean Error StdDev
OpenTk 6.5341 ns 0.0392 ns 0.0367 ns
SystemNumerics 0.0510 ns 0.0080 ns 0.0075 ns
MathSharp 0.0426 ns 0.0043 ns 0.0040 ns

Authors

MathSharp is a library written, managed, and maintained by John Kelly (@john-h-k)

How to use

TODO

Contributing

MathSharp uses and encourages Early Pull Requests. Please don't wait until you're done to open a PR!

  1. Install Git and the .Net Core SDK
  2. Fork MathSharp
  3. Create a branch on your fork.
  4. Add an empty commit to start your work off (and let you open a PR): git commit --allow-empty -m "start of [thing you're working on]"
  5. Open a Pull request with [WIP] in the title. Do this before you actually start working.
  6. Make your commits in small, incremental steps with clear descriptions.
  7. Tag a maintainer when you're done and ask for a review!

Click here for good first issues.

Click here for everything we need help with.

License & Copyright

MathSharp is licensed under the MIT license. Full copyright belongs to @john-h-k.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].