Stan Math Library: stan/math/rev/scal/fun/log10.hpp Source File

| Stan Math Library 2.10.0 reverse mode automatic differentiation

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

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>
5 #include <stan/math/prim/scal/fun/constants.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
core.hpp
stan
Definition: log_sum_exp.hpp:8
std
Definition: std_numeric_limits.hpp:7
stan::math::LOG_10
const double LOG_10
The natural logarithm of 10, .
Definition: constants.hpp:39
stan::math::log10
fvar< T > log10(const fvar< T > &x)
Definition: log10.hpp:15
stan::math::var
Independent (input) and dependent (output) variables for gradients.
Definition: var.hpp:31
stan::math::var::vi_
vari * vi_
Pointer to the implementation of this variable.
Definition: var.hpp:43
exp_val_
const double exp_val_
Definition: log10.hpp:14
constants.hpp

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