📄 matrix.h
字号:
#if !defined(AFX_MATRIX_H__ACEC32EA_5254_4C23_A8BD_12F9220EF43A__INCLUDED_)
#define AFX_MATRIX_H__ACEC32EA_5254_4C23_A8BD_12F9220EF43A__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#if !defined(_BITSET_)
# include <bitset>
#endif
#include <math.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& other);
BOOL Init(int nRows, int nCols);
BOOL MakeUnitMatrix(int nSize);
virtual ~CMatrix();
BOOL SetElement(int nRow, int nCol, double value);
double GetElement(int nRow, int nCol) const;
void SetData(double value[]);
int GetNumColumns() const;
int GetNumRows() const;
double* GetData() const;
CMatrix& operator=(const CMatrix& other);
BOOL operator==(const CMatrix& other) const;
BOOL operator!=(const CMatrix& other) const;
CMatrix operator+(const CMatrix& other) const;
CMatrix operator-(const CMatrix& other) const;
CMatrix operator*(double value) const;
CMatrix operator*(const CMatrix& other) const;
CMatrix Transpose() const;
BOOL SplitUV(CMatrix& mtxU, CMatrix& mtxV, double eps = 0.000001); // 一般实矩阵的奇异值分解
BOOL GInvertUV(CMatrix& mtxAP, CMatrix& mtxU, CMatrix& mtxV, double eps = 0.000001); // 求广义逆的奇异值分解法
protected:
int m_nNumColumns; // 矩阵列数
int m_nNumRows; // 矩阵行数
double* m_pData; // 矩阵数据缓冲区
private:
void ppp(double a[], double e[], double s[], double v[], int m, int n);
void sss(double fg[2], double cs[2]);
};
#endif // !defined(AFX_MATRIX_H__ACEC32EA_5254_4C23_A8BD_12F9220EF43A__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -