Automatic Differentiation
 
Loading...
Searching...
No Matches
log1m.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_PRIM_FUN_LOG1M_HPP
2#define STAN_MATH_PRIM_FUN_LOG1M_HPP
3
9
10namespace stan {
11namespace math {
12
42inline double log1m(double x) {
43 if (!is_nan(x)) {
44 check_less_or_equal("log1m", "x", x, 1);
45 }
46 return stan::math::log1p(-x);
47}
48
56struct log1m_fun {
57 template <typename T>
58 static inline auto fun(const T& x) {
59 return log1m(x);
60 }
61};
62
70template <
71 typename T, require_not_var_matrix_t<T>* = nullptr,
73inline auto log1m(const T& x) {
75}
76
77} // namespace math
78} // namespace stan
79
80#endif
require_all_not_t< is_nonscalar_prim_or_rev_kernel_expression< std::decay_t< Types > >... > require_all_not_nonscalar_prim_or_rev_kernel_expression_t
Require none of the types 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.
void check_less_or_equal(const char *function, const char *name, const T_y &y, const T_high &high, Idxs... idxs)
Throw an exception if y is not less than high.
bool is_nan(T &&x)
Returns 1 if the input's value is NaN and 0 otherwise.
Definition is_nan.hpp:22
fvar< T > log1p(const fvar< T > &x)
Definition log1p.hpp:12
fvar< T > log1m(const fvar< T > &x)
Definition log1m.hpp:12
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...
Definition fvar.hpp:9
Base template class for vectorization of unary scalar functions defined by a template class F to a sc...
static auto fun(const T &x)
Definition log1m.hpp:58
Structure to wrap log1m() so it can be vectorized.
Definition log1m.hpp:56