Ian Jauslin
summaryrefslogtreecommitdiff
blob: fb30ddd0953cce18a3d113a01734128505bab734 (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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
/*
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
*/

#ifndef SS_INTEGRAL_H
#define SS_INTEGRAL_H

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

// compute pi and sqrt3 ahead of time
struct ss_cache {
  mpfr_t pi;
  mpfr_t sqrt3;
};

// extra arguments for the integrations
// A_FF
typedef struct ssFF_argsint_rho {
  hh_params params;
  TYPE_I;
  array_mpfr abcissa;
  array_mpfr weights;
  struct ss_cache cache;
  array_2_mpfr tmpss;
  array_pthread_t* thread_ids;
} ssFF_argsint_rho;
typedef struct ssFF_argsint_theta {
  hh_params params;
  TYPE_I;
  array_mpfr abcissa;
  array_mpfr weights;
  struct ss_cache cache;
  array_2_mpfr tmpss;
  mpfr_ptr rho;
} ssFF_argsint_theta;
typedef struct ssFF_argsint_psi {
  hh_params params;
  TYPE_I;
  array_mpfr abcissa;
  array_mpfr weights;
  struct ss_cache cache;
  array_2_mpfr tmpss;
  mpfr_ptr rho;
  mpfr_ptr theta;
} ssFF_argsint_psi;
typedef struct ssFF_argsint_z {
  hh_params params;
  TYPE_I;
  struct ss_cache cache;
  array_2_mpfr tmpss;
  mpfr_ptr rho;
  mpfr_ptr theta;
  mpfr_ptr psi;
} ssFF_argsint_z;

// A_RF
typedef struct ssRF_argsint_theta {
  hh_params params;
  TYPE_I;
  array_mpfr abcissa;
  array_mpfr weights;
  struct ss_cache cache;
  array_2_mpfr tmpss;
  array_pthread_t* thread_ids;
} ssRF_argsint_theta;
typedef struct ssRF_argsint_varphi {
  hh_params params;
  TYPE_I;
  array_mpfr abcissa;
  array_mpfr weights;
  struct ss_cache cache;
  array_2_mpfr tmpss;
  mpfr_ptr theta;
} ssRF_argsint_varphi;
typedef struct ssRF_argsint_r {
  hh_params params;
  TYPE_I;
  array_mpfr abcissa;
  array_mpfr weights;
  struct ss_cache cache;
  array_2_mpfr tmpss;
  mpfr_ptr theta;
  mpfr_ptr varphi;
} ssRF_argsint_r;
typedef struct ssRF_argsint_rho {
  hh_params params;
  TYPE_I;
  struct ss_cache cache;
  array_2_mpfr tmpss;
  mpfr_ptr theta;
  mpfr_ptr varphi;
  mpfr_ptr r;
} ssRF_argsint_rho;

// A_RR
typedef struct ssRR_argsint_theta {
  hh_params params;
  TYPE_I;
  array_mpfr abcissa;
  array_mpfr weights;
  struct ss_cache cache;
  array_2_mpfr tmpss;
  array_pthread_t* thread_ids;
  int sector_theta;
} ssRR_argsint_theta;
typedef struct ssRR_argsint_varphi {
  hh_params params;
  TYPE_I;
  array_mpfr abcissa;
  array_mpfr weights;
  struct ss_cache cache;
  array_2_mpfr tmpss;
  int sector_theta;
  mpfr_ptr theta;
} ssRR_argsint_varphi;
typedef struct ssRR_argsint_r {
  hh_params params;
  TYPE_I;
  array_mpfr abcissa;
  array_mpfr weights;
  struct ss_cache cache;
  array_2_mpfr tmpss;
  mpfr_ptr theta;
  mpfr_ptr varphi;
} ssRR_argsint_r;
typedef struct ssRR_argsint_rho {
  hh_params params;
  TYPE_I;
  struct ss_cache cache;
  array_2_mpfr tmpss;
  mpfr_ptr theta;
  mpfr_ptr varphi;
  mpfr_ptr r;
} ssRR_argsint_rho;

// compute the integral
int ss_integrate(mpfr_t* out, TYPE_I, hh_params params, array_mpfr abcissa, array_mpfr weights, unsigned int threads);

// compute the integral A_FF
int ssFF_integrate(mpfr_t* out, TYPE_I, hh_params params, array_mpfr abcissa, array_mpfr weights, struct ss_cache cache, array_2_mpfr tmpss , unsigned int threads);
// integrand of the integral over rho in A_FF
int ssFF_integrand_rho(mpfr_t* out, mpfr_t rho, void* args);
// integrand of the integral over theta in A_FF
int ssFF_integrand_theta(mpfr_t* out, mpfr_t theta, void* args);
// integrand of the integral over psi in A_FF
int ssFF_integrand_psi(mpfr_t* out, mpfr_t psi, void* args);
// integrand of the integral over z in A_FF
int ssFF_integrand_z(mpfr_t* out, mpfr_t z, void* args);

// compute the integral A_RF
int ssRF_integrate(mpfr_t* out, TYPE_I, hh_params params, array_mpfr abcissa, array_mpfr weights, struct ss_cache cache, array_2_mpfr tmpss, unsigned int threads);
// integrand of the integral over theta in A_RF
int ssRF_integrand_theta(mpfr_t* out, mpfr_t theta, void* args);
// integrand of the integral over varphi in A_RF
int ssRF_integrand_varphi(mpfr_t* out, mpfr_t varphi, void* args);
// integrand of the integral over r in A_RF
int ssRF_integrand_r(mpfr_t* out, mpfr_t r, void* args);
// integrand of the integral over rho in A_RF
int ssRF_integrand_rho(mpfr_t* out, mpfr_t rho, void* args);

// compute the integral A_RR
int ssRR_integrate(mpfr_t* out, TYPE_I, hh_params params, array_mpfr abcissa, array_mpfr weights, struct ss_cache cache, array_2_mpfr tmpss, unsigned int threads);
// integrand of the integral over theta in A_RR
int ssRR_integrand_theta(mpfr_t* out, mpfr_t theta, void* args);
// integrand of the integral over varphi in A_RR
int ssRR_integrand_varphi(mpfr_t* out, mpfr_t varphi, void* args);
// integrand of the integral over r in A_RR
int ssRR_integrand_r(mpfr_t* out, mpfr_t r, void* args);
// integrand of the integral over rho in A_RR
int ssRR_integrand_rho(mpfr_t* out, mpfr_t rho, void* args);

// R(theta)
int ss_R(mpfr_t out, mpfr_t theta, unsigned int sector, struct ss_cache cache);

// cutoff function
int ss_cutoff(mpfr_t out, mpfr_t x, mpfr_t tmp1, mpfr_t tmp2);

// periodic norm
int ss_norm(mpfr_t out, mpfr_t k1, mpfr_t k2, struct ss_cache cache, mpfr_t tmp1, mpfr_t tmp2);

#endif