Automatic Differentiation
 
Loading...
Searching...
No Matches
modified_bessel_first_kind.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_PRIM_FUN_MODIFIED_BESSEL_FIRST_KIND_HPP
2#define STAN_MATH_PRIM_FUN_MODIFIED_BESSEL_FIRST_KIND_HPP
3
7#include <boost/math/special_functions/bessel.hpp>
8
9namespace stan {
10namespace math {
11
37template <typename T2, require_arithmetic_t<T2>* = nullptr>
38inline T2 modified_bessel_first_kind(int v, const T2 z) {
39 check_not_nan("modified_bessel_first_kind", "z", z);
40
41 return boost::math::cyl_bessel_i(v, z);
42}
43
49inline double modified_bessel_first_kind(int v, int z) {
50 check_not_nan("modified_bessel_first_kind", "z", z);
51
52 return boost::math::cyl_bessel_i(v, static_cast<double>(z));
53}
54
65template <typename T1, typename T2, require_any_container_t<T1, T2>* = nullptr>
66inline auto modified_bessel_first_kind(T1&& a, T2&& b) {
68 [](auto&& c, auto&& d) {
69 return modified_bessel_first_kind(std::forward<decltype(c)>(c),
70 std::forward<decltype(d)>(d));
71 },
72 std::forward<T1>(a), std::forward<T2>(b));
73}
74
75} // namespace math
76} // namespace stan
77
78#endif
auto apply_scalar_binary(F &&f, T1 &&x, T2 &&y)
Base template function for vectorization of binary scalar functions defined by applying a functor to ...
fvar< T > modified_bessel_first_kind(int v, const fvar< T > &z)
void check_not_nan(const char *function, const char *name, const T_y &y)
Check if y is not NaN.
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...