Automatic Differentiation
 
Loading...
Searching...
No Matches
stan::math::precomputed_gradients_vari_template< ContainerOperands, ContainerGradients > Class Template Reference

Detailed Description

template<typename ContainerOperands = std::tuple<>, typename ContainerGradients = std::tuple<>>
class stan::math::precomputed_gradients_vari_template< ContainerOperands, ContainerGradients >

A variable implementation taking a sequence of operands and partial derivatives with respect to the operands.

Stan users should use function precomputed_gradients() directly.

Template Parameters
ContainerOperandstuple of any container operands ((optionally std vector of) var_value containing Eigen types)
ContainerGradientstuple of any container gradients (Eigen types)

Definition at line 29 of file precomputed_gradients.hpp.

#include <precomputed_gradients.hpp>

+ Inheritance diagram for stan::math::precomputed_gradients_vari_template< ContainerOperands, ContainerGradients >:

Public Member Functions

template<typename... ContainerOps, typename... ContainerGrads>
 precomputed_gradients_vari_template (double val, size_t size, vari **varis, double *gradients, const std::tuple< ContainerOps... > &container_operands=std::tuple<>(), const std::tuple< ContainerGrads... > &container_gradients=std::tuple<>())
 Construct a precomputed vari with the specified value, operands, gradients and optionally container operands and containers of gradients.
 
template<typename Arith , typename VecVar , typename VecArith , typename... ContainerOps, typename... ContainerGrads, require_all_vector_t< VecVar, VecArith > * = nullptr>
 precomputed_gradients_vari_template (Arith val, const VecVar &vars, const VecArith &gradients, const std::tuple< ContainerOps... > &container_operands=std::tuple<>(), const std::tuple< ContainerGrads... > &container_gradients=std::tuple<>())
 Construct a precomputed vari with the specified value, operands, gradients and optionally container operands and containers of gradients.
 
void chain ()
 Implements the chain rule for this variable, using the prestored operands and gradient.
 

Protected Member Functions

template<size_t... Is>
void check_sizes (std::index_sequence< Is... >)
 Checks that sizes of containers in container operands and container_gradients match.
 

Protected Attributes

const size_t size_
 
vari ** varis_
 
double * gradients_
 
ContainerOperands container_operands_
 
ContainerGradients container_gradients_
 

Static Protected Attributes

static constexpr size_t N_containers = std::tuple_size<ContainerOperands>::value
 

Private Member Functions

template<typename Op , typename Grad , require_all_not_std_vector_t< Op, Grad > * = nullptr>
void chain_one (Op &op, const Grad &grad)
 Implements the chain rule for one non-std::vector operand.
 
template<typename Op , typename OpAlloc , typename Grad , typename GradAlloc >
void chain_one (const std::vector< Op, OpAlloc > &op, const std::vector< Grad, GradAlloc > &grad)
 Implements the chain rule for one std::vector operand.
 

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