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

📄 matrix.cpp

📁 可以做數學陣列的反轉, 是一個cla
💻 CPP
字号:
/**//***
*	ref:
*   author:XieXiaokui
*    purpose:Defines functions for matrix
*
***/
//#pragma once

#include <iostream>
#include <fstream>

#include <string>
#include <sstream>
#include <algorithm>
#include <functional>
#include <numeric>
#include <iterator>
#include <cassert>

//#include "MatrixException.h"

using namespace std;

class Matrix
{
public:
  
    // Constructors
    Matrix();
    Matrix(int size);
    Matrix(int row,int col);
    Matrix(const Matrix& m);

    // Destructor
    ~Matrix();

    // Assignment operators
    Matrix& operator= (const Matrix& m);

    // Value extraction method
    int GetRow() const;
    int GetCol() const;

    // Subscript operator
    double operator()(int i,int j)const;    //subscript operator to get individual elements
    double& operator()(int i,int j);    //subscript operator to set individual elements

    // Unary operators
    Matrix operator+() const;    //unary negation operator
    Matrix operator-() const;    //unary negation operator

    //Binary operators
    Matrix operator+(const Matrix& m) const;
    Matrix operator-(const Matrix& m) const;
    Matrix operator*(const Matrix& m) const;
//    Matrix operator*(double d)const;
    Matrix operator/(const Matrix& m) const;
    Matrix operator/(double d) const;
    Matrix operator^(int pow) const;

    bool operator== (const Matrix& m) const;    //logical equal-to operator
    bool operator!= (const Matrix& m) const;    //logical not-equal-to operator

    friend Matrix operator* (double d,const Matrix& m);
    friend Matrix operator/ (double d,const Matrix& m);



    // Combined assignment - calculation operators
    Matrix& operator +=(const Matrix& m) const;
    Matrix& operator -=(const Matrix& m) const;
    Matrix& operator *=(const Matrix& m) const;
    Matrix& operator *=(double d) const;
    Matrix& operator /=(const Matrix& m) const;
    Matrix& operator /=(double d) const;
    Matrix& operator ^=(int pow) const;

    // Miscellaneous -methods
    void SetZero() ;    //zero matrix:箂?
    void SetUnit() ;    //unit matrix:?

⌨️ 快捷键说明

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