Home | History | Annotate | Download | only in SpecialFunctions
      1 // This file is part of Eigen, a lightweight C++ template library
      2 // for linear algebra.
      3 //
      4 // Copyright (C) 2016 Gael Guennebaud <gael.guennebaud (at) inria.fr>
      5 //
      6 // This Source Code Form is subject to the terms of the Mozilla
      7 // Public License v. 2.0. If a copy of the MPL was not distributed
      8 // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
      9 
     10 #ifndef EIGEN_SPECIALFUNCTIONS_PACKETMATH_H
     11 #define EIGEN_SPECIALFUNCTIONS_PACKETMATH_H
     12 
     13 namespace Eigen {
     14 
     15 namespace internal {
     16 
     17 /** \internal \returns the ln(|gamma(\a a)|) (coeff-wise) */
     18 template<typename Packet> EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS
     19 Packet plgamma(const Packet& a) { using numext::lgamma; return lgamma(a); }
     20 
     21 /** \internal \returns the derivative of lgamma, psi(\a a) (coeff-wise) */
     22 template<typename Packet> EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS
     23 Packet pdigamma(const Packet& a) { using numext::digamma; return digamma(a); }
     24 
     25 /** \internal \returns the zeta function of two arguments (coeff-wise) */
     26 template<typename Packet> EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS
     27 Packet pzeta(const Packet& x, const Packet& q) { using numext::zeta; return zeta(x, q); }
     28 
     29 /** \internal \returns the polygamma function (coeff-wise) */
     30 template<typename Packet> EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS
     31 Packet ppolygamma(const Packet& n, const Packet& x) { using numext::polygamma; return polygamma(n, x); }
     32 
     33 /** \internal \returns the erf(\a a) (coeff-wise) */
     34 template<typename Packet> EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS
     35 Packet perf(const Packet& a) { using numext::erf; return erf(a); }
     36 
     37 /** \internal \returns the erfc(\a a) (coeff-wise) */
     38 template<typename Packet> EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS
     39 Packet perfc(const Packet& a) { using numext::erfc; return erfc(a); }
     40 
     41 /** \internal \returns the incomplete gamma function igamma(\a a, \a x) */
     42 template<typename Packet> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
     43 Packet pigamma(const Packet& a, const Packet& x) { using numext::igamma; return igamma(a, x); }
     44 
     45 /** \internal \returns the complementary incomplete gamma function igammac(\a a, \a x) */
     46 template<typename Packet> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
     47 Packet pigammac(const Packet& a, const Packet& x) { using numext::igammac; return igammac(a, x); }
     48 
     49 /** \internal \returns the complementary incomplete gamma function betainc(\a a, \a b, \a x) */
     50 template<typename Packet> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
     51 Packet pbetainc(const Packet& a, const Packet& b,const Packet& x) { using numext::betainc; return betainc(a, b, x); }
     52 
     53 } // end namespace internal
     54 
     55 } // end namespace Eigen
     56 
     57 #endif // EIGEN_SPECIALFUNCTIONS_PACKETMATH_H
     58 
     59