7 #include "hyperspherical.h"
13 #define _index_tt_in_range_(index,num,flag) (flag == _TRUE_) && (index_tt >= index) && (index_tt < index+num)
15 #define _integrated_ncl_ (_index_tt_in_range_(ptr->index_tt_lensing, ppt->selection_num, ppt->has_cl_lensing_potential)) || \
16 (_index_tt_in_range_(ptr->index_tt_nc_lens, ppt->selection_num, ppt->has_nc_lens)) || \
17 (_index_tt_in_range_(ptr->index_tt_nc_g4, ppt->selection_num, ppt->has_nc_gr)) || \
18 (_index_tt_in_range_(ptr->index_tt_nc_g5, ppt->selection_num, ppt->has_nc_gr))
20 #define _nonintegrated_ncl_ (_index_tt_in_range_(ptr->index_tt_density, ppt->selection_num, ppt->has_nc_density)) || \
21 (_index_tt_in_range_(ptr->index_tt_rsd, ppt->selection_num, ppt->has_nc_rsd)) || \
22 (_index_tt_in_range_(ptr->index_tt_d0, ppt->selection_num, ppt->has_nc_rsd)) || \
23 (_index_tt_in_range_(ptr->index_tt_d1, ppt->selection_num, ppt->has_nc_rsd)) || \
24 (_index_tt_in_range_(ptr->index_tt_nc_g1, ppt->selection_num, ppt->has_nc_gr)) || \
25 (_index_tt_in_range_(ptr->index_tt_nc_g2, ppt->selection_num, ppt->has_nc_gr)) || \
26 (_index_tt_in_range_(ptr->index_tt_nc_g3, ppt->selection_num, ppt->has_nc_gr))
28 #define _get_bin_nonintegrated_ncl_(index_tt) \
29 if (_index_tt_in_range_(ptr->index_tt_density, ppt->selection_num, ppt->has_nc_density)) \
30 bin = index_tt - ptr->index_tt_density; \
31 if (_index_tt_in_range_(ptr->index_tt_rsd, ppt->selection_num, ppt->has_nc_rsd)) \
32 bin = index_tt - ptr->index_tt_rsd; \
33 if (_index_tt_in_range_(ptr->index_tt_d0, ppt->selection_num, ppt->has_nc_rsd)) \
34 bin = index_tt - ptr->index_tt_d0; \
35 if (_index_tt_in_range_(ptr->index_tt_d1, ppt->selection_num, ppt->has_nc_rsd)) \
36 bin = index_tt - ptr->index_tt_d1; \
37 if (_index_tt_in_range_(ptr->index_tt_nc_g1, ppt->selection_num, ppt->has_nc_gr)) \
38 bin = index_tt - ptr->index_tt_nc_g1; \
39 if (_index_tt_in_range_(ptr->index_tt_nc_g2, ppt->selection_num, ppt->has_nc_gr)) \
40 bin = index_tt - ptr->index_tt_nc_g2; \
41 if (_index_tt_in_range_(ptr->index_tt_nc_g3, ppt->selection_num, ppt->has_nc_gr)) \
42 bin = index_tt - ptr->index_tt_nc_g3;
44 #define _get_bin_integrated_ncl_(index_tt) \
45 if (_index_tt_in_range_(ptr->index_tt_lensing, ppt->selection_num, ppt->has_cl_lensing_potential)) \
46 bin = index_tt - ptr->index_tt_lensing; \
47 if (_index_tt_in_range_(ptr->index_tt_nc_lens, ppt->selection_num, ppt->has_nc_lens)) \
48 bin = index_tt - ptr->index_tt_nc_lens; \
49 if (_index_tt_in_range_(ptr->index_tt_nc_g4, ppt->selection_num, ppt->has_nc_gr)) \
50 bin = index_tt - ptr->index_tt_nc_g4; \
51 if (_index_tt_in_range_(ptr->index_tt_nc_g5, ppt->selection_num, ppt->has_nc_gr)) \
52 bin = index_tt - ptr->index_tt_nc_g5;
272 typedef enum {SCALAR_TEMPERATURE_0,
273 SCALAR_TEMPERATURE_1,
274 SCALAR_TEMPERATURE_2,
275 SCALAR_POLARISATION_E,
276 VECTOR_TEMPERATURE_1,
277 VECTOR_TEMPERATURE_2,
278 VECTOR_POLARISATION_E,
279 VECTOR_POLARISATION_B,
280 TENSOR_TEMPERATURE_2,
281 TENSOR_POLARISATION_E,
282 TENSOR_POLARISATION_B,
285 enum Hermite_Interpolation_Order {HERMITE3, HERMITE4, HERMITE6};
303 double * ptransfer_local
328 int transfer_perturbation_copy_sources_and_nl_corrections(
335 int transfer_perturbation_source_spline(
339 double *** sources_spline
342 int transfer_perturbation_sources_free(
349 int transfer_perturbation_sources_spline_free(
352 double *** sources_spline
370 int transfer_get_q_list_v1(
391 int transfer_free_source_correspondence(
396 int transfer_source_tau_size_max(
428 double *** sources_spline,
433 int transfer_radial_coordinates(
448 double * source_spline,
449 double * interpolated_sources
457 double * interpolated_sources,
465 double * tau0_minus_tau,
482 double * dln_dNdz_dz);
490 double * tau0_minus_tau,
500 double * tau0_minus_tau,
509 double * tau0_minus_tau,
513 double * interpolated_sources,
532 double * tau0_minus_tau,
554 int transfer_use_limber(
593 double * tau0_minus_tau,
596 double tau0_minus_tau_limber,
607 double * tau0_minus_tau,
613 int transfer_can_be_neglected(
626 int transfer_late_source_can_be_neglected(
635 int transfer_select_radial_function(
643 int transfer_radial_function(
651 double * radial_function,
655 int transfer_init_HIS_from_bessel(
657 HyperInterpStruct *pHIS
660 int transfer_global_selection_read(
664 int transfer_workspace_init(
668 int perturbations_tau_size,
672 double tau0_minus_tau_cut,
673 HyperInterpStruct * pBIS
676 int transfer_workspace_free(
681 int transfer_update_HIS(
689 int transfer_get_lmax(
int (*get_xmin_generic)(
int sgnK,
705 ErrorMsg error_message);
Definition: background.h:48
#define _SELECTION_NUM_MAX_
Definition: perturbations.h:70
Definition: perturbations.h:98
Definition: thermodynamics.h:59
int transfer_limber_interpolate(struct transfer *ptr, double *tau0_minus_tau, double *sources, int tau_size, double tau0_minus_tau_limber, double *S)
Definition: transfer.c:3523
int transfer_compute_for_each_l(struct transfer_workspace *ptw, struct precision *ppr, struct perturbations *ppt, struct transfer *ptr, int index_q, int index_md, int index_ic, int index_tt, int index_l, double l, double q_max_bessel, radial_function_type radial_type)
Definition: transfer.c:2999
int transfer_functions_at_q(struct transfer *ptr, int index_md, int index_ic, int index_tt, int index_l, double q, double *transfer_function)
Definition: transfer.c:61
int transfer_get_source_correspondence(struct perturbations *ppt, struct transfer *ptr, int **tp_of_tt)
Definition: transfer.c:1326
int transfer_compute_for_each_q(struct precision *ppr, struct background *pba, struct perturbations *ppt, struct transfer *ptr, int **tp_of_tt, int index_q, int tau_size_max, double tau_rec, double ***pert_sources, double ***pert_sources_spline, double *window, struct transfer_workspace *ptw)
Definition: transfer.c:1683
int transfer_get_k_list(struct perturbations *ppt, struct transfer *ptr, double K)
Definition: transfer.c:1249
int transfer_indices(struct precision *ppr, struct perturbations *ppt, struct transfer *ptr, double q_period, double K, int sgnK)
Definition: transfer.c:492
int transfer_interpolate_sources(struct perturbations *ppt, struct transfer *ptr, int index_q, int index_md, int index_ic, int index_type, double *pert_source, double *pert_source_spline, double *interpolated_sources)
Definition: transfer.c:2001
int transfer_sources(struct precision *ppr, struct background *pba, struct perturbations *ppt, struct transfer *ptr, double *interpolated_sources, double tau_rec, int index_q, int index_md, int index_tt, double *sources, double *window, int tau_size_max, double *tau0_minus_tau, double *w_trapz, int *tau_size_out)
Definition: transfer.c:2087
int transfer_source_tau_size(struct precision *ppr, struct background *pba, struct perturbations *ppt, struct transfer *ptr, double tau_rec, double tau0, int index_md, int index_tt, int *tau_size)
Definition: transfer.c:1510
int transfer_integrate(struct perturbations *ppt, struct transfer *ptr, struct transfer_workspace *ptw, int index_q, int index_md, int index_tt, double l, int index_l, double k, radial_function_type radial_type, double *trsf)
Definition: transfer.c:3185
int transfer_selection_sampling(struct precision *ppr, struct background *pba, struct perturbations *ppt, struct transfer *ptr, int bin, double *tau0_minus_tau, int tau_size)
Definition: transfer.c:2607
int transfer_get_q_list(struct precision *ppr, struct perturbations *ppt, struct transfer *ptr, double q_period, double K, int sgnK)
Definition: transfer.c:1018
int transfer_dNdz_analytic(struct transfer *ptr, double z, double *dNdz, double *dln_dNdz_dz)
Definition: transfer.c:2563
int transfer_limber2(int tau_size, struct transfer *ptr, int index_md, int index_k, double l, double k, double *tau0_minus_tau, double *sources, radial_function_type radial_type, double *trsf)
Definition: transfer.c:3610
int transfer_selection_times(struct precision *ppr, struct background *pba, struct perturbations *ppt, struct transfer *ptr, int bin, double *tau_min, double *tau_mean, double *tau_max)
Definition: transfer.c:2799
int transfer_init(struct precision *ppr, struct background *pba, struct thermodynamics *pth, struct perturbations *ppt, struct fourier *pfo, struct transfer *ptr)
Definition: transfer.c:115
int transfer_limber(struct transfer *ptr, struct transfer_workspace *ptw, int index_md, int index_q, double l, double q, radial_function_type radial_type, double *trsf)
Definition: transfer.c:3366
int transfer_lensing_sampling(struct precision *ppr, struct background *pba, struct perturbations *ppt, struct transfer *ptr, int bin, double tau0, double *tau0_minus_tau, int tau_size)
Definition: transfer.c:2675
int transfer_source_resample(struct precision *ppr, struct background *pba, struct perturbations *ppt, struct transfer *ptr, int bin, double *tau0_minus_tau, int tau_size, int index_md, double tau0, double *interpolated_sources, double *sources)
Definition: transfer.c:2732
int transfer_precompute_selection(struct precision *ppr, struct background *pba, struct perturbations *ppt, struct transfer *ptr, double tau_rec, int tau_size_max, double **window)
Definition: transfer.c:4600
int transfer_selection_function(struct precision *ppr, struct perturbations *ppt, struct transfer *ptr, int bin, double z, double *selection)
Definition: transfer.c:2418
int transfer_free(struct transfer *ptr)
Definition: transfer.c:435
int transfer_get_l_list(struct precision *ppr, struct perturbations *ppt, struct transfer *ptr)
Definition: transfer.c:819
int transfer_selection_compute(struct precision *ppr, struct background *pba, struct perturbations *ppt, struct transfer *ptr, double *selection, double *tau0_minus_tau, double *w_trapz, int tau_size, double *pvecback, double tau0, int bin)
Definition: transfer.c:2879
double angular_rescaling
Definition: transfer.h:166
int * l_size
Definition: transfer.h:158
double * cscKgen
Definition: transfer.h:247
double selection_magnification_bias[_SELECTION_NUM_MAX_]
Definition: transfer.h:94
double tau0_minus_tau_cut
Definition: transfer.h:261
double * nz_evo_nz
Definition: transfer.h:109
int index_tt_d1
Definition: transfer.h:140
double * nz_evo_z
Definition: transfer.h:108
double K
Definition: transfer.h:256
double * nz_z
Definition: transfer.h:100
short has_nz_file
Definition: transfer.h:96
int index_tt_nc_g3
Definition: transfer.h:144
double * chi
Definition: transfer.h:243
double * w_trapz
Definition: transfer.h:242
int index_tt_lcmb
Definition: transfer.h:134
short transfer_verbose
Definition: transfer.h:196
int nz_size
Definition: transfer.h:99
short has_nz_evo_analytic
Definition: transfer.h:105
double * nz_evo_dd_dlog_nz
Definition: transfer.h:111
int * l
Definition: transfer.h:162
int nz_evo_size
Definition: transfer.h:107
short has_nz_analytic
Definition: transfer.h:97
int index_tt_nc_g1
Definition: transfer.h:142
int index_tt_e
Definition: transfer.h:132
int tau_size
Definition: transfer.h:230
double lcmb_tilt
Definition: transfer.h:87
double * nz_evo_dlog_nz
Definition: transfer.h:110
double ** k
Definition: transfer.h:178
double selection_bias[_SELECTION_NUM_MAX_]
Definition: transfer.h:93
double * sources
Definition: transfer.h:236
FileName nz_evo_file_name
Definition: transfer.h:106
int l_size
Definition: transfer.h:222
int ** l_size_tt
Definition: transfer.h:156
double * nz_nz
Definition: transfer.h:101
int index_tt_nc_lens
Definition: transfer.h:141
int index_q_flat_approximation
Definition: transfer.h:180
int index_tt_nc_g4
Definition: transfer.h:145
HyperInterpStruct HIS
Definition: transfer.h:216
int HIS_allocated
Definition: transfer.h:218
ErrorMsg error_message
Definition: transfer.h:198
int index_tt_t0
Definition: transfer.h:129
int index_tt_density
Definition: transfer.h:135
double * q
Definition: transfer.h:176
HyperInterpStruct * pBIS
Definition: transfer.h:220
double * tau0_minus_tau
Definition: transfer.h:241
int index_tt_b
Definition: transfer.h:133
int md_size
Definition: transfer.h:127
int index_tt_lensing
Definition: transfer.h:136
short neglect_late_source
Definition: transfer.h:262
double * cotKgen
Definition: transfer.h:248
int * tt_size
Definition: transfer.h:148
int index_tt_nc_g2
Definition: transfer.h:143
int index_tt_t1
Definition: transfer.h:130
size_t q_size
Definition: transfer.h:174
int index_tt_d0
Definition: transfer.h:139
double * interpolated_sources
Definition: transfer.h:232
FileName nz_file_name
Definition: transfer.h:98
double lcmb_rescale
Definition: transfer.h:84
int index_tt_nc_g5
Definition: transfer.h:146
short has_cls
Definition: transfer.h:119
int tau_size_max
Definition: transfer.h:231
short has_nz_evo_file
Definition: transfer.h:104
double ** transfer
Definition: transfer.h:188
int index_tt_t2
Definition: transfer.h:131
radial_function_type
Definition: transfer.h:272
int sgnK
Definition: transfer.h:257
int index_tt_rsd
Definition: transfer.h:138
double lcmb_pivot
Definition: transfer.h:90
int l_size_max
Definition: transfer.h:160
double * nz_ddnz
Definition: transfer.h:102
Definition: transfer.h:76
Definition: transfer.h:210