Stan Math Library  2.9.0
reverse mode automatic differentiation
log10.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_REV_SCAL_FUN_LOG10_HPP
2 #define STAN_MATH_REV_SCAL_FUN_LOG10_HPP
3 
4 #include <stan/math/rev/core.hpp>
6 #include <cmath>
7 
8 namespace stan {
9  namespace math {
10 
11  namespace {
12  class log10_vari : public op_v_vari {
13  public:
14  const double exp_val_;
15  explicit log10_vari(vari* avi) :
16  op_v_vari(std::log10(avi->val_), avi),
17  exp_val_(avi->val_) {
18  }
19  void chain() {
20  avi_->adj_ += adj_ / (stan::math::LOG_10 * exp_val_);
21  }
22  };
23  }
24 
54  inline var log10(const var& a) {
55  return var(new log10_vari(a.vi_));
56  }
57 
58  }
59 }
60 #endif
const double LOG_10
The natural logarithm of 10, .
Definition: constants.hpp:39
fvar< T > log10(const fvar< T > &x)
Definition: log10.hpp:15
Independent (input) and dependent (output) variables for gradients.
Definition: var.hpp:31
vari * vi_
Pointer to the implementation of this variable.
Definition: var.hpp:43
const double exp_val_
Definition: log10.hpp:14

     [ Stan Home Page ] © 2011–2015, Stan Development Team.