| Stan Math Library 2.12.0 reverse mode automatic differentiation

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

asinh.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_REV_SCAL_FUN_ASINH_HPP
2 #define STAN_MATH_REV_SCAL_FUN_ASINH_HPP
3
4 #include <math.h>
5 #include <stan/math/rev/core.hpp>
6 #include <stan/math/prim/scal/fun/is_inf.hpp>
7 #include <cmath>
8 #include <valarray>
9
10 #ifdef _MSC_VER
11 #include <boost/math/special_functions/asinh.hpp>
12 using boost::math::asinh;
13 #endif
14
15 namespace stan {
16 namespace math {
17
18 namespace {
19 class asinh_vari : public op_v_vari {
20 public:
21 asinh_vari(double val, vari* avi) :
22 op_v_vari(val, avi) {
23 }
24 void chain() {
25 avi_->adj_ += adj_ / std::sqrt(avi_->val_ * avi_->val_ + 1.0);
26 }
27 };
28 }
29
67 inline var asinh(const var& a) {
68 if (is_inf(a.val()))
69 return var(new asinh_vari(a.val(), a.vi_));
70 return var(new asinh_vari(::asinh(a.val()), a.vi_));
71 }
72
73 }
74 }
75 #endif
core.hpp
stan::math::sqrt
fvar< T > sqrt(const fvar< T > &x)
Definition: sqrt.hpp:14
stan
Definition: log_sum_exp.hpp:8
is_inf.hpp
stan::math::var
Independent (input) and dependent (output) variables for gradients.
Definition: var.hpp:30
stan::math::asinh
fvar< T > asinh(const fvar< T > &x)
Definition: asinh.hpp:13
stan::math::var::vi_
vari * vi_
Pointer to the implementation of this variable.
Definition: var.hpp:42
stan::math::is_inf
int is_inf(const fvar< T > &x)
Returns 1 if the input's value is infinite and 0 otherwise.
Definition: is_inf.hpp:21
stan::math::asinh
var asinh(const var &a)
The inverse hyperbolic sine function for variables (C99).
Definition: asinh.hpp:67
stan::math::var::val
double val() const
Return the value of this variable.
Definition: var.hpp:229

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