CCL
fftlog.h
Go to the documentation of this file.
1 #ifdef __cplusplus
2 extern "C" {
3 #endif
4 
5 #ifndef FFTLOG_H
6 #define FFTLOG_H
7 
8 /****************************************************************
9 
10 This is the famous FFTLog.
11 
12 First imlplemented by the living legend Andrew Hamilton:
13 
14 http://casa.colorado.edu/~ajsh/FFTLog/
15 
16 This version is a C version that was adapted from the C++ version found
17 in Copter JWG Carlson, another big loss for the cosmology community.
18 
19 https://github.com/jwgcarlson/Copter
20 
21 I've transformed this from C++ to C99 as the lowest common denominator
22 and provided bindings for C++ and python.
23 
24 These are the C++ bindings
25 
26 *****************************************************************/
27 
28 /* Compute the correlation function xi(r) from a power spectrum P(k), sampled
29  * at logarithmically spaced points k[j]. */
30 void pk2xi(int N, const double k[], const double pk[], double r[], double xi[]);
31 
32 /* Compute the power spectrum P(k) from a correlation function xi(r), sampled
33  * at logarithmically spaced points r[i]. */
34 void xi2pk(int N, const double r[], const double xi[], double k[], double pk[]);
35 
36 /* Compute the function
37  * \xi_l^m(r) = \int_0^\infty \frac{dk}{2\pi^2} k^m j_l(kr) P(k)
38  * Note that the usual 2-point correlation function xi(r) is just xi_0^2(r)
39  * in this notation. The input k-values must be logarithmically spaced. The
40  * resulting xi_l^m(r) will be evaluated at the dual r-values
41  * r[0] = 1/k[N-1], ..., r[N-1] = 1/k[0]. */
42 void fftlog_ComputeXiLM(double l, double m, int N, const double k[], const double pk[],
43  double r[], double xi[]);
44 
45 
46 #include <complex.h>
47 
48 /* Compute the discrete Hankel transform of the function a(r). See the FFTLog
49  * documentation (or the Fortran routine of the same name in the FFTLog
50  * sources) for a description of exactly what this function computes.
51  * If u is NULL, the transform coefficients will be computed anew and discarded
52  * afterwards. If you plan on performing many consecutive transforms, it is
53  * more efficient to pre-compute the u coefficients. */
54 void fht(int N, const double r[], const double complex a[], double k[], double complex b[], double mu,
55  double q, double kcrc, int noring, double complex* u);
56 // double q = 0, double kcrc = 1, bool noring = true, double complex* u = NULL);
57 
58 /* Pre-compute the coefficients that appear in the FFTLog implementation of
59  * the discrete Hankel transform. The parameters N, mu, and q here are the
60  * same as for the function fht(). The parameter L is defined (for whatever
61  * reason) to be N times the logarithmic spacing of the input array, i.e.
62  * L = N * log(r[N-1]/r[0])/(N-1) */
63 void compute_u_coefficients(int N, double mu, double q, double L, double kcrc, double complex u[]);
64 
65 
66 #endif // FFTLOG_H
67 
68 #ifdef __cplusplus
69 }
70 #endif
void compute_u_coefficients(int N, double mu, double q, double L, double kcrc, double complex u[])
Definition: fftlog.c:70
void pk2xi(int N, const double k[], const double pk[], double r[], double xi[])
Definition: fftlog.c:158
void fftlog_ComputeXiLM(double l, double m, int N, const double k[], const double pk[], double r[], double xi[])
Definition: fftlog.c:141
void fht(int N, const double r[], const double complex a[], double k[], double complex b[], double mu, double q, double kcrc, int noring, double complex *u)
Definition: fftlog.c:101
void xi2pk(int N, const double r[], const double xi[], double k[], double pk[])
Definition: fftlog.c:163