Automatic Differentiation
 
Loading...
Searching...
No Matches
stan::math::vari_value< T, require_eigen_sparse_base_t< T > > Class Template Reference

Detailed Description

template<typename T>
class stan::math::vari_value< T, require_eigen_sparse_base_t< T > >

The variable implementation for Eigen sparse matrix types.

This class is complete (not abstract) and may be used for constants.

A variable implementation is constructed with a constant value. It also stores the adjoint for storing the partial derivative with respect to the root of the derivative tree.

Definition at line 810 of file vari.hpp.

#include <vari.hpp>

+ Inheritance diagram for stan::math::vari_value< T, require_eigen_sparse_base_t< T > >:

Public Types

using PlainObject = plain_type_t< T >
 
using value_type = PlainObject
 
using InnerIterator = typename arena_matrix< PlainObject >::InnerIterator
 

Public Member Functions

template<typename S , require_convertible_t< S &, T > * = nullptr>
 vari_value (S &&x)
 Construct a variable implementation from a value.
 
 vari_value (const arena_matrix< PlainObject > &val, const arena_matrix< PlainObject > &adj)
 
template<typename S , require_convertible_t< S &, T > * = nullptr>
 vari_value (S &&x, bool stacked)
 Construct an sparse Eigen variable implementation from a value.
 
Eigen::Index rows () const
 Return the number of rows for this class's val_ member.
 
Eigen::Index cols () const
 Return the number of columns for this class's val_ member.
 
Eigen::Index size () const
 Return the size of this class's val_ member.
 
const auto & val () const
 Return a constant reference to the value of this vari.
 
auto & val_op ()
 
auto & adj ()
 Return a reference to the derivative of the root expression with respect to this expression.
 
auto & adj () const
 
auto & adj_op ()
 
void chain ()
 Apply the chain rule to this variable based on the variables on which it depends.
 
void init_dependent ()
 Initialize the adjoint for this (dependent) variable to 1.
 
void set_zero_adjoint () noexcept final
 Set the adjoint value of this variable to 0.
 

Static Public Member Functions

static void * operator new (size_t nbytes) noexcept
 Allocate memory from the underlying memory pool.
 
static void operator delete (void *) noexcept
 Delete a pointer from the underlying memory pool.
 

Public Attributes

arena_matrix< PlainObjectval_
 The value of this variable.
 
arena_matrix< PlainObjectadj_
 The adjoint of this variable, which is the partial derivative of this variable with respect to the root variable.
 

Static Public Attributes

static constexpr int RowsAtCompileTime = T::RowsAtCompileTime
 Rows at compile time.
 
static constexpr int ColsAtCompileTime = T::ColsAtCompileTime
 Columns at compile time.
 

Friends

template<typename , typename >
class var_value
 
std::ostream & operator<< (std::ostream &os, const vari_value< T > *v)
 Insertion operator for vari.
 

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