#include <iostream>
#include <fstream>
#include <stdexcept>
#include "matrix.h"
using namespace std;

int main() {

  // perform tests based on a matrix read from a file
  fstream fin;

  do {
    if (fin.fail()) {
      cout << "Unable to open file." << endl;
      fin.clear();
    }
    string filename;
    cout << "Enter filename containing origin matrix: ";
    cin >> filename;
    fin.open(filename.c_str());
  } while (fin.fail());

  matrix A;
  fin >> A;

  cout << "Matrix A was read as:" << endl;
  cout << A << endl;


  matrix_proxy P = A(range(3,5), range(4,9));
  cout << "Proxy for A(range(3,5), range(4,9)) appears as" << endl;
  cout << P;

  matrix B(P);   // B becomes a matrix that is a copy of current proxy
  cout << "Copy B of proxy P appears as" << endl;
  cout << B;

  cout << endl;
  P(0,2) = 0;
  cout << "After P(0,2) = 0, proxy appears as" << endl;
  cout << P;
  cout << "original A appears as" << endl;
  cout << A;
  cout << "and matrix B appears as" << endl;
  cout << B;

  // add many more tests here
  

}
