| 50 | 
  | 
#define MATH_CHEBYSHEVPOLYNOMIALS_HPP | 
| 51 | 
  | 
 | 
| 52 | 
  | 
#include <vector> | 
| 53 | 
+ | 
#include <cassert> | 
| 54 | 
  | 
 | 
| 55 | 
  | 
#include "math/Polynomial.hpp" | 
| 56 | 
  | 
 | 
| 64 | 
  | 
  class ChebyshevPolynomials { | 
| 65 | 
  | 
  public: | 
| 66 | 
  | 
    ChebyshevPolynomials(int maxPower); | 
| 67 | 
< | 
 | 
| 67 | 
> | 
    virtual ~ChebyshevPolynomials() {} | 
| 68 | 
  | 
    /** | 
| 69 | 
  | 
     * Calculates the value of the nth Chebyshev Polynomial evaluated at the given x value. | 
| 70 | 
  | 
     * @return The value of the nth Chebyshev Polynomial evaluates at the given x value | 
| 72 | 
  | 
     * @param x the value of the independent variable for the nth Chebyshev Polynomial  function | 
| 73 | 
  | 
     */ | 
| 74 | 
  | 
         | 
| 75 | 
< | 
    double evaluate(int n, double x) { | 
| 75 | 
> | 
    RealType evaluate(int n, RealType x) { | 
| 76 | 
  | 
      assert (n <= maxPower_ && n >=0);  | 
| 77 | 
  | 
      return polyList_[n].evaluate(x); | 
| 78 | 
  | 
    } | 
| 83 | 
  | 
     * @param n | 
| 84 | 
  | 
     * @param x the value of the independent variable for the nth Chebyshev Polynomial  function | 
| 85 | 
  | 
     */ | 
| 86 | 
< | 
    double evaluateDerivative(int n, double x) { | 
| 86 | 
> | 
    RealType evaluateDerivative(int n, RealType x) { | 
| 87 | 
  | 
      assert (n <= maxPower_ && n >=0);  | 
| 88 | 
  | 
      return polyList_[n].evaluateDerivative(x);         | 
| 89 | 
  | 
    } |