MathFunctions.h 877 Bytes
Newer Older
1
2
#ifndef AMDIS_MATHFUNCTIONS_H
#define AMDIS_MATHFUNCTIONS_H
Praetorius, Simon's avatar
Praetorius, Simon committed
3

4
  {
5
    if (r < 0)
6
      return 1;
7
    if (r > 0)
8
9
10
11
12
13
14
15
16
17
18
19
//
// Software License for AMDiS
//
// Copyright (c) 2010 Dresden University of Technology 
// All rights reserved.
// Authors: Simon Vey, Thomas Witkowski et al.
//
// This file is part of AMDiS
//
// See also license.opensource.txt in the distribution.


20
21
22
23
      return -1;
    return 0;
  }

24
  inline double Phi1ToR(double p1, double eps) {
25
26
27
    double x = max(-1.0 + numeric_limits< double >::epsilon(), 
		    min(1.0 - numeric_limits< double >::epsilon(), p1));
    return eps / 3.0 * log((1 + x) / (1 - x)) * 0.5;
28
  }
29

30
  inline double Phi2ToR(double p2, double eps) {
31
32
33
    double x = max(-1.0 + numeric_limits< double >::epsilon(), 
		    min(1.0 - numeric_limits< double >::epsilon(), 1 + 2 * p2));
    return eps / 3.0 * log( (1 + x) / (1 - x) );
34
  }
35

36
37
}
#endif