]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - libstdc++-v3/include/tr1/legendre_function.tcc
Revert 20001.
[thirdparty/gcc.git] / libstdc++-v3 / include / tr1 / legendre_function.tcc
index a07d83a0bb1eba4d33d6058c64d78d04d622e16c..e2d1880ecb003b4d9ddc6a8b4fbbd5904f98a16b 100644 (file)
@@ -65,7 +65,7 @@ namespace tr1
   namespace __detail
   {
     /**
-     *   @brief  Return the Legendre polynomial by recursion on degree
+     *   @brief  Return the Legendre polynomial by recursion on order
      *           @f$ l @f$.
      * 
      *   The Legendre function of @f$ l @f$ and @f$ x @f$,
@@ -74,7 +74,7 @@ namespace tr1
      *     P_l(x) = \frac{1}{2^l l!}\frac{d^l}{dx^l}(x^2 - 1)^{l}
      *   @f]
      * 
-     *   @param  l  The degree of the Legendre polynomial.  @f$l >= 0@f$.
+     *   @param  l  The order of the Legendre polynomial.  @f$l >= 0@f$.
      *   @param  x  The argument of the Legendre polynomial.  @f$|x| <= 1@f$.
      */
     template<typename _Tp>
@@ -127,19 +127,16 @@ namespace tr1
      *     P_l^m(x) = (1 - x^2)^{m/2}\frac{d^m}{dx^m}P_l(x)
      *   @f]
      * 
-     *   @param  l  The degree of the associated Legendre function.
+     *   @param  l  The order of the associated Legendre function.
      *              @f$ l >= 0 @f$.
      *   @param  m  The order of the associated Legendre function.
      *              @f$ m <= l @f$.
      *   @param  x  The argument of the associated Legendre function.
      *              @f$ |x| <= 1 @f$.
-     *   @param  phase  The phase of the associated Legendre function.
-     *                  Use -1 for the Condon-Shortley phase convention.
      */
     template<typename _Tp>
     _Tp
-    __assoc_legendre_p(unsigned int __l, unsigned int __m, _Tp __x,
-                      _Tp __phase = _Tp{+1})
+    __assoc_legendre_p(unsigned int __l, unsigned int __m, _Tp __x)
     {
 
       if (__x < _Tp(-1) || __x > _Tp(+1))
@@ -163,7 +160,7 @@ namespace tr1
               _Tp __fact = _Tp(1);
               for (unsigned int __i = 1; __i <= __m; ++__i)
                 {
-                  __p_mm *= __phase * __fact * __root;
+                  __p_mm *= -__fact * __root;
                   __fact += _Tp(2);
                 }
             }
@@ -208,10 +205,8 @@ namespace tr1
      *   but this factor is rather large for large @f$ l @f$ and @f$ m @f$
      *   and so this function is stable for larger differences of @f$ l @f$
      *   and @f$ m @f$.
-     *   @note Unlike the case for __assoc_legendre_p the Condon-Shortley
-     *   phase factor @f$ (-1)^m @f$ is present here.
      * 
-     *   @param  l  The degree of the spherical associated Legendre function.
+     *   @param  l  The order of the spherical associated Legendre function.
      *              @f$ l >= 0 @f$.
      *   @param  m  The order of the spherical associated Legendre function.
      *              @f$ m <= l @f$.
@@ -270,15 +265,19 @@ namespace tr1
           const _Tp __lnpre_val =
                     -_Tp(0.25L) * __numeric_constants<_Tp>::__lnpi()
                     + _Tp(0.5L) * (__lnpoch + __m * __lncirc);
-          const _Tp __sr = std::sqrt((_Tp(2) + _Tp(1) / __m)
-                         / (_Tp(4) * __numeric_constants<_Tp>::__pi()));
+          _Tp __sr = std::sqrt((_Tp(2) + _Tp(1) / __m)
+                   / (_Tp(4) * __numeric_constants<_Tp>::__pi()));
           _Tp __y_mm = __sgn * __sr * std::exp(__lnpre_val);
           _Tp __y_mp1m = __y_mp1m_factor * __y_mm;
 
           if (__l == __m)
-            return __y_mm;
+            {
+              return __y_mm;
+            }
           else if (__l == __m + 1)
-            return __y_mp1m;
+            {
+              return __y_mp1m;
+            }
           else
             {
               _Tp __y_lm = _Tp(0);