OSDN Git Service

2014-04-04 Richard Biener <rguenther@suse.de>
[pf3gnuchains/gcc-fork.git] / libstdc++-v3 / include / tr1 / hypergeometric.tcc
index 5e6902f..b98b5b2 100644 (file)
@@ -1,12 +1,12 @@
 // Special functions -*- C++ -*-
 
-// Copyright (C) 2006, 2007, 2008
+// Copyright (C) 2006, 2007, 2008, 2009, 2010
 // Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the
 // terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2, or (at your option)
+// Free Software Foundation; either version 3, or (at your option)
 // any later version.
 //
 // This library is distributed in the hope that it will be useful,
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 // GNU General Public License for more details.
 //
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING.  If not, write to the Free
-// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
-// USA.
-//
-// As a special exception, you may use this file as part of a free software
-// library without restriction.  Specifically, if other files instantiate
-// templates or use macros or inline functions from this file, or you compile
-// this file and link it with other files to produce an executable, this
-// file does not by itself cause the resulting executable to be covered by
-// the GNU General Public License.  This exception does not however
-// invalidate any other reasons why the executable file might be covered by
-// the GNU General Public License.
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
 
 /** @file tr1/hypergeometric.tcc
  *  This is an internal header file, included by other library headers.
- *  You should not attempt to use it directly.
+ *  Do not attempt to use it directly. @headername{tr1/cmath}
  */
 
 //
 #ifndef _GLIBCXX_TR1_HYPERGEOMETRIC_TCC
 #define _GLIBCXX_TR1_HYPERGEOMETRIC_TCC 1
 
-namespace std
+namespace std _GLIBCXX_VISIBILITY(default)
 {
 namespace tr1
 {
-
   // [5.2] Special functions
 
   // Implementation-space details.
   namespace __detail
   {
+  _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
     /**
      *   @brief This routine returns the confluent hypergeometric function
@@ -69,9 +64,10 @@ namespace tr1
      *                      \frac{x^n}{n!}
      *   @f]
      * 
-     *   If a and b are integers and a < 0 and either b > 0 or b < a then the
-     *   series is a polynomial with a finite number of terms.  If b is an integer
-     *   and b <= 0 the confluent hypergeometric function is undefined.
+     *   If a and b are integers and a < 0 and either b > 0 or b < a
+     *   then the series is a polynomial with a finite number of
+     *   terms.  If b is an integer and b <= 0 the confluent
+     *   hypergeometric function is undefined.
      *
      *   @param  __a  The "numerator" parameter.
      *   @param  __c  The "denominator" parameter.
@@ -217,8 +213,8 @@ namespace tr1
      * 
      *   @todo  Handle b == nonpositive integer blowup - return NaN.
      *
-     *   @param  __a  The "numerator" parameter.
-     *   @param  __c  The "denominator" parameter.
+     *   @param  __a  The @a numerator parameter.
+     *   @param  __c  The @a denominator parameter.
      *   @param  __x  The argument of the confluent hypergeometric function.
      *   @return  The confluent hypergeometric function.
      */
@@ -260,9 +256,9 @@ namespace tr1
      * 
      *   This works and it's pretty fast.
      *
-     *   @param  __a  The first "numerator" parameter.
-     *   @param  __a  The second "numerator" parameter.
-     *   @param  __c  The "denominator" parameter.
+     *   @param  __a  The first @a numerator parameter.
+     *   @param  __a  The second @a numerator parameter.
+     *   @param  __c  The @a denominator parameter.
      *   @param  __x  The argument of the confluent hypergeometric function.
      *   @return  The confluent hypergeometric function.
      */
@@ -406,10 +402,11 @@ namespace tr1
 
 
     /**
-     *  @brief  Return the hypogeometric function @f$ _2F_1(a,b;c;x) @f$ by the reflection
-     *          formulae in Abramowitz & Stegun formula 15.3.6 for d = c - a - b not integral
-     *          and formula 15.3.11 for d = c - a - b integral.
-     *          This assumes a, b, c != negative integer.
+     *  @brief  Return the hypogeometric function @f$ _2F_1(a,b;c;x) @f$ 
+     *  by the reflection formulae in Abramowitz & Stegun formula
+     *  15.3.6 for d = c - a - b not integral and formula 15.3.11 for
+     *  d = c - a - b integral.  This assumes a, b, c != negative
+     *  integer.
      *
      *   The hypogeometric function is defined by
      *   @f[
@@ -477,13 +474,13 @@ namespace tr1
 
               bool __ok_d1 = true;
               _Tp __lng_ad, __lng_ad1, __lng_bd1;
-              try
+              __try
                 {
                   __lng_ad = __log_gamma(__ad);
                   __lng_ad1 = __log_gamma(__a + __d1);
                   __lng_bd1 = __log_gamma(__b + __d1);
                 }
-              catch(...)
+              __catch(...)
                 {
                   __ok_d1 = false;
                 }
@@ -509,8 +506,8 @@ namespace tr1
                     }
 
                   if (__ln_pre1 > __log_max)
-                    std::__throw_runtime_error(__N("Overflow of gamma functions "
-                                                   "in __hyperg_luke."));
+                    std::__throw_runtime_error(__N("Overflow of gamma functions"
+                                                   " in __hyperg_luke."));
                   else
                     __F1 = std::exp(__ln_pre1) * __sum1;
                 }
@@ -525,12 +522,12 @@ namespace tr1
           // Evaluate F2.
           bool __ok_d2 = true;
           _Tp __lng_ad2, __lng_bd2;
-          try
+          __try
             {
               __lng_ad2 = __log_gamma(__a + __d2);
               __lng_bd2 = __log_gamma(__b + __d2);
             }
-          catch(...)
+          __catch(...)
             {
               __ok_d2 = false;
             }
@@ -556,7 +553,8 @@ namespace tr1
               int __j;
               for (__j = 1; __j < __maxiter; ++__j)
                 {
-                  //  Values for psi functions use recurrence; Abramowitz & Stegun 6.3.5
+                  //  Values for psi functions use recurrence;
+                  //  Abramowitz & Stegun 6.3.5
                   const _Tp __term1 = _Tp(1) / _Tp(__j)
                                     + _Tp(1) / (__ad + __j);
                   const _Tp __term2 = _Tp(1) / (__a + __d1 + _Tp(__j - 1))
@@ -600,14 +598,14 @@ namespace tr1
           bool __ok1 = true;
           _Tp __sgn_g1ca = _Tp(0), __ln_g1ca = _Tp(0);
           _Tp __sgn_g1cb = _Tp(0), __ln_g1cb = _Tp(0);
-          try
+          __try
             {
               __sgn_g1ca = __log_gamma_sign(__c - __a);
               __ln_g1ca = __log_gamma(__c - __a);
               __sgn_g1cb = __log_gamma_sign(__c - __b);
               __ln_g1cb = __log_gamma(__c - __b);
             }
-          catch(...)
+          __catch(...)
             {
               __ok1 = false;
             }
@@ -615,14 +613,14 @@ namespace tr1
           bool __ok2 = true;
           _Tp __sgn_g2a = _Tp(0), __ln_g2a = _Tp(0);
           _Tp __sgn_g2b = _Tp(0), __ln_g2b = _Tp(0);
-          try
+          __try
             {
               __sgn_g2a = __log_gamma_sign(__a);
               __ln_g2a = __log_gamma(__a);
               __sgn_g2b = __log_gamma_sign(__b);
               __ln_g2b = __log_gamma(__b);
             }
-          catch(...)
+          __catch(...)
             {
               __ok2 = false;
             }
@@ -718,9 +716,9 @@ namespace tr1
      *                      \frac{x^n}{n!}
      *   @f]
      *
-     *   @param  __a  The first "numerator" parameter.
-     *   @param  __a  The second "numerator" parameter.
-     *   @param  __c  The "denominator" parameter.
+     *   @param  __a  The first @a numerator parameter.
+     *   @param  __a  The second @a numerator parameter.
+     *   @param  __c  The @a denominator parameter.
      *   @param  __x  The argument of the confluent hypergeometric function.
      *   @return  The confluent hypergeometric function.
      */
@@ -753,7 +751,8 @@ namespace tr1
         return __hyperg_series(__a, __b, __c, __x);
       else if (std::abs(__a) < _Tp(10) && std::abs(__b) < _Tp(10))
         {
-          //  For integer a and b the hypergeometric function is a finite polynomial.
+          //  For integer a and b the hypergeometric function is a
+          //  finite polynomial.
           if (__a < _Tp(0)  &&  std::abs(__a - __a_nint) < __toler)
             return __hyperg_series(__a_nint, __b, __c, __x);
           else if (__b < _Tp(0)  &&  std::abs(__b - __b_nint) < __toler)
@@ -772,6 +771,7 @@ namespace tr1
         return __hyperg_luke(__a, __b, __c, __x);
     }
 
+  _GLIBCXX_END_NAMESPACE_VERSION
   } // namespace std::tr1::__detail
 }
 }