📄 my_matrix.h
字号:
#ifndef GUARD_MY_MATRIX
#define GUARD_MY_MATRIX
#include <vector>
#include <iostream>
class matrix
{
friend std::istream& operator>>(std::istream&,matrix&);
friend std::ostream& operator<<(std::ostream&,const matrix&);
friend matrix operator*(double,const matrix&);
public:
matrix(){}
matrix(int i,int j);
matrix(const std::vector<std::vector<double> >& orig):vec_vec(orig){}
std::vector<double>& operator[](int i){return vec_vec[i];}
matrix operator*(matrix mat)const;
matrix operator*(double)const;
matrix operator+(const matrix& mat)const;
matrix& operator+=(const matrix& mat);
matrix operator-(const matrix& mat)const;
matrix& operator-=(const matrix& mat);
matrix operator-()const;
matrix trans();
matrix inver();
double mold();
private:
std::vector<std::vector<double> > vec_vec;
bool empty(){ return vec_vec.empty(); }
bool empty()const { return vec_vec.empty(); }
void changeline(int i,int j){vec_vec[i].swap(vec_vec[j]);}
int maxrow(int);
matrix elim(int&);
};
std::istream& operator>>(std::istream&,matrix&);
std::ostream& operator<<(std::ostream&,const matrix&);
matrix operator*(double,const matrix&);
double fab(double);
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -