#include <iostream>
using namespace std;

#include <gausselim.h>
#include <gausselimtest.h>
#include <print.h>

void gausselimtest::test01()
{
  double e2[] = 
  { 
    3.0, 5.0, 2.0,
    3.0, 5.0, 5.0
  };

  cout << "Inconsistent gaussian elimination example." << endl;

  gausselim<double> g(e2,2);

  cout << (stringc)g << endl;

  bool res = g.eval();

  cout << "Solve" << endl;

  cout << (stringc)g << endl;

  cout << "Result:  ";
 
  cout << SHOW(res) << endl;

}

void gausselimtest::test02()
{
  double e3[] = 
  {
    1.0, 5.0, 0.0, 11.0,
    1.0, 1.0, 1.0, 0.0,
    2.0, 0.0, 1.0, -1.0
  };

  cout << "Solve a 3 by 3 linear equations system." << endl;

  gausselim<double> g(e3,3);

  cout << "Initial system" << endl;
  cout << (stringc)g << endl;

  cout << endl;
  cout << "Solve system." << endl;

  g.eval();
  
  cout << (stringc)g << endl;

  cout << "Get solution" << endl;
  double s[3];
  g.columnC(s);

  cout << print(s,s+3) << endl;
  cout << endl;

}




