CMatrix is a robust C++ matrix library designed to simplify matrix operations and provide extensive functionalities. This library is tailored for Data Science and Machine Learning projects, offering a versatile toolset for working with matrices.
To install the library, follow these steps:
- Clone the repository using the following command:
git clone https://github.com/B-Manitas/CMatrix.git-
Include the
CMatrix.hppfile in your project. -
Compile your project with the following flags:
-std=c++11 -fopenmpHere's an example of how to use CMatrix:
#include "CMatrix.hpp"
int main()
{
// Create a 2x3 matrix
cmatrix<int> mat = {{1, 2, 3}, {4, 5, 6}};
// Create a random 3x2 matrix
cmatrix<int> rand = cmatrix<int>::randint(3, 2, 0, 10);
rand.print();
// Performs a calculation on the matrix
mat += ((rand * 2) - 1);
// Print the transpose of the result
mat.transpose().print();
return 0;
}
// TERMINAL
$ g++ -std=c++11 -fopenmp main.cpp -o main
> "[[18, 9], [5, 22], [20, 13]]"CMatrix is structured as follows:
| Class | Description |
|---|---|
| include | |
CBool.hpp |
The class that represents a boolean matrix. |
CMatrix.hpp |
The main template class that can work with any data type. |
| src | |
CMatrix.tpp |
General methods of the class. |
CMatrixConstructors.hpp |
Implementation of class constructors. |
CMatrixGetter.hpp |
Methods to retrieve information about the matrix and access its elements. |
CMatrixSetter.hpp |
Methods to set data in the matrix. |
CMatrixCheck.tpp |
Methods to verify matrix conditions and perform checks before operations to prevent errors. |
CMatrixManipulation.hpp |
Methods to find elements in the matrix and transform it. |
CMatrixOperator.hpp |
Implementation of various operators. |
CMatrixStatic.hpp |
Implementation of static methods of the class. |
CMatrixStatistics.hpp |
Methods to perform statistical operations on the matrix. |
| test | |
CMatrixTest.hpp |
Contains the tests for the class. |
For detailed information on how to use CMatrix, consult the documentation.
- OpenMP: An API for parallel programming. (Required for compile CMatrix)
- GoogleTest: A C++ testing framework.
- GoogleBenchmark: A C++ benchmarking framework.
- Doxygen: A documentation generator.
- CDataFrame: A C++ DataFrame library for Data Science and Machine Learning projects.
This project is licensed under the MIT License, ensuring its free and open availability to the community.