herwig
is hosted by
Hepforge
,
IPPP Durham
Herwig
7.3.0
Looptools
include
ftypes.h
1
#ifndef FTYPES_H
2
#define FTYPES_H
3
4
#define FORTRAN(s) s##_
5
6
#if QUAD
7
8
#define RealType long double
9
10
#pragma pack(push, 1)
11
typedef
struct
{
12
unsigned
long
long
frac;
13
unsigned
short
exp;
14
} REAL10;
15
typedef
struct
{
16
char
zero
[6];
17
unsigned
long
long
frac;
18
unsigned
short
exp;
19
} REAL16;
20
#pragma pack(pop)
21
22
typedef
union
{
23
long
double
r10;
24
REAL10 i10;
25
REAL16 i16;
26
unsigned
long
long
i8[2];
27
} REAL;
28
29
static
inline
REAL ToREAL(
const
RealType r) {
30
REAL n;
31
n.i8[0] = 0;
32
n.i16.frac = ((REAL *)&r)->i10.frac << 1;
33
n.i16.exp = ((REAL *)&r)->i10.exp;
34
return
n;
35
}
36
37
static
inline
RealType ToReal(
const
REAL r) {
38
REAL n;
39
const
long
long
z = r.i16.frac | (r.i16.exp & 0x7fff);
40
n.i10.frac = (r.i16.frac >> 1) | ((z | -z) & 0x8000000000000000LL);
41
n.i10.exp = r.i16.exp;
42
return
n.r10;
43
}
44
45
static
inline
void
ToRealArray(RealType *out,
const
REAL *in,
const
int
n) {
46
int
i;
47
for
( i = 0; i < n; ++i ) out[i] = ToReal(in[i]);
48
}
49
50
static
inline
void
ToREALArray(REAL *out,
const
RealType *in,
const
int
n) {
51
int
i;
52
for
( i = 0; i < n; ++i ) out[i] = ToREAL(in[i]);
53
}
54
55
#else
56
57
#define RealType double
58
typedef
double
REAL;
59
60
#define ToReal(r) (r)
61
#define ToREAL(r) (r)
62
63
#endif
64
65
typedef
int
INTEGER;
66
typedef
const
INTEGER CINTEGER;
67
typedef
const
REAL CREAL;
68
typedef
struct
{ REAL re, im; }
COMPLEX
;
69
typedef
const
COMPLEX
CCOMPLEX
;
70
typedef
char
CHARACTER;
71
typedef
const
CHARACTER CCHARACTER;
72
73
#include <complex>
74
typedef
std::complex<RealType> ComplexType;
75
#define ToComplex(c) ComplexType(ToReal((c).re), ToReal((c).im))
76
#define ToComplex2(r,i) ComplexType(r, i)
77
#define Re(x) std::real(x)
78
#define Im(x) std::imag(x)
79
#define Conjugate(x) std::conj(x)
80
81
typedef
const
RealType cRealType;
82
typedef
const
ComplexType cComplexType;
83
84
#endif
85
Herwig::RandomHelpers::zero
Generator< Zero > zero(double low, double up)
Construct a zero density.
Definition:
RandomHelpers.h:972
COMPLEX
Definition:
clooptools.h:27
Generated on Thu Jun 20 2024 17:50:52 for Herwig by
1.9.6