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

📄 matrix.h

📁 用c++的一个矩阵类
💻 H
字号:
#ifndef _MATRIX_H_
#define _MATRIX_H_
#include "math.h"
#include "stdlib.h"

#include "stdio.h"
#include "memory.h"
#include "assert.h"
//#include "windows.h"


class CMatrix
{
public:
 CMatrix();  //
 CMatrix(int nRows, int nCols);
    CMatrix(int nRows, int nCols, double value[]);
 CMatrix(int nSize);
    CMatrix(int nSize, double value[]);
 CMatrix(const CMatrix& m);
 ~CMatrix();
public:
    bool Init(int nRows, int nCols);  //初始化矩阵
    bool MakeUnitMatrix(int nSize);	  //单位矩阵
  
 void SetData(double value[]);		
 bool SetElement(int nRow, int nCol, double value);	//为矩阵中的元素设置数值
 double GetElement(int nRow, int nCol)const;	//获得矩阵中的一个元素
 int GetNumColumns()const; 
 int GetNumRows()const; 
 double* GetData()const; 
 CMatrix& operator=(const CMatrix& m);
 bool operator==(const CMatrix& m)const; 
 bool operator!=(const CMatrix& m)const; 
 CMatrix operator+(const CMatrix& m)const; 
 CMatrix operator-(const CMatrix& m)const; 
 CMatrix operator*(double value)const; 
 CMatrix operator*(const CMatrix& m)const; 
 CMatrix Transpose()const; 
 CMatrix DinV();
 //CMatrix equation(CMatrix &m,CMatrix &m1);  //一个求解方程的函数
 

 double Det();
 int Rank();
 void Print();



private:
 int m_nNumColumns, m_nNumRows;
 double *m_pData;
};
#endif

⌨️ 快捷键说明

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