-
Бобриков Пётр Алексеевич authored1cef68a7
#pragma once
#include <iostream>
#include <initializer_list>
namespace linalg {
class Matrix {
double* m_ptr;
int m_rows, m_columns;
protected:
class ProxyConst;
class Proxy;
public:
class ProxyConst
{
const Matrix& M;
int i;
public:
inline ProxyConst(const Matrix& M, int i);
inline double operator [] (int j) const;
};
class Proxy
{
Matrix& M;
int i;
public:
inline Proxy(Matrix& M, int i);
inline double& operator [] (int j);
};
inline Matrix(int rows, int columns);
inline Matrix(std::initializer_list<double> il);
inline Matrix(std::initializer_list <std::initializer_list<double>> il);
inline Matrix(const Matrix& orig);
inline Matrix(Matrix&& orig) noexcept;
inline ~Matrix();
inline double* ptr() const;
inline int rows() const;
inline int columns() const;
inline bool empty() const;
inline void operator = (Matrix orig) ;
inline Matrix operator - (Matrix& orig) const;
inline Matrix operator += (Matrix& orig);
inline Matrix operator -= (Matrix& orig);
inline double& operator()(int i, int j);
inline double operator()(int i, int j) const;
ProxyConst operator[](int i) const {
return ProxyConst (*this, i);
}
Proxy operator[](int i) {
return Proxy(*this, i);
}
inline Matrix operator * (double n) const noexcept ;
inline Matrix operator *= (double n) noexcept;
inline Matrix operator *= (Matrix& other);
inline Matrix operator + (Matrix& other) const;
inline Matrix operator * (Matrix& other) const;
inline bool operator == (Matrix& other) ;
inline bool operator != (Matrix& other);
inline Matrix& reshape(int rows, int cols);
inline friend std::ostream& operator << (std::ostream& out, Matrix& M);
inline double norm();
71727374757677787980818283848586878889
inline double trace();
inline Matrix gauss_forward();
inline Matrix gauss_backward();
inline int rank();
inline double det();
inline friend double calculateDeterminant(double* matrix, int size);
inline friend Matrix concatenate(Matrix& matr1, Matrix& matr2);
inline friend Matrix algebraAddition(int i, int j, Matrix& matr);
inline friend Matrix transpose(Matrix& matr1);
inline friend Matrix invert(Matrix& matr);
inline friend Matrix power(Matrix& matr, int power);
inline friend Matrix solve(Matrix& matr_a, Matrix& matr_f);
inline friend Matrix operator * (double a, Matrix& matr) noexcept;
};
}