log1m_exp.hpp
Go to the documentation of this file.
#ifndef STAN_MATH_REV_SCAL_FUN_LOG1M_EXP_HPP
#define STAN_MATH_REV_SCAL_FUN_LOG1M_EXP_HPP
#include <stan/math/rev/core.hpp>
#include <stan/math/prim/scal/fun/expm1.hpp>
#include <stan/math/prim/scal/fun/log1m_exp.hpp>
namespace stan {
namespace math {
namespace {
class log1m_exp_v_vari : public op_v_vari {
public:
explicit log1m_exp_v_vari(vari* avi) :
op_v_vari(log1m_exp(avi->val_), avi) { }
void chain() {
avi_->adj_ -= adj_ / expm1(-(avi_->val_));
}
};
}
inline var log1m_exp(const var& x) {
return var(new log1m_exp_v_vari(x.vi_));
}
}
}
#endif
core.hpp
stan
Definition: log_sum_exp.hpp:8
stan::math::var
Independent (input) and dependent (output) variables for gradients.
Definition: var.hpp:30
stan::math::expm1
fvar< T > expm1(const fvar< T > &x)
Definition: expm1.hpp:12
stan::math::log1m_exp
fvar< T > log1m_exp(const fvar< T > &x)
Return the natural logarithm of one minus the exponentiation of the specified argument.
Definition: log1m_exp.hpp:23
log1m_exp.hpp
stan::math::var::vi_
vari * vi_
Pointer to the implementation of this variable.
Definition: var.hpp:42
expm1.hpp

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