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

Detailed Description

template<typename T>
class stan::math::vari_value< T, require_all_t< is_plain_type< T >, is_eigen_dense_base< T > > >

The variable implementation for Eigen dense 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 645 of file vari.hpp.

#include <vari.hpp>

+ Inheritance diagram for stan::math::vari_value< T, require_all_t< is_plain_type< T >, is_eigen_dense_base< T > > >:

Public Types

using PlainObject = plain_type_t< T >
 PlainObject represents a user constructible type such as Matrix or Array
 
using value_type = PlainObject
 
using eigen_scalar = value_type_t< PlainObject >
 
using vari_type = vari_value< T >
 

Public Member Functions

template<typename S , require_assignable_t< T, S > * = nullptr>
 vari_value (const S &x)
 Construct a dense Eigen variable implementation from a value.
 
template<typename S , require_assignable_t< T, S > * = nullptr>
 vari_value (const S &x, bool stacked)
 Construct a dense Eigen variable implementation from a value.
 
const auto & val () const noexcept
 Return a constant reference to the value of this vari.
 
auto & val_op () noexcept
 
auto & adj () noexcept
 Return a reference to the derivative of the root expression with respect to this expression.
 
auto & adj () const noexcept
 
auto & adj_op () noexcept
 
virtual 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 () final
 Set the adjoint value of this variable to 0.
 
auto block (Eigen::Index start_row, Eigen::Index start_col, Eigen::Index num_rows, Eigen::Index num_cols) const
 A block view of the underlying Eigen matrices.
 
auto block (Eigen::Index start_row, Eigen::Index start_col, Eigen::Index num_rows, Eigen::Index num_cols)
 
auto head (Eigen::Index n) const
 View of the head of Eigen vector types.
 
auto head (Eigen::Index n)
 
auto tail (Eigen::Index n) const
 View of the tail of the Eigen vector types.
 
auto tail (Eigen::Index n)
 
auto segment (Eigen::Index i, Eigen::Index n) const
 View block of N elements starting at position i
 
auto segment (Eigen::Index i, Eigen::Index n)
 
auto transpose () const
 View transpose of eigen matrix.
 
auto transpose ()
 
auto row (Eigen::Index i) const
 View row of eigen matrices.
 
auto row (Eigen::Index i)
 
auto col (Eigen::Index i) const
 View column of eigen matrices.
 
auto col (Eigen::Index i)
 
auto diagonal () const
 View diagonal of eigen matrices.
 
auto diagonal ()
 
auto coeff (Eigen::Index i, Eigen::Index j) const
 Get coefficient of eigen matrices.
 
auto coeff (Eigen::Index i, Eigen::Index j)
 
auto coeff (Eigen::Index i) const
 Get coefficient of eigen matrices.
 
auto coeff (Eigen::Index i)
 
auto operator() (Eigen::Index i) const
 Get coefficient of eigen matrices.
 
auto operator() (Eigen::Index i)
 
auto operator() (Eigen::Index i, Eigen::Index j) const
 Get coefficient of eigen matrices.
 
auto operator() (Eigen::Index i, Eigen::Index j)
 
auto rowwise_reverse () const
 Return an expression that operates on the rows of the matrix vari
 
auto rowwise_reverse ()
 
auto colwise_reverse () const
 Return an expression that operates on the columns of the matrix vari
 
auto colwise_reverse ()
 
auto reverse () const
 Return an expression to reverse the order of the coefficients inside of a vari matrix.
 
auto reverse ()
 
auto topRows (Eigen::Index n) const
 Return a block consisting of the top rows.
 
auto topRows (Eigen::Index n)
 
auto bottomRows (Eigen::Index n) const
 Return a block consisting of the bottom rows.
 
auto bottomRows (Eigen::Index n)
 
auto middleRows (Eigen::Index start_row, Eigen::Index n) const
 Return a block consisting of rows in the middle.
 
auto middleRows (Eigen::Index start_row, Eigen::Index n)
 
auto leftCols (Eigen::Index n) const
 Return a block consisting of the left-most columns.
 
auto leftCols (Eigen::Index n)
 
auto rightCols (Eigen::Index n) const
 Return a block consisting of the right-most columns.
 
auto rightCols (Eigen::Index n)
 
auto middleCols (Eigen::Index start_col, Eigen::Index n) const
 Return a block consisting of columns in the middle.
 
auto middleCols (Eigen::Index start_col, Eigen::Index n)
 
auto array () const
 Return an Array expression.
 
auto array ()
 
auto matrix () const
 Return a Matrix expression.
 
auto matrix ()
 
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.
 

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 = PlainObject::RowsAtCompileTime
 Number of rows known at compile time.
 
static constexpr int ColsAtCompileTime = PlainObject::ColsAtCompileTime
 Number of columns known at compile time.
 

Protected Member Functions

template<typename S , require_not_same_t< T, S > * = nullptr>
 vari_value (const vari_value< S > *x)
 

Private Member Functions

vari_value< T, require_all_t< is_plain_type< T >, is_eigen_dense_base< T > > > & derived ()
 Helper function to return a reference to the derived type.
 
const vari_value< T, require_all_t< is_plain_type< T >, is_eigen_dense_base< T > > > & derived () const
 Helper function to return a constant reference to the derived type.
 

Private Attributes

friend Derived
 

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: