Triumvirate C++ API 0.5.0
Three-point clustering measurements in large-scale structure analyses.
Loading...
Searching...
No Matches
fftlog.hpp
Go to the documentation of this file.
1// Copyright (C) [GPLv3 Licence]
2//
3// This file is part of the Triumvirate program. See the COPYRIGHT
4// and LICENCE files at the top-level directory of this distribution
5// for details of copyright and licensing.
6//
7// This program is free software: you can redistribute it and/or modify it
8// under the terms of the GNU General Public License as published by
9// the Free Software Foundation, either version 3 of the License, or
10// (at your option) any later version.
11//
12// This program is distributed in the hope that it will be useful,
13// but WITHOUT ANY WARRANTY; without even the implied warranty of
14// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15// See the GNU General Public License for more details.
16//
17// You should have received a copy of the GNU General Public License
18// along with this program. If not, see <https://www.gnu.org/licenses/>.
19
29#ifndef TRIUMVIRATE_INCLUDE_FFTLOG_HPP_INCLUDED_
30#define TRIUMVIRATE_INCLUDE_FFTLOG_HPP_INCLUDED_
31
32#include <fftw3.h>
33
34#include <cmath>
35#include <complex>
36#include <cstring>
37#include <vector>
38
39#include "maths.hpp"
40#include "arrayops.hpp"
41
42namespace trva = trv::array;
43
44namespace trv {
45
46namespace maths {
47
54 public:
55 double order;
56 double bias;
57 int nsamp = 0;
58 int nsamp_trans = 0;
59 double logres = 0.;
60 double pivot = 1.;
61
63 std::vector<double> pre_sampts;
64
66 std::vector<double> post_sampts;
67
75 HankelTransform(double mu, double q, bool threaded = true);
76
81
117 void initialise(
118 std::vector<double> sample_pts, double kr_c,
119 bool lowring = true,
120 trva::ExtrapOption extrap = trva::ExtrapOption::NONE,
121 double extrap_exp = 2.
122 );
123
149 void initialise(
150 std::vector<double> sample_pts, double kr_c,
151 bool lowring = true,
152 int extrap = 0,
153 double extrap_exp = 2.
154 );
155
172 void biased_transform(std::complex<double>* a, std::complex<double>* b);
173
179 std::vector< std::complex<double> > compute_kernel_coeff();
180
194 double calc_lowring_pivot(double delta, double kr_c = 1.);
195
196 private:
198 trva::ExtrapOption extrap = trva::ExtrapOption::NONE;
199
201 int n_ext = 0;
202
204 std::vector<double> pre_sampts_extrap;
205
207 std::vector<double> post_sampts_extrap;
208
210 std::vector< std::complex<double> > kernel;
211
213 fftw_plan pre_plan;
214 fftw_complex* pre_buffer = nullptr;
215
217 fftw_plan post_plan;
218 fftw_complex* post_buffer = nullptr;
219
221 bool plan_init = false;
222
224 bool threaded = true;
225
230 void reset();
231};
232
234 public:
235 int degree;
236
244 SphericalBesselTransform(int ell, int n, bool threaded = true);
245
271 void initialise(
272 std::vector<double> sample_pts, double kr_c,
273 bool lowring = true,
274 trva::ExtrapOption extrap = trva::ExtrapOption::NONE,
275 double extrap_exp = 2.
276 );
277
304 void initialise(
305 std::vector<double> sample_pts, double kr_c,
306 bool lowring = true,
307 int extrap = 0,
308 double extrap_exp = 2.
309 );
310
332 void biased_transform(
333 std::vector< std::complex<double> >& a,
334 std::vector< std::complex<double> >& b
335 );
336
352 int dir,
353 std::vector< std::complex<double> >& pre_samples,
354 std::vector< std::complex<double> >& post_samples
355 );
356};
357
358} // namespace trv::maths
359
360} // namespace trv
361
362#endif // !TRIUMVIRATE_INCLUDE_FFTLOG_HPP_INCLUDED_
Array operations.
Perform the (forward biased) Hankel and associated transforms using the FFTLog algorithm.
Definition fftlog.hpp:53
HankelTransform(double mu, double q, bool threaded=true)
Construct the Hankel transform.
Definition fftlog.cpp:37
int nsamp
number of samples provided
Definition fftlog.hpp:57
std::vector< double > post_sampts
logarithmically linearly-spaced sample points post-transform
Definition fftlog.hpp:66
void biased_transform(std::complex< double > *a, std::complex< double > *b)
Perform the (forward biased) Hankel transform.
Definition fftlog.cpp:297
double order
order of the Hankel transform
Definition fftlog.hpp:55
void initialise(std::vector< double > sample_pts, double kr_c, bool lowring=true, trva::ExtrapOption extrap=trva::ExtrapOption::NONE, double extrap_exp=2.)
Initialise the Hankel transform.
Definition fftlog.cpp:93
double calc_lowring_pivot(double delta, double kr_c=1.)
Calculate a low-ringing FFTLog transform pivot value .
Definition fftlog.cpp:206
double bias
power-law bias index
Definition fftlog.hpp:56
int nsamp_trans
number of samples transformed
Definition fftlog.hpp:58
~HankelTransform()
Destruct the Hankel transform.
Definition fftlog.cpp:63
double pivot
pivot value
Definition fftlog.hpp:60
double logres
logarithmic interval sample spacing
Definition fftlog.hpp:59
std::vector< std::complex< double > > compute_kernel_coeff()
Compute the FFTLog transform kernel coefficients .
Definition fftlog.cpp:238
std::vector< double > pre_sampts
logarithmically linearly-spaced sample points pre-transform
Definition fftlog.hpp:63
void biased_transform(std::vector< std::complex< double > > &a, std::vector< std::complex< double > > &b)
Perform the (forward biased) spherical Bessel transform.
Definition fftlog.cpp:422
void initialise(std::vector< double > sample_pts, double kr_c, bool lowring=true, trva::ExtrapOption extrap=trva::ExtrapOption::NONE, double extrap_exp=2.)
Initialise the spherical Bessel transform.
Definition fftlog.cpp:408
void transform_cosmological_multipole(int dir, std::vector< std::complex< double > > &pre_samples, std::vector< std::complex< double > > &post_samples)
Transform csomological multipole samples.
Definition fftlog.cpp:452
int degree
degree of the spherical Bessel transform
Definition fftlog.hpp:235
SphericalBesselTransform(int ell, int n, bool threaded=true)
Construct the spherical Bessel transform.
Definition fftlog.cpp:402
Mathematical calculations.
ExtrapOption
Extrapolation scheme.
Definition arrayops.hpp:83