Automatic Differentiation
 
Loading...
Searching...
No Matches

◆ gp_periodic_cov() [3/3]

template<typename T_x , typename T_sigma , require_st_arithmetic< T_x > * = nullptr, require_stan_scalar_t< T_sigma > * = nullptr>
Eigen::Matrix< var, Eigen::Dynamic, Eigen::Dynamic > stan::math::gp_periodic_cov ( const std::vector< T_x > &  x,
const T_sigma  sigma,
const var  l,
const var  p 
)
inline

Returns a periodic covariance matrix \( \mathbf{K} \) using the input \( \mathbf{X} \).

The elements of \( \mathbf{K} \) are defined as \( \mathbf{K}_{ij} = k(\mathbf{X}_i,\mathbf{X}_j), \) where \( \mathbf{X}_i \) is the \(i\)-th row of \( \mathbf{X} \) and
\( k(\mathbf{x},\mathbf{x}^\prime) = \sigma^2 \exp\left(-\frac{2\sin^2(\pi |\mathbf{x}-\mathbf{x}^\prime|/p)}{\ell^2}\right), \)
where \( \sigma^2 \), \( \ell \) and \( p \) are the signal variance, length-scale and period.

Template Parameters
T_xtype of elements in the std::vector
Parameters
xstd::vector of input elements. Assumes that all elements of x have the same size.
sigmastandard deviation of the signal
llength-scale
pperiod
Returns
periodic covariance matrix
Exceptions
std::domain_errorif sigma <= 0, l <= 0, p <= 0, or x is nan or infinite

Definition at line 42 of file gp_periodic_cov.hpp.