Automatic Differentiation
 
Loading...
Searching...
No Matches
log.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_FWD_FUN_LOG_HPP
2#define STAN_MATH_FWD_FUN_LOG_HPP
3
11#include <cmath>
12#include <complex>
13
14namespace stan {
15namespace math {
16
17template <typename T>
18inline fvar<T> log(const fvar<T>& x) {
19 if (x.val_ < 0.0) {
21 } else {
22 return fvar<T>(log(x.val_), x.d_ / x.val_);
23 }
24}
25
33template <typename T>
34inline std::complex<fvar<T>> log(const std::complex<fvar<T>>& z) {
35 return internal::complex_log(z);
36}
37
38} // namespace math
39} // namespace stan
40#endif
std::complex< V > complex_log(const std::complex< V > &z)
Return the natural logarithm of the complex argument.
Definition log.hpp:98
static constexpr double NOT_A_NUMBER
(Quiet) not-a-number value.
Definition constants.hpp:56
fvar< T > log(const fvar< T > &x)
Definition log.hpp:18
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...
Scalar val_
The value of this variable.
Definition fvar.hpp:49
Scalar d_
The tangent (derivative) of this variable.
Definition fvar.hpp:61
This template class represents scalars used in forward-mode automatic differentiation,...
Definition fvar.hpp:40