45#include <initializer_list>
52 Matrix()
noexcept =
default;
54 Matrix(
size_t rows,
size_t columns);
57 Matrix(std::initializer_list<double> lst)
noexcept;
58 Matrix(std::initializer_list<std::initializer_list<double>> lst);
64 size_t rows()
const noexcept {
return m_rows; }
65 size_t columns()
const noexcept {
return m_columns; }
66 bool empty()
const noexcept {
return (m_rows == 0); }
67 void reshape(
size_t new_rows,
size_t new_columns);
71 const double&
operator()(
size_t row,
size_t column)
const;
86 double minor(
size_t rows,
size_t columns)
const;
89 double* m_ptr =
nullptr;
95 std::ostream& operator<<(std::ostream&,
const Matrix&);
101 Matrix operator*(
const Matrix& m,
const double c)
noexcept;
102 Matrix operator*(
const double c,
const Matrix& m)
noexcept;
double & operator()(size_t row, size_t column)
Accesses the element at the specified position in the matrix.
Definition matrix.cpp:276
Matrix & operator=(Matrix m) noexcept
Copy assignment operator.
Definition matrix.cpp:319
double det() const
Calculates the determinant of the matrix.
Definition matrix.cpp:701
Matrix & operator*=(const double c) noexcept
Scales a matrix by a scalar.
Definition matrix.cpp:383
double minor(size_t rows, size_t columns) const
Calculates the minor of the matrix at the given position.
Definition matrix.cpp:733
Matrix & operator-=(const Matrix &m)
Subtracts one matrix from another.
Definition matrix.cpp:439
Matrix & operator+=(const Matrix &m)
Adds another matrix to the current matrix.
Definition matrix.cpp:340
Matrix Gauss(bool rref) const
Gaussian elimination.
Definition matrix.cpp:652
double trace() const
Calculates the trace of the matrix.
Definition matrix.cpp:628
double norm() const
Calculates the norm of the matrix.
Definition matrix.cpp:604