SoftSUSY is hosted by Hepforge, IPPP Durham
SOFTSUSY  4.1
utils.h
Go to the documentation of this file.
1 
12 #ifndef UTILS_H
13 #define UTILS_H
14 
15 #ifdef HAVE_CONFIG_H
16  #include <config.h>
17 #endif
18 
19 #include "mycomplex.h"
20 #include "def.h"
21 #include <cstdlib>
22 #include <fstream>
23 #include <iostream>
24 #include <cmath>
25 #include <stdio.h>
26 #include <string>
27 #include <exception>
29 #include <csignal>
30 #include <unistd.h>
31 #include <stdlib.h>
32 #include <stdio.h>
33 #include <iostream>
34 #include <signal.h>
35 #include <dirent.h>
36 
37 using namespace std;
38 using namespace softsusy;
39 
41 inline double zeroSqrt(double f){ if (f > 0.) return sqrt(f);
42  else return EPSTOL;
43 }
45 double frexp(const Complex & c, int * i);
47 void FPE_ExceptionHandler(int nErrType);
49 int theta(double a);
51 void outputCharacteristics(int);
53 inline double sqr(double a) { return a * a; }
55 inline double maximum(double a, double b) { return ((a > b) ? a : b); }
57 inline double minimum(double a, double b) { return ((a < b) ? a : b); }
59 inline int minimum(int a, int b) { return ((a < b) ? a : b); }
61 double toleranceCheck(double sTin, double sTout);
62 
63 inline double minimum(double a, double b, double c) {
64  if(a <= b && a <= c) return a;
65  else if(b <= a && b <= c) return b;
66  else return c;
67 }
68 
69 inline double maximum(double a, double b, double c) {
70  if(a >= b && a >= c) return a;
71  else if(b >= a && b >= c) return b;
72  else return c;
73 }
74 
75 inline double middle(double a, double b, double c) {
76  if((a >= b && a <= c) ||(a >= c && a <= b) ) return a;
77  else if((b >= a && b <= c) ||(b >= c && b <= a) ) return b;
78  else return c;
79 }
80 
81 inline int massorder(double & a, double & b, double & c) {
82  double anew, bnew, cnew;
83  anew = minimum(a,b,c);
84  cnew= maximum(a,b,c);
85  bnew = middle(a,b,c);
86 
87  a = anew;
88  b = bnew;
89  c = cnew;
90  return 0;
91 }
92 
95 bool close(double m1, double m2, double tol);
96 
98 bool close(Complex m1, Complex m2, double tol);
99 
101 inline double sign(double a, double b) { return ((b) >= 0.0 ?
102  fabs(a) : -fabs(a)); }
103 
105 inline int sgn(double x)
106 { return (x >= 0.0 ? 1 : -1); }
107 
110 void printRow(ostream & o, double x);
111 
114 bool testNan(double f);
115 
116 // For DEBUGING
117 #ifdef DEBUG
118 #define dout cout
119 #else
120 #define dout if(0)cout
121 #endif
122 
123 
124 #endif
125 
global variable declaration
Definition: def.cpp:13
bool close(double m1, double m2, double tol)
Definition: utils.cpp:68
int theta(double a)
Standard theta function: 1 is a>0, 0 otherwise.
Definition: utils.cpp:25
switches (options) and parameters such as default fermion masses, required accuracy etc ...
void FPE_ExceptionHandler(int nErrType)
Exception handler - will even trap errors in the fortran portion.
Definition: utils.cpp:21
double frexp(const Complex &c, int *i)
Gives exponent of the largest number: either imaginary or real part.
Definition: utils.cpp:12
int sgn(double x)
gives the sign (+-1) of x
Definition: utils.h:105
double toleranceCheck(double sTin, double sTout)
Finds fractional difference between |a| and |b|.
Definition: utils.cpp:42
double sqr(double a)
square of a number
Definition: utils.h:53
double zeroSqrt(double f)
returns either sqrt(f) for f>0 or 0 otherwise
Definition: utils.h:41
complex numbers and operators between them
void printRow(ostream &o, double x)
Definition: utils.cpp:54
double m1
decay global variable declarations
Definition: decays.cpp:14
bool testNan(double f)
Definition: utils.cpp:64
const double EPSTOL
underflow accuracy
Definition: def.h:33
double sign(double a, double b)
Returns |a| with sign of b in front.
Definition: utils.h:101
double maximum(double a, double b)
maximum of two numbers
Definition: utils.h:55
double minimum(double a, double b)
minimum of a and b
Definition: utils.h:57
drop-in replacement for the original home-grown Complex class
Definition: mycomplex.h:17
void outputCharacteristics(int)
Sets number of decimal places to display in scientific output.
Definition: utils.cpp:32