compare.h 552 Bytes
#ifndef RTS_VALIDATE_COMPARE_H
#define RTS_VALIDATE_COMPARE_H

#define N		5000
#define epsilon	0.00001

#include <complex>
#include <iostream>
#include <stdlib.h>
#include "rts/complex.h"

template <typename T>
static void compare(std::complex<T> a, rts::complex<T> b, std::string testName)
{
	T diffx = std::abs(a.real() - b.r);
	T diffy = std::abs(a.imag() - b.i);

	if(diffx > epsilon || diffy > epsilon)
	{
		std::cout<<"Failed "<<testName<<std::endl;
		std::cout<<a<<"------"<<b.toStr()<<std::endl;
		exit(1);
	}

}

#endif