A basic
SquareMatrix A({{5, 6, -1}, {1, 4, 2}, {1, -2, 5}});
A.to_ref(); // convert matrix to row echelon form
A.calc_cout(); // output calculations
âš The interactive version of the documentation may take some time to load initially.
- Basic matrix operations (addition, subtraction, multiplication, transpose).
- Inverse of a matrix.
- Gauss-Jordan elimination method.
- Leibniz method.
- Calculates matrix properties.
- Determinant.
- Laplace expansion method.
- Gauss-Jordan elimination method.
- Rank of matrix.
- Trace of matrix.
- Determinant.
- Convert matrix to row echelon form and reduced row echelon form.
- LU/PLU factorization (Crout's method) with partial pivoting.
- Solving system of linear equations.
- Gauss-Jordan elimination method.
- Cramers rule method.
- LU/PLU decomposition method with partial pivoting.
- Iterative methods
- Gauss-Jacobi method.
- Gauss-Seidel method.
- Pre-conditioning for iterative methods by making matrix strictly diagonally dominant.
- Chaining of operations is possible.
- Unit-testing with
doctest
library. - Automatic update to shared library using Github Actions.
To use this library locally, you will need a compiler that supports
Once you have a compiler installed, you can download the src
folder from the GitHub repository. Import the SquareMatrix.h
file in the .cpp
where you want to use the library. For example, if your file structure is as follows:
src/
├─ SquareMatrix.h
├─ SquareMatrix.cpp
main.cpp
then your main.cpp
file should have #include "src/SquareMatrix.h"
at the top.
âš Do not include
test_runner.cpp
and thetest
folder in your project.
If you want to use a shared library instead, you can generate the shared library with:
g++ -o libligebra.so -fpic -shared src/SquareMatrix.cpp -std=c++17
Then follow this tutorial on how to integrate the library in your code.
If you are using VS Code, assuming you have my .vscode
folder, simply navigate to test_runner.cpp
and pres F5
.
All files required for testing are found in the tests
folder. Tests are using doctest
library.
To run the tests (assuming you have a g++ compiler):
g++ -std=c++17 test_runner.cpp tests/tests.cpp src/SquareMatrix.cpp -W
./a.out
âš There should not be any other
.cpp
files with amain()
function in your project.
Comment the following lines in test_runner.cpp
:
if (test_result == 1)
throw std::runtime_error("Test failed");
The above lines causes the github workflow in test.yml
to fail whenever a test fails. They are not necessary for testing locally.
If you are using VS Code, assuming you have my .vscode
folder, simply navigate to test_runner.cpp
and pres F5
.
- Add binder link to documentation
- Update task.json : add task to update so.
- Reduce binder setup time
- Split tests into several files
- Calculate eigenvalues + vectors using QR algorithm
- Add tests for console output (Test string spit out by
calc_cout
) - Add bodmas support for matrix operations
- Add option to output in improper fraction form instead of decimals.
- No support for complex numbers.
- Can only convert matrices to non-strict diagonal dominant form.
- Data type of numbers is limited to
double
. - Supports only square matrices for coefficient matrix.
- Matrix operations do not follow BODMAS.