You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
81 lines
1.6 KiB
C++
81 lines
1.6 KiB
C++
#pragma once
|
|
|
|
#include "Defines.h"
|
|
#include "iAlgMath_global.h"
|
|
|
|
#ifdef _SCAN_OLD_CODE_
|
|
|
|
// 该类库矩阵定义暂未启用,仅供参考
|
|
|
|
// 列向量
|
|
class I_ALGMATH_EXPORT zxMatrixCol
|
|
{
|
|
public:
|
|
|
|
zxMatrixCol();
|
|
zxMatrixCol(int n, double val = 0.0);
|
|
|
|
int rows();
|
|
|
|
double operator()(int i) const;
|
|
double& operator()(int i);
|
|
|
|
double& operator[](int i);
|
|
const double& operator[](int i) const;
|
|
|
|
// 赋值函数
|
|
zxMatrixCol operator= ( zxMatrixCol other);
|
|
|
|
protected:
|
|
// 数据体
|
|
VecDouble m_vecData;
|
|
};
|
|
|
|
// 矩阵优化
|
|
class I_ALGMATH_EXPORT zxMatrix
|
|
{
|
|
public:
|
|
zxMatrix();
|
|
zxMatrix(int rows, int cols, double val = 0.0);
|
|
|
|
// 获取矩阵的行数
|
|
int rows() const;
|
|
// 获取矩阵的列数
|
|
int cols() const;
|
|
|
|
// 设置矩阵元素值
|
|
void set(int row, int col, double value);
|
|
// 获取矩阵元素值
|
|
double get(int row, int col) const;
|
|
// 访问矩阵中的元素
|
|
double operator()(int row, int col = 0) const;
|
|
double& operator()(int row, int col = 0);
|
|
|
|
// 赋值函数
|
|
zxMatrix operator= (zxMatrix other);
|
|
// 矩阵相加
|
|
zxMatrix operator+ (zxMatrix other);
|
|
// 矩阵相减
|
|
zxMatrix operator- ( zxMatrix other);
|
|
// 矩阵相乘
|
|
zxMatrix operator* ( zxMatrix other);
|
|
// 举证求负
|
|
zxMatrix operator- ();
|
|
// 矩阵与行列式相乘
|
|
zxMatrixCol operator* (const zxMatrixCol& vec);
|
|
|
|
// 矩阵转置
|
|
zxMatrix transpose();
|
|
// 矩阵求逆
|
|
zxMatrix inverse();
|
|
// 行列式
|
|
double determinant();
|
|
|
|
protected:
|
|
|
|
// 数据体
|
|
VVecDouble m_vvecData;
|
|
};
|
|
#endif
|
|
|