#include "AnT.hpp"


#define a parameters[0]
#define b parameters[1]
#define X currentState[0]
#define Y currentState[1]

// return value x mod y is between 0 and y
real_t mod (real_t x, real_t y)
{
    if (x > 0)
	while (x > y) 
	    x -= y;
    else
	while (x < 0) 
	    x += y;

    return x;
}

bool sinai (const Array<real_t>&currentState,
	    const Array<real_t>& parameters,
	    Array<real_t>& rhs)
{
    
    rhs[0] = mod (X + Y + a * cos(Two_Pi * Y), 1.0 );
    rhs[1] = mod (X + 2.0 * Y, 1.0);

    return true;
}

#undef a
#undef b
#undef X
#undef Y

extern "C" 
{

void connectSystem ()
{
  MapProxy::systemFunction = sinai;

}

}


