# | Line 1 | Line 1 | |
---|---|---|
1 | < | /* |
1 | > | /* |
2 | * Copyright (c) 2005 The University of Notre Dame. All Rights Reserved. | |
3 | * | |
4 | * The University of Notre Dame grants you ("Licensee") a | |
# | Line 50 | Line 50 | |
50 | #define MATH_CHEBYSHEVPOLYNOMIALS_HPP | |
51 | ||
52 | #include <vector> | |
53 | + | #include <cassert> |
54 | ||
55 | #include "math/Polynomial.hpp" | |
56 | ||
57 | namespace oopse { | |
58 | ||
59 | < | /** |
60 | < | * @class ChebyshevPolynomials |
61 | < | * A collection of Chebyshev Polynomials. |
62 | < | * @todo document |
63 | < | */ |
64 | < | class ChebyshevPolynomials { |
65 | < | public: |
66 | < | ChebyshevPolynomials(int maxPower); |
67 | < | |
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 |
71 | < | * @param n |
72 | < | * @param x the value of the independent variable for the nth Chebyshev Polynomial function |
73 | < | */ |
59 | > | /** |
60 | > | * @class ChebyshevPolynomials |
61 | > | * A collection of Chebyshev Polynomials. |
62 | > | * @todo document |
63 | > | */ |
64 | > | class ChebyshevPolynomials { |
65 | > | public: |
66 | > | ChebyshevPolynomials(int maxPower); |
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 |
71 | > | * @param n |
72 | > | * @param x the value of the independent variable for the nth Chebyshev Polynomial function |
73 | > | */ |
74 | ||
75 | < | double evaluate(int n, double x) { |
76 | < | assert (n <= maxPower_ && n >=0); |
77 | < | return polyList_[n].evaluate(x); |
78 | < | } |
75 | > | RealType evaluate(int n, RealType x) { |
76 | > | assert (n <= maxPower_ && n >=0); |
77 | > | return polyList_[n].evaluate(x); |
78 | > | } |
79 | ||
80 | < | /** |
81 | < | * Returns the first derivative of the nth Chebyshev Polynomial. |
82 | < | * @return the first derivative of the nth Chebyshev Polynomial |
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) { |
87 | < | assert (n <= maxPower_ && n >=0); |
88 | < | return polyList_[n].evaluateDerivative(x); |
89 | < | } |
80 | > | /** |
81 | > | * Returns the first derivative of the nth Chebyshev Polynomial. |
82 | > | * @return the first derivative of the nth Chebyshev Polynomial |
83 | > | * @param n |
84 | > | * @param x the value of the independent variable for the nth Chebyshev Polynomial function |
85 | > | */ |
86 | > | RealType evaluateDerivative(int n, RealType x) { |
87 | > | assert (n <= maxPower_ && n >=0); |
88 | > | return polyList_[n].evaluateDerivative(x); |
89 | > | } |
90 | ||
91 | < | /** |
92 | < | * Returns the nth Chebyshev Polynomial |
93 | < | * @return the nth Chebyshev Polynomial |
94 | < | * @param n |
95 | < | */ |
96 | < | const DoublePolynomial& getChebyshevPolynomial(int n) const { |
97 | < | assert (n <= maxPower_ && n >=0); |
98 | < | return polyList_[n]; |
99 | < | } |
91 | > | /** |
92 | > | * Returns the nth Chebyshev Polynomial |
93 | > | * @return the nth Chebyshev Polynomial |
94 | > | * @param n |
95 | > | */ |
96 | > | const DoublePolynomial& getChebyshevPolynomial(int n) const { |
97 | > | assert (n <= maxPower_ && n >=0); |
98 | > | return polyList_[n]; |
99 | > | } |
100 | ||
101 | < | protected: |
101 | > | protected: |
102 | ||
103 | < | std::vector<DoublePolynomial> polyList_; |
103 | > | std::vector<DoublePolynomial> polyList_; |
104 | ||
105 | < | private: |
105 | > | private: |
106 | ||
107 | < | void GeneratePolynomials(int maxPower); |
108 | < | virtual void GenerateFirstTwoTerms() = 0; |
107 | > | void GeneratePolynomials(int maxPower); |
108 | > | virtual void GenerateFirstTwoTerms() = 0; |
109 | ||
110 | < | int maxPower_; |
111 | < | }; |
110 | > | int maxPower_; |
111 | > | }; |
112 | ||
113 | < | /** |
114 | < | * @class ChebyshevT |
115 | < | * @todo document |
116 | < | */ |
117 | < | class ChebyshevT : public ChebyshevPolynomials { |
118 | < | public: |
119 | < | ChebyshevT(int maxPower) :ChebyshevPolynomials(maxPower) {} |
113 | > | /** |
114 | > | * @class ChebyshevT |
115 | > | * @todo document |
116 | > | */ |
117 | > | class ChebyshevT : public ChebyshevPolynomials { |
118 | > | public: |
119 | > | ChebyshevT(int maxPower) :ChebyshevPolynomials(maxPower) {} |
120 | ||
121 | < | private: |
122 | < | virtual void GenerateFirstTwoTerms(); |
123 | < | }; |
121 | > | private: |
122 | > | virtual void GenerateFirstTwoTerms(); |
123 | > | }; |
124 | ||
125 | < | /** |
126 | < | * @class ChebyshevU |
127 | < | * @todo document |
128 | < | */ |
129 | < | class ChebyshevU : public ChebyshevPolynomials { |
130 | < | public: |
131 | < | ChebyshevU(int maxPower) :ChebyshevPolynomials(maxPower) {} |
125 | > | /** |
126 | > | * @class ChebyshevU |
127 | > | * @todo document |
128 | > | */ |
129 | > | class ChebyshevU : public ChebyshevPolynomials { |
130 | > | public: |
131 | > | ChebyshevU(int maxPower) :ChebyshevPolynomials(maxPower) {} |
132 | ||
133 | < | private: |
134 | < | virtual void GenerateFirstTwoTerms(); |
135 | < | }; |
133 | > | private: |
134 | > | virtual void GenerateFirstTwoTerms(); |
135 | > | }; |
136 | ||
137 | ||
138 | } //end namespace oopse |
– | Removed lines |
+ | Added lines |
< | Changed lines |
> | Changed lines |