Stan Math Library: stan/math/mix/mat/functor/derivative.hpp Source File

| Stan Math Library 2.10.0 reverse mode automatic differentiation

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

derivative.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_MIX_MAT_FUNCTOR_DERIVATIVE_HPP
2 #define STAN_MATH_MIX_MAT_FUNCTOR_DERIVATIVE_HPP
3
4 #include <stan/math/fwd/core.hpp>
5 #include <stan/math/prim/mat/fun/Eigen.hpp>
6 #include <stan/math/rev/core.hpp>
7 #include <vector>
8
9 namespace stan {
10
11 namespace math {
12
24 template <typename T, typename F>
25 void
26 derivative(const F& f,
27 const T& x,
28 T& fx,
29 T& dfx_dx) {
30 fvar<T> x_fvar = fvar<T>(x, 1.0);
31 fvar<T> fx_fvar = f(x_fvar);
32 fx = fx_fvar.val_;
33 dfx_dx = fx_fvar.d_;
34 }
35
36 } // namespace math
37 } // namespace stan
38 #endif
core.hpp
core.hpp
stan::math::fvar::d_
T d_
Definition: fvar.hpp:15
stan
Definition: log_sum_exp.hpp:8
stan::math::fvar::val_
T val_
Definition: fvar.hpp:14
stan::math::derivative
void derivative(const F &f, const T &x, T &fx, T &dfx_dx)
Return the derivative of the specified univariate function at the specified argument.
Definition: derivative.hpp:26
Eigen.hpp
stan::math::fvar
Definition: fvar.hpp:13

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