2016-07-08 17:13:55 +08:00
|
|
|
// This file is part of Eigen, a lightweight C++ template library
|
|
|
|
// for linear algebra.
|
|
|
|
//
|
|
|
|
// Copyright (C) 2016 Gael Guennebaud <g.gael@free.fr>
|
|
|
|
//
|
|
|
|
// This Source Code Form is subject to the terms of the Mozilla
|
|
|
|
// Public License v. 2.0. If a copy of the MPL was not distributed
|
|
|
|
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
|
|
|
|
#ifndef EIGEN_SPECIALFUNCTIONS_MODULE
|
|
|
|
#define EIGEN_SPECIALFUNCTIONS_MODULE
|
|
|
|
|
2016-11-02 23:51:52 +08:00
|
|
|
#include <math.h>
|
|
|
|
|
2016-07-08 17:13:55 +08:00
|
|
|
#include "../../Eigen/Core"
|
|
|
|
|
|
|
|
#include "../../Eigen/src/Core/util/DisableStupidWarnings.h"
|
|
|
|
|
|
|
|
namespace Eigen {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* \defgroup SpecialFunctions_Module Special math functions module
|
|
|
|
*
|
|
|
|
* This module features additional coefficient-wise math functions available
|
|
|
|
* within the numext:: namespace for the scalar version, and as method and/or free
|
|
|
|
* functions of Array. Those include:
|
|
|
|
*
|
|
|
|
* - erf
|
|
|
|
* - erfc
|
|
|
|
* - lgamma
|
|
|
|
* - igamma
|
Derivative of the incomplete Gamma function and the sample of a Gamma random variable.
In addition to igamma(a, x), this code implements:
* igamma_der_a(a, x) = d igamma(a, x) / da -- derivative of igamma with respect to the parameter
* gamma_sample_der_alpha(alpha, sample) -- reparameterization derivative of a Gamma(alpha, 1) random variable sample with respect to the alpha parameter
The derivatives are computed by forward mode differentiation of the igamma(a, x) code. Although gamma_sample_der_alpha can be implemented via igamma_der_a, a separate function is more accurate and efficient due to analytical cancellation of some terms. All three functions are implemented by a method parameterized with "mode" that always computes the derivatives, but does not return them unless required by the mode. The compiler is expected to (and, based on benchmarks, does) skip the unnecessary computations depending on the mode.
2018-06-07 01:49:26 +08:00
|
|
|
* - igamma_der_a
|
|
|
|
* - gamma_sample_der_alpha
|
2016-07-08 17:13:55 +08:00
|
|
|
* - igammac
|
|
|
|
* - digamma
|
|
|
|
* - polygamma
|
|
|
|
* - zeta
|
|
|
|
* - betainc
|
2018-05-31 22:34:53 +08:00
|
|
|
* - i0e
|
|
|
|
* - i1e
|
2016-07-08 17:13:55 +08:00
|
|
|
*
|
|
|
|
* \code
|
|
|
|
* #include <unsupported/Eigen/SpecialFunctions>
|
|
|
|
* \endcode
|
|
|
|
*/
|
|
|
|
//@{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "src/SpecialFunctions/SpecialFunctionsImpl.h"
|
|
|
|
#include "src/SpecialFunctions/SpecialFunctionsPacketMath.h"
|
|
|
|
#include "src/SpecialFunctions/SpecialFunctionsHalf.h"
|
|
|
|
#include "src/SpecialFunctions/SpecialFunctionsFunctors.h"
|
|
|
|
#include "src/SpecialFunctions/SpecialFunctionsArrayAPI.h"
|
|
|
|
|
2018-07-11 22:39:54 +08:00
|
|
|
#if defined EIGEN_VECTORIZE_GPU
|
|
|
|
#include "src/SpecialFunctions/arch/GPU/GpuSpecialFunctions.h"
|
2016-07-12 00:39:11 +08:00
|
|
|
#endif
|
|
|
|
|
2016-07-08 17:13:55 +08:00
|
|
|
namespace Eigen {
|
|
|
|
//@}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#include "../../Eigen/src/Core/util/ReenableStupidWarnings.h"
|
|
|
|
|
|
|
|
#endif // EIGEN_SPECIALFUNCTIONS_MODULE
|