All Classes Namespaces Files Functions Variables Typedefs Enumerator Friends Macros Groups
grad.hpp
Go to the documentation of this file.
#ifndef STAN_MATH_REV_MAT_FUN_GRAD_HPP
#define STAN_MATH_REV_MAT_FUN_GRAD_HPP
#include <stan/math/prim/mat/fun/Eigen.hpp>
#include <stan/math/rev/mat/fun/Eigen_NumTraits.hpp>
#include <stan/math/rev/core.hpp>
namespace stan {
namespace math {
void grad(var& v,
Eigen::Matrix<var, Eigen::Dynamic, 1>& x,
Eigen::VectorXd& g) {
stan::math::grad(v.vi_);
g.resize(x.size());
for (int i = 0; i < x.size(); ++i)
g(i) = x(i).vi_->adj_;
}
}
}
#endif
core.hpp
Eigen_NumTraits.hpp
stan::math::grad
static void grad(chainable *vi)
Compute the gradient for all variables starting from the specified root variable implementation.
Definition: grad.hpp:30
stan::math::var
Independent (input) and dependent (output) variables for gradients.
Definition: var.hpp:32
stan::math::var::vi_
vari * vi_
Pointer to the implementation of this variable.
Definition: var.hpp:44
Eigen.hpp

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