.. _program_listing_file_src_LouLib_Math_Matrix.hpp: Program Listing for File Matrix.hpp =================================== |exhale_lsh| :ref:`Return to documentation for file ` (``src/LouLib/Math/Matrix.hpp``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp #ifndef LOULIB_MATRIX_HPP #define LOULIB_MATRIX_HPP #include #include "Vector.hpp" #include namespace LouLib { namespace Math { class Matrix { private: class MatrixRow{ private: std::vector data; public: explicit MatrixRow(int n); MatrixRow(std::initializer_list rowData); explicit MatrixRow(std::vector rowData); MatrixRow(const MatrixRow& other); double& operator[](int i); const double& operator[](int i) const; int size() const; Vector getVector(); }; std::vector data; public: Matrix(int rows, int cols); Matrix(std::initializer_list> matrixData); Matrix(std::vector> matrixData); Matrix(std::vector matrixData); Matrix(const Matrix& other); MatrixRow& operator[](int i); const MatrixRow& operator[](int i) const; Vector getCol(int i); Vector getRow(int i); int rows() const; int cols() const; Matrix transpose(); double norm(); double det(); Matrix minor(int i, int j); double cofactor(int i, int j); Matrix inverse(); std::string toString(); }; Matrix operator+(const Matrix& a, const Matrix& b); Matrix operator-(const Matrix& a, const Matrix& b); Matrix operator*(const Matrix& a, const Matrix& b); Matrix operator*(const Matrix& a, const double& b); Matrix operator*(const double& a, const Matrix& b); Vector operator*(const Matrix& a, const Vector& b); } // LouLib } // Math #endif //LOULIB_MATRIX_HPP