diff options
| author | y-jan137 <yousefjan24000@gmail.com> | 2026-04-27 07:24:41 +0300 |
|---|---|---|
| committer | y-jan137 <yousefjan24000@gmail.com> | 2026-04-27 07:24:41 +0300 |
| commit | 4602b36e9d5ea08656e3222846a1f161bbb1cec1 (patch) | |
| tree | 87618f154f7ebe91657ba1501d695d45a31e7881 /include/matrix.hpp | |
| parent | b8bc28c70a6f2b0e7de81e85a796303d514df008 (diff) | |
Module refactor
Diffstat (limited to 'include/matrix.hpp')
| -rw-r--r-- | include/matrix.hpp | 48 |
1 files changed, 0 insertions, 48 deletions
diff --git a/include/matrix.hpp b/include/matrix.hpp deleted file mode 100644 index d78f814..0000000 --- a/include/matrix.hpp +++ /dev/null @@ -1,48 +0,0 @@ -#pragma once - -#include <cstddef> -#include <initializer_list> -#include <vector> -#include "vector.hpp" - -namespace linalg { - -class Matrix { -public: - Matrix() = default; - Matrix(std::size_t rows, std::size_t cols); - Matrix(std::size_t rows, std::size_t cols, double value); - Matrix(std::initializer_list<std::initializer_list<double>> values); - - [[nodiscard]] std::size_t rows() const noexcept; - [[nodiscard]] std::size_t cols() const noexcept; - [[nodiscard]] bool empty() const noexcept; - - double& operator()(std::size_t i, std::size_t j); - const double& operator()(std::size_t i, std::size_t j) const; - - void fill(double value); - - double* data() noexcept; - const double* data() const noexcept; - - static Matrix identity(std::size_t n); - static Matrix zeros(std::size_t rows, std::size_t cols); - -private: - [[nodiscard]] std::size_t index(std::size_t i, std::size_t j) const; - void check_bounds(std::size_t i, std::size_t j) const; - - std::size_t rows_ = 0; - std::size_t cols_ = 0; - std::vector<double> data_; -}; - -Matrix transpose(const Matrix& matrix); -Matrix operator+(const Matrix& lhs, const Matrix& rhs); -Matrix operator-(const Matrix& lhs, const Matrix& rhs); -Vector operator*(const Matrix& matrix, const Vector& vector); -Matrix operator*(const Matrix& lhs, const Matrix& rhs); - -} // namespace linalg - |