Ian Jauslin
summaryrefslogtreecommitdiff
blob: 67ec1de718806da1a3b08ffca3083ce7e62dfb8f (plain)
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
/*
Copyright 2016 Ian Jauslin

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

/*
  Computation of the sunrise diagram

  Takes a pointer to an integrand function 'I' as an argument. 'I' must have the following arguments
    long double I(long double p1, long double p2, long double q1, long double q2, long double K1, long double K2, long double t1, long double t2, long double phi, long double W)
*/

#ifndef SS_INTEGRAL_DOUBLE_H
#define SS_INTEGRAL_DOUBLE_H

#include <libinum.h>
#include "double_util.h"

// extra arguments for the integrations
// A_FF
typedef struct ssFF_argsint_rho_double {
  hh_params_double params;
  TYPE_I_DOUBLE;
  array_ldouble abcissa;
  array_ldouble weights;
} ssFF_argsint_rho_double;
typedef struct ssFF_argsint_theta_double {
  hh_params_double params;
  TYPE_I_DOUBLE;
  array_ldouble abcissa;
  array_ldouble weights;
  long double rho;
} ssFF_argsint_theta_double;
typedef struct ssFF_argsint_psi_double {
  hh_params_double params;
  TYPE_I_DOUBLE;
  array_ldouble abcissa;
  array_ldouble weights;
  long double rho;
  long double theta;
} ssFF_argsint_psi_double;
typedef struct ssFF_argsint_z_double {
  hh_params_double params;
  TYPE_I_DOUBLE;
  long double rho;
  long double theta;
  long double psi;
} ssFF_argsint_z_double;

// A_RF
typedef struct ssRF_argsint_theta_double {
  hh_params_double params;
  TYPE_I_DOUBLE;
  array_ldouble abcissa;
  array_ldouble weights;
} ssRF_argsint_theta_double;
typedef struct ssRF_argsint_varphi_double {
  hh_params_double params;
  TYPE_I_DOUBLE;
  array_ldouble abcissa;
  array_ldouble weights;
  long double theta;
} ssRF_argsint_varphi_double;
typedef struct ssRF_argsint_r_double {
  hh_params_double params;
  TYPE_I_DOUBLE;
  array_ldouble abcissa;
  array_ldouble weights;
  long double theta;
  long double varphi;
} ssRF_argsint_r_double;
typedef struct ssRF_argsint_rho_double {
  hh_params_double params;
  TYPE_I_DOUBLE;
  long double theta;
  long double varphi;
  long double r;
} ssRF_argsint_rho_double;

// A_RR
typedef struct ssRR_argsint_theta_double {
  hh_params_double params;
  TYPE_I_DOUBLE;
  array_ldouble abcissa;
  array_ldouble weights;
  int sector_theta;
} ssRR_argsint_theta_double;
typedef struct ssRR_argsint_varphi_double {
  hh_params_double params;
  TYPE_I_DOUBLE;
  array_ldouble abcissa;
  array_ldouble weights;
  int sector_theta;
  long double theta;
} ssRR_argsint_varphi_double;
typedef struct ssRR_argsint_r_double {
  hh_params_double params;
  TYPE_I_DOUBLE;
  array_ldouble abcissa;
  array_ldouble weights;
  long double theta;
  long double varphi;
} ssRR_argsint_r_double;
typedef struct ssRR_argsint_rho_double {
  hh_params_double params;
  TYPE_I_DOUBLE;
  long double theta;
  long double varphi;
  long double r;
} ssRR_argsint_rho_double;


// compute the integral
int ss_integrate_double(long double* out, TYPE_I_DOUBLE, hh_params_double params, array_ldouble abcissa, array_ldouble weights, unsigned int threads);

// compute the integral A_FF
int ssFF_integrate_double(long double* out, TYPE_I_DOUBLE, hh_params_double params, array_ldouble abcissa, array_ldouble weights, unsigned int threads);
// integrand of the integral over rho in A_FF
int ssFF_integrand_rho_double(long double* out, long double rho, void* args);
// integrand of the integral over theta in A_FF
int ssFF_integrand_theta_double(long double* out, long double theta, void* args);
// integrand of the integral over psi in A_FF
int ssFF_integrand_psi_double(long double* out, long double psi, void* args);
// integrand of the integral over z in A_FF
int ssFF_integrand_z_double(long double* out, long double z, void* args);

// compute the integral A_RF
int ssRF_integrate_double(long double* out, TYPE_I_DOUBLE, hh_params_double params, array_ldouble abcissa, array_ldouble weights, unsigned int threads);
// integrand of the integral over theta in A_RF
int ssRF_integrand_theta_double(long double* out, long double theta, void* args);
// integrand of the integral over varphi in A_RF
int ssRF_integrand_varphi_double(long double* out, long double varphi, void* args);
// integrand of the integral over r in A_RF
int ssRF_integrand_r_double(long double* out, long double r, void* args);
// integrand of the integral over rho in A_RF
int ssRF_integrand_rho_double(long double* out, long double rho, void* args);

// compute the integral A_RR
int ssRR_integrate_double(long double* out, TYPE_I_DOUBLE, hh_params_double params, array_ldouble abcissa, array_ldouble weights, unsigned int threads);
// integrand of the integral over theta in A_RR
int ssRR_integrand_theta_double(long double* out, long double theta, void* args);
// integrand of the integral over varphi in A_RR
int ssRR_integrand_varphi_double(long double* out, long double varphi, void* args);
// integrand of the integral over r in A_RR
int ssRR_integrand_r_double(long double* out, long double r, void* args);
// integrand of the integral over rho in A_RR
int ssRR_integrand_rho_double(long double* out, long double rho, void* args);

// R(theta;
long double ss_R_double(long double theta, int sector);

// cutoff function
long double ss_cutoff_double(long double x);

// periodic norm
long double ss_norm_double(long double k1, long double k2);

#endif