Language: C++

#include "Matrix.h"

    Matrix::Matrix(int sizeR, int sizeC, double val){
    M = sizeR; // Set number of rows.
    N = sizeC; // Set number of cols.
    data = new double[sizeR * sizeC]; 
    }

    Matrix::Matrix(int sizeR, int sizeC, double* inputData){    
    M = sizeR;
    N = sizeC;

    data = new double[sizeR * sizeC]; // Set data sixe
    for (int i = 0; i < sizeR * sizeC; i++) //  input data store
    {
        data[i] = inputData[i];
    }
    }

    Matrix::~Matrix(){
    delete[] data;
    data = 0;
    }

    Matrix::Matrix(const Matrix& existingMatrix){
    M = existingMatrix.M;
    N = existingMatrix.N;

    data = new double[M * N]; // Allocate memory
    for (int i = 0; i < M * N; i++) 
    {
        data[i] = existingMatrix.data[i];
    }
    }

         Matrix Matrix::getBlock(int width, int height, int r, int c, int yMove,     int xMove) const{  
    int startCol = r * width;
    int startRow = c * height;
    int cols = width;
    int rows = height;
    Matrix R(rows, cols, 0.0);

    for (int i = 0; i < rows; i++) {

        for (int ii = 0; ii < cols; ii++) {

            R.setElmt(i, ii, getElmt(i + startRow + yMove, ii + startCol + xMove));
        }
        }return R;
     }

    void Matrix::setBlock(int r, int c, int yMove, int xMove, const Matrix& blockValues){
    int rows = blockValues.M;
    int cols = blockValues.N;
    int startCol = c * blockValues.N;
    int startRow = r * blockValues.M;

    for (int i = 0; i < rows; i++) // Rows
    {
        for (int ii = 0; ii < cols; ii++) //Cols
        {
            this->setElmt(i + startRow + yMove, ii + startCol +     xMove, blockValues.getElmt(i, ii));
        }
    }
}

double Matrix::getElmt(int i, int j) const{
    return data[i * N + j];
}

void Matrix::setElmt(int i, int j, double val)
{
    data[i * N + j] = val;
}

int Matrix::getCol() const{
    return N;
}

int Matrix::getRow() const{
    return M;
}

Matrix Matrix::operator-(double value){
    double val = 0;
    Matrix C(M, N, val);

    for (int i = 0; i < M; i++) // Rows
    {
        for (int j = 0; j < N; j++) // Cols
        {
            val = data[i * N + j] - value;
            C.setElmt(i, j, val);
        }
    }return C;
}

Matrix Matrix::operator*(const Matrix& B){
    double val = 0;
    Matrix C(M, N, val);

    for (int i = 0; i < M; i++) // Rows
    {
        for (int j = 0; j < N; j++) // Cols
        {
            val = data[i * N + j] * B.getElmt(i, j);
            C.setElmt(i, j, val);
        }
    }
    return C;
}

Matrix& Matrix::operator=(const Matrix& B){
    if (this == &B) {
        return *this;
    }
    else {
        delete[] data;

        M = B.getRow();
        N = B.getCol();
        data = new double[M * N];

        for (int i = 0; i < M; i++) // Rows
        {
            for (int j = 0; j < N; j++) // Cols
            {
                setElmt(i, j, B.getElmt(i, j));
            }
        }
    }
}

double Matrix::getSum() const{
    double result = 0.0;

    for (int i = 0; i < M * N; i++) {
        result += data[i];
    }
    return result;

Compiler output:
a.cc:1:10: fatal error: Matrix.h: No such file or directory
    1 | #include "Matrix.h"
      |          ^~~~~~~~~~
compilation terminated.