![]() |
Stan Math Library
2.20.0
reverse mode automatic differentiation
|
This is a subclass of the vari class for precomputed gradients of gp_periodic_cov. More...
#include <gp_periodic_cov.hpp>
Public Member Functions | |
gp_periodic_cov_vari (const std::vector< T_x > &x, const T_sigma &sigma, const T_l &l, const T_p &p) | |
Constructor for gp_periodic_cov. More... | |
virtual void | chain () |
Apply the chain rule to this variable based on the variables on which it depends. More... | |
![]() | |
vari (double x) | |
Construct a variable implementation from a value. More... | |
vari (double x, bool stacked) | |
virtual | ~vari () |
Throw an illegal argument exception. More... | |
void | init_dependent () |
Initialize the adjoint for this (dependent) variable to 1. More... | |
void | set_zero_adjoint () |
Set the adjoint value of this variable to 0. More... | |
Public Attributes | |
const size_t | size_ |
const size_t | size_ltri_ |
const double | l_d_ |
const double | sigma_d_ |
const double | p_d_ |
const double | sigma_sq_d_ |
double * | dist_ |
double * | sin_2_dist_ |
double * | sin_dist_sq_ |
vari * | l_vari_ |
vari * | sigma_vari_ |
vari * | p_vari_ |
vari ** | cov_lower_ |
vari ** | cov_diag_ |
![]() | |
const double | val_ |
The value of this variable. More... | |
double | adj_ |
The adjoint of this variable, which is the partial derivative of this variable with respect to the root variable. More... | |
Additional Inherited Members | |
![]() | |
static void * | operator new (size_t nbytes) |
Allocate memory from the underlying memory pool. More... | |
static void | operator delete (void *) |
Delete a pointer from the underlying memory pool. More... | |
This is a subclass of the vari class for precomputed gradients of gp_periodic_cov.
The class stores the double values for the distance matrix, sine, cosine and sine squared of the latter, pointers to the varis for the covariance matrix, along with a pointer to the vari for sigma, the vari for l and the vari for p.
The elements of periodic covariance matrix using the input
are defined as
where
is the
-th row of
and
where ,
and
are the signal variance, length-scale and period.
The partial derivatives w.r.t. the parameters are the following:
T_x | type of std::vector elements of x. T_x can be a scalar, an Eigen::Vector, or an Eigen::RowVector. |
T_sigma | type of sigma |
T_l | type of length-scale |
T_p | type of period |
Definition at line 55 of file gp_periodic_cov.hpp.
|
inline |
Constructor for gp_periodic_cov.
All memory allocated in ChainableStack's stack_alloc arena.
It is critical for the efficiency of this object that the constructor create new varis that aren't popped onto the var_stack_, but rather are popped onto the var_nochain_stack_. This is controlled by the second argument to vari's constructor.
x | std::vector of input elements. Assumes that all elements of x have the same size. |
sigma | standard deviation of the signal |
l | length-scale |
p | period |
Definition at line 91 of file gp_periodic_cov.hpp.
|
inlinevirtual |
Apply the chain rule to this variable based on the variables on which it depends.
The base implementation in this class is a no-op.
Reimplemented from stan::math::vari.
Definition at line 133 of file gp_periodic_cov.hpp.
vari** stan::math::gp_periodic_cov_vari< T_x, T_sigma, T_l, T_p >::cov_diag_ |
Definition at line 70 of file gp_periodic_cov.hpp.
vari** stan::math::gp_periodic_cov_vari< T_x, T_sigma, T_l, T_p >::cov_lower_ |
Definition at line 69 of file gp_periodic_cov.hpp.
double* stan::math::gp_periodic_cov_vari< T_x, T_sigma, T_l, T_p >::dist_ |
Definition at line 63 of file gp_periodic_cov.hpp.
const double stan::math::gp_periodic_cov_vari< T_x, T_sigma, T_l, T_p >::l_d_ |
Definition at line 59 of file gp_periodic_cov.hpp.
vari* stan::math::gp_periodic_cov_vari< T_x, T_sigma, T_l, T_p >::l_vari_ |
Definition at line 66 of file gp_periodic_cov.hpp.
const double stan::math::gp_periodic_cov_vari< T_x, T_sigma, T_l, T_p >::p_d_ |
Definition at line 61 of file gp_periodic_cov.hpp.
vari* stan::math::gp_periodic_cov_vari< T_x, T_sigma, T_l, T_p >::p_vari_ |
Definition at line 68 of file gp_periodic_cov.hpp.
const double stan::math::gp_periodic_cov_vari< T_x, T_sigma, T_l, T_p >::sigma_d_ |
Definition at line 60 of file gp_periodic_cov.hpp.
const double stan::math::gp_periodic_cov_vari< T_x, T_sigma, T_l, T_p >::sigma_sq_d_ |
Definition at line 62 of file gp_periodic_cov.hpp.
vari* stan::math::gp_periodic_cov_vari< T_x, T_sigma, T_l, T_p >::sigma_vari_ |
Definition at line 67 of file gp_periodic_cov.hpp.
double* stan::math::gp_periodic_cov_vari< T_x, T_sigma, T_l, T_p >::sin_2_dist_ |
Definition at line 64 of file gp_periodic_cov.hpp.
double* stan::math::gp_periodic_cov_vari< T_x, T_sigma, T_l, T_p >::sin_dist_sq_ |
Definition at line 65 of file gp_periodic_cov.hpp.
const size_t stan::math::gp_periodic_cov_vari< T_x, T_sigma, T_l, T_p >::size_ |
Definition at line 57 of file gp_periodic_cov.hpp.
const size_t stan::math::gp_periodic_cov_vari< T_x, T_sigma, T_l, T_p >::size_ltri_ |
Definition at line 58 of file gp_periodic_cov.hpp.