1 // Special functions -*- C++ -*-
3 // Copyright (C) 2006, 2007, 2008
4 // Free Software Foundation, Inc.
6 // This file is part of the GNU ISO C++ Library. This library is free
7 // software; you can redistribute it and/or modify it under the
8 // terms of the GNU General Public License as published by the
9 // Free Software Foundation; either version 2, or (at your option)
12 // This library is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
17 // You should have received a copy of the GNU General Public License along
18 // with this library; see the file COPYING. If not, write to the Free
19 // Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
22 // As a special exception, you may use this file as part of a free software
23 // library without restriction. Specifically, if other files instantiate
24 // templates or use macros or inline functions from this file, or you compile
25 // this file and link it with other files to produce an executable, this
26 // file does not by itself cause the resulting executable to be covered by
27 // the GNU General Public License. This exception does not however
28 // invalidate any other reasons why the executable file might be covered by
29 // the GNU General Public License.
31 /** @file tr1/poly_hermite.tcc
32 * This is an internal header file, included by other library headers.
33 * You should not attempt to use it directly.
37 // ISO C++ 14882 TR1: 5.2 Special functions
40 // Written by Edward Smith-Rowland based on:
41 // (1) Handbook of Mathematical Functions,
42 // Ed. Milton Abramowitz and Irene A. Stegun,
43 // Dover Publications, Section 22 pp. 773-802
45 #ifndef _GLIBCXX_TR1_POLY_HERMITE_TCC
46 #define _GLIBCXX_TR1_POLY_HERMITE_TCC 1
53 // [5.2] Special functions
55 // Implementation-space details.
60 * @brief This routine returns the Hermite polynomial
61 * of order n: \f$ H_n(x) \f$ by recursion on n.
63 * The Hermite polynomial is defined by:
65 * H_n(x) = (-1)^n e^{x^2} \frac{d^n}{dx^n} e^{-x^2}
68 * @param __n The order of the Hermite polynomial.
69 * @param __x The argument of the Hermite polynomial.
70 * @return The value of the Hermite polynomial of order n
73 template<typename _Tp>
75 __poly_hermite_recursion(const unsigned int __n, const _Tp __x)
88 _Tp __H_n, __H_nm1, __H_nm2;
90 for (__H_nm2 = __H_0, __H_nm1 = __H_1, __i = 2; __i <= __n; ++__i)
92 __H_n = 2 * (__x * __H_nm1 + (__i - 1) * __H_nm2);
102 * @brief This routine returns the Hermite polynomial
103 * of order n: \f$ H_n(x) \f$.
105 * The Hermite polynomial is defined by:
107 * H_n(x) = (-1)^n e^{x^2} \frac{d^n}{dx^n} e^{-x^2}
110 * @param __n The order of the Hermite polynomial.
111 * @param __x The argument of the Hermite polynomial.
112 * @return The value of the Hermite polynomial of order n
115 template<typename _Tp>
117 __poly_hermite(const unsigned int __n, const _Tp __x)
120 return std::numeric_limits<_Tp>::quiet_NaN();
122 return __poly_hermite_recursion(__n, __x);
125 } // namespace std::tr1::__detail
129 #endif // _GLIBCXX_TR1_POLY_HERMITE_TCC