MARLEY (Model of Argon Reaction Low Energy Yields)  v1.2.0
A Monte Carlo event generator for tens-of-MeV neutrino interactions
Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
marley::ChebyshevInterpolatingFunction Class Reference

Approximate representation of a 1D continuous function. More...

#include <ChebyshevInterpolatingFunction.hh>

Public Member Functions

 ChebyshevInterpolatingFunction (const std::function< double(double)> &func, double x_min, double x_max, size_t N=0)
 
ChebyshevInterpolatingFunction cdf () const
 
const std::vector< double > & chebyshev_coeffs () const
 
double evaluate (double x) const
 Approximates the represented function using the barycentric formula.
 
const std::vector< double > & Fs () const
 
double integral () const
 
int N () const
 
const std::vector< double > & Xs () const
 

Protected Member Functions

 ChebyshevInterpolatingFunction ()
 Default constructor used by cdf()
 
double chebyshev_point (size_t j) const
 For a given N, returns the x position of the jth Chebyshev point (of the second kind) More...
 
void compute_integral ()
 

Protected Attributes

std::vector< double > chebyshev_coeffs_
 Coefficients of the Chebyshev expansion of this function.
 
std::vector< double > Fs_
 Function values at the grid points.
 
std::vector< int > ifac_
 
double integral_
 Approximate integral of the function on [x_min_, x_max_].
 
size_t N_
 Grid size parameter (N + 1 total points)
 
std::vector< double > wsave_
 
double x_max_
 Upper edge of the grid.
 
double x_min_
 Lower edge of the grid.
 
std::vector< double > Xs_
 Chebyshev points at which the function was evaluated.
 

Static Protected Attributes

static constexpr size_t N_MAX_ = 65536u
 Maximum allowed value of the grid size parameter.
 

Detailed Description

Approximate representation of a 1D continuous function.

Constructor & Destructor Documentation

◆ ChebyshevInterpolatingFunction()

marley::ChebyshevInterpolatingFunction::ChebyshevInterpolatingFunction ( const std::function< double(double)> &  func,
double  x_min,
double  x_max,
size_t  N = 0 
)
Todo:
PRINT WARNING MESSAGE

Member Function Documentation

◆ chebyshev_point()

double marley::ChebyshevInterpolatingFunction::chebyshev_point ( size_t  j) const
inlineprotected

For a given N, returns the x position of the jth Chebyshev point (of the second kind)

Todo:
If needed for speed, consider caching the std::cos evaluations used here

The documentation for this class was generated from the following files: