1#ifndef STAN_MATH_PRIM_FUN_EXP_HPP
2#define STAN_MATH_PRIM_FUN_EXP_HPP
27 static inline auto fun(
const T& x) {
47inline auto exp(
const Container& x) {
59template <
typename Container,
61inline auto exp(
const Container& x) {
63 x, [](
const auto& v) {
return v.array().
exp(); });
79 if (
is_inf(z.real()) && z.real() > 0) {
80 if (
is_nan(z.imag()) || z.imag() == 0) {
83 }
else if (
is_inf(z.imag()) && z.imag() > 0) {
85 return {z.real(), std::numeric_limits<double>::quiet_NaN()};
86 }
else if (
is_inf(z.imag()) && z.imag() < 0) {
88 return {std::numeric_limits<double>::quiet_NaN(),
89 std::numeric_limits<double>::quiet_NaN()};
92 if (
is_inf(z.real()) && z.real() < 0
97 if (
is_nan(z.real()) && z.imag() == -0.0) {
101 V exp_re =
exp(z.real());
102 return {exp_re *
cos(z.imag()), exp_re *
sin(z.imag())};
require_not_t< container_type_check_base< is_container, scalar_type_t, TypeCheck, Check... > > require_not_container_st
Require type does not satisfy is_container.
require_t< container_type_check_base< is_container, scalar_type_t, TypeCheck, Check... > > require_container_st
Require type satisfies is_container.
require_not_t< is_nonscalar_prim_or_rev_kernel_expression< std::decay_t< T > > > require_not_nonscalar_prim_or_rev_kernel_expression_t
Require type does not satisfy is_nonscalar_prim_or_rev_kernel_expression.
require_not_t< is_var_matrix< std::decay_t< T > > > require_not_var_matrix_t
Require type does not satisfy is_var_matrix.
std::complex< V > complex_exp(const std::complex< V > &z)
Return the natural (base e) complex exponentiation of the specified complex argument.
fvar< T > sin(const fvar< T > &x)
bool is_nan(T &&x)
Returns 1 if the input's value is NaN and 0 otherwise.
fvar< T > cos(const fvar< T > &x)
int is_inf(const fvar< T > &x)
Returns 1 if the input's value is infinite and 0 otherwise.
fvar< T > exp(const fvar< T > &x)
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...
Base template class for vectorization of unary scalar functions defined by a template class F to a sc...
static auto fun(const T &x)
Return the exponential of the specified scalar argument.
Structure to wrap exp() so that it can be vectorized.