-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.c
85 lines (71 loc) · 2.4 KB
/
test.c
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
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <complex.h>
#include <string.h>
#include <time.h>
#include <fftw3.h>
#include "utils.h"
#include "utils_complex.h"
#include "cfastpt.h"
int main(int argc, char const *argv[])
{
FILE *finput;
finput = fopen("Pk_test.dat", "r");
long Nk = 3000;
long line_num;
double k[Nk], Pin[Nk];
double dummy;
if(finput == NULL)
{printf("File not found\n");}
else
{
line_num = 0;
while(!feof(finput)) {
fscanf(finput, "%lg %lg %lg %lg", &(k[line_num]), &(Pin[line_num]), &dummy, &dummy );
line_num++;
}
fclose(finput);
}
// int alpha_ar[] = {0,0,0,2,1,1,2};
// int beta_ar[] = {0,0,0,-2,-1,-1,-2};
// int ell_ar[] = {0,2,4,2,1,3,0};
double P_d1d2[Nk],P_d2d2[Nk],P_d1s2[Nk],P_d2s2[Nk],P_s2s2[Nk],P_d1d3nl[Nk];
double IA_tt_EE[Nk],IA_tt_BB[Nk];
double IA_ta_dE1[Nk], IA_ta_dE2[Nk], IA_ta_0E0E[Nk], IA_ta_0B0B[Nk];
double IA_mix_A[Nk], IA_mix_B[Nk], IA_mix_DEE[Nk], IA_mix_DBB[Nk];
clock_t t1, t2;
t1 = clock();
Pd1d2(k, Pin, Nk, P_d1d2);
Pd2d2(k, Pin, Nk, P_d2d2);
Pd1s2(k, Pin, Nk, P_d1s2);
Pd2s2(k, Pin, Nk, P_d2s2);
Ps2s2(k, Pin, Nk, P_s2s2);
Pd1d3nl(k, Pin, Nk, P_d1d3nl);
IA_tt(k, Pin, Nk, IA_tt_EE, IA_tt_BB);
// printf("tt finished\n");
IA_ta(k, Pin, Nk, IA_ta_dE1, IA_ta_dE2, IA_ta_0E0E, IA_ta_0B0B);
// printf("ta finished\n");
IA_mix(k,Pin, Nk, IA_mix_A, IA_mix_B, IA_mix_DEE, IA_mix_DBB);
// printf("mix finished\n");
t2 = clock();
printf("time: %lg\n", (double)(t2 - t1) / CLOCKS_PER_SEC);
FILE *fout;
fout = fopen("out_galbias.txt", "w");
for(line_num=0; line_num<Nk; line_num++){
// fprintf(fout, "%lg %lg %lg\n", k[line_num], Pin[line_num], Pout[line_num]);
fprintf(fout, "%lg %lg %lg %lg %lg %lg %lg %lg \n", k[line_num], Pin[line_num], \
P_d1d2[line_num],P_d2d2[line_num],P_d1s2[line_num], \
P_d2s2[line_num],P_s2s2[line_num],P_d1d3nl[line_num]);
}
fclose(fout);
fout = fopen("out_IA.txt", "w");
for(line_num=0; line_num<Nk; line_num++){
// fprintf(fout, "%lg %lg %lg\n", k[line_num], Pin[line_num], Pout[line_num]);
fprintf(fout, "%lg %lg %lg %lg %lg %lg %lg %lg %lg %lg %lg %lg\n", k[line_num], Pin[line_num], IA_tt_EE[line_num], IA_tt_BB[line_num], \
IA_ta_dE1[line_num], IA_ta_dE2[line_num], IA_ta_0E0E[line_num], IA_ta_0B0B[line_num],\
IA_mix_A[line_num], IA_mix_B[line_num], IA_mix_DEE[line_num], IA_mix_DBB[line_num]);
}
fclose(fout);
return 0;
}