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

📄 mat.h

📁 矩阵类,自己编写,通过较多考验,符合matlab编程习惯,可处理无穷维矩阵和向量
💻 H
字号:
// Mat.h: interface for the Mat class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_MAT_H__AE7610FB_DC4B_4E73_B822_20EDB06A2404__INCLUDED_)
#define AFX_MAT_H__AE7610FB_DC4B_4E73_B822_20EDB06A2404__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

class mat  
{
public:	
	//矩阵基本设置
	mat();
	mat(const mat &other);
	~mat();
	void zero(int,int);
	void eyemat(int);

	double r(int,int) const;
	void set(int,int,double);

	void setr(int,const mat&);
	void setc(int,const mat&);
	
	mat cpr(int);
	mat cpc(int);

public:
	//操作符重载
	mat& operator=(const mat& other);

	mat	 operator*(double value) const;
	mat  operator*(int value) const;
	mat  operator*(const mat& other) const;

	mat	 operator+(const mat& other) const;
	mat	 operator-(const mat& other) const;	

	mat operator/(int value) const;
	mat operator/(double value) const;	
	mat operator/(const mat& other) const;	

	mat operator^(const mat& c) const;    //cross 
	double operator|(const mat& a) const; //dot

	void operator||(mat);
	void operator||(double);

public:
	//基本运算
	double detmat() const;
	mat adj() const;
	mat T() const;
	double normmat() const;
	mat sub_mat(int,int) const;
	mat invmat() const;	

public:
	//矩阵方程及若干算法
	double Intf(double,double,double,double) const;
	mat intm(const mat&,const mat&,const mat&,double) const;

	double inperp(mat,double) const;
	void setarray(double []);
	void linespace(double,double,double);

	mat max1mat(int,int) const;
	mat maxmat() const;
	int length();
	void Jieduan(int);
	mat Sortmat() const;
	mat Delr(int n) const;
	mat Delc(int) const;
	void Freethis();
public:
	double *p;	
	int row;
	int col;
};
#endif // !defined(AFX_MAT_H__AE7610FB_DC4B_4E73_B822_20EDB06A2404__INCLUDED_)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -