
#ifndef _WIN32
#include "../include/lminmaxgd.h"
#else
#include "..\include\lminmaxgd.h"
using namespace std;
#endif

#include <time.h>
#include <stdio.h>
// sample.cpp :
// you must link with a library which contains all source files given in folder src
// gd.cpp poly.cpp serie.cpp smatrix.cpp tools.cpp interf.cpp
// or add these files in your project
// or alternatively you can include the folowing files
//
//#include "..\src\gd.cpp"
//#include "..\src\poly.cpp"
//#include "..\src\serie.cpp"
//#include "..\src\smatrix.cpp"
//#include "..\src\tools.cpp"





#define nrow 10
#define ncol 2

int main(void)

{
	try
	{
//**********************************************************************/
// this example compute the star of the matrix found in
// "On Large Scale Max-plus algebra Model in Railway systems"
// Olsder, Subiono, Mc Gettrick
// Ecole de printemps INRIA,
// Algèbre max-plus et applications en informatique et automatique, 1999
//**********************************************************************/



	smatrix A(nrow,nrow),H(nrow,nrow),Htime(nrow,nrow); // matrix of series declaration
	gd m; // monomial declaration


 A(0,3).init(epsilon,m.init(1,58),e);
    A(1,0).init(epsilon,m.init(2,61),e);
    A(1,7).init(epsilon,e,e);

    A(2,1).init(epsilon,m.init(1,81),e);
    A(2,8).init(epsilon,e,e);

    A(3,2).init(epsilon,m.init(2,86),e);

    A(4,7).init(epsilon,m.init(1,58),e);

    A(5,3).init(epsilon,e,e);
    A(5,4).init(epsilon,m.init(1,61),e);

    A(6,5).init(epsilon,m.init(1,35),e);
    A(6,9).init(epsilon,e,e);

    A(7,6).init(epsilon,m.init(1,36),e);

    A(8,2).init(epsilon,e,e);
    A(8,9).init(epsilon,m.init(1,69),e);

    A(9,6).init(epsilon,e,e);
    A(9,8).init(epsilon,m.init(2,69),e);


	 std::cout<<"A"<<A;

	H=star(A);

	 std::cout<<"H"<<H;
	 return 0;
	}



catch(mem_limite l)
 {
 std::cout<<"Exception : too many coefficent in polynom "<<l.memoire<< std::endl;
	 return(1);
 }

 catch(taille_incorrecte obj)
 { // 0 : r non causal
   // 1 : tentative d'accès à un element d'une matrice avec un indice incorrect
   // 2 : matrice de taille incompatible pour oplus, inf, otimes, rfrac, lfrac
   // 3 : etoile de matrice carré uniquement
 std::cout<<"Exception  "<<obj.erreur<< std::endl;
	 return(1);
 }

}
