#include <gpk_std.h>
#include "../nltrans.h"
#include "../v2.h"
#include <stdio.h>
#include <assert.h>


main()
{
 C vector_space A("A");
 C vector_space B("B");

 C vector2 cA(1,0, &A);
 C vector2 cB(5,7, &B);

 C nltransform AtoB(cA, cB, matrix22(1.1,0.1,-0.2,0.95),
						tensor222(.01,-.01,.01,.02,-.02,-.015,.01,.02));

 double x;
 for(x=0;x<2;x+=0.8)	{
	double y;
	for(y=0;y<1;y+=0.3)	{
		C vector2 xy(x,y, &A);
		C vector2 xyB = AtoB(xy);
		assert(vector_space::vseQ(xyB.space(), &B));
		C vector2 back = AtoB.inverse(xyB);
		assert(dist(back-xy) < 1e-6);
		}
	}
 printf("OK\n");
}
