33 lines
860 B
C++
33 lines
860 B
C++
#pragma once
|
|
|
|
#include "fesa/math/vector.hpp"
|
|
|
|
#include <cstddef>
|
|
#include <vector>
|
|
|
|
namespace fesa {
|
|
|
|
// Owns row-major contiguous dense storage independently of sparse matrices.
|
|
class Matrix {
|
|
public:
|
|
Matrix(std::size_t rows, std::size_t columns, double value = 0.0);
|
|
Matrix(const Matrix& other);
|
|
Matrix(Matrix&& other) noexcept;
|
|
Matrix& operator=(const Matrix& other);
|
|
Matrix& operator=(Matrix&& other) noexcept;
|
|
|
|
std::size_t rows() const noexcept;
|
|
std::size_t columns() const noexcept;
|
|
double& operator()(std::size_t row, std::size_t column);
|
|
const double& operator()(std::size_t row, std::size_t column) const;
|
|
Vector multiply(const Vector& rhs) const;
|
|
Matrix multiply(const Matrix& rhs) const;
|
|
|
|
private:
|
|
std::size_t rows_;
|
|
std::size_t columns_;
|
|
std::vector<double> values_;
|
|
};
|
|
|
|
} // namespace fesa
|