#include <iostream>
#include <kv/ode-maffine.hpp>
#include <kv/autodif.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;
	}
};

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

	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::autodif<itv>::split(ax, y, dy);

	std::cout << y << "\n";
	std::cout << dy << "\n";
}
