Stan
1.3
probability, sampling & optimization
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerator
Friends
Macros
Pages
src
stan
agrad
rev
log1p_exp.hpp
Go to the documentation of this file.
1
#ifndef __STAN__AGRAD__REV__LOG1P_EXP_HPP__
2
#define __STAN__AGRAD__REV__LOG1P_EXP_HPP__
3
4
#include <
stan/agrad/rev/var.hpp
>
5
#include <
stan/agrad/rev/op/v_vari.hpp
>
6
#include <
stan/math/functions/log1p_exp.hpp
>
7
#include <
stan/agrad/rev/calculate_chain.hpp
>
8
9
namespace
stan {
10
namespace
agrad {
11
12
namespace
{
13
class
log1p_exp_v_vari :
public
op_v_vari {
14
public
:
15
log1p_exp_v_vari(vari* avi) :
16
op_v_vari(stan::math::
log1p_exp
(avi->val_),
17
avi) {
18
}
19
void
chain() {
20
avi_
->adj_ += adj_ *
calculate_chain
(
avi_
->val_, val_);
21
}
22
};
23
}
24
29
inline
var
log1p_exp
(
const
stan::agrad::var
& a) {
30
return
var
(
new
log1p_exp_v_vari(a.
vi_
));
31
}
32
33
}
34
}
35
#endif
[
Stan Home Page
]
© 2011–2013, Stan Development Team.