Cmathematics
Mathematics library for C and C++
Install / Use
/learn @michaelg29/CmathematicsREADME
cmathematics
Mathematics library for C and C++
Follows this tutorial playlist on YouTube.
Description
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:
Data
- Encryption
- AES
- Hashing
- SHA1/SHA2/SHA3
- HMAC-SHA, PBKDF2-HMAC-SHA
Graph
- Graph representation
- Graph algorithms - Dijkstra, Ford Fulkerson
Linear Algebra
- Vectors
- Matrices
Utility
- Big Integers
- Expression evaluation
Documentation
Full documentation can be found in the header files in the cmathematics folder.
Use
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;
}
Complete list of implemented functions
Data
- Encryption
- AES
- Hashing
- SHA1/SHA2/SHA3
- HMAC-SHA
- PBKDF2-HMAC-SHA
Graph
- Representation
- Adjacency Lists/Adjacency Matrices
- Algorithms
- DFS
- Dijkstra Shortest Path
- Ford Fulkerson Max Flow
Linear Algebra
- 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
Utility
- 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
Todo
Utility
- Big Integers
- Division
- Modular Division
- Exponentiation
- Modular Exponentiation
Data
- Algorithms
- RSA
Graph Theory
Algebra/Calculus
- Functions
- Polynomials
- Differentiation
- Newton's Root Approximation
Related Skills
node-connect
349.9kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
109.8kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
349.9kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
349.9kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
