Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:57:10

0001 // This file is part of Eigen, a lightweight C++ template library
0002 // for linear algebra.
0003 //
0004 // Copyright (C) 2016 Gael Guennebaud <gael.guennebaud@inria.fr>
0005 //
0006 // This Source Code Form is subject to the terms of the Mozilla
0007 // Public License v. 2.0. If a copy of the MPL was not distributed
0008 // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
0009 
0010 #ifndef EIGEN_SPECIALFUNCTIONS_PACKETMATH_H
0011 #define EIGEN_SPECIALFUNCTIONS_PACKETMATH_H
0012 
0013 namespace Eigen {
0014 
0015 namespace internal {
0016 
0017 /** \internal \returns the ln(|gamma(\a a)|) (coeff-wise) */
0018 template<typename Packet> EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS
0019 Packet plgamma(const Packet& a) { using numext::lgamma; return lgamma(a); }
0020 
0021 /** \internal \returns the derivative of lgamma, psi(\a a) (coeff-wise) */
0022 template<typename Packet> EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS
0023 Packet pdigamma(const Packet& a) { using numext::digamma; return digamma(a); }
0024 
0025 /** \internal \returns the zeta function of two arguments (coeff-wise) */
0026 template<typename Packet> EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS
0027 Packet pzeta(const Packet& x, const Packet& q) { using numext::zeta; return zeta(x, q); }
0028 
0029 /** \internal \returns the polygamma function (coeff-wise) */
0030 template<typename Packet> EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS
0031 Packet ppolygamma(const Packet& n, const Packet& x) { using numext::polygamma; return polygamma(n, x); }
0032 
0033 /** \internal \returns the erf(\a a) (coeff-wise) */
0034 template<typename Packet> EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS
0035 Packet perf(const Packet& a) { using numext::erf; return erf(a); }
0036 
0037 /** \internal \returns the erfc(\a a) (coeff-wise) */
0038 template<typename Packet> EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS
0039 Packet perfc(const Packet& a) { using numext::erfc; return erfc(a); }
0040 
0041 /** \internal \returns the ndtri(\a a) (coeff-wise) */
0042 template<typename Packet> EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS
0043 Packet pndtri(const Packet& a) {
0044   typedef typename unpacket_traits<Packet>::type ScalarType;
0045   using internal::generic_ndtri; return generic_ndtri<Packet, ScalarType>(a);
0046 }
0047 
0048 /** \internal \returns the incomplete gamma function igamma(\a a, \a x) */
0049 template<typename Packet> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
0050 Packet pigamma(const Packet& a, const Packet& x) { using numext::igamma; return igamma(a, x); }
0051 
0052 /** \internal \returns the derivative of the incomplete gamma function
0053  * igamma_der_a(\a a, \a x) */
0054 template <typename Packet>
0055 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet pigamma_der_a(const Packet& a, const Packet& x) {
0056   using numext::igamma_der_a; return igamma_der_a(a, x);
0057 }
0058 
0059 /** \internal \returns compute the derivative of the sample
0060   * of Gamma(alpha, 1) random variable with respect to the parameter a
0061   * gamma_sample_der_alpha(\a alpha, \a sample) */
0062 template <typename Packet>
0063 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet pgamma_sample_der_alpha(const Packet& alpha, const Packet& sample) {
0064   using numext::gamma_sample_der_alpha; return gamma_sample_der_alpha(alpha, sample);
0065 }
0066 
0067 /** \internal \returns the complementary incomplete gamma function igammac(\a a, \a x) */
0068 template<typename Packet> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
0069 Packet pigammac(const Packet& a, const Packet& x) { using numext::igammac; return igammac(a, x); }
0070 
0071 /** \internal \returns the complementary incomplete gamma function betainc(\a a, \a b, \a x) */
0072 template<typename Packet> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
0073 Packet pbetainc(const Packet& a, const Packet& b,const Packet& x) { using numext::betainc; return betainc(a, b, x); }
0074 
0075 } // end namespace internal
0076 
0077 } // end namespace Eigen
0078 
0079 #endif // EIGEN_SPECIALFUNCTIONS_PACKETMATH_H