Mathematical library for game developers.
The library contains necessary elements of Matrix Algebra to enable working in 2D and 3D space.
numerics
)
Perceptron
)AdalineGD
)AdalineSGD
)see /benchmarks/README.md
Matrix<int>:
finished computation with 9 elements and 5000000 * operations. elapsed time: 0.160372s
finished computation with 9 elements and 5000000 # operations. elapsed time: 0.0172873s
finished computation with 9 elements and 5000000 + operations. elapsed time: 0.145237s
mat3<int>:
finished computation with 9 elements and 5000000 * operations. elapsed time: 4.3e-08s
finished computation with 9 elements and 5000000 + operations. elapsed time: 5e-08s
Matrix<double>:
finished computation with 9 elements and 5000000 * operations. elapsed time: 0.132516s
finished computation with 9 elements and 5000000 # operations. elapsed time: 0.00899579s
finished computation with 9 elements and 5000000 + operations. elapsed time: 0.152282s
mat3<double>:
finished computation with 9 elements and 5000000 * operations. elapsed time: 5.2e-08s
finished computation with 9 elements and 5000000 + operations. elapsed time: 5e-08s
Matrix<float>:
finished computation with 9 elements and 5000000 * operations. elapsed time: 0.186274s
finished computation with 9 elements and 5000000 # operations. elapsed time: 0.00887903s
finished computation with 9 elements and 5000000 + operations. elapsed time: 0.146145s
mat3<float>:
finished computation with 9 elements and 5000000 * operations. elapsed time: 7.1e-08s
finished computation with 9 elements and 5000000 + operations. elapsed time: 8e-08s
gcc, cmake, clang
Download repository
git clone git@github.com:/philsupertramp/game-math
Integration into your project
Only CMake fully tested
in your CMakeLists.txt
add
link_libraries(math-lib)
include_directories(math/include)
After linking the library correctly one is able to include
the main header file math.h
#include <math/math.h>
Although one can explicitly include parts
#include <math/vec/vec2.h>
Currently there are two different implementations of matrices/vectors
Game dev oriented. 2, 3 and 4 dimensional vector/matrix
implementations.
Tightly packed data to allow minimal memory usage.
see ./include/math/vec
and ./include/math/mat
for implementation details.
Matrix<T>
(see ./include/math/Matrix.h
) represents a m x n
-Matrix of data of type T
a specific data science and numerics implementation.
Capable of Matrix-Vector and Matrix-Multiplication, it also contains
data science specific algorithms and statistical methods.
The library is split into multiple content seperated module.
Each module is nested in the root directory math/
.
Each sub-directory contains a README file with instructions how to use the module
and if it has dependencies.
To activate modules use the MATH_EXTENSIONS
compile argument.
Example build command adding numerics
module and building test suite:
mkdir -p build
cmake -DMATH_EXTENSIONS=numerics --build math/build -- -j 3 .
Feel free to contribute to the project!
master
branchNOTE: please run make lint
prior to submitting your code!
This requires clang-format>=11.0.0
The project is under MIT
-License see LICENSE
for more