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

| Stan Math Library 2.10.0 reverse mode automatic differentiation

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

modified_bessel_first_kind.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_REV_SCAL_FUN_MODIFIED_BESSEL_FIRST_KIND_HPP
2 #define STAN_MATH_REV_SCAL_FUN_MODIFIED_BESSEL_FIRST_KIND_HPP
3
4 #include <stan/math/rev/core.hpp>
5 #include <stan/math/prim/scal/fun/modified_bessel_first_kind.hpp>
6
7 namespace stan {
8 namespace math {
9
10 namespace {
11
12 class modified_bessel_first_kind_dv_vari : public op_dv_vari {
13 public:
14 modified_bessel_first_kind_dv_vari(int a, vari* bvi) :
15 op_dv_vari(stan::math::modified_bessel_first_kind(a, bvi->val_),
16 a, bvi) {
17 }
18 void chain() {
19 bvi_->adj_ += adj_
20 * (-ad_ * stan::math::modified_bessel_first_kind(ad_, bvi_->val_)
21 / bvi_->val_
22 + stan::math::modified_bessel_first_kind(ad_ - 1, bvi_->val_));
23 }
24 };
25 }
26
27 inline var modified_bessel_first_kind(const int& v,
28 const var& a) {
29 return var(new modified_bessel_first_kind_dv_vari(v, a.vi_));
30 }
31
32 }
33 }
34 #endif
core.hpp
stan
Definition: log_sum_exp.hpp:8
modified_bessel_first_kind.hpp
stan::math::var
Independent (input) and dependent (output) variables for gradients.
Definition: var.hpp:31
stan::math::modified_bessel_first_kind
fvar< T > modified_bessel_first_kind(int v, const fvar< T > &z)
Definition: modified_bessel_first_kind.hpp:15
stan::math::var::vi_
vari * vi_
Pointer to the implementation of this variable.
Definition: var.hpp:43

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