Automatic Differentiation
 
Loading...
Searching...
No Matches
stan::math::internal::partials_propagator< ReturnType, require_arithmetic_t< ReturnType >, Ops... > Class Template Reference

Detailed Description

template<typename ReturnType, typename... Ops>
class stan::math::internal::partials_propagator< ReturnType, require_arithmetic_t< ReturnType >, Ops... >

This template builds partial derivatives with respect to a set of operands.

There are two reason for the generality of this class. The first is to handle vector and scalar arguments without needing to write additional code. The second is to use this class for writing probability distributions that handle primitives, reverse mode, and forward mode variables seamlessly.

Conceptually, this class is used when we want to manually calculate the derivative of a function and store this manual result on the autodiff stack in a sort of "compressed" form. Think of it like an easy-to-use interface to rev/core/precomputed_gradients.

This class supports nested container ("multivariate") use-cases as well by exposing a partials_vec_ member on edges of the appropriate type.

This base template is instantiated when all operands are primitives and we don't want to calculate derivatives at all. So all Op1 - Op5 must be arithmetic primitives like int or double. This is controlled with the T_return_type type parameter.

Template Parameters
Opstype of the operands
ReturnTypeThe type returned from calling the build() method.

Definition at line 51 of file partials_propagator.hpp.

#include <partials_propagator.hpp>

Public Member Functions

template<typename... Types>
 partials_propagator (Types &&...) noexcept
 

Static Public Member Functions

static double build (double value) noexcept
 Build the node to be stored on the autodiff graph.
 

Public Attributes

std::tuple< internal::ops_partials_edge< double, std::decay_t< Ops > >... > edges_
 

The documentation for this class was generated from the following file: