1 #ifndef STAN__AGRAD__REV__FUNCTIONS__HYPOT_HPP
2 #define STAN__AGRAD__REV__FUNCTIONS__HYPOT_HPP
14 class hypot_vv_vari :
public op_vv_vari {
16 hypot_vv_vari(vari* avi, vari* bvi) :
17 op_vv_vari(::
hypot(avi->val_,bvi->val_),
21 avi_->adj_ += adj_ * avi_->val_ / val_;
22 bvi_->adj_ += adj_ * bvi_->val_ / val_;
26 class hypot_vd_vari :
public op_v_vari {
28 hypot_vd_vari(vari* avi,
double b) :
29 op_v_vari(::
hypot(avi->val_,b),
33 avi_->adj_ += adj_ * avi_->val_ / val_;
56 return var(
new hypot_vv_vari(a.
vi_,b.
vi_));
75 return var(
new hypot_vd_vari(a.
vi_,b));
121 return var(
new hypot_vd_vari(b.
vi_,a));
fvar< T > hypot(const fvar< T > &x1, const fvar< T > &x2)
vari * vi_
Pointer to the implementation of this variable.
Independent (input) and dependent (output) variables for gradients.