mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Exponentially scaled modified Bessel functions of order zero and one.
The functions are conventionally called i0e and i1e. The exponentially scaled version is more numerically stable. The standard Bessel functions can be obtained as i0(x) = exp(|x|) i0e(x) The code is ported from Cephes and tested against SciPy.
This commit is contained in:
@@ -119,6 +119,52 @@ zeta(const Eigen::ArrayBase<DerivedX>& x, const Eigen::ArrayBase<DerivedQ>& q)
|
||||
);
|
||||
}
|
||||
|
||||
/** \returns an expression of the coefficient-wise i0e(\a x) to the given
|
||||
* arrays.
|
||||
*
|
||||
* It returns the exponentially scaled modified Bessel
|
||||
* function 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::i0e()
|
||||
*/
|
||||
template <typename Derived>
|
||||
inline const Eigen::CwiseUnaryOp<
|
||||
Eigen::internal::scalar_i0e_op<typename Derived::Scalar>, const Derived>
|
||||
i0e(const Eigen::ArrayBase<Derived>& x) {
|
||||
return Eigen::CwiseUnaryOp<
|
||||
Eigen::internal::scalar_i0e_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 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::i1e()
|
||||
*/
|
||||
template <typename Derived>
|
||||
inline const Eigen::CwiseUnaryOp<
|
||||
Eigen::internal::scalar_i1e_op<typename Derived::Scalar>, const Derived>
|
||||
i1e(const Eigen::ArrayBase<Derived>& x) {
|
||||
return Eigen::CwiseUnaryOp<
|
||||
Eigen::internal::scalar_i1e_op<typename Derived::Scalar>,
|
||||
const Derived>(x.derived());
|
||||
}
|
||||
|
||||
} // end namespace Eigen
|
||||
|
||||
#endif // EIGEN_SPECIALFUNCTIONS_ARRAYAPI_H
|
||||
|
||||
Reference in New Issue
Block a user