Automatic Differentiation
 
Loading...
Searching...
No Matches
finite_diff_stepsize.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_PRIM_FUN_FINITE_DIFF_STEPSIZE_HPP
2#define STAN_MATH_PRIM_FUN_FINITE_DIFF_STEPSIZE_HPP
3
6#include <cmath>
7
8namespace stan {
9namespace math {
10
21inline double finite_diff_stepsize(double u) {
22 using std::fabs;
23 static const double cbrt_epsilon = std::cbrt(EPSILON);
24 return cbrt_epsilon * std::fmax(1, fabs(u));
25}
26
27} // namespace math
28} // namespace stan
29#endif
static constexpr double EPSILON
Smallest positive value.
Definition constants.hpp:41
double finite_diff_stepsize(double u)
Return the stepsize for finite difference evaluations at the specified scalar.
fvar< T > fabs(const fvar< T > &x)
Definition fabs.hpp:15
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...
Definition fvar.hpp:9