my_matrix.h
来自「DEV C++ 写的一个矩阵类」· C头文件 代码 · 共 43 行
H
43 行
#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 + =
减小字号Ctrl + -
显示快捷键?