Blame view

validate/compare.h 552 Bytes
f1402849   dmayerich   renewed commit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
  #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