Coursework on programming basics in C++ at BSTU named after V.G. Shukhov
This project is a C++ library for working with various types of matrices, sparse, and block matrices. The library provides a wide range of functionalities for matrix operations, manipulation, and analysis. It aims to facilitate efficient handling of matrix data structures, especially in applications where sparsity is a significant factor.
- Dense Matrix Operations: Support for standard matrix operations such as addition, subtraction, multiplication, and transposition.
- Sparse Matrix Representation: Efficient storage and manipulation of sparse matrices, including operations tailored for sparse data.
- Block Matrix Support: Capabilities to handle block matrices, allowing for more advanced matrix manipulations and computations.
- Comprehensive Testing: Includes unit tests to ensure the reliability and correctness of the implemented functionalities. Note that tests for block matrices are currently not implemented due to time constraints.
- Documentation: Automatically generated documentation using Doxygen.
Please note that this project may contain some student errors as it is part of a coursework assignment. Users are encouraged to review the code and contribute improvements.
- C++17 compiler (e.g., g++)
- Make
- Doxygen (for documentation generation)
- Google Test (for testing)
To build the library and run the tests, follow these steps:
-
Clone the repository:
git clone https://github.com/crissyro/library-for-working-with-matrices.git cd library-for-working-with-matrices
-
Use
make
to build the project:make
-
Run tests:
make test
-
Generate a code coverage report (optional):
make gcov_report
all
: The default target that builds the library and runs the tests.test
: Compiles and runs the tests without coverage.gcov_report
: Compiles and runs the tests with coverage, generating coverage reports using lcov and genhtml.format
: Checks and formats all.hpp
and.cpp
files using clang-format.doxygen
: Generates documentation using Doxygen based on the provided configuration file.clean
: Cleans up object files, test binaries, coverage reports, and generated documentation.clean_doxygen
: Cleans up the generated Doxygen documentation.rebuild
: Cleans the project and rebuilds it from scratch.
To use the library, include the headers in your C++ project as follows:
#include "matrix/matrix.hpp"
#include "sparse_matrix/sparse_matrix.hpp"
#include "block_matrix/block_matrix.hpp"
Here is a simple example of how to create a dense matrix and perform some operations:
#include "matrix/matrix.hpp"
int main() {
int arr5[5][5] = {
{1, 2, 3, 4, 5},
{5, 4, 3, 2, 1},
{1, 3, 5, 2, 4},
{4, 5, 2, 1, 3},
{2, 1, 4, 5, 3}
};
Matrix<int> mat(arr5);
mat.printMatrix();
return 0;
}
To generate the documentation for the library, you can run the following command:
make doxygen
The generated documentation will be available in the docs
directory.
Contributions are welcome! If you have suggestions for improvements or features, please create an issue or submit a pull request.
This project is licensed under the GNU GENERAL PUBLIC LICENSE. See the LICENSE file for details.