https://github.com/beliumgl/matrixcpp
MatrixCPP is a simple C++11 project for performing basic matrix operations such as addition, subtraction, and multiplication.
https://github.com/beliumgl/matrixcpp
cmake cpp cpp11 cpp11-library matrix matrix-calculations matrix-library matrix-multiplication
Last synced: 2 months ago
JSON representation
MatrixCPP is a simple C++11 project for performing basic matrix operations such as addition, subtraction, and multiplication.
- Host: GitHub
- URL: https://github.com/beliumgl/matrixcpp
- Owner: beliumgl
- License: mit
- Created: 2024-12-01T08:54:47.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2024-12-10T09:37:25.000Z (6 months ago)
- Last Synced: 2025-01-30T10:43:08.438Z (4 months ago)
- Topics: cmake, cpp, cpp11, cpp11-library, matrix, matrix-calculations, matrix-library, matrix-multiplication
- Language: C++
- Homepage:
- Size: 17.6 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# MatrixCPP

MatrixCPP is a simple C++11 project for performing basic matrix operations such as addition, subtraction, and multiplication.
# Requirements
- C++11 or later
- Git (optional, for cloning the repository)## Installation
1. **Clone the repository**:
```bash
git clone https://github.com/yourusername/matrixcpp.git
cd matrixcpp
2. **Create a build directory**:
```bash
mkdir build
cd build
3. **Run CMake to configure the project and build it to static library**:
```bash
cmake ..
cmake --build .# Usage
```cpp
#include "matrixcpp.hpp"
#includeint main() {
try {
Matrix m1({{1, 2}, {3, 4}});
Matrix m2({{5, 6}, {7, 8}});
Matrix result = m1 + m2;for (const auto& row : result.content) {
for (int value : row) {
std::cout << value << " ";
}
std::cout << std::endl;
}
} catch (const std::invalid_argument& e) {
std::cerr << "Error: " << e.what() << std::endl;
}return 0;
}
```