HighMap library (C++)
Loading...
Searching...
No Matches
hmap::ChebyshevEvaluator Class Reference

Evaluates a Chebyshev polynomial series using Clenshaw recurrence. More...

#include <chebyshev.hpp>

Public Types

using value_type = float
 

Public Member Functions

 ChebyshevEvaluator ()=default
 Default constructor.
 
 ChebyshevEvaluator (std::vector< value_type > coefficients)
 Construct from Chebyshev coefficients.
 
void set_coefficients (std::vector< value_type > coefficients)
 Set Chebyshev coefficients.
 
value_type evaluate (value_type x) const noexcept
 Evaluate the polynomial series at x.
 
template<typename InputIt , typename OutputIt >
void evaluate_batch (InputIt begin, InputIt end, OutputIt out) const noexcept
 Evaluate the series on a range of input values.
 
int degree () const noexcept
 Get polynomial degree.
 
const std::vector< value_type > & coefficients () const noexcept
 Get series coefficients.
 

Detailed Description

Evaluates a Chebyshev polynomial series using Clenshaw recurrence.

Evaluates:

f(x) = sum_k c_k T_k(x)

where T_k are Chebyshev polynomials of the first kind.

Designed for very large numbers of evaluations with minimal overhead.

Member Typedef Documentation

◆ value_type

Constructor & Destructor Documentation

◆ ChebyshevEvaluator() [1/2]

hmap::ChebyshevEvaluator::ChebyshevEvaluator ( )
default

Default constructor.

◆ ChebyshevEvaluator() [2/2]

hmap::ChebyshevEvaluator::ChebyshevEvaluator ( std::vector< value_type coefficients)
inlineexplicit

Construct from Chebyshev coefficients.

Parameters
coefficientsSeries coefficients ordered by polynomial degree.

Member Function Documentation

◆ set_coefficients()

void hmap::ChebyshevEvaluator::set_coefficients ( std::vector< value_type coefficients)
inline

Set Chebyshev coefficients.

Parameters
coefficientsSeries coefficients ordered by polynomial degree.

◆ evaluate()

value_type hmap::ChebyshevEvaluator::evaluate ( value_type  x) const
inlinenoexcept

Evaluate the polynomial series at x.

Uses the Clenshaw recurrence algorithm.

Parameters
xEvaluation coordinate.
Returns
Evaluated value.

◆ evaluate_batch()

template<typename InputIt , typename OutputIt >
void hmap::ChebyshevEvaluator::evaluate_batch ( InputIt  begin,
InputIt  end,
OutputIt  out 
) const
inlinenoexcept

Evaluate the series on a range of input values.

Template Parameters
InputItInput iterator type.
OutputItOutput iterator type.
Parameters
beginInput begin iterator.
endInput end iterator.
outOutput iterator.

◆ degree()

int hmap::ChebyshevEvaluator::degree ( ) const
inlinenoexcept

Get polynomial degree.

Returns
Highest polynomial degree.

◆ coefficients()

const std::vector< value_type > & hmap::ChebyshevEvaluator::coefficients ( ) const
inlinenoexcept

Get series coefficients.

Returns
Coefficient array.

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