Automatic Differentiation
 
Loading...
Searching...
No Matches
ldexp.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_REV_FUN_LDEXP_HPP
2#define STAN_MATH_REV_FUN_LDEXP_HPP
3
6
7namespace stan {
8namespace math {
9
10namespace {
11class ldexp_vari : public op_vd_vari {
12 public:
13 explicit ldexp_vari(vari* avi, int b)
14 : op_vd_vari(ldexp(avi->val_, b), avi, b) {}
15 void chain() { avi_->adj_ += ldexp(adj_, bd_); }
16};
17} // namespace
18
19inline var ldexp(const var& a, int b) { return var(new ldexp_vari(a.vi_, b)); }
20
21} // namespace math
22} // namespace stan
23#endif
vari_value< double > vari
Definition vari.hpp:197
fvar< T > ldexp(const fvar< T > &a, int b)
Returns the product of a (the significand) times 2 to power b (the exponent).
Definition ldexp.hpp:21
var_value< double > var
Definition var.hpp:1187
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...