1 /* _______________________________________________________________________
2
3 PECOS: Parallel Environment for Creation Of Stochastics
4 Copyright (c) 2011, Sandia National Laboratories.
5 This software is distributed under the GNU Lesser General Public License.
6 For more information, see the README file in the top Pecos directory.
7 _______________________________________________________________________ */
8
9 //- Class: LegendreOrthogPolynomial
10 //- Description: Class for Legendre Orthogonal Polynomial
11 //-
12 //- Owner: Mike Eldred, Sandia National Laboratories
13
14 #ifndef LEGENDRE_ORTHOG_POLYNOMIAL_HPP
15 #define LEGENDRE_ORTHOG_POLYNOMIAL_HPP
16
17 #include "OrthogonalPolynomial.hpp"
18
19
20 namespace Pecos {
21
22 /// Derived orthogonal polynomial class for Legendre polynomials
23
24 /** The LegendreOrthogPolynomial class evaluates a univariate Legendre
25 polynomial of a particular order. These polynomials are
26 orthogonal with respect to the weight function 1 when integrated
27 over the support range of [-1,+1]. This corresponds to the
28 probability density function f(x) = 1/(U-L) = 1/2 for the uniform
29 distribution for [L,U]=[-1,1]. It enables (mixed)
30 multidimensional orthogonal polynomial basis functions within
31 OrthogPolyApproximation. Legendre polynomials are a special case
32 (alpha = beta = 0) of the more general Jacobi polynomials
33 (implemented separately) which correspond to the beta distribution. */
34
35 class LegendreOrthogPolynomial: public OrthogonalPolynomial
36 {
37 public:
38
39 //
40 //- Heading: Constructor and destructor
41 //
42
43 LegendreOrthogPolynomial(short colloc_rule); ///< extended constructor
44 LegendreOrthogPolynomial(); ///< default constructor
45 ~LegendreOrthogPolynomial(); ///< destructor
46
47 protected:
48
49 //
50 //- Heading: Virtual function redefinitions
51 //
52
53 Real type1_value(Real x, unsigned short order);
54 Real type1_gradient(Real x, unsigned short order);
55 Real type1_hessian(Real x, unsigned short order);
56 Real norm_squared(unsigned short order);
57
58 const RealArray& collocation_points(unsigned short order);
59 const RealArray& type1_collocation_weights(unsigned short order);
60
61 Real length_scale() const;
62
63 private:
64
65 //
66 //- Heading: Data
67 //
68 };
69
70
71 // collocRule may be GAUSS_LEGENDRE (default), GAUSS_PATTERSON,
72 // CLENSHAW_CURTIS, or FEJER2
LegendreOrthogPolynomial(short colloc_rule)73 inline LegendreOrthogPolynomial::LegendreOrthogPolynomial(short colloc_rule)
74 { collocRule = colloc_rule; wtFactor = 0.5; }
75
76
LegendreOrthogPolynomial()77 inline LegendreOrthogPolynomial::LegendreOrthogPolynomial()
78 { collocRule = GAUSS_LEGENDRE; wtFactor = 0.5; }
79
80
~LegendreOrthogPolynomial()81 inline LegendreOrthogPolynomial::~LegendreOrthogPolynomial()
82 { }
83
84
85 /** [-1,1]: mean is zero; return std deviation = 2/sqrt(12). */
length_scale() const86 inline Real LegendreOrthogPolynomial::length_scale() const
87 { return std::pow(3., -0.5); }
88
89 } // namespace Pecos
90
91 #endif
92