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

📄 mat.h

📁 随机搜索法,用于大型复杂优化问题.该方法只支持变量的范围约束,不支持其它类型的约束.
💻 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(int,int,double a[]);
	~mat();
	void zero(int,int);
	void eyemat(int);
	double r(int,int) const;
	void set(int,int,double);
	void set(int,int,int);

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

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);
	mat  operator|=(const mat& a) const;
    mat  operator/=(const mat& a) const;
	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;	
	int length();
	mat Delr(int n) const;
	mat Delc(int) const;
	void Freethis();
public:	
	void setmat(int m,int n,double a[]);
	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 + -