#include <iostream>
#include <kv/ode-maffine.hpp>
#include <kv/autodif.hpp>
#include <kv/ode-callback.hpp>

namespace ub = boost::numeric::ublas;
typedef kv::interval<double> itv;

struct Func {
	template <class T> ub::vector<T> operator() (const ub::vector<T>& x, T t){
		ub::vector<T> y(2);

		y(0) = x(1);
		y(1) = -x(0); 
		return y;
	}
};

namespace kv {
template <class T> struct ode_callback_sample : ode_callback<T> {
	virtual bool operator()(const interval<T>& start, const interval<T>& end, const ub::vector< interval<T> >& x_s, const ub::vector< interval<T> >& x_e, const ub::vector< psa< interval<T> > >& result) const {
		std::cout << "t: " << end << "\n";
		std::cout << "x: " << x_e << "\n";
		return true;
	}
};
}

int main()
{
	ub::vector<itv> x;
	ub::vector< kv::autodif<itv> > ax;
	itv end;
	int r;

	std::cout.precision(17);

	x.resize(2);
	x(0) = 0.;
	x(1) = 1.;

	ax = kv::autodif<itv>::init(x);

	end = 10.;
	r = kv::odelong_maffine(Func(), ax, itv(0.), end, kv::ode_param<double>(), kv::ode_callback_sample<double>());
}
