4#ifndef HUMMINGBIRD_QUADRATURE_QUADRATURE_BASE_H_
5#define HUMMINGBIRD_QUADRATURE_QUADRATURE_BASE_H_
48 double GetWeight(
const unsigned int abscissa_index)
const {
67 double Integrate(
const std::vector<QuadraturePair>& quad_pairs)
const {
69 for (
auto& pair : quad_pairs) {
70 auto weight =
GetWeight(pair.abscissa_index);
71 sum += pair.function_value * weight;
104 for (
auto i = 0; i < order; i++) {
const std::vector< T > & abscissas() const
Getter for the abscissas in the quadrature set.
void CreateWeightMap()
Create the weight map.
std::map< unsigned int, double > weight_map_
Map to store the weights of the quadrature set where the keys are the indices corresponding to abscis...
virtual double ComputeWeight(const size_t k, const size_t n)
Compute the weight for the k-th abscissa for n total points.
T GetAbscissa(const unsigned int index) const
Get the abscissa corresponding to the index.
size_t n_points() const
Get total number of abscissas.
double Integrate(const std::vector< QuadraturePair > &quad_pairs) const
Integrate the function using the function value and its location on the quadrature grid.
double GetWeight(const unsigned int abscissa_index) const
Get the weight value corresponding to a given abscissa value.
QuadratureBase(const std::vector< T > abscissas)
Construct a new Quadrature object.
std::vector< T > abscissas_
Abscissa values.
Simple struct holding a function value evaluated at the supplied abscissa value.
double function_value
Function value at the abscissa.
int abscissa_index
Index of the abscissa the function was evaluated at.