Mathematics library for C and C++
Follows this tutorial playlist on YouTube.
This is a mathematics library for C and C++ that implements common mathematical concepts and ideas from algebra, calculus, statistics, and linear algebra. A complete list of implemented functions and concepts can be found here.
List of implemented concepts so far:
- Encryption
- AES
- Hashing
- SHA1/SHA2/SHA3
- HMAC-SHA, PBKDF2-HMAC-SHA
- Graph representation
- Graph algorithms - Dijkstra, Ford Fulkerson
- Vectors
- Matrices
- Big Integers
- Expression evaluation
Full documentation can be found in the header files in the cmathematics
folder.
Simply drag the cmathematics
folder into your C or C++ project, not the include directory, and it can be used as if it were apart of the project.
Example file structure:
PROJECT_DIR \
...
cmathematics \
cmathematics.h
...
...
main.c
Sample use in main.c
:
#include "cmathematics/cmathematics.h"
#include "cmathematics/linalg/vec.h"
int main() {
vec v1 = vector(2.0f, 1.0f, 3.4f);
printVec(v1);
return 0;
}
- Encryption
- AES
- Hashing
- SHA1/SHA2/SHA3
- HMAC-SHA
- PBKDF2-HMAC-SHA
- Representation
- Adjacency Lists/Adjacency Matrices
- Algorithms
- DFS
- Dijkstra Shortest Path
- Ford Fulkerson Max Flow
- Vectors
- Vector-Scalar operations (+, -, *, /, ^)
- Vector-Vector operations (+, -, .*, ./, dot, cross)
- Magnitude, Squared Magnitude
- Normalize
- Matrices
- Matrix-Scalar operations (+, -, *, /)
- Matrix-Vector multiplication
- Matrix-Matrix multiplication
- Matrix operations
- Transpose
- Elementary row operations
- Row Echelon Form/Reduced Row Echelon Form
- Splicing
- Determinant (through 3 different methods)
- Augmentation (vectors and matrices)
- Cofactors/adjugates
- Matrix Inverses
- Big Integers (Note: a good reference book for integer representations is Modern Computer Arithmetic by Richard Brent and Paul Zimmerman)
- Parsing from string
- Output to string
- Comparison
- Addition, subtraction
- Multiplication (Long, Karatsuba)
- Expression evaluation
- Shunting-Yard Algorithm
- Big Integers
- Division
- Modular Division
- Exponentiation
- Modular Exponentiation
- Algorithms
- RSA
- Functions
- Polynomials
- Differentiation
- Newton's Root Approximation