Program Listing for File Matrix.hpp
↰ Return to documentation for file (src/LouLib/Math/Matrix.hpp
)
#ifndef LOULIB_MATRIX_HPP
#define LOULIB_MATRIX_HPP
#include <vector>
#include "Vector.hpp"
#include <stdexcept>
namespace LouLib {
namespace Math {
class Matrix {
private:
class MatrixRow{
private:
std::vector<double> data;
public:
explicit MatrixRow(int n);
MatrixRow(std::initializer_list<double> rowData);
explicit MatrixRow(std::vector<double> rowData);
MatrixRow(const MatrixRow& other);
double& operator[](int i);
const double& operator[](int i) const;
int size() const;
Vector getVector();
};
std::vector<MatrixRow> data;
public:
Matrix(int rows, int cols);
Matrix(std::initializer_list<std::initializer_list<double>> matrixData);
Matrix(std::vector<std::vector<double>> matrixData);
Matrix(std::vector<MatrixRow> 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