mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Apply clang-format
This commit is contained in:
@@ -7,7 +7,6 @@
|
||||
// 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_BESSELFUNCTIONS_ARRAYAPI_H
|
||||
#define EIGEN_BESSELFUNCTIONS_ARRAYAPI_H
|
||||
|
||||
@@ -18,272 +17,260 @@ namespace Eigen {
|
||||
|
||||
/** \returns an expression of the coefficient-wise i0(\a x) to the given
|
||||
* arrays.
|
||||
*
|
||||
* It returns the modified Bessel function of the first kind of order zero.
|
||||
*
|
||||
* \param x is the argument
|
||||
*
|
||||
* \note This function supports only float and double scalar types. To support
|
||||
* other scalar types, the user has to provide implementations of i0(T) for
|
||||
* any scalar type T to be supported.
|
||||
*
|
||||
* \sa ArrayBase::bessel_i0()
|
||||
*/
|
||||
*
|
||||
* It returns the modified Bessel function of the first kind of order zero.
|
||||
*
|
||||
* \param x is the argument
|
||||
*
|
||||
* \note This function supports only float and double scalar types. To support
|
||||
* other scalar types, the user has to provide implementations of i0(T) for
|
||||
* any scalar type T to be supported.
|
||||
*
|
||||
* \sa ArrayBase::bessel_i0()
|
||||
*/
|
||||
template <typename Derived>
|
||||
EIGEN_STRONG_INLINE const Eigen::CwiseUnaryOp<
|
||||
Eigen::internal::scalar_bessel_i0_op<typename Derived::Scalar>, const Derived>
|
||||
bessel_i0(const Eigen::ArrayBase<Derived>& x) {
|
||||
return Eigen::CwiseUnaryOp<
|
||||
Eigen::internal::scalar_bessel_i0_op<typename Derived::Scalar>,
|
||||
const Derived>(x.derived());
|
||||
EIGEN_STRONG_INLINE const
|
||||
Eigen::CwiseUnaryOp<Eigen::internal::scalar_bessel_i0_op<typename Derived::Scalar>, const Derived>
|
||||
bessel_i0(const Eigen::ArrayBase<Derived>& x) {
|
||||
return Eigen::CwiseUnaryOp<Eigen::internal::scalar_bessel_i0_op<typename Derived::Scalar>, const Derived>(
|
||||
x.derived());
|
||||
}
|
||||
|
||||
/** \returns an expression of the coefficient-wise i0e(\a x) to the given
|
||||
* arrays.
|
||||
*
|
||||
* It returns the exponentially scaled modified Bessel
|
||||
* function of the first kind of order zero.
|
||||
*
|
||||
* \param x is the argument
|
||||
*
|
||||
* \note This function supports only float and double scalar types. To support
|
||||
* other scalar types, the user has to provide implementations of i0e(T) for
|
||||
* any scalar type T to be supported.
|
||||
*
|
||||
* \sa ArrayBase::bessel_i0e()
|
||||
*/
|
||||
*
|
||||
* It returns the exponentially scaled modified Bessel
|
||||
* function of the first kind of order zero.
|
||||
*
|
||||
* \param x is the argument
|
||||
*
|
||||
* \note This function supports only float and double scalar types. To support
|
||||
* other scalar types, the user has to provide implementations of i0e(T) for
|
||||
* any scalar type T to be supported.
|
||||
*
|
||||
* \sa ArrayBase::bessel_i0e()
|
||||
*/
|
||||
template <typename Derived>
|
||||
EIGEN_STRONG_INLINE const Eigen::CwiseUnaryOp<
|
||||
Eigen::internal::scalar_bessel_i0e_op<typename Derived::Scalar>, const Derived>
|
||||
bessel_i0e(const Eigen::ArrayBase<Derived>& x) {
|
||||
return Eigen::CwiseUnaryOp<
|
||||
Eigen::internal::scalar_bessel_i0e_op<typename Derived::Scalar>,
|
||||
const Derived>(x.derived());
|
||||
EIGEN_STRONG_INLINE const
|
||||
Eigen::CwiseUnaryOp<Eigen::internal::scalar_bessel_i0e_op<typename Derived::Scalar>, const Derived>
|
||||
bessel_i0e(const Eigen::ArrayBase<Derived>& x) {
|
||||
return Eigen::CwiseUnaryOp<Eigen::internal::scalar_bessel_i0e_op<typename Derived::Scalar>, const Derived>(
|
||||
x.derived());
|
||||
}
|
||||
|
||||
/** \returns an expression of the coefficient-wise i1(\a x) to the given
|
||||
* arrays.
|
||||
*
|
||||
* It returns the modified Bessel function of the first kind of order one.
|
||||
*
|
||||
* \param x is the argument
|
||||
*
|
||||
* \note This function supports only float and double scalar types. To support
|
||||
* other scalar types, the user has to provide implementations of i1(T) for
|
||||
* any scalar type T to be supported.
|
||||
*
|
||||
* \sa ArrayBase::bessel_i1()
|
||||
*/
|
||||
*
|
||||
* It returns the modified Bessel function of the first kind of order one.
|
||||
*
|
||||
* \param x is the argument
|
||||
*
|
||||
* \note This function supports only float and double scalar types. To support
|
||||
* other scalar types, the user has to provide implementations of i1(T) for
|
||||
* any scalar type T to be supported.
|
||||
*
|
||||
* \sa ArrayBase::bessel_i1()
|
||||
*/
|
||||
template <typename Derived>
|
||||
EIGEN_STRONG_INLINE const Eigen::CwiseUnaryOp<
|
||||
Eigen::internal::scalar_bessel_i1_op<typename Derived::Scalar>, const Derived>
|
||||
bessel_i1(const Eigen::ArrayBase<Derived>& x) {
|
||||
return Eigen::CwiseUnaryOp<
|
||||
Eigen::internal::scalar_bessel_i1_op<typename Derived::Scalar>,
|
||||
const Derived>(x.derived());
|
||||
EIGEN_STRONG_INLINE const
|
||||
Eigen::CwiseUnaryOp<Eigen::internal::scalar_bessel_i1_op<typename Derived::Scalar>, const Derived>
|
||||
bessel_i1(const Eigen::ArrayBase<Derived>& x) {
|
||||
return Eigen::CwiseUnaryOp<Eigen::internal::scalar_bessel_i1_op<typename Derived::Scalar>, const Derived>(
|
||||
x.derived());
|
||||
}
|
||||
|
||||
/** \returns an expression of the coefficient-wise i1e(\a x) to the given
|
||||
* arrays.
|
||||
*
|
||||
* It returns the exponentially scaled modified Bessel
|
||||
* function of the first kind of order one.
|
||||
*
|
||||
* \param x is the argument
|
||||
*
|
||||
* \note This function supports only float and double scalar types. To support
|
||||
* other scalar types, the user has to provide implementations of i1e(T) for
|
||||
* any scalar type T to be supported.
|
||||
*
|
||||
* \sa ArrayBase::bessel_i1e()
|
||||
*/
|
||||
*
|
||||
* It returns the exponentially scaled modified Bessel
|
||||
* function of the first kind of order one.
|
||||
*
|
||||
* \param x is the argument
|
||||
*
|
||||
* \note This function supports only float and double scalar types. To support
|
||||
* other scalar types, the user has to provide implementations of i1e(T) for
|
||||
* any scalar type T to be supported.
|
||||
*
|
||||
* \sa ArrayBase::bessel_i1e()
|
||||
*/
|
||||
template <typename Derived>
|
||||
EIGEN_STRONG_INLINE const Eigen::CwiseUnaryOp<
|
||||
Eigen::internal::scalar_bessel_i1e_op<typename Derived::Scalar>, const Derived>
|
||||
bessel_i1e(const Eigen::ArrayBase<Derived>& x) {
|
||||
return Eigen::CwiseUnaryOp<
|
||||
Eigen::internal::scalar_bessel_i1e_op<typename Derived::Scalar>,
|
||||
const Derived>(x.derived());
|
||||
EIGEN_STRONG_INLINE const
|
||||
Eigen::CwiseUnaryOp<Eigen::internal::scalar_bessel_i1e_op<typename Derived::Scalar>, const Derived>
|
||||
bessel_i1e(const Eigen::ArrayBase<Derived>& x) {
|
||||
return Eigen::CwiseUnaryOp<Eigen::internal::scalar_bessel_i1e_op<typename Derived::Scalar>, const Derived>(
|
||||
x.derived());
|
||||
}
|
||||
|
||||
/** \returns an expression of the coefficient-wise k0(\a x) to the given
|
||||
* arrays.
|
||||
*
|
||||
* It returns the modified Bessel function of the second kind of order zero.
|
||||
*
|
||||
* \param x is the argument
|
||||
*
|
||||
* \note This function supports only float and double scalar types. To support
|
||||
* other scalar types, the user has to provide implementations of k0(T) for
|
||||
* any scalar type T to be supported.
|
||||
*
|
||||
* \sa ArrayBase::bessel_k0()
|
||||
*/
|
||||
*
|
||||
* It returns the modified Bessel function of the second kind of order zero.
|
||||
*
|
||||
* \param x is the argument
|
||||
*
|
||||
* \note This function supports only float and double scalar types. To support
|
||||
* other scalar types, the user has to provide implementations of k0(T) for
|
||||
* any scalar type T to be supported.
|
||||
*
|
||||
* \sa ArrayBase::bessel_k0()
|
||||
*/
|
||||
template <typename Derived>
|
||||
EIGEN_STRONG_INLINE const Eigen::CwiseUnaryOp<
|
||||
Eigen::internal::scalar_bessel_k0_op<typename Derived::Scalar>, const Derived>
|
||||
bessel_k0(const Eigen::ArrayBase<Derived>& x) {
|
||||
return Eigen::CwiseUnaryOp<
|
||||
Eigen::internal::scalar_bessel_k0_op<typename Derived::Scalar>,
|
||||
const Derived>(x.derived());
|
||||
EIGEN_STRONG_INLINE const
|
||||
Eigen::CwiseUnaryOp<Eigen::internal::scalar_bessel_k0_op<typename Derived::Scalar>, const Derived>
|
||||
bessel_k0(const Eigen::ArrayBase<Derived>& x) {
|
||||
return Eigen::CwiseUnaryOp<Eigen::internal::scalar_bessel_k0_op<typename Derived::Scalar>, const Derived>(
|
||||
x.derived());
|
||||
}
|
||||
|
||||
/** \returns an expression of the coefficient-wise k0e(\a x) to the given
|
||||
* arrays.
|
||||
*
|
||||
* It returns the exponentially scaled modified Bessel
|
||||
* function of the second kind of order zero.
|
||||
*
|
||||
* \param x is the argument
|
||||
*
|
||||
* \note This function supports only float and double scalar types. To support
|
||||
* other scalar types, the user has to provide implementations of k0e(T) for
|
||||
* any scalar type T to be supported.
|
||||
*
|
||||
* \sa ArrayBase::bessel_k0e()
|
||||
*/
|
||||
*
|
||||
* It returns the exponentially scaled modified Bessel
|
||||
* function of the second kind of order zero.
|
||||
*
|
||||
* \param x is the argument
|
||||
*
|
||||
* \note This function supports only float and double scalar types. To support
|
||||
* other scalar types, the user has to provide implementations of k0e(T) for
|
||||
* any scalar type T to be supported.
|
||||
*
|
||||
* \sa ArrayBase::bessel_k0e()
|
||||
*/
|
||||
template <typename Derived>
|
||||
EIGEN_STRONG_INLINE const Eigen::CwiseUnaryOp<
|
||||
Eigen::internal::scalar_bessel_k0e_op<typename Derived::Scalar>, const Derived>
|
||||
bessel_k0e(const Eigen::ArrayBase<Derived>& x) {
|
||||
return Eigen::CwiseUnaryOp<
|
||||
Eigen::internal::scalar_bessel_k0e_op<typename Derived::Scalar>,
|
||||
const Derived>(x.derived());
|
||||
EIGEN_STRONG_INLINE const
|
||||
Eigen::CwiseUnaryOp<Eigen::internal::scalar_bessel_k0e_op<typename Derived::Scalar>, const Derived>
|
||||
bessel_k0e(const Eigen::ArrayBase<Derived>& x) {
|
||||
return Eigen::CwiseUnaryOp<Eigen::internal::scalar_bessel_k0e_op<typename Derived::Scalar>, const Derived>(
|
||||
x.derived());
|
||||
}
|
||||
|
||||
/** \returns an expression of the coefficient-wise k1(\a x) to the given
|
||||
* arrays.
|
||||
*
|
||||
* It returns the modified Bessel function of the second kind of order one.
|
||||
*
|
||||
* \param x is the argument
|
||||
*
|
||||
* \note This function supports only float and double scalar types. To support
|
||||
* other scalar types, the user has to provide implementations of k1(T) for
|
||||
* any scalar type T to be supported.
|
||||
*
|
||||
* \sa ArrayBase::bessel_k1()
|
||||
*/
|
||||
*
|
||||
* It returns the modified Bessel function of the second kind of order one.
|
||||
*
|
||||
* \param x is the argument
|
||||
*
|
||||
* \note This function supports only float and double scalar types. To support
|
||||
* other scalar types, the user has to provide implementations of k1(T) for
|
||||
* any scalar type T to be supported.
|
||||
*
|
||||
* \sa ArrayBase::bessel_k1()
|
||||
*/
|
||||
template <typename Derived>
|
||||
EIGEN_STRONG_INLINE const Eigen::CwiseUnaryOp<
|
||||
Eigen::internal::scalar_bessel_k1_op<typename Derived::Scalar>, const Derived>
|
||||
bessel_k1(const Eigen::ArrayBase<Derived>& x) {
|
||||
return Eigen::CwiseUnaryOp<
|
||||
Eigen::internal::scalar_bessel_k1_op<typename Derived::Scalar>,
|
||||
const Derived>(x.derived());
|
||||
EIGEN_STRONG_INLINE const
|
||||
Eigen::CwiseUnaryOp<Eigen::internal::scalar_bessel_k1_op<typename Derived::Scalar>, const Derived>
|
||||
bessel_k1(const Eigen::ArrayBase<Derived>& x) {
|
||||
return Eigen::CwiseUnaryOp<Eigen::internal::scalar_bessel_k1_op<typename Derived::Scalar>, const Derived>(
|
||||
x.derived());
|
||||
}
|
||||
|
||||
/** \returns an expression of the coefficient-wise k1e(\a x) to the given
|
||||
* arrays.
|
||||
*
|
||||
* It returns the exponentially scaled modified Bessel
|
||||
* function of the second kind of order one.
|
||||
*
|
||||
* \param x is the argument
|
||||
*
|
||||
* \note This function supports only float and double scalar types. To support
|
||||
* other scalar types, the user has to provide implementations of k1e(T) for
|
||||
* any scalar type T to be supported.
|
||||
*
|
||||
* \sa ArrayBase::bessel_k1e()
|
||||
*/
|
||||
*
|
||||
* It returns the exponentially scaled modified Bessel
|
||||
* function of the second kind of order one.
|
||||
*
|
||||
* \param x is the argument
|
||||
*
|
||||
* \note This function supports only float and double scalar types. To support
|
||||
* other scalar types, the user has to provide implementations of k1e(T) for
|
||||
* any scalar type T to be supported.
|
||||
*
|
||||
* \sa ArrayBase::bessel_k1e()
|
||||
*/
|
||||
template <typename Derived>
|
||||
EIGEN_STRONG_INLINE const Eigen::CwiseUnaryOp<
|
||||
Eigen::internal::scalar_bessel_k1e_op<typename Derived::Scalar>, const Derived>
|
||||
bessel_k1e(const Eigen::ArrayBase<Derived>& x) {
|
||||
return Eigen::CwiseUnaryOp<
|
||||
Eigen::internal::scalar_bessel_k1e_op<typename Derived::Scalar>,
|
||||
const Derived>(x.derived());
|
||||
EIGEN_STRONG_INLINE const
|
||||
Eigen::CwiseUnaryOp<Eigen::internal::scalar_bessel_k1e_op<typename Derived::Scalar>, const Derived>
|
||||
bessel_k1e(const Eigen::ArrayBase<Derived>& x) {
|
||||
return Eigen::CwiseUnaryOp<Eigen::internal::scalar_bessel_k1e_op<typename Derived::Scalar>, const Derived>(
|
||||
x.derived());
|
||||
}
|
||||
|
||||
/** \returns an expression of the coefficient-wise j0(\a x) to the given
|
||||
* arrays.
|
||||
*
|
||||
* It returns the Bessel function of the first kind of order zero.
|
||||
*
|
||||
* \param x is the argument
|
||||
*
|
||||
* \note This function supports only float and double scalar types. To support
|
||||
* other scalar types, the user has to provide implementations of j0(T) for
|
||||
* any scalar type T to be supported.
|
||||
*
|
||||
* \sa ArrayBase::bessel_j0()
|
||||
*/
|
||||
*
|
||||
* It returns the Bessel function of the first kind of order zero.
|
||||
*
|
||||
* \param x is the argument
|
||||
*
|
||||
* \note This function supports only float and double scalar types. To support
|
||||
* other scalar types, the user has to provide implementations of j0(T) for
|
||||
* any scalar type T to be supported.
|
||||
*
|
||||
* \sa ArrayBase::bessel_j0()
|
||||
*/
|
||||
template <typename Derived>
|
||||
EIGEN_STRONG_INLINE const Eigen::CwiseUnaryOp<
|
||||
Eigen::internal::scalar_bessel_j0_op<typename Derived::Scalar>, const Derived>
|
||||
bessel_j0(const Eigen::ArrayBase<Derived>& x) {
|
||||
return Eigen::CwiseUnaryOp<
|
||||
Eigen::internal::scalar_bessel_j0_op<typename Derived::Scalar>,
|
||||
const Derived>(x.derived());
|
||||
EIGEN_STRONG_INLINE const
|
||||
Eigen::CwiseUnaryOp<Eigen::internal::scalar_bessel_j0_op<typename Derived::Scalar>, const Derived>
|
||||
bessel_j0(const Eigen::ArrayBase<Derived>& x) {
|
||||
return Eigen::CwiseUnaryOp<Eigen::internal::scalar_bessel_j0_op<typename Derived::Scalar>, const Derived>(
|
||||
x.derived());
|
||||
}
|
||||
|
||||
/** \returns an expression of the coefficient-wise y0(\a x) to the given
|
||||
* arrays.
|
||||
*
|
||||
* It returns the Bessel function of the second kind of order zero.
|
||||
*
|
||||
* \param x is the argument
|
||||
*
|
||||
* \note This function supports only float and double scalar types. To support
|
||||
* other scalar types, the user has to provide implementations of y0(T) for
|
||||
* any scalar type T to be supported.
|
||||
*
|
||||
* \sa ArrayBase::bessel_y0()
|
||||
*/
|
||||
*
|
||||
* It returns the Bessel function of the second kind of order zero.
|
||||
*
|
||||
* \param x is the argument
|
||||
*
|
||||
* \note This function supports only float and double scalar types. To support
|
||||
* other scalar types, the user has to provide implementations of y0(T) for
|
||||
* any scalar type T to be supported.
|
||||
*
|
||||
* \sa ArrayBase::bessel_y0()
|
||||
*/
|
||||
template <typename Derived>
|
||||
EIGEN_STRONG_INLINE const Eigen::CwiseUnaryOp<
|
||||
Eigen::internal::scalar_bessel_y0_op<typename Derived::Scalar>, const Derived>
|
||||
bessel_y0(const Eigen::ArrayBase<Derived>& x) {
|
||||
return Eigen::CwiseUnaryOp<
|
||||
Eigen::internal::scalar_bessel_y0_op<typename Derived::Scalar>,
|
||||
const Derived>(x.derived());
|
||||
EIGEN_STRONG_INLINE const
|
||||
Eigen::CwiseUnaryOp<Eigen::internal::scalar_bessel_y0_op<typename Derived::Scalar>, const Derived>
|
||||
bessel_y0(const Eigen::ArrayBase<Derived>& x) {
|
||||
return Eigen::CwiseUnaryOp<Eigen::internal::scalar_bessel_y0_op<typename Derived::Scalar>, const Derived>(
|
||||
x.derived());
|
||||
}
|
||||
|
||||
/** \returns an expression of the coefficient-wise j1(\a x) to the given
|
||||
* arrays.
|
||||
*
|
||||
* It returns the modified Bessel function of the first kind of order one.
|
||||
*
|
||||
* \param x is the argument
|
||||
*
|
||||
* \note This function supports only float and double scalar types. To support
|
||||
* other scalar types, the user has to provide implementations of j1(T) for
|
||||
* any scalar type T to be supported.
|
||||
*
|
||||
* \sa ArrayBase::bessel_j1()
|
||||
*/
|
||||
*
|
||||
* It returns the modified Bessel function of the first kind of order one.
|
||||
*
|
||||
* \param x is the argument
|
||||
*
|
||||
* \note This function supports only float and double scalar types. To support
|
||||
* other scalar types, the user has to provide implementations of j1(T) for
|
||||
* any scalar type T to be supported.
|
||||
*
|
||||
* \sa ArrayBase::bessel_j1()
|
||||
*/
|
||||
template <typename Derived>
|
||||
EIGEN_STRONG_INLINE const Eigen::CwiseUnaryOp<
|
||||
Eigen::internal::scalar_bessel_j1_op<typename Derived::Scalar>, const Derived>
|
||||
bessel_j1(const Eigen::ArrayBase<Derived>& x) {
|
||||
return Eigen::CwiseUnaryOp<
|
||||
Eigen::internal::scalar_bessel_j1_op<typename Derived::Scalar>,
|
||||
const Derived>(x.derived());
|
||||
EIGEN_STRONG_INLINE const
|
||||
Eigen::CwiseUnaryOp<Eigen::internal::scalar_bessel_j1_op<typename Derived::Scalar>, const Derived>
|
||||
bessel_j1(const Eigen::ArrayBase<Derived>& x) {
|
||||
return Eigen::CwiseUnaryOp<Eigen::internal::scalar_bessel_j1_op<typename Derived::Scalar>, const Derived>(
|
||||
x.derived());
|
||||
}
|
||||
|
||||
/** \returns an expression of the coefficient-wise y1(\a x) to the given
|
||||
* arrays.
|
||||
*
|
||||
* It returns the Bessel function of the second kind of order one.
|
||||
*
|
||||
* \param x is the argument
|
||||
*
|
||||
* \note This function supports only float and double scalar types. To support
|
||||
* other scalar types, the user has to provide implementations of y1(T) for
|
||||
* any scalar type T to be supported.
|
||||
*
|
||||
* \sa ArrayBase::bessel_y1()
|
||||
*/
|
||||
*
|
||||
* It returns the Bessel function of the second kind of order one.
|
||||
*
|
||||
* \param x is the argument
|
||||
*
|
||||
* \note This function supports only float and double scalar types. To support
|
||||
* other scalar types, the user has to provide implementations of y1(T) for
|
||||
* any scalar type T to be supported.
|
||||
*
|
||||
* \sa ArrayBase::bessel_y1()
|
||||
*/
|
||||
template <typename Derived>
|
||||
EIGEN_STRONG_INLINE const Eigen::CwiseUnaryOp<
|
||||
Eigen::internal::scalar_bessel_y1_op<typename Derived::Scalar>, const Derived>
|
||||
bessel_y1(const Eigen::ArrayBase<Derived>& x) {
|
||||
return Eigen::CwiseUnaryOp<
|
||||
Eigen::internal::scalar_bessel_y1_op<typename Derived::Scalar>,
|
||||
const Derived>(x.derived());
|
||||
EIGEN_STRONG_INLINE const
|
||||
Eigen::CwiseUnaryOp<Eigen::internal::scalar_bessel_y1_op<typename Derived::Scalar>, const Derived>
|
||||
bessel_y1(const Eigen::ArrayBase<Derived>& x) {
|
||||
return Eigen::CwiseUnaryOp<Eigen::internal::scalar_bessel_y1_op<typename Derived::Scalar>, const Derived>(
|
||||
x.derived());
|
||||
}
|
||||
|
||||
} // end namespace Eigen
|
||||
} // end namespace Eigen
|
||||
|
||||
#endif // EIGEN_BESSELFUNCTIONS_ARRAYAPI_H
|
||||
#endif // EIGEN_BESSELFUNCTIONS_ARRAYAPI_H
|
||||
|
||||
@@ -30,9 +30,7 @@ struct scalar_bessel_i0_op {
|
||||
return bessel_i0(x);
|
||||
}
|
||||
typedef typename packet_traits<Scalar>::type Packet;
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet packetOp(const Packet& x) const {
|
||||
return internal::pbessel_i0(x);
|
||||
}
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet packetOp(const Packet& x) const { return internal::pbessel_i0(x); }
|
||||
};
|
||||
template <typename Scalar>
|
||||
struct functor_traits<scalar_bessel_i0_op<Scalar> > {
|
||||
@@ -57,9 +55,7 @@ struct scalar_bessel_i0e_op {
|
||||
return bessel_i0e(x);
|
||||
}
|
||||
typedef typename packet_traits<Scalar>::type Packet;
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet packetOp(const Packet& x) const {
|
||||
return internal::pbessel_i0e(x);
|
||||
}
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet packetOp(const Packet& x) const { return internal::pbessel_i0e(x); }
|
||||
};
|
||||
template <typename Scalar>
|
||||
struct functor_traits<scalar_bessel_i0e_op<Scalar> > {
|
||||
@@ -83,9 +79,7 @@ struct scalar_bessel_i1_op {
|
||||
return bessel_i1(x);
|
||||
}
|
||||
typedef typename packet_traits<Scalar>::type Packet;
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet packetOp(const Packet& x) const {
|
||||
return internal::pbessel_i1(x);
|
||||
}
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet packetOp(const Packet& x) const { return internal::pbessel_i1(x); }
|
||||
};
|
||||
template <typename Scalar>
|
||||
struct functor_traits<scalar_bessel_i1_op<Scalar> > {
|
||||
@@ -110,9 +104,7 @@ struct scalar_bessel_i1e_op {
|
||||
return bessel_i1e(x);
|
||||
}
|
||||
typedef typename packet_traits<Scalar>::type Packet;
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet packetOp(const Packet& x) const {
|
||||
return internal::pbessel_i1e(x);
|
||||
}
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet packetOp(const Packet& x) const { return internal::pbessel_i1e(x); }
|
||||
};
|
||||
template <typename Scalar>
|
||||
struct functor_traits<scalar_bessel_i1e_op<Scalar> > {
|
||||
@@ -136,9 +128,7 @@ struct scalar_bessel_j0_op {
|
||||
return bessel_j0(x);
|
||||
}
|
||||
typedef typename packet_traits<Scalar>::type Packet;
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet packetOp(const Packet& x) const {
|
||||
return internal::pbessel_j0(x);
|
||||
}
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet packetOp(const Packet& x) const { return internal::pbessel_j0(x); }
|
||||
};
|
||||
template <typename Scalar>
|
||||
struct functor_traits<scalar_bessel_j0_op<Scalar> > {
|
||||
@@ -163,9 +153,7 @@ struct scalar_bessel_y0_op {
|
||||
return bessel_y0(x);
|
||||
}
|
||||
typedef typename packet_traits<Scalar>::type Packet;
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet packetOp(const Packet& x) const {
|
||||
return internal::pbessel_y0(x);
|
||||
}
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet packetOp(const Packet& x) const { return internal::pbessel_y0(x); }
|
||||
};
|
||||
template <typename Scalar>
|
||||
struct functor_traits<scalar_bessel_y0_op<Scalar> > {
|
||||
@@ -190,9 +178,7 @@ struct scalar_bessel_j1_op {
|
||||
return bessel_j1(x);
|
||||
}
|
||||
typedef typename packet_traits<Scalar>::type Packet;
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet packetOp(const Packet& x) const {
|
||||
return internal::pbessel_j1(x);
|
||||
}
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet packetOp(const Packet& x) const { return internal::pbessel_j1(x); }
|
||||
};
|
||||
template <typename Scalar>
|
||||
struct functor_traits<scalar_bessel_j1_op<Scalar> > {
|
||||
@@ -217,9 +203,7 @@ struct scalar_bessel_y1_op {
|
||||
return bessel_y1(x);
|
||||
}
|
||||
typedef typename packet_traits<Scalar>::type Packet;
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet packetOp(const Packet& x) const {
|
||||
return internal::pbessel_y1(x);
|
||||
}
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet packetOp(const Packet& x) const { return internal::pbessel_y1(x); }
|
||||
};
|
||||
template <typename Scalar>
|
||||
struct functor_traits<scalar_bessel_y1_op<Scalar> > {
|
||||
@@ -244,9 +228,7 @@ struct scalar_bessel_k0_op {
|
||||
return bessel_k0(x);
|
||||
}
|
||||
typedef typename packet_traits<Scalar>::type Packet;
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet packetOp(const Packet& x) const {
|
||||
return internal::pbessel_k0(x);
|
||||
}
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet packetOp(const Packet& x) const { return internal::pbessel_k0(x); }
|
||||
};
|
||||
template <typename Scalar>
|
||||
struct functor_traits<scalar_bessel_k0_op<Scalar> > {
|
||||
@@ -271,9 +253,7 @@ struct scalar_bessel_k0e_op {
|
||||
return bessel_k0e(x);
|
||||
}
|
||||
typedef typename packet_traits<Scalar>::type Packet;
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet packetOp(const Packet& x) const {
|
||||
return internal::pbessel_k0e(x);
|
||||
}
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet packetOp(const Packet& x) const { return internal::pbessel_k0e(x); }
|
||||
};
|
||||
template <typename Scalar>
|
||||
struct functor_traits<scalar_bessel_k0e_op<Scalar> > {
|
||||
@@ -298,9 +278,7 @@ struct scalar_bessel_k1_op {
|
||||
return bessel_k1(x);
|
||||
}
|
||||
typedef typename packet_traits<Scalar>::type Packet;
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet packetOp(const Packet& x) const {
|
||||
return internal::pbessel_k1(x);
|
||||
}
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet packetOp(const Packet& x) const { return internal::pbessel_k1(x); }
|
||||
};
|
||||
template <typename Scalar>
|
||||
struct functor_traits<scalar_bessel_k1_op<Scalar> > {
|
||||
@@ -325,9 +303,7 @@ struct scalar_bessel_k1e_op {
|
||||
return bessel_k1e(x);
|
||||
}
|
||||
typedef typename packet_traits<Scalar>::type Packet;
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet packetOp(const Packet& x) const {
|
||||
return internal::pbessel_k1e(x);
|
||||
}
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet packetOp(const Packet& x) const { return internal::pbessel_k1e(x); }
|
||||
};
|
||||
template <typename Scalar>
|
||||
struct functor_traits<scalar_bessel_k1e_op<Scalar> > {
|
||||
@@ -340,9 +316,8 @@ struct functor_traits<scalar_bessel_k1e_op<Scalar> > {
|
||||
};
|
||||
};
|
||||
|
||||
} // end namespace internal
|
||||
|
||||
} // end namespace internal
|
||||
} // end namespace Eigen
|
||||
|
||||
} // end namespace Eigen
|
||||
|
||||
#endif // EIGEN_BESSELFUNCTIONS_FUNCTORS_H
|
||||
#endif // EIGEN_BESSELFUNCTIONS_FUNCTORS_H
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -20,102 +20,89 @@ namespace internal {
|
||||
/** \internal \returns the exponentially scaled modified Bessel function of
|
||||
* order zero i0(\a a) (coeff-wise) */
|
||||
template <typename Packet>
|
||||
EIGEN_DEVICE_FUNC EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS
|
||||
Packet pbessel_i0(const Packet& x) {
|
||||
EIGEN_DEVICE_FUNC EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pbessel_i0(const Packet& x) {
|
||||
return numext::bessel_i0(x);
|
||||
}
|
||||
|
||||
/** \internal \returns the exponentially scaled modified Bessel function of
|
||||
* order zero i0e(\a a) (coeff-wise) */
|
||||
template <typename Packet>
|
||||
EIGEN_DEVICE_FUNC EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS
|
||||
Packet pbessel_i0e(const Packet& x) {
|
||||
EIGEN_DEVICE_FUNC EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pbessel_i0e(const Packet& x) {
|
||||
return numext::bessel_i0e(x);
|
||||
}
|
||||
|
||||
/** \internal \returns the exponentially scaled modified Bessel function of
|
||||
* order one i1(\a a) (coeff-wise) */
|
||||
template <typename Packet>
|
||||
EIGEN_DEVICE_FUNC EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS
|
||||
Packet pbessel_i1(const Packet& x) {
|
||||
EIGEN_DEVICE_FUNC EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pbessel_i1(const Packet& x) {
|
||||
return numext::bessel_i1(x);
|
||||
}
|
||||
|
||||
/** \internal \returns the exponentially scaled modified Bessel function of
|
||||
* order one i1e(\a a) (coeff-wise) */
|
||||
template <typename Packet>
|
||||
EIGEN_DEVICE_FUNC EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS
|
||||
Packet pbessel_i1e(const Packet& x) {
|
||||
EIGEN_DEVICE_FUNC EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pbessel_i1e(const Packet& x) {
|
||||
return numext::bessel_i1e(x);
|
||||
}
|
||||
|
||||
/** \internal \returns the exponentially scaled modified Bessel function of
|
||||
* order zero j0(\a a) (coeff-wise) */
|
||||
template <typename Packet>
|
||||
EIGEN_DEVICE_FUNC EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS
|
||||
Packet pbessel_j0(const Packet& x) {
|
||||
EIGEN_DEVICE_FUNC EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pbessel_j0(const Packet& x) {
|
||||
return numext::bessel_j0(x);
|
||||
}
|
||||
|
||||
/** \internal \returns the exponentially scaled modified Bessel function of
|
||||
* order zero j1(\a a) (coeff-wise) */
|
||||
template <typename Packet>
|
||||
EIGEN_DEVICE_FUNC EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS
|
||||
Packet pbessel_j1(const Packet& x) {
|
||||
EIGEN_DEVICE_FUNC EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pbessel_j1(const Packet& x) {
|
||||
return numext::bessel_j1(x);
|
||||
}
|
||||
|
||||
/** \internal \returns the exponentially scaled modified Bessel function of
|
||||
* order one y0(\a a) (coeff-wise) */
|
||||
template <typename Packet>
|
||||
EIGEN_DEVICE_FUNC EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS
|
||||
Packet pbessel_y0(const Packet& x) {
|
||||
EIGEN_DEVICE_FUNC EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pbessel_y0(const Packet& x) {
|
||||
return numext::bessel_y0(x);
|
||||
}
|
||||
|
||||
/** \internal \returns the exponentially scaled modified Bessel function of
|
||||
* order one y1(\a a) (coeff-wise) */
|
||||
template <typename Packet>
|
||||
EIGEN_DEVICE_FUNC EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS
|
||||
Packet pbessel_y1(const Packet& x) {
|
||||
EIGEN_DEVICE_FUNC EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pbessel_y1(const Packet& x) {
|
||||
return numext::bessel_y1(x);
|
||||
}
|
||||
|
||||
/** \internal \returns the exponentially scaled modified Bessel function of
|
||||
* order zero k0(\a a) (coeff-wise) */
|
||||
template <typename Packet>
|
||||
EIGEN_DEVICE_FUNC EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS
|
||||
Packet pbessel_k0(const Packet& x) {
|
||||
EIGEN_DEVICE_FUNC EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pbessel_k0(const Packet& x) {
|
||||
return numext::bessel_k0(x);
|
||||
}
|
||||
|
||||
/** \internal \returns the exponentially scaled modified Bessel function of
|
||||
* order zero k0e(\a a) (coeff-wise) */
|
||||
template <typename Packet>
|
||||
EIGEN_DEVICE_FUNC EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS
|
||||
Packet pbessel_k0e(const Packet& x) {
|
||||
EIGEN_DEVICE_FUNC EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pbessel_k0e(const Packet& x) {
|
||||
return numext::bessel_k0e(x);
|
||||
}
|
||||
|
||||
/** \internal \returns the exponentially scaled modified Bessel function of
|
||||
* order one k1e(\a a) (coeff-wise) */
|
||||
template <typename Packet>
|
||||
EIGEN_DEVICE_FUNC EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS
|
||||
Packet pbessel_k1(const Packet& x) {
|
||||
EIGEN_DEVICE_FUNC EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pbessel_k1(const Packet& x) {
|
||||
return numext::bessel_k1(x);
|
||||
}
|
||||
|
||||
/** \internal \returns the exponentially scaled modified Bessel function of
|
||||
* order one k1e(\a a) (coeff-wise) */
|
||||
template <typename Packet>
|
||||
EIGEN_DEVICE_FUNC EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS
|
||||
Packet pbessel_k1e(const Packet& x) {
|
||||
EIGEN_DEVICE_FUNC EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pbessel_k1e(const Packet& x) {
|
||||
return numext::bessel_k1e(x);
|
||||
}
|
||||
|
||||
} // end namespace internal
|
||||
} // end namespace internal
|
||||
|
||||
} // end namespace Eigen
|
||||
|
||||
#endif // EIGEN_BESSELFUNCTIONS_PACKETMATH_H
|
||||
} // end namespace Eigen
|
||||
|
||||
#endif // EIGEN_BESSELFUNCTIONS_PACKETMATH_H
|
||||
|
||||
@@ -2,8 +2,9 @@
|
||||
#define HIP_VECTOR_COMPATIBILITY_H
|
||||
|
||||
namespace hip_impl {
|
||||
template <typename, typename, unsigned int> struct Scalar_accessor;
|
||||
} // end namespace hip_impl
|
||||
template <typename, typename, unsigned int>
|
||||
struct Scalar_accessor;
|
||||
} // end namespace hip_impl
|
||||
|
||||
// IWYU pragma: private
|
||||
#include "./InternalHeaderCheck.h"
|
||||
@@ -11,19 +12,19 @@ namespace hip_impl {
|
||||
namespace Eigen {
|
||||
namespace internal {
|
||||
|
||||
#define HIP_SCALAR_ACCESSOR_BUILDER(NAME) \
|
||||
template <typename T, typename U, unsigned int n> \
|
||||
struct NAME <hip_impl::Scalar_accessor<T, U, n>> : NAME <T> {};
|
||||
#define HIP_SCALAR_ACCESSOR_BUILDER(NAME) \
|
||||
template <typename T, typename U, unsigned int n> \
|
||||
struct NAME<hip_impl::Scalar_accessor<T, U, n>> : NAME<T> {};
|
||||
|
||||
#define HIP_SCALAR_ACCESSOR_BUILDER_RETVAL(NAME) \
|
||||
template <typename T, typename U, unsigned int n> \
|
||||
struct NAME##_impl <hip_impl::Scalar_accessor<T, U, n>> : NAME##_impl <T> {}; \
|
||||
template <typename T, typename U, unsigned int n> \
|
||||
struct NAME##_retval <hip_impl::Scalar_accessor<T, U, n>> : NAME##_retval <T> {};
|
||||
#define HIP_SCALAR_ACCESSOR_BUILDER_RETVAL(NAME) \
|
||||
template <typename T, typename U, unsigned int n> \
|
||||
struct NAME##_impl<hip_impl::Scalar_accessor<T, U, n>> : NAME##_impl<T> {}; \
|
||||
template <typename T, typename U, unsigned int n> \
|
||||
struct NAME##_retval<hip_impl::Scalar_accessor<T, U, n>> : NAME##_retval<T> {};
|
||||
|
||||
#define HIP_SCALAR_ACCESSOR_BUILDER_IGAMMA(NAME) \
|
||||
template <typename T, typename U, unsigned int n, IgammaComputationMode mode> \
|
||||
struct NAME <hip_impl::Scalar_accessor<T, U, n>, mode> : NAME <T, mode> {};
|
||||
#define HIP_SCALAR_ACCESSOR_BUILDER_IGAMMA(NAME) \
|
||||
template <typename T, typename U, unsigned int n, IgammaComputationMode mode> \
|
||||
struct NAME<hip_impl::Scalar_accessor<T, U, n>, mode> : NAME<T, mode> {};
|
||||
|
||||
#if EIGEN_HAS_C99_MATH
|
||||
HIP_SCALAR_ACCESSOR_BUILDER(betainc_helper)
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#ifndef EIGEN_SPECIALFUNCTIONS_MODULE_H
|
||||
#error "Please include unsupported/Eigen/SpecialFunctions instead of including headers inside the src directory directly."
|
||||
#error \
|
||||
"Please include unsupported/Eigen/SpecialFunctions instead of including headers inside the src directory directly."
|
||||
#endif
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
// 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_ARRAYAPI_H
|
||||
#define EIGEN_SPECIALFUNCTIONS_ARRAYAPI_H
|
||||
|
||||
@@ -17,154 +16,144 @@
|
||||
namespace Eigen {
|
||||
|
||||
/** \cpp11 \returns an expression of the coefficient-wise igamma(\a a, \a x) to the given arrays.
|
||||
*
|
||||
* This function computes the coefficient-wise incomplete gamma function.
|
||||
*
|
||||
* \note This function supports only float and double scalar types in c++11 mode. To support other scalar types,
|
||||
* or float/double in non c++11 mode, the user has to provide implementations of igammac(T,T) for any scalar
|
||||
* type T to be supported.
|
||||
*
|
||||
* \sa Eigen::igammac(), Eigen::lgamma()
|
||||
*/
|
||||
template<typename Derived,typename ExponentDerived>
|
||||
EIGEN_STRONG_INLINE const Eigen::CwiseBinaryOp<Eigen::internal::scalar_igamma_op<typename Derived::Scalar>, const Derived, const ExponentDerived>
|
||||
igamma(const Eigen::ArrayBase<Derived>& a, const Eigen::ArrayBase<ExponentDerived>& x)
|
||||
{
|
||||
return Eigen::CwiseBinaryOp<Eigen::internal::scalar_igamma_op<typename Derived::Scalar>, const Derived, const ExponentDerived>(
|
||||
a.derived(),
|
||||
x.derived()
|
||||
);
|
||||
*
|
||||
* This function computes the coefficient-wise incomplete gamma function.
|
||||
*
|
||||
* \note This function supports only float and double scalar types in c++11 mode. To support other scalar types,
|
||||
* or float/double in non c++11 mode, the user has to provide implementations of igammac(T,T) for any scalar
|
||||
* type T to be supported.
|
||||
*
|
||||
* \sa Eigen::igammac(), Eigen::lgamma()
|
||||
*/
|
||||
template <typename Derived, typename ExponentDerived>
|
||||
EIGEN_STRONG_INLINE const Eigen::CwiseBinaryOp<Eigen::internal::scalar_igamma_op<typename Derived::Scalar>,
|
||||
const Derived, const ExponentDerived>
|
||||
igamma(const Eigen::ArrayBase<Derived>& a, const Eigen::ArrayBase<ExponentDerived>& x) {
|
||||
return Eigen::CwiseBinaryOp<Eigen::internal::scalar_igamma_op<typename Derived::Scalar>, const Derived,
|
||||
const ExponentDerived>(a.derived(), x.derived());
|
||||
}
|
||||
|
||||
/** \cpp11 \returns an expression of the coefficient-wise igamma_der_a(\a a, \a x) to the given arrays.
|
||||
*
|
||||
* This function computes the coefficient-wise derivative of the incomplete
|
||||
* gamma function with respect to the parameter a.
|
||||
*
|
||||
* \note This function supports only float and double scalar types in c++11
|
||||
* mode. To support other scalar types,
|
||||
* or float/double in non c++11 mode, the user has to provide implementations
|
||||
* of igamma_der_a(T,T) for any scalar
|
||||
* type T to be supported.
|
||||
*
|
||||
* \sa Eigen::igamma(), Eigen::lgamma()
|
||||
*/
|
||||
*
|
||||
* This function computes the coefficient-wise derivative of the incomplete
|
||||
* gamma function with respect to the parameter a.
|
||||
*
|
||||
* \note This function supports only float and double scalar types in c++11
|
||||
* mode. To support other scalar types,
|
||||
* or float/double in non c++11 mode, the user has to provide implementations
|
||||
* of igamma_der_a(T,T) for any scalar
|
||||
* type T to be supported.
|
||||
*
|
||||
* \sa Eigen::igamma(), Eigen::lgamma()
|
||||
*/
|
||||
template <typename Derived, typename ExponentDerived>
|
||||
EIGEN_STRONG_INLINE const Eigen::CwiseBinaryOp<Eigen::internal::scalar_igamma_der_a_op<typename Derived::Scalar>, const Derived, const ExponentDerived>
|
||||
EIGEN_STRONG_INLINE const Eigen::CwiseBinaryOp<Eigen::internal::scalar_igamma_der_a_op<typename Derived::Scalar>,
|
||||
const Derived, const ExponentDerived>
|
||||
igamma_der_a(const Eigen::ArrayBase<Derived>& a, const Eigen::ArrayBase<ExponentDerived>& x) {
|
||||
return Eigen::CwiseBinaryOp<Eigen::internal::scalar_igamma_der_a_op<typename Derived::Scalar>, const Derived, const ExponentDerived>(
|
||||
a.derived(),
|
||||
x.derived());
|
||||
return Eigen::CwiseBinaryOp<Eigen::internal::scalar_igamma_der_a_op<typename Derived::Scalar>, const Derived,
|
||||
const ExponentDerived>(a.derived(), x.derived());
|
||||
}
|
||||
|
||||
/** \cpp11 \returns an expression of the coefficient-wise gamma_sample_der_alpha(\a alpha, \a sample) to the given arrays.
|
||||
*
|
||||
* This function computes the coefficient-wise derivative of the sample
|
||||
* of a Gamma(alpha, 1) random variable with respect to the parameter alpha.
|
||||
*
|
||||
* \note This function supports only float and double scalar types in c++11
|
||||
* mode. To support other scalar types,
|
||||
* or float/double in non c++11 mode, the user has to provide implementations
|
||||
* of gamma_sample_der_alpha(T,T) for any scalar
|
||||
* type T to be supported.
|
||||
*
|
||||
* \sa Eigen::igamma(), Eigen::lgamma()
|
||||
*/
|
||||
/** \cpp11 \returns an expression of the coefficient-wise gamma_sample_der_alpha(\a alpha, \a sample) to the given
|
||||
* arrays.
|
||||
*
|
||||
* This function computes the coefficient-wise derivative of the sample
|
||||
* of a Gamma(alpha, 1) random variable with respect to the parameter alpha.
|
||||
*
|
||||
* \note This function supports only float and double scalar types in c++11
|
||||
* mode. To support other scalar types,
|
||||
* or float/double in non c++11 mode, the user has to provide implementations
|
||||
* of gamma_sample_der_alpha(T,T) for any scalar
|
||||
* type T to be supported.
|
||||
*
|
||||
* \sa Eigen::igamma(), Eigen::lgamma()
|
||||
*/
|
||||
template <typename AlphaDerived, typename SampleDerived>
|
||||
EIGEN_STRONG_INLINE const Eigen::CwiseBinaryOp<Eigen::internal::scalar_gamma_sample_der_alpha_op<typename AlphaDerived::Scalar>, const AlphaDerived, const SampleDerived>
|
||||
gamma_sample_der_alpha(const Eigen::ArrayBase<AlphaDerived>& alpha, const Eigen::ArrayBase<SampleDerived>& sample) {
|
||||
return Eigen::CwiseBinaryOp<Eigen::internal::scalar_gamma_sample_der_alpha_op<typename AlphaDerived::Scalar>, const AlphaDerived, const SampleDerived>(
|
||||
alpha.derived(),
|
||||
sample.derived());
|
||||
EIGEN_STRONG_INLINE const
|
||||
Eigen::CwiseBinaryOp<Eigen::internal::scalar_gamma_sample_der_alpha_op<typename AlphaDerived::Scalar>,
|
||||
const AlphaDerived, const SampleDerived>
|
||||
gamma_sample_der_alpha(const Eigen::ArrayBase<AlphaDerived>& alpha, const Eigen::ArrayBase<SampleDerived>& sample) {
|
||||
return Eigen::CwiseBinaryOp<Eigen::internal::scalar_gamma_sample_der_alpha_op<typename AlphaDerived::Scalar>,
|
||||
const AlphaDerived, const SampleDerived>(alpha.derived(), sample.derived());
|
||||
}
|
||||
|
||||
/** \cpp11 \returns an expression of the coefficient-wise igammac(\a a, \a x) to the given arrays.
|
||||
*
|
||||
* This function computes the coefficient-wise complementary incomplete gamma function.
|
||||
*
|
||||
* \note This function supports only float and double scalar types in c++11 mode. To support other scalar types,
|
||||
* or float/double in non c++11 mode, the user has to provide implementations of igammac(T,T) for any scalar
|
||||
* type T to be supported.
|
||||
*
|
||||
* \sa Eigen::igamma(), Eigen::lgamma()
|
||||
*/
|
||||
template<typename Derived,typename ExponentDerived>
|
||||
EIGEN_STRONG_INLINE const Eigen::CwiseBinaryOp<Eigen::internal::scalar_igammac_op<typename Derived::Scalar>, const Derived, const ExponentDerived>
|
||||
igammac(const Eigen::ArrayBase<Derived>& a, const Eigen::ArrayBase<ExponentDerived>& x)
|
||||
{
|
||||
return Eigen::CwiseBinaryOp<Eigen::internal::scalar_igammac_op<typename Derived::Scalar>, const Derived, const ExponentDerived>(
|
||||
a.derived(),
|
||||
x.derived()
|
||||
);
|
||||
*
|
||||
* This function computes the coefficient-wise complementary incomplete gamma function.
|
||||
*
|
||||
* \note This function supports only float and double scalar types in c++11 mode. To support other scalar types,
|
||||
* or float/double in non c++11 mode, the user has to provide implementations of igammac(T,T) for any scalar
|
||||
* type T to be supported.
|
||||
*
|
||||
* \sa Eigen::igamma(), Eigen::lgamma()
|
||||
*/
|
||||
template <typename Derived, typename ExponentDerived>
|
||||
EIGEN_STRONG_INLINE const Eigen::CwiseBinaryOp<Eigen::internal::scalar_igammac_op<typename Derived::Scalar>,
|
||||
const Derived, const ExponentDerived>
|
||||
igammac(const Eigen::ArrayBase<Derived>& a, const Eigen::ArrayBase<ExponentDerived>& x) {
|
||||
return Eigen::CwiseBinaryOp<Eigen::internal::scalar_igammac_op<typename Derived::Scalar>, const Derived,
|
||||
const ExponentDerived>(a.derived(), x.derived());
|
||||
}
|
||||
|
||||
/** \cpp11 \returns an expression of the coefficient-wise polygamma(\a n, \a x) to the given arrays.
|
||||
*
|
||||
* It returns the \a n -th derivative of the digamma(psi) evaluated at \c x.
|
||||
*
|
||||
* \note This function supports only float and double scalar types in c++11 mode. To support other scalar types,
|
||||
* or float/double in non c++11 mode, the user has to provide implementations of polygamma(T,T) for any scalar
|
||||
* type T to be supported.
|
||||
*
|
||||
* \sa Eigen::digamma()
|
||||
*/
|
||||
*
|
||||
* It returns the \a n -th derivative of the digamma(psi) evaluated at \c x.
|
||||
*
|
||||
* \note This function supports only float and double scalar types in c++11 mode. To support other scalar types,
|
||||
* or float/double in non c++11 mode, the user has to provide implementations of polygamma(T,T) for any scalar
|
||||
* type T to be supported.
|
||||
*
|
||||
* \sa Eigen::digamma()
|
||||
*/
|
||||
// * \warning Be careful with the order of the parameters: x.polygamma(n) is equivalent to polygamma(n,x)
|
||||
// * \sa ArrayBase::polygamma()
|
||||
template<typename DerivedN,typename DerivedX>
|
||||
EIGEN_STRONG_INLINE const Eigen::CwiseBinaryOp<Eigen::internal::scalar_polygamma_op<typename DerivedX::Scalar>, const DerivedN, const DerivedX>
|
||||
polygamma(const Eigen::ArrayBase<DerivedN>& n, const Eigen::ArrayBase<DerivedX>& x)
|
||||
{
|
||||
return Eigen::CwiseBinaryOp<Eigen::internal::scalar_polygamma_op<typename DerivedX::Scalar>, const DerivedN, const DerivedX>(
|
||||
n.derived(),
|
||||
x.derived()
|
||||
);
|
||||
template <typename DerivedN, typename DerivedX>
|
||||
EIGEN_STRONG_INLINE const Eigen::CwiseBinaryOp<Eigen::internal::scalar_polygamma_op<typename DerivedX::Scalar>,
|
||||
const DerivedN, const DerivedX>
|
||||
polygamma(const Eigen::ArrayBase<DerivedN>& n, const Eigen::ArrayBase<DerivedX>& x) {
|
||||
return Eigen::CwiseBinaryOp<Eigen::internal::scalar_polygamma_op<typename DerivedX::Scalar>, const DerivedN,
|
||||
const DerivedX>(n.derived(), x.derived());
|
||||
}
|
||||
|
||||
/** \cpp11 \returns an expression of the coefficient-wise betainc(\a x, \a a, \a b) to the given arrays.
|
||||
*
|
||||
* This function computes the regularized incomplete beta function (integral).
|
||||
*
|
||||
* \note This function supports only float and double scalar types in c++11 mode. To support other scalar types,
|
||||
* or float/double in non c++11 mode, the user has to provide implementations of betainc(T,T,T) for any scalar
|
||||
* type T to be supported.
|
||||
*
|
||||
* \sa Eigen::betainc(), Eigen::lgamma()
|
||||
*/
|
||||
template<typename ArgADerived, typename ArgBDerived, typename ArgXDerived>
|
||||
EIGEN_STRONG_INLINE const Eigen::CwiseTernaryOp<Eigen::internal::scalar_betainc_op<typename ArgXDerived::Scalar>, const ArgADerived, const ArgBDerived, const ArgXDerived>
|
||||
betainc(const Eigen::ArrayBase<ArgADerived>& a, const Eigen::ArrayBase<ArgBDerived>& b, const Eigen::ArrayBase<ArgXDerived>& x)
|
||||
{
|
||||
return Eigen::CwiseTernaryOp<Eigen::internal::scalar_betainc_op<typename ArgXDerived::Scalar>, const ArgADerived, const ArgBDerived, const ArgXDerived>(
|
||||
a.derived(),
|
||||
b.derived(),
|
||||
x.derived()
|
||||
);
|
||||
*
|
||||
* This function computes the regularized incomplete beta function (integral).
|
||||
*
|
||||
* \note This function supports only float and double scalar types in c++11 mode. To support other scalar types,
|
||||
* or float/double in non c++11 mode, the user has to provide implementations of betainc(T,T,T) for any scalar
|
||||
* type T to be supported.
|
||||
*
|
||||
* \sa Eigen::betainc(), Eigen::lgamma()
|
||||
*/
|
||||
template <typename ArgADerived, typename ArgBDerived, typename ArgXDerived>
|
||||
EIGEN_STRONG_INLINE const Eigen::CwiseTernaryOp<Eigen::internal::scalar_betainc_op<typename ArgXDerived::Scalar>,
|
||||
const ArgADerived, const ArgBDerived, const ArgXDerived>
|
||||
betainc(const Eigen::ArrayBase<ArgADerived>& a, const Eigen::ArrayBase<ArgBDerived>& b,
|
||||
const Eigen::ArrayBase<ArgXDerived>& x) {
|
||||
return Eigen::CwiseTernaryOp<Eigen::internal::scalar_betainc_op<typename ArgXDerived::Scalar>, const ArgADerived,
|
||||
const ArgBDerived, const ArgXDerived>(a.derived(), b.derived(), x.derived());
|
||||
}
|
||||
|
||||
|
||||
/** \returns an expression of the coefficient-wise zeta(\a x, \a q) to the given arrays.
|
||||
*
|
||||
* It returns the Riemann zeta function of two arguments \a x and \a q:
|
||||
*
|
||||
* \param x is the exponent, it must be > 1
|
||||
* \param q is the shift, it must be > 0
|
||||
*
|
||||
* \note This function supports only float and double scalar types. To support other scalar types, the user has
|
||||
* to provide implementations of zeta(T,T) for any scalar type T to be supported.
|
||||
*
|
||||
* \sa ArrayBase::zeta()
|
||||
*/
|
||||
template<typename DerivedX,typename DerivedQ>
|
||||
EIGEN_STRONG_INLINE const Eigen::CwiseBinaryOp<Eigen::internal::scalar_zeta_op<typename DerivedX::Scalar>, const DerivedX, const DerivedQ>
|
||||
zeta(const Eigen::ArrayBase<DerivedX>& x, const Eigen::ArrayBase<DerivedQ>& q)
|
||||
{
|
||||
return Eigen::CwiseBinaryOp<Eigen::internal::scalar_zeta_op<typename DerivedX::Scalar>, const DerivedX, const DerivedQ>(
|
||||
x.derived(),
|
||||
q.derived()
|
||||
);
|
||||
*
|
||||
* It returns the Riemann zeta function of two arguments \a x and \a q:
|
||||
*
|
||||
* \param x is the exponent, it must be > 1
|
||||
* \param q is the shift, it must be > 0
|
||||
*
|
||||
* \note This function supports only float and double scalar types. To support other scalar types, the user has
|
||||
* to provide implementations of zeta(T,T) for any scalar type T to be supported.
|
||||
*
|
||||
* \sa ArrayBase::zeta()
|
||||
*/
|
||||
template <typename DerivedX, typename DerivedQ>
|
||||
EIGEN_STRONG_INLINE const
|
||||
Eigen::CwiseBinaryOp<Eigen::internal::scalar_zeta_op<typename DerivedX::Scalar>, const DerivedX, const DerivedQ>
|
||||
zeta(const Eigen::ArrayBase<DerivedX>& x, const Eigen::ArrayBase<DerivedQ>& q) {
|
||||
return Eigen::CwiseBinaryOp<Eigen::internal::scalar_zeta_op<typename DerivedX::Scalar>, const DerivedX,
|
||||
const DerivedQ>(x.derived(), q.derived());
|
||||
}
|
||||
|
||||
} // end namespace Eigen
|
||||
|
||||
} // end namespace Eigen
|
||||
|
||||
#endif // EIGEN_SPECIALFUNCTIONS_ARRAYAPI_H
|
||||
#endif // EIGEN_SPECIALFUNCTIONS_ARRAYAPI_H
|
||||
|
||||
@@ -15,28 +15,36 @@ namespace Eigen {
|
||||
namespace numext {
|
||||
|
||||
#if EIGEN_HAS_C99_MATH
|
||||
template<> EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::bfloat16 lgamma(const Eigen::bfloat16& a) {
|
||||
template <>
|
||||
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::bfloat16 lgamma(const Eigen::bfloat16& a) {
|
||||
return Eigen::bfloat16(Eigen::numext::lgamma(static_cast<float>(a)));
|
||||
}
|
||||
template<> EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::bfloat16 digamma(const Eigen::bfloat16& a) {
|
||||
template <>
|
||||
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::bfloat16 digamma(const Eigen::bfloat16& a) {
|
||||
return Eigen::bfloat16(Eigen::numext::digamma(static_cast<float>(a)));
|
||||
}
|
||||
template<> EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::bfloat16 zeta(const Eigen::bfloat16& x, const Eigen::bfloat16& q) {
|
||||
template <>
|
||||
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::bfloat16 zeta(const Eigen::bfloat16& x, const Eigen::bfloat16& q) {
|
||||
return Eigen::bfloat16(Eigen::numext::zeta(static_cast<float>(x), static_cast<float>(q)));
|
||||
}
|
||||
template<> EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::bfloat16 polygamma(const Eigen::bfloat16& n, const Eigen::bfloat16& x) {
|
||||
template <>
|
||||
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::bfloat16 polygamma(const Eigen::bfloat16& n, const Eigen::bfloat16& x) {
|
||||
return Eigen::bfloat16(Eigen::numext::polygamma(static_cast<float>(n), static_cast<float>(x)));
|
||||
}
|
||||
template<> EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::bfloat16 erf(const Eigen::bfloat16& a) {
|
||||
template <>
|
||||
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::bfloat16 erf(const Eigen::bfloat16& a) {
|
||||
return Eigen::bfloat16(Eigen::numext::erf(static_cast<float>(a)));
|
||||
}
|
||||
template<> EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::bfloat16 erfc(const Eigen::bfloat16& a) {
|
||||
template <>
|
||||
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::bfloat16 erfc(const Eigen::bfloat16& a) {
|
||||
return Eigen::bfloat16(Eigen::numext::erfc(static_cast<float>(a)));
|
||||
}
|
||||
template<> EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::bfloat16 ndtri(const Eigen::bfloat16& a) {
|
||||
template <>
|
||||
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::bfloat16 ndtri(const Eigen::bfloat16& a) {
|
||||
return Eigen::bfloat16(Eigen::numext::ndtri(static_cast<float>(a)));
|
||||
}
|
||||
template<> EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::bfloat16 igamma(const Eigen::bfloat16& a, const Eigen::bfloat16& x) {
|
||||
template <>
|
||||
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::bfloat16 igamma(const Eigen::bfloat16& a, const Eigen::bfloat16& x) {
|
||||
return Eigen::bfloat16(Eigen::numext::igamma(static_cast<float>(a), static_cast<float>(x)));
|
||||
}
|
||||
template <>
|
||||
@@ -44,13 +52,17 @@ EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::bfloat16 igamma_der_a(const Eigen::
|
||||
return Eigen::bfloat16(Eigen::numext::igamma_der_a(static_cast<float>(a), static_cast<float>(x)));
|
||||
}
|
||||
template <>
|
||||
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::bfloat16 gamma_sample_der_alpha(const Eigen::bfloat16& alpha, const Eigen::bfloat16& sample) {
|
||||
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::bfloat16 gamma_sample_der_alpha(const Eigen::bfloat16& alpha,
|
||||
const Eigen::bfloat16& sample) {
|
||||
return Eigen::bfloat16(Eigen::numext::gamma_sample_der_alpha(static_cast<float>(alpha), static_cast<float>(sample)));
|
||||
}
|
||||
template<> EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::bfloat16 igammac(const Eigen::bfloat16& a, const Eigen::bfloat16& x) {
|
||||
template <>
|
||||
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::bfloat16 igammac(const Eigen::bfloat16& a, const Eigen::bfloat16& x) {
|
||||
return Eigen::bfloat16(Eigen::numext::igammac(static_cast<float>(a), static_cast<float>(x)));
|
||||
}
|
||||
template<> EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::bfloat16 betainc(const Eigen::bfloat16& a, const Eigen::bfloat16& b, const Eigen::bfloat16& x) {
|
||||
template <>
|
||||
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::bfloat16 betainc(const Eigen::bfloat16& a, const Eigen::bfloat16& b,
|
||||
const Eigen::bfloat16& x) {
|
||||
return Eigen::bfloat16(Eigen::numext::betainc(static_cast<float>(a), static_cast<float>(b), static_cast<float>(x)));
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -18,23 +18,23 @@ namespace Eigen {
|
||||
|
||||
namespace internal {
|
||||
|
||||
|
||||
/** \internal
|
||||
* \brief Template functor to compute the incomplete gamma function igamma(a, x)
|
||||
*
|
||||
* \sa class CwiseBinaryOp, Cwise::igamma
|
||||
*/
|
||||
template<typename Scalar> struct scalar_igamma_op : binary_op_base<Scalar,Scalar>
|
||||
{
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar operator() (const Scalar& a, const Scalar& x) const {
|
||||
using numext::igamma; return igamma(a, x);
|
||||
* \brief Template functor to compute the incomplete gamma function igamma(a, x)
|
||||
*
|
||||
* \sa class CwiseBinaryOp, Cwise::igamma
|
||||
*/
|
||||
template <typename Scalar>
|
||||
struct scalar_igamma_op : binary_op_base<Scalar, Scalar> {
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar operator()(const Scalar& a, const Scalar& x) const {
|
||||
using numext::igamma;
|
||||
return igamma(a, x);
|
||||
}
|
||||
template<typename Packet>
|
||||
template <typename Packet>
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Packet packetOp(const Packet& a, const Packet& x) const {
|
||||
return internal::pigamma(a, x);
|
||||
}
|
||||
};
|
||||
template<typename Scalar>
|
||||
template <typename Scalar>
|
||||
struct functor_traits<scalar_igamma_op<Scalar> > {
|
||||
enum {
|
||||
// Guesstimate
|
||||
@@ -44,11 +44,11 @@ struct functor_traits<scalar_igamma_op<Scalar> > {
|
||||
};
|
||||
|
||||
/** \internal
|
||||
* \brief Template functor to compute the derivative of the incomplete gamma
|
||||
* function igamma_der_a(a, x)
|
||||
*
|
||||
* \sa class CwiseBinaryOp, Cwise::igamma_der_a
|
||||
*/
|
||||
* \brief Template functor to compute the derivative of the incomplete gamma
|
||||
* function igamma_der_a(a, x)
|
||||
*
|
||||
* \sa class CwiseBinaryOp, Cwise::igamma_der_a
|
||||
*/
|
||||
template <typename Scalar>
|
||||
struct scalar_igamma_der_a_op {
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar operator()(const Scalar& a, const Scalar& x) const {
|
||||
@@ -70,12 +70,12 @@ struct functor_traits<scalar_igamma_der_a_op<Scalar> > {
|
||||
};
|
||||
|
||||
/** \internal
|
||||
* \brief Template functor to compute the derivative of the sample
|
||||
* of a Gamma(alpha, 1) random variable with respect to the parameter alpha
|
||||
* gamma_sample_der_alpha(alpha, sample)
|
||||
*
|
||||
* \sa class CwiseBinaryOp, Cwise::gamma_sample_der_alpha
|
||||
*/
|
||||
* \brief Template functor to compute the derivative of the sample
|
||||
* of a Gamma(alpha, 1) random variable with respect to the parameter alpha
|
||||
* gamma_sample_der_alpha(alpha, sample)
|
||||
*
|
||||
* \sa class CwiseBinaryOp, Cwise::gamma_sample_der_alpha
|
||||
*/
|
||||
template <typename Scalar>
|
||||
struct scalar_gamma_sample_der_alpha_op {
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar operator()(const Scalar& alpha, const Scalar& sample) const {
|
||||
@@ -97,22 +97,22 @@ struct functor_traits<scalar_gamma_sample_der_alpha_op<Scalar> > {
|
||||
};
|
||||
|
||||
/** \internal
|
||||
* \brief Template functor to compute the complementary incomplete gamma function igammac(a, x)
|
||||
*
|
||||
* \sa class CwiseBinaryOp, Cwise::igammac
|
||||
*/
|
||||
template<typename Scalar> struct scalar_igammac_op : binary_op_base<Scalar,Scalar>
|
||||
{
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar operator() (const Scalar& a, const Scalar& x) const {
|
||||
using numext::igammac; return igammac(a, x);
|
||||
* \brief Template functor to compute the complementary incomplete gamma function igammac(a, x)
|
||||
*
|
||||
* \sa class CwiseBinaryOp, Cwise::igammac
|
||||
*/
|
||||
template <typename Scalar>
|
||||
struct scalar_igammac_op : binary_op_base<Scalar, Scalar> {
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar operator()(const Scalar& a, const Scalar& x) const {
|
||||
using numext::igammac;
|
||||
return igammac(a, x);
|
||||
}
|
||||
template<typename Packet>
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Packet packetOp(const Packet& a, const Packet& x) const
|
||||
{
|
||||
template <typename Packet>
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Packet packetOp(const Packet& a, const Packet& x) const {
|
||||
return internal::pigammac(a, x);
|
||||
}
|
||||
};
|
||||
template<typename Scalar>
|
||||
template <typename Scalar>
|
||||
struct functor_traits<scalar_igammac_op<Scalar> > {
|
||||
enum {
|
||||
// Guesstimate
|
||||
@@ -121,22 +121,23 @@ struct functor_traits<scalar_igammac_op<Scalar> > {
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/** \internal
|
||||
* \brief Template functor to compute the incomplete beta integral betainc(a, b, x)
|
||||
*
|
||||
*/
|
||||
template<typename Scalar> struct scalar_betainc_op {
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar operator() (const Scalar& x, const Scalar& a, const Scalar& b) const {
|
||||
using numext::betainc; return betainc(x, a, b);
|
||||
* \brief Template functor to compute the incomplete beta integral betainc(a, b, x)
|
||||
*
|
||||
*/
|
||||
template <typename Scalar>
|
||||
struct scalar_betainc_op {
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar operator()(const Scalar& x, const Scalar& a,
|
||||
const Scalar& b) const {
|
||||
using numext::betainc;
|
||||
return betainc(x, a, b);
|
||||
}
|
||||
template<typename Packet>
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Packet packetOp(const Packet& x, const Packet& a, const Packet& b) const
|
||||
{
|
||||
template <typename Packet>
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Packet packetOp(const Packet& x, const Packet& a, const Packet& b) const {
|
||||
return internal::pbetainc(x, a, b);
|
||||
}
|
||||
};
|
||||
template<typename Scalar>
|
||||
template <typename Scalar>
|
||||
struct functor_traits<scalar_betainc_op<Scalar> > {
|
||||
enum {
|
||||
// Guesstimate
|
||||
@@ -145,22 +146,22 @@ struct functor_traits<scalar_betainc_op<Scalar> > {
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/** \internal
|
||||
* \brief Template functor to compute the natural log of the absolute
|
||||
* value of Gamma of a scalar
|
||||
* \sa class CwiseUnaryOp, Cwise::lgamma()
|
||||
*/
|
||||
template<typename Scalar> struct scalar_lgamma_op {
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar operator() (const Scalar& a) const {
|
||||
using numext::lgamma; return lgamma(a);
|
||||
template <typename Scalar>
|
||||
struct scalar_lgamma_op {
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar operator()(const Scalar& a) const {
|
||||
using numext::lgamma;
|
||||
return lgamma(a);
|
||||
}
|
||||
typedef typename packet_traits<Scalar>::type Packet;
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet packetOp(const Packet& a) const { return internal::plgamma(a); }
|
||||
};
|
||||
template<typename Scalar>
|
||||
struct functor_traits<scalar_lgamma_op<Scalar> >
|
||||
{
|
||||
template <typename Scalar>
|
||||
struct functor_traits<scalar_lgamma_op<Scalar> > {
|
||||
enum {
|
||||
// Guesstimate
|
||||
Cost = 10 * NumTraits<Scalar>::MulCost + 5 * NumTraits<Scalar>::AddCost,
|
||||
@@ -172,16 +173,17 @@ struct functor_traits<scalar_lgamma_op<Scalar> >
|
||||
* \brief Template functor to compute psi, the derivative of lgamma of a scalar.
|
||||
* \sa class CwiseUnaryOp, Cwise::digamma()
|
||||
*/
|
||||
template<typename Scalar> struct scalar_digamma_op {
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar operator() (const Scalar& a) const {
|
||||
using numext::digamma; return digamma(a);
|
||||
template <typename Scalar>
|
||||
struct scalar_digamma_op {
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar operator()(const Scalar& a) const {
|
||||
using numext::digamma;
|
||||
return digamma(a);
|
||||
}
|
||||
typedef typename packet_traits<Scalar>::type Packet;
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet packetOp(const Packet& a) const { return internal::pdigamma(a); }
|
||||
};
|
||||
template<typename Scalar>
|
||||
struct functor_traits<scalar_digamma_op<Scalar> >
|
||||
{
|
||||
template <typename Scalar>
|
||||
struct functor_traits<scalar_digamma_op<Scalar> > {
|
||||
enum {
|
||||
// Guesstimate
|
||||
Cost = 10 * NumTraits<Scalar>::MulCost + 5 * NumTraits<Scalar>::AddCost,
|
||||
@@ -193,53 +195,57 @@ struct functor_traits<scalar_digamma_op<Scalar> >
|
||||
* \brief Template functor to compute the Riemann Zeta function of two arguments.
|
||||
* \sa class CwiseUnaryOp, Cwise::zeta()
|
||||
*/
|
||||
template<typename Scalar> struct scalar_zeta_op {
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar operator() (const Scalar& x, const Scalar& q) const {
|
||||
using numext::zeta; return zeta(x, q);
|
||||
}
|
||||
typedef typename packet_traits<Scalar>::type Packet;
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet packetOp(const Packet& x, const Packet& q) const { return internal::pzeta(x, q); }
|
||||
template <typename Scalar>
|
||||
struct scalar_zeta_op {
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar operator()(const Scalar& x, const Scalar& q) const {
|
||||
using numext::zeta;
|
||||
return zeta(x, q);
|
||||
}
|
||||
typedef typename packet_traits<Scalar>::type Packet;
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet packetOp(const Packet& x, const Packet& q) const {
|
||||
return internal::pzeta(x, q);
|
||||
}
|
||||
};
|
||||
template<typename Scalar>
|
||||
struct functor_traits<scalar_zeta_op<Scalar> >
|
||||
{
|
||||
enum {
|
||||
// Guesstimate
|
||||
Cost = 10 * NumTraits<Scalar>::MulCost + 5 * NumTraits<Scalar>::AddCost,
|
||||
PacketAccess = packet_traits<Scalar>::HasZeta
|
||||
};
|
||||
template <typename Scalar>
|
||||
struct functor_traits<scalar_zeta_op<Scalar> > {
|
||||
enum {
|
||||
// Guesstimate
|
||||
Cost = 10 * NumTraits<Scalar>::MulCost + 5 * NumTraits<Scalar>::AddCost,
|
||||
PacketAccess = packet_traits<Scalar>::HasZeta
|
||||
};
|
||||
};
|
||||
|
||||
/** \internal
|
||||
* \brief Template functor to compute the polygamma function.
|
||||
* \sa class CwiseUnaryOp, Cwise::polygamma()
|
||||
*/
|
||||
template<typename Scalar> struct scalar_polygamma_op {
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar operator() (const Scalar& n, const Scalar& x) const {
|
||||
using numext::polygamma; return polygamma(n, x);
|
||||
}
|
||||
typedef typename packet_traits<Scalar>::type Packet;
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet packetOp(const Packet& n, const Packet& x) const { return internal::ppolygamma(n, x); }
|
||||
template <typename Scalar>
|
||||
struct scalar_polygamma_op {
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar operator()(const Scalar& n, const Scalar& x) const {
|
||||
using numext::polygamma;
|
||||
return polygamma(n, x);
|
||||
}
|
||||
typedef typename packet_traits<Scalar>::type Packet;
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet packetOp(const Packet& n, const Packet& x) const {
|
||||
return internal::ppolygamma(n, x);
|
||||
}
|
||||
};
|
||||
template<typename Scalar>
|
||||
struct functor_traits<scalar_polygamma_op<Scalar> >
|
||||
{
|
||||
enum {
|
||||
// Guesstimate
|
||||
Cost = 10 * NumTraits<Scalar>::MulCost + 5 * NumTraits<Scalar>::AddCost,
|
||||
PacketAccess = packet_traits<Scalar>::HasPolygamma
|
||||
};
|
||||
template <typename Scalar>
|
||||
struct functor_traits<scalar_polygamma_op<Scalar> > {
|
||||
enum {
|
||||
// Guesstimate
|
||||
Cost = 10 * NumTraits<Scalar>::MulCost + 5 * NumTraits<Scalar>::AddCost,
|
||||
PacketAccess = packet_traits<Scalar>::HasPolygamma
|
||||
};
|
||||
};
|
||||
|
||||
/** \internal
|
||||
* \brief Template functor to compute the error function of a scalar
|
||||
* \sa class CwiseUnaryOp, ArrayBase::erf()
|
||||
*/
|
||||
template<typename Scalar> struct scalar_erf_op {
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar
|
||||
operator()(const Scalar& a) const {
|
||||
return numext::erf(a);
|
||||
}
|
||||
template <typename Scalar>
|
||||
struct scalar_erf_op {
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar operator()(const Scalar& a) const { return numext::erf(a); }
|
||||
template <typename Packet>
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet packetOp(const Packet& x) const {
|
||||
return perf(x);
|
||||
@@ -249,22 +255,19 @@ template <typename Scalar>
|
||||
struct functor_traits<scalar_erf_op<Scalar> > {
|
||||
enum {
|
||||
PacketAccess = packet_traits<Scalar>::HasErf,
|
||||
Cost =
|
||||
(PacketAccess
|
||||
Cost = (PacketAccess
|
||||
#ifdef EIGEN_VECTORIZE_FMA
|
||||
// TODO(rmlarsen): Move the FMA cost model to a central location.
|
||||
// Haswell can issue 2 add/mul/madd per cycle.
|
||||
// 10 pmadd, 2 pmul, 1 div, 2 other
|
||||
? (2 * NumTraits<Scalar>::AddCost +
|
||||
7 * NumTraits<Scalar>::MulCost +
|
||||
scalar_div_cost<Scalar, packet_traits<Scalar>::HasDiv>::value)
|
||||
// TODO(rmlarsen): Move the FMA cost model to a central location.
|
||||
// Haswell can issue 2 add/mul/madd per cycle.
|
||||
// 10 pmadd, 2 pmul, 1 div, 2 other
|
||||
? (2 * NumTraits<Scalar>::AddCost + 7 * NumTraits<Scalar>::MulCost +
|
||||
scalar_div_cost<Scalar, packet_traits<Scalar>::HasDiv>::value)
|
||||
#else
|
||||
? (12 * NumTraits<Scalar>::AddCost +
|
||||
12 * NumTraits<Scalar>::MulCost +
|
||||
scalar_div_cost<Scalar, packet_traits<Scalar>::HasDiv>::value)
|
||||
? (12 * NumTraits<Scalar>::AddCost + 12 * NumTraits<Scalar>::MulCost +
|
||||
scalar_div_cost<Scalar, packet_traits<Scalar>::HasDiv>::value)
|
||||
#endif
|
||||
// Assume for simplicity that this is as expensive as an exp().
|
||||
: (functor_traits<scalar_exp_op<Scalar> >::Cost))
|
||||
// Assume for simplicity that this is as expensive as an exp().
|
||||
: (functor_traits<scalar_exp_op<Scalar> >::Cost))
|
||||
};
|
||||
};
|
||||
|
||||
@@ -273,16 +276,17 @@ struct functor_traits<scalar_erf_op<Scalar> > {
|
||||
* of a scalar
|
||||
* \sa class CwiseUnaryOp, Cwise::erfc()
|
||||
*/
|
||||
template<typename Scalar> struct scalar_erfc_op {
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar operator() (const Scalar& a) const {
|
||||
using numext::erfc; return erfc(a);
|
||||
template <typename Scalar>
|
||||
struct scalar_erfc_op {
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar operator()(const Scalar& a) const {
|
||||
using numext::erfc;
|
||||
return erfc(a);
|
||||
}
|
||||
typedef typename packet_traits<Scalar>::type Packet;
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet packetOp(const Packet& a) const { return internal::perfc(a); }
|
||||
};
|
||||
template<typename Scalar>
|
||||
struct functor_traits<scalar_erfc_op<Scalar> >
|
||||
{
|
||||
template <typename Scalar>
|
||||
struct functor_traits<scalar_erfc_op<Scalar> > {
|
||||
enum {
|
||||
// Guesstimate
|
||||
Cost = 10 * NumTraits<Scalar>::MulCost + 5 * NumTraits<Scalar>::AddCost,
|
||||
@@ -295,16 +299,17 @@ struct functor_traits<scalar_erfc_op<Scalar> >
|
||||
* function of a scalar
|
||||
* \sa class CwiseUnaryOp, Cwise::ndtri()
|
||||
*/
|
||||
template<typename Scalar> struct scalar_ndtri_op {
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar operator() (const Scalar& a) const {
|
||||
using numext::ndtri; return ndtri(a);
|
||||
template <typename Scalar>
|
||||
struct scalar_ndtri_op {
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar operator()(const Scalar& a) const {
|
||||
using numext::ndtri;
|
||||
return ndtri(a);
|
||||
}
|
||||
typedef typename packet_traits<Scalar>::type Packet;
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet packetOp(const Packet& a) const { return internal::pndtri(a); }
|
||||
};
|
||||
template<typename Scalar>
|
||||
struct functor_traits<scalar_ndtri_op<Scalar> >
|
||||
{
|
||||
template <typename Scalar>
|
||||
struct functor_traits<scalar_ndtri_op<Scalar> > {
|
||||
enum {
|
||||
// On average, We are evaluating rational functions with degree N=9 in the
|
||||
// numerator and denominator. This results in 2*N additions and 2*N
|
||||
@@ -314,8 +319,8 @@ struct functor_traits<scalar_ndtri_op<Scalar> >
|
||||
};
|
||||
};
|
||||
|
||||
} // end namespace internal
|
||||
} // end namespace internal
|
||||
|
||||
} // end namespace Eigen
|
||||
} // end namespace Eigen
|
||||
|
||||
#endif // EIGEN_SPECIALFUNCTIONS_FUNCTORS_H
|
||||
#endif // EIGEN_SPECIALFUNCTIONS_FUNCTORS_H
|
||||
|
||||
@@ -15,28 +15,36 @@ namespace Eigen {
|
||||
namespace numext {
|
||||
|
||||
#if EIGEN_HAS_C99_MATH
|
||||
template<> EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::half lgamma(const Eigen::half& a) {
|
||||
template <>
|
||||
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::half lgamma(const Eigen::half& a) {
|
||||
return Eigen::half(Eigen::numext::lgamma(static_cast<float>(a)));
|
||||
}
|
||||
template<> EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::half digamma(const Eigen::half& a) {
|
||||
template <>
|
||||
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::half digamma(const Eigen::half& a) {
|
||||
return Eigen::half(Eigen::numext::digamma(static_cast<float>(a)));
|
||||
}
|
||||
template<> EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::half zeta(const Eigen::half& x, const Eigen::half& q) {
|
||||
template <>
|
||||
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::half zeta(const Eigen::half& x, const Eigen::half& q) {
|
||||
return Eigen::half(Eigen::numext::zeta(static_cast<float>(x), static_cast<float>(q)));
|
||||
}
|
||||
template<> EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::half polygamma(const Eigen::half& n, const Eigen::half& x) {
|
||||
template <>
|
||||
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::half polygamma(const Eigen::half& n, const Eigen::half& x) {
|
||||
return Eigen::half(Eigen::numext::polygamma(static_cast<float>(n), static_cast<float>(x)));
|
||||
}
|
||||
template<> EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::half erf(const Eigen::half& a) {
|
||||
template <>
|
||||
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::half erf(const Eigen::half& a) {
|
||||
return Eigen::half(Eigen::numext::erf(static_cast<float>(a)));
|
||||
}
|
||||
template<> EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::half erfc(const Eigen::half& a) {
|
||||
template <>
|
||||
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::half erfc(const Eigen::half& a) {
|
||||
return Eigen::half(Eigen::numext::erfc(static_cast<float>(a)));
|
||||
}
|
||||
template<> EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::half ndtri(const Eigen::half& a) {
|
||||
template <>
|
||||
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::half ndtri(const Eigen::half& a) {
|
||||
return Eigen::half(Eigen::numext::ndtri(static_cast<float>(a)));
|
||||
}
|
||||
template<> EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::half igamma(const Eigen::half& a, const Eigen::half& x) {
|
||||
template <>
|
||||
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::half igamma(const Eigen::half& a, const Eigen::half& x) {
|
||||
return Eigen::half(Eigen::numext::igamma(static_cast<float>(a), static_cast<float>(x)));
|
||||
}
|
||||
template <>
|
||||
@@ -44,13 +52,17 @@ EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::half igamma_der_a(const Eigen::half
|
||||
return Eigen::half(Eigen::numext::igamma_der_a(static_cast<float>(a), static_cast<float>(x)));
|
||||
}
|
||||
template <>
|
||||
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::half gamma_sample_der_alpha(const Eigen::half& alpha, const Eigen::half& sample) {
|
||||
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::half gamma_sample_der_alpha(const Eigen::half& alpha,
|
||||
const Eigen::half& sample) {
|
||||
return Eigen::half(Eigen::numext::gamma_sample_der_alpha(static_cast<float>(alpha), static_cast<float>(sample)));
|
||||
}
|
||||
template<> EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::half igammac(const Eigen::half& a, const Eigen::half& x) {
|
||||
template <>
|
||||
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::half igammac(const Eigen::half& a, const Eigen::half& x) {
|
||||
return Eigen::half(Eigen::numext::igammac(static_cast<float>(a), static_cast<float>(x)));
|
||||
}
|
||||
template<> EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::half betainc(const Eigen::half& a, const Eigen::half& b, const Eigen::half& x) {
|
||||
template <>
|
||||
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::half betainc(const Eigen::half& a, const Eigen::half& b,
|
||||
const Eigen::half& x) {
|
||||
return Eigen::half(Eigen::numext::betainc(static_cast<float>(a), static_cast<float>(b), static_cast<float>(x)));
|
||||
}
|
||||
#endif
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -18,65 +18,95 @@ namespace Eigen {
|
||||
namespace internal {
|
||||
|
||||
/** \internal \returns the ln(|gamma(\a a)|) (coeff-wise) */
|
||||
template<typename Packet> EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS
|
||||
Packet plgamma(const Packet& a) { using numext::lgamma; return lgamma(a); }
|
||||
template <typename Packet>
|
||||
EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet plgamma(const Packet& a) {
|
||||
using numext::lgamma;
|
||||
return lgamma(a);
|
||||
}
|
||||
|
||||
/** \internal \returns the derivative of lgamma, psi(\a a) (coeff-wise) */
|
||||
template<typename Packet> EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS
|
||||
Packet pdigamma(const Packet& a) { using numext::digamma; return digamma(a); }
|
||||
template <typename Packet>
|
||||
EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pdigamma(const Packet& a) {
|
||||
using numext::digamma;
|
||||
return digamma(a);
|
||||
}
|
||||
|
||||
/** \internal \returns the zeta function of two arguments (coeff-wise) */
|
||||
template<typename Packet> EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS
|
||||
Packet pzeta(const Packet& x, const Packet& q) { using numext::zeta; return zeta(x, q); }
|
||||
template <typename Packet>
|
||||
EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pzeta(const Packet& x, const Packet& q) {
|
||||
using numext::zeta;
|
||||
return zeta(x, q);
|
||||
}
|
||||
|
||||
/** \internal \returns the polygamma function (coeff-wise) */
|
||||
template<typename Packet> EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS
|
||||
Packet ppolygamma(const Packet& n, const Packet& x) { using numext::polygamma; return polygamma(n, x); }
|
||||
template <typename Packet>
|
||||
EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet ppolygamma(const Packet& n, const Packet& x) {
|
||||
using numext::polygamma;
|
||||
return polygamma(n, x);
|
||||
}
|
||||
|
||||
/** \internal \returns the erf(\a a) (coeff-wise) */
|
||||
template<typename Packet> EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS
|
||||
Packet perf(const Packet& a) { using numext::erf; return erf(a); }
|
||||
template <typename Packet>
|
||||
EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet perf(const Packet& a) {
|
||||
using numext::erf;
|
||||
return erf(a);
|
||||
}
|
||||
|
||||
/** \internal \returns the erfc(\a a) (coeff-wise) */
|
||||
template<typename Packet> EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS
|
||||
Packet perfc(const Packet& a) { using numext::erfc; return erfc(a); }
|
||||
template <typename Packet>
|
||||
EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet perfc(const Packet& a) {
|
||||
using numext::erfc;
|
||||
return erfc(a);
|
||||
}
|
||||
|
||||
/** \internal \returns the ndtri(\a a) (coeff-wise) */
|
||||
template<typename Packet> EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS
|
||||
Packet pndtri(const Packet& a) {
|
||||
template <typename Packet>
|
||||
EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pndtri(const Packet& a) {
|
||||
typedef typename unpacket_traits<Packet>::type ScalarType;
|
||||
using internal::generic_ndtri; return generic_ndtri<Packet, ScalarType>(a);
|
||||
using internal::generic_ndtri;
|
||||
return generic_ndtri<Packet, ScalarType>(a);
|
||||
}
|
||||
|
||||
/** \internal \returns the incomplete gamma function igamma(\a a, \a x) */
|
||||
template<typename Packet> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
|
||||
Packet pigamma(const Packet& a, const Packet& x) { using numext::igamma; return igamma(a, x); }
|
||||
template <typename Packet>
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet pigamma(const Packet& a, const Packet& x) {
|
||||
using numext::igamma;
|
||||
return igamma(a, x);
|
||||
}
|
||||
|
||||
/** \internal \returns the derivative of the incomplete gamma function
|
||||
* igamma_der_a(\a a, \a x) */
|
||||
template <typename Packet>
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet pigamma_der_a(const Packet& a, const Packet& x) {
|
||||
using numext::igamma_der_a; return igamma_der_a(a, x);
|
||||
using numext::igamma_der_a;
|
||||
return igamma_der_a(a, x);
|
||||
}
|
||||
|
||||
/** \internal \returns compute the derivative of the sample
|
||||
* of Gamma(alpha, 1) random variable with respect to the parameter a
|
||||
* gamma_sample_der_alpha(\a alpha, \a sample) */
|
||||
* of Gamma(alpha, 1) random variable with respect to the parameter a
|
||||
* gamma_sample_der_alpha(\a alpha, \a sample) */
|
||||
template <typename Packet>
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet pgamma_sample_der_alpha(const Packet& alpha, const Packet& sample) {
|
||||
using numext::gamma_sample_der_alpha; return gamma_sample_der_alpha(alpha, sample);
|
||||
using numext::gamma_sample_der_alpha;
|
||||
return gamma_sample_der_alpha(alpha, sample);
|
||||
}
|
||||
|
||||
/** \internal \returns the complementary incomplete gamma function igammac(\a a, \a x) */
|
||||
template<typename Packet> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
|
||||
Packet pigammac(const Packet& a, const Packet& x) { using numext::igammac; return igammac(a, x); }
|
||||
template <typename Packet>
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet pigammac(const Packet& a, const Packet& x) {
|
||||
using numext::igammac;
|
||||
return igammac(a, x);
|
||||
}
|
||||
|
||||
/** \internal \returns the complementary incomplete gamma function betainc(\a a, \a b, \a x) */
|
||||
template<typename Packet> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
|
||||
Packet pbetainc(const Packet& a, const Packet& b,const Packet& x) { using numext::betainc; return betainc(a, b, x); }
|
||||
template <typename Packet>
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet pbetainc(const Packet& a, const Packet& b, const Packet& x) {
|
||||
using numext::betainc;
|
||||
return betainc(a, b, x);
|
||||
}
|
||||
|
||||
} // end namespace internal
|
||||
} // end namespace internal
|
||||
|
||||
} // end namespace Eigen
|
||||
} // end namespace Eigen
|
||||
|
||||
#endif // EIGEN_SPECIALFUNCTIONS_PACKETMATH_H
|
||||
#endif // EIGEN_SPECIALFUNCTIONS_PACKETMATH_H
|
||||
|
||||
@@ -19,187 +19,147 @@ namespace internal {
|
||||
// we'll use on the host side (SSE, AVX, ...)
|
||||
#if defined(EIGEN_GPUCC) && defined(EIGEN_USE_GPU)
|
||||
|
||||
template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
|
||||
float4 plgamma<float4>(const float4& a)
|
||||
{
|
||||
template <>
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE float4 plgamma<float4>(const float4& a) {
|
||||
return make_float4(lgammaf(a.x), lgammaf(a.y), lgammaf(a.z), lgammaf(a.w));
|
||||
}
|
||||
|
||||
template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
|
||||
double2 plgamma<double2>(const double2& a)
|
||||
{
|
||||
template <>
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE double2 plgamma<double2>(const double2& a) {
|
||||
using numext::lgamma;
|
||||
return make_double2(lgamma(a.x), lgamma(a.y));
|
||||
}
|
||||
|
||||
template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
|
||||
float4 pdigamma<float4>(const float4& a)
|
||||
{
|
||||
template <>
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE float4 pdigamma<float4>(const float4& a) {
|
||||
using numext::digamma;
|
||||
return make_float4(digamma(a.x), digamma(a.y), digamma(a.z), digamma(a.w));
|
||||
}
|
||||
|
||||
template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
|
||||
double2 pdigamma<double2>(const double2& a)
|
||||
{
|
||||
template <>
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE double2 pdigamma<double2>(const double2& a) {
|
||||
using numext::digamma;
|
||||
return make_double2(digamma(a.x), digamma(a.y));
|
||||
}
|
||||
|
||||
template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
|
||||
float4 pzeta<float4>(const float4& x, const float4& q)
|
||||
{
|
||||
using numext::zeta;
|
||||
return make_float4(zeta(x.x, q.x), zeta(x.y, q.y), zeta(x.z, q.z), zeta(x.w, q.w));
|
||||
template <>
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE float4 pzeta<float4>(const float4& x, const float4& q) {
|
||||
using numext::zeta;
|
||||
return make_float4(zeta(x.x, q.x), zeta(x.y, q.y), zeta(x.z, q.z), zeta(x.w, q.w));
|
||||
}
|
||||
|
||||
template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
|
||||
double2 pzeta<double2>(const double2& x, const double2& q)
|
||||
{
|
||||
using numext::zeta;
|
||||
return make_double2(zeta(x.x, q.x), zeta(x.y, q.y));
|
||||
template <>
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE double2 pzeta<double2>(const double2& x, const double2& q) {
|
||||
using numext::zeta;
|
||||
return make_double2(zeta(x.x, q.x), zeta(x.y, q.y));
|
||||
}
|
||||
|
||||
template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
|
||||
float4 ppolygamma<float4>(const float4& n, const float4& x)
|
||||
{
|
||||
using numext::polygamma;
|
||||
return make_float4(polygamma(n.x, x.x), polygamma(n.y, x.y), polygamma(n.z, x.z), polygamma(n.w, x.w));
|
||||
template <>
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE float4 ppolygamma<float4>(const float4& n, const float4& x) {
|
||||
using numext::polygamma;
|
||||
return make_float4(polygamma(n.x, x.x), polygamma(n.y, x.y), polygamma(n.z, x.z), polygamma(n.w, x.w));
|
||||
}
|
||||
|
||||
template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
|
||||
double2 ppolygamma<double2>(const double2& n, const double2& x)
|
||||
{
|
||||
using numext::polygamma;
|
||||
return make_double2(polygamma(n.x, x.x), polygamma(n.y, x.y));
|
||||
template <>
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE double2 ppolygamma<double2>(const double2& n, const double2& x) {
|
||||
using numext::polygamma;
|
||||
return make_double2(polygamma(n.x, x.x), polygamma(n.y, x.y));
|
||||
}
|
||||
|
||||
template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
|
||||
float4 perf<float4>(const float4& a)
|
||||
{
|
||||
template <>
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE float4 perf<float4>(const float4& a) {
|
||||
return make_float4(erff(a.x), erff(a.y), erff(a.z), erff(a.w));
|
||||
}
|
||||
|
||||
template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
|
||||
double2 perf<double2>(const double2& a)
|
||||
{
|
||||
template <>
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE double2 perf<double2>(const double2& a) {
|
||||
using numext::erf;
|
||||
return make_double2(erf(a.x), erf(a.y));
|
||||
}
|
||||
|
||||
template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
|
||||
float4 perfc<float4>(const float4& a)
|
||||
{
|
||||
template <>
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE float4 perfc<float4>(const float4& a) {
|
||||
using numext::erfc;
|
||||
return make_float4(erfc(a.x), erfc(a.y), erfc(a.z), erfc(a.w));
|
||||
}
|
||||
|
||||
template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
|
||||
double2 perfc<double2>(const double2& a)
|
||||
{
|
||||
template <>
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE double2 perfc<double2>(const double2& a) {
|
||||
using numext::erfc;
|
||||
return make_double2(erfc(a.x), erfc(a.y));
|
||||
}
|
||||
|
||||
template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
|
||||
float4 pndtri<float4>(const float4& a)
|
||||
{
|
||||
template <>
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE float4 pndtri<float4>(const float4& a) {
|
||||
using numext::ndtri;
|
||||
return make_float4(ndtri(a.x), ndtri(a.y), ndtri(a.z), ndtri(a.w));
|
||||
}
|
||||
|
||||
template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
|
||||
double2 pndtri<double2>(const double2& a)
|
||||
{
|
||||
template <>
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE double2 pndtri<double2>(const double2& a) {
|
||||
using numext::ndtri;
|
||||
return make_double2(ndtri(a.x), ndtri(a.y));
|
||||
}
|
||||
|
||||
template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
|
||||
float4 pigamma<float4>(const float4& a, const float4& x)
|
||||
{
|
||||
template <>
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE float4 pigamma<float4>(const float4& a, const float4& x) {
|
||||
using numext::igamma;
|
||||
return make_float4(
|
||||
igamma(a.x, x.x),
|
||||
igamma(a.y, x.y),
|
||||
igamma(a.z, x.z),
|
||||
igamma(a.w, x.w));
|
||||
return make_float4(igamma(a.x, x.x), igamma(a.y, x.y), igamma(a.z, x.z), igamma(a.w, x.w));
|
||||
}
|
||||
|
||||
template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
|
||||
double2 pigamma<double2>(const double2& a, const double2& x)
|
||||
{
|
||||
template <>
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE double2 pigamma<double2>(const double2& a, const double2& x) {
|
||||
using numext::igamma;
|
||||
return make_double2(igamma(a.x, x.x), igamma(a.y, x.y));
|
||||
}
|
||||
|
||||
template <>
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE float4 pigamma_der_a<float4>(
|
||||
const float4& a, const float4& x) {
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE float4 pigamma_der_a<float4>(const float4& a, const float4& x) {
|
||||
using numext::igamma_der_a;
|
||||
return make_float4(igamma_der_a(a.x, x.x), igamma_der_a(a.y, x.y),
|
||||
igamma_der_a(a.z, x.z), igamma_der_a(a.w, x.w));
|
||||
return make_float4(igamma_der_a(a.x, x.x), igamma_der_a(a.y, x.y), igamma_der_a(a.z, x.z), igamma_der_a(a.w, x.w));
|
||||
}
|
||||
|
||||
template <>
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE double2
|
||||
pigamma_der_a<double2>(const double2& a, const double2& x) {
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE double2 pigamma_der_a<double2>(const double2& a, const double2& x) {
|
||||
using numext::igamma_der_a;
|
||||
return make_double2(igamma_der_a(a.x, x.x), igamma_der_a(a.y, x.y));
|
||||
}
|
||||
|
||||
template <>
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE float4 pgamma_sample_der_alpha<float4>(
|
||||
const float4& alpha, const float4& sample) {
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE float4 pgamma_sample_der_alpha<float4>(const float4& alpha,
|
||||
const float4& sample) {
|
||||
using numext::gamma_sample_der_alpha;
|
||||
return make_float4(
|
||||
gamma_sample_der_alpha(alpha.x, sample.x),
|
||||
gamma_sample_der_alpha(alpha.y, sample.y),
|
||||
gamma_sample_der_alpha(alpha.z, sample.z),
|
||||
gamma_sample_der_alpha(alpha.w, sample.w));
|
||||
return make_float4(gamma_sample_der_alpha(alpha.x, sample.x), gamma_sample_der_alpha(alpha.y, sample.y),
|
||||
gamma_sample_der_alpha(alpha.z, sample.z), gamma_sample_der_alpha(alpha.w, sample.w));
|
||||
}
|
||||
|
||||
template <>
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE double2
|
||||
pgamma_sample_der_alpha<double2>(const double2& alpha, const double2& sample) {
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE double2 pgamma_sample_der_alpha<double2>(const double2& alpha,
|
||||
const double2& sample) {
|
||||
using numext::gamma_sample_der_alpha;
|
||||
return make_double2(
|
||||
gamma_sample_der_alpha(alpha.x, sample.x),
|
||||
gamma_sample_der_alpha(alpha.y, sample.y));
|
||||
return make_double2(gamma_sample_der_alpha(alpha.x, sample.x), gamma_sample_der_alpha(alpha.y, sample.y));
|
||||
}
|
||||
|
||||
template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
|
||||
float4 pigammac<float4>(const float4& a, const float4& x)
|
||||
{
|
||||
template <>
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE float4 pigammac<float4>(const float4& a, const float4& x) {
|
||||
using numext::igammac;
|
||||
return make_float4(
|
||||
igammac(a.x, x.x),
|
||||
igammac(a.y, x.y),
|
||||
igammac(a.z, x.z),
|
||||
igammac(a.w, x.w));
|
||||
return make_float4(igammac(a.x, x.x), igammac(a.y, x.y), igammac(a.z, x.z), igammac(a.w, x.w));
|
||||
}
|
||||
|
||||
template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
|
||||
double2 pigammac<double2>(const double2& a, const double2& x)
|
||||
{
|
||||
template <>
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE double2 pigammac<double2>(const double2& a, const double2& x) {
|
||||
using numext::igammac;
|
||||
return make_double2(igammac(a.x, x.x), igammac(a.y, x.y));
|
||||
}
|
||||
|
||||
template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
|
||||
float4 pbetainc<float4>(const float4& a, const float4& b, const float4& x)
|
||||
{
|
||||
template <>
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE float4 pbetainc<float4>(const float4& a, const float4& b, const float4& x) {
|
||||
using numext::betainc;
|
||||
return make_float4(
|
||||
betainc(a.x, b.x, x.x),
|
||||
betainc(a.y, b.y, x.y),
|
||||
betainc(a.z, b.z, x.z),
|
||||
betainc(a.w, b.w, x.w));
|
||||
return make_float4(betainc(a.x, b.x, x.x), betainc(a.y, b.y, x.y), betainc(a.z, b.z, x.z), betainc(a.w, b.w, x.w));
|
||||
}
|
||||
|
||||
template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
|
||||
double2 pbetainc<double2>(const double2& a, const double2& b, const double2& x)
|
||||
{
|
||||
template <>
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE double2 pbetainc<double2>(const double2& a, const double2& b, const double2& x) {
|
||||
using numext::betainc;
|
||||
return make_double2(betainc(a.x, b.x, x.x), betainc(a.y, b.y, x.y));
|
||||
}
|
||||
@@ -211,8 +171,7 @@ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE float4 pbessel_i0e<float4>(const float4& x
|
||||
}
|
||||
|
||||
template <>
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE double2
|
||||
pbessel_i0e<double2>(const double2& x) {
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE double2 pbessel_i0e<double2>(const double2& x) {
|
||||
using numext::bessel_i0e;
|
||||
return make_double2(bessel_i0e(x.x), bessel_i0e(x.y));
|
||||
}
|
||||
@@ -224,8 +183,7 @@ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE float4 pbessel_i0<float4>(const float4& x)
|
||||
}
|
||||
|
||||
template <>
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE double2
|
||||
pbessel_i0<double2>(const double2& x) {
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE double2 pbessel_i0<double2>(const double2& x) {
|
||||
using numext::bessel_i0;
|
||||
return make_double2(bessel_i0(x.x), bessel_i0(x.y));
|
||||
}
|
||||
@@ -237,8 +195,7 @@ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE float4 pbessel_i1e<float4>(const float4& x
|
||||
}
|
||||
|
||||
template <>
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE double2
|
||||
pbessel_i1e<double2>(const double2& x) {
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE double2 pbessel_i1e<double2>(const double2& x) {
|
||||
using numext::bessel_i1e;
|
||||
return make_double2(bessel_i1e(x.x), bessel_i1e(x.y));
|
||||
}
|
||||
@@ -250,8 +207,7 @@ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE float4 pbessel_i1<float4>(const float4& x)
|
||||
}
|
||||
|
||||
template <>
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE double2
|
||||
pbessel_i1<double2>(const double2& x) {
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE double2 pbessel_i1<double2>(const double2& x) {
|
||||
using numext::bessel_i1;
|
||||
return make_double2(bessel_i1(x.x), bessel_i1(x.y));
|
||||
}
|
||||
@@ -263,8 +219,7 @@ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE float4 pbessel_k0e<float4>(const float4& x
|
||||
}
|
||||
|
||||
template <>
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE double2
|
||||
pbessel_k0e<double2>(const double2& x) {
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE double2 pbessel_k0e<double2>(const double2& x) {
|
||||
using numext::bessel_k0e;
|
||||
return make_double2(bessel_k0e(x.x), bessel_k0e(x.y));
|
||||
}
|
||||
@@ -276,8 +231,7 @@ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE float4 pbessel_k0<float4>(const float4& x)
|
||||
}
|
||||
|
||||
template <>
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE double2
|
||||
pbessel_k0<double2>(const double2& x) {
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE double2 pbessel_k0<double2>(const double2& x) {
|
||||
using numext::bessel_k0;
|
||||
return make_double2(bessel_k0(x.x), bessel_k0(x.y));
|
||||
}
|
||||
@@ -289,8 +243,7 @@ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE float4 pbessel_k1e<float4>(const float4& x
|
||||
}
|
||||
|
||||
template <>
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE double2
|
||||
pbessel_k1e<double2>(const double2& x) {
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE double2 pbessel_k1e<double2>(const double2& x) {
|
||||
using numext::bessel_k1e;
|
||||
return make_double2(bessel_k1e(x.x), bessel_k1e(x.y));
|
||||
}
|
||||
@@ -302,8 +255,7 @@ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE float4 pbessel_k1<float4>(const float4& x)
|
||||
}
|
||||
|
||||
template <>
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE double2
|
||||
pbessel_k1<double2>(const double2& x) {
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE double2 pbessel_k1<double2>(const double2& x) {
|
||||
using numext::bessel_k1;
|
||||
return make_double2(bessel_k1(x.x), bessel_k1(x.y));
|
||||
}
|
||||
@@ -315,8 +267,7 @@ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE float4 pbessel_j0<float4>(const float4& x)
|
||||
}
|
||||
|
||||
template <>
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE double2
|
||||
pbessel_j0<double2>(const double2& x) {
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE double2 pbessel_j0<double2>(const double2& x) {
|
||||
using numext::bessel_j0;
|
||||
return make_double2(bessel_j0(x.x), bessel_j0(x.y));
|
||||
}
|
||||
@@ -328,8 +279,7 @@ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE float4 pbessel_j1<float4>(const float4& x)
|
||||
}
|
||||
|
||||
template <>
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE double2
|
||||
pbessel_j1<double2>(const double2& x) {
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE double2 pbessel_j1<double2>(const double2& x) {
|
||||
using numext::bessel_j1;
|
||||
return make_double2(bessel_j1(x.x), bessel_j1(x.y));
|
||||
}
|
||||
@@ -341,8 +291,7 @@ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE float4 pbessel_y0<float4>(const float4& x)
|
||||
}
|
||||
|
||||
template <>
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE double2
|
||||
pbessel_y0<double2>(const double2& x) {
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE double2 pbessel_y0<double2>(const double2& x) {
|
||||
using numext::bessel_y0;
|
||||
return make_double2(bessel_y0(x.x), bessel_y0(x.y));
|
||||
}
|
||||
@@ -354,16 +303,15 @@ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE float4 pbessel_y1<float4>(const float4& x)
|
||||
}
|
||||
|
||||
template <>
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE double2
|
||||
pbessel_y1<double2>(const double2& x) {
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE double2 pbessel_y1<double2>(const double2& x) {
|
||||
using numext::bessel_y1;
|
||||
return make_double2(bessel_y1(x.x), bessel_y1(x.y));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
} // end namespace internal
|
||||
} // end namespace internal
|
||||
|
||||
} // end namespace Eigen
|
||||
} // end namespace Eigen
|
||||
|
||||
#endif // EIGEN_GPU_SPECIALFUNCTIONS_H
|
||||
#endif // EIGEN_GPU_SPECIALFUNCTIONS_H
|
||||
|
||||
@@ -6,18 +6,18 @@ namespace internal {
|
||||
|
||||
#if EIGEN_HAS_ARM64_FP16_VECTOR_ARITHMETIC
|
||||
|
||||
#define NEON_HALF_TO_FLOAT_FUNCTIONS(METHOD) \
|
||||
template <> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE \
|
||||
Packet8hf METHOD<Packet8hf>(const Packet8hf& x) { \
|
||||
const Packet4f lo = METHOD<Packet4f>(vcvt_f32_f16(vget_low_f16(x))); \
|
||||
const Packet4f hi = METHOD<Packet4f>(vcvt_f32_f16(vget_high_f16(x))); \
|
||||
return vcombine_f16(vcvt_f16_f32(lo), vcvt_f16_f32(hi)); \
|
||||
} \
|
||||
\
|
||||
template <> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE \
|
||||
Packet4hf METHOD<Packet4hf>(const Packet4hf& x) { \
|
||||
return vcvt_f16_f32(METHOD<Packet4f>(vcvt_f32_f16(x))); \
|
||||
}
|
||||
#define NEON_HALF_TO_FLOAT_FUNCTIONS(METHOD) \
|
||||
template <> \
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet8hf METHOD<Packet8hf>(const Packet8hf& x) { \
|
||||
const Packet4f lo = METHOD<Packet4f>(vcvt_f32_f16(vget_low_f16(x))); \
|
||||
const Packet4f hi = METHOD<Packet4f>(vcvt_f32_f16(vget_high_f16(x))); \
|
||||
return vcombine_f16(vcvt_f16_f32(lo), vcvt_f16_f32(hi)); \
|
||||
} \
|
||||
\
|
||||
template <> \
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet4hf METHOD<Packet4hf>(const Packet4hf& x) { \
|
||||
return vcvt_f16_f32(METHOD<Packet4f>(vcvt_f32_f16(x))); \
|
||||
}
|
||||
|
||||
NEON_HALF_TO_FLOAT_FUNCTIONS(pbessel_i0)
|
||||
NEON_HALF_TO_FLOAT_FUNCTIONS(pbessel_i0e)
|
||||
|
||||
@@ -6,18 +6,18 @@ namespace internal {
|
||||
|
||||
#if EIGEN_HAS_ARM64_FP16_VECTOR_ARITHMETIC
|
||||
|
||||
#define NEON_HALF_TO_FLOAT_FUNCTIONS(METHOD) \
|
||||
template <> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE \
|
||||
Packet8hf METHOD<Packet8hf>(const Packet8hf& x) { \
|
||||
const Packet4f lo = METHOD<Packet4f>(vcvt_f32_f16(vget_low_f16(x))); \
|
||||
const Packet4f hi = METHOD<Packet4f>(vcvt_f32_f16(vget_high_f16(x))); \
|
||||
return vcombine_f16(vcvt_f16_f32(lo), vcvt_f16_f32(hi)); \
|
||||
} \
|
||||
\
|
||||
template <> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE \
|
||||
Packet4hf METHOD<Packet4hf>(const Packet4hf& x) { \
|
||||
return vcvt_f16_f32(METHOD<Packet4f>(vcvt_f32_f16(x))); \
|
||||
}
|
||||
#define NEON_HALF_TO_FLOAT_FUNCTIONS(METHOD) \
|
||||
template <> \
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet8hf METHOD<Packet8hf>(const Packet8hf& x) { \
|
||||
const Packet4f lo = METHOD<Packet4f>(vcvt_f32_f16(vget_low_f16(x))); \
|
||||
const Packet4f hi = METHOD<Packet4f>(vcvt_f32_f16(vget_high_f16(x))); \
|
||||
return vcombine_f16(vcvt_f16_f32(lo), vcvt_f16_f32(hi)); \
|
||||
} \
|
||||
\
|
||||
template <> \
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet4hf METHOD<Packet4hf>(const Packet4hf& x) { \
|
||||
return vcvt_f16_f32(METHOD<Packet4f>(vcvt_f32_f16(x))); \
|
||||
}
|
||||
|
||||
NEON_HALF_TO_FLOAT_FUNCTIONS(perf)
|
||||
NEON_HALF_TO_FLOAT_FUNCTIONS(pndtri)
|
||||
|
||||
Reference in New Issue
Block a user