水准网平差c++代码
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
水准网平差
结果
#include
#include
#include
#include
#define max 50
class CMatrix
{
public:
CMatrix(){row=0; column=0;}; // 默认构造函数
CMatrix(int i, int j){row=i;column=j;} // 构造函数一
CMatrix(const CMatrix& m); // 复制构造函数
~CMatrix(void){/*cout<<"谢谢使用,矩阵所占空间以释放!"< CMatrix& operator=(const CMatrix& m); // 赋值运算符 bool operator==(const CMatrix& m); // 比括较运算符 bool operator!=(const CMatrix& m); // 比括较运算符 CMatrix operator+(const CMatrix& m); // 加运算符 CMatrix operator-(const CMatrix& m); // 减运算符 CMatrix& operator+=(const CMatrix& m); // 自加运算符 CMatrix& operator-=(const CMatrix& m); // 自减运算符 CMatrix operator-();// 取负数 CMatrix& operator*(const CMatrix& m); // 乘法运算符 void input(); //输入矩阵 void outputMatrix(); // 输出该矩阵 void setValue(int row, int column, double value) { A[row-1][column-1] = value; }// 设 置(i,j)的值 double getValue(int row, int column) const { return A[row-1][column-1]; }// 设置行、列的值 void setRow(const int i) { row = i; } int getRow() const { return row; } void setColunm(const int i) { column = i; } int getColumn() const { return column; } CMatrix& change(int i, int j);//交换矩 阵的行 CMatrix& transpose(); // 矩阵转置 CMatrix& inverse(); // 矩阵求逆 void find(int& f)const;// 判断该矩阵 是否可用于迭代求解 friend void jocabi(const CMatrix& a) ; //迭代求解 void lzys(); //列主元素法求解 void solve(); //可逆线性矩阵求解 void qxnh(); //曲线拟合 private:// 成员变量 double A[max][max]; int row;// 行 int column;// 列 }; void CMatrix::input() //输入 { cout<<"开始输入矩阵值:"< int i, j; double z; for(i=0;i { cout<<"请输入第"< for(j=0;j { cin>>z; A[i][j]=z; } } cout< CMatrix::CMatrix(const CMatrix& m) // 复制构造函数 { int i, j; for(i=0;i for(j=0;j this->A[i][j]=m.A[i][j]; }; CMatrix& CMatrix::operator=(const CMatrix& m) // 赋值运算符 { int i,j; for(i=0;i { for(j=0;j A[i][j]=m.A[i][j]; } return *this; }; bool CMatrix::operator ==(const CMatrix& m) // 比括较运算符 { int i,j,k; for(i=0;i { for(j=0;j if(this->A[i][j]=m.A[i][j]) k=1; else k=0; } if(k=1) return true; else return false; }; bool CMatrix::operator !=(const CMatrix& m) // 比括较运算符 { int i,j,k; for(i=0;i { for(j=0;j if(this->A[i][j]=m.A[i][j]) k=1;