-
Notifications
You must be signed in to change notification settings - Fork 5
/
test_ells.c
77 lines (62 loc) · 1.46 KB
/
test_ells.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
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <complex.h>
#include <string.h>
#include <time.h>
#include <fftw3.h>
#include "cfftlog.h"
#include "utils.h"
#include "utils_complex.h"
int main(int argc, char const *argv[])
{
config my_config;
my_config.nu = 1.5;
my_config.c_window_width = 0.25;
my_config.derivative = 0;
my_config.N_pad = 0;
char filename[] = "../Pk_test";
FILE *IN = fopen(filename, "r");
// double *ell, *fl;
long Nk = 3000;
double k[Nk], fk[Nk];
long linenum = 0;
while(!feof(IN) && (linenum<Nk)) {
fscanf(IN, "%lg %lg", &k[linenum], &fk[linenum]);
linenum++;
}
double dlnk = log(k[1]/k[0]);
int i,j;
int Nell = 100;
double ell[Nell];
for(j=1;j<=Nell;j++) {
ell[j] = (double)j;
}
double **r, **result;
r = malloc(Nell * sizeof(double *));
result = malloc(Nell * sizeof(double *));
for(j=0;j<Nell;j++) {
r[j] = malloc(Nk * sizeof(double));
result[j] = malloc(Nk * sizeof(double));
for(i=0; i<Nk; i++) {
r[j][i] = 0.;
result[j][i] = 0.;
}
}
clock_t start = clock();
cfftlog_ells(k, fk, Nk, &my_config, ell, Nell, r, result);
clock_t end = clock();
float seconds = (float)(end - start) / CLOCKS_PER_SEC;
printf("time:%f\n", seconds);
// char outfilename[] = "test_output.txt";
// FILE *OUT = fopen(outfilename, "w");
// for(i=0; i<Nk; i++) {
// fprintf(OUT, "%lg %lg", r[i], result[i]);
// fprintf(OUT, "\n");
// }
// fclose(OUT);
// fclose(IN);
free(r);
free(result);
return 0;
}