All Classes Namespaces Files Functions Variables Typedefs Enumerator Friends Macros Groups
asinh.hpp
Go to the documentation of this file.
#ifndef STAN_MATH_REV_SCAL_FUN_ASINH_HPP
#define STAN_MATH_REV_SCAL_FUN_ASINH_HPP
#include <math.h>
#include <stan/math/rev/core.hpp>
#include <boost/math/special_functions/fpclassify.hpp>
#include <cmath>
#include <valarray>
#ifdef _MSC_VER
#include <boost/math/special_functions/asinh.hpp>
using boost::math::asinh;
#endif
namespace stan {
namespace math {
namespace {
class asinh_vari : public op_v_vari {
public:
asinh_vari(double val, vari* avi) :
op_v_vari(val, avi) {
}
void chain() {
avi_->adj_ += adj_ / std::sqrt(avi_->val_ * avi_->val_ + 1.0);
}
};
}
inline var asinh(const var& a) {
if (boost::math::isinf(a.val()))
return var(new asinh_vari(a.val(), a.vi_));
return var(new asinh_vari(::asinh(a.val()), a.vi_));
}
}
}
#endif
core.hpp
stan::math::sqrt
fvar< T > sqrt(const fvar< T > &x)
Definition: sqrt.hpp:15
stan::math::var
Independent (input) and dependent (output) variables for gradients.
Definition: var.hpp:32
boost::math::isinf
bool isinf(const stan::math::var &v)
Checks if the given number is infinite.
Definition: boost_isinf.hpp:22
stan::math::asinh
fvar< T > asinh(const fvar< T > &x)
Definition: asinh.hpp:13
stan::math::var::vi_
vari * vi_
Pointer to the implementation of this variable.
Definition: var.hpp:44
stan::math::asinh
var asinh(const var &a)
The inverse hyperbolic sine function for variables (C99).
Definition: asinh.hpp:67
stan::math::var::val
double val() const
Return the value of this variable.
Definition: var.hpp:234

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