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




/////////////////////////////////////////////////////////////////////
/* Example :
we try to find a counter example to the follwoing assertion
A*B (CA*B \ CA*B) = A*B => (A*B/CA*B) CA*B =A*B
*/
#include "..\src\gd.cpp"
#include "..\src\poly.cpp"
#include "..\src\serie.cpp"
#include "..\src\smatrix.cpp"
#include "..\src\tools.cpp"
#define N 5
using namespace std;

int main(void)
{
try{
clock_t start, finish;
srand(time(NULL));
//struct rusage ru;
clock_t duration,duration2;
poly p1;
poly p2,p3,p4;
smatrix l;


smatrix C(1,4);
smatrix A(4,4);
smatrix B(4,1);
smatrix AS;
smatrix AB;
smatrix CAB;
smatrix u,y;
smatrix z(1,1);




int i,j;
int n0=_infinity,t0=_infinity;
int n,t;
gd r;

p1.init(2,24)(3,33)(4,infinity);
z(0,0).init(epsilon,p1,e);

 B(0,0).init(epsilon,r.init(0,1),e);
 A(0,0).init(epsilon,r.init(3,5),e);
 A(1,0).init(epsilon,r.init(0,7),e);
 A(1,1).init(epsilon,r.init(1,4),e);
 A(2,0).init(epsilon,r.init(0,8),e);
 A(2,2).init(epsilon,r.init(2,4),e);

 A(3,1).init(epsilon,r.init(0,5),e);
 A(3,2).init(epsilon,r.init(0,5),e);
 A(3,3).init(epsilon,r.init(1,4),e);

 C(0,3).init(epsilon,r.init(0,5),e);

 AS=star(A);
 AB=otimes(AS,B);
 CAB=otimes(C,AB);

cout <<"CAB"<<CAB<<endl;
u=lfrac(z,CAB);
cout<<" u"<<u<<endl;
y=otimes(CAB,u);
cout<<" y"<<y<<endl;






//cout<<"AS= "<<AS<<endl;
return(0);
 }
  catch(mem_limite l)
 {
	 cout<<"Exception : too many coefficent in polynom "<<l.memoire<<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
	 cout<<"Exception  "<<obj.erreur<<endl;
	 return(1);
 }
}
