⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 my_matrix.h

📁 DEV C++ 写的一个矩阵类
💻 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 + -