Stan Math Library  2.20.0
reverse mode automatic differentiation
operands_and_partials.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_PRIM_SCAL_META_OPERANDS_AND_PARTIALS_HPP
2 #define STAN_MATH_PRIM_SCAL_META_OPERANDS_AND_PARTIALS_HPP
3 
6 
7 namespace stan {
8 namespace math {
9 template <typename Op1 = double, typename Op2 = double, typename Op3 = double,
10  typename Op4 = double, typename Op5 = double,
11  typename T_return_type =
13 class operands_and_partials; // Forward declaration
14 
15 namespace internal {
35 template <typename ViewElt, typename Op>
37  public:
39 
41  explicit ops_partials_edge(const Op& /* op */) {}
42 
43  private:
44  template <typename, typename, typename, typename, typename, typename>
46 
47  void dump_partials(ViewElt* /* partials */) const {} // reverse mode
48  void dump_operands(void* /* operands */) const {} // reverse mode
49  ViewElt dx() const { return 0; } // used for fvars
50  int size() const { return 0; } // reverse mode
51 };
52 } // namespace internal
53 
88 template <typename Op1, typename Op2, typename Op3, typename Op4, typename Op5,
89  typename T_return_type>
91  public:
92  explicit operands_and_partials(const Op1& /* op1 */) {}
93  operands_and_partials(const Op1& /* op1 */, const Op2& /* op2 */) {}
94  operands_and_partials(const Op1& /* op1 */, const Op2& /* op2 */,
95  const Op3& /* op3 */) {}
96  operands_and_partials(const Op1& /* op1 */, const Op2& /* op2 */,
97  const Op3& /* op3 */, const Op4& /* op4 */) {}
98  operands_and_partials(const Op1& /* op1 */, const Op2& /* op2 */,
99  const Op3& /* op3 */, const Op4& /* op4 */,
100  const Op5& /* op5 */) {}
101 
115  T_return_type build(double value) { return value; }
116 
117  // These will always be 0 size base template instantiations (above).
123 };
124 } // namespace math
125 } // namespace stan
126 #endif
An edge holds both the operands and its associated partial derivatives.
internal::ops_partials_edge< double, Op5 > edge5_
internal::ops_partials_edge< double, Op4 > edge4_
This template builds partial derivatives with respect to a set of operands.
operands_and_partials(const Op1 &, const Op2 &, const Op3 &, const Op4 &)
operands_and_partials(const Op1 &, const Op2 &, const Op3 &, const Op4 &, const Op5 &)
boost::math::tools::promote_args< double, typename scalar_type< T >::type, typename return_type< Types_pack... >::type >::type type
Definition: return_type.hpp:36
operands_and_partials(const Op1 &, const Op2 &, const Op3 &)
empty_broadcast_array< ViewElt, Op > partials_
T_return_type build(double value)
Build the node to be stored on the autodiff graph.
internal::ops_partials_edge< double, Op2 > edge2_
int size(const std::vector< T > &x)
Return the size of the specified standard vector.
Definition: size.hpp:17
operands_and_partials(const Op1 &, const Op2 &)
internal::ops_partials_edge< double, Op3 > edge3_
internal::ops_partials_edge< double, Op1 > edge1_

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