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

◆ gp_periodic_cov() [2/3]

template<typename T_x1 , typename T_x2 , typename T_sigma , typename T_l , typename T_p >
Eigen::Matrix< return_type_t< T_x1, T_x2, T_sigma, T_l, T_p >, Eigen::Dynamic, Eigen::Dynamic > stan::math::gp_periodic_cov ( const std::vector< T_x1 > &  x1,
const std::vector< T_x2 > &  x2,
const T_sigma &  sigma,
const T_l &  l,
const T_p &  p 
)
inline

Returns a periodic covariance matrix \( \mathbf{K} \) using inputs \( \mathbf{X}_1 \) and \( \mathbf{X}_2 \).

The elements of \( \mathbf{K} \) are defined as \( \mathbf{K}_{ij} = k(\mathbf{X}_{1_i},\mathbf{X}_{2_j}), \) where \( \mathbf{X}_{1_i} \) and \( \mathbf{X}_{2_j} \) are the \(i\)-th and \(j\)-th rows of \( \mathbf{X}_1 \) and \( \mathbf{X}_2 \) 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_x1type of std::vector elements of x1 T_x1 can be a scalar, an Eigen::Vector, or an Eigen::RowVector.
T_x2type of std::vector elements of x2 T_x2 can be a scalar, an Eigen::Vector, or an Eigen::RowVector.
T_sigmatype of sigma
T_ltype of length-scale
T_ptype of period
Parameters
x1std::vector of first input elements
x2std::vector of second input elements. This function assumes that all the elements of x1 and x2 have the same sizes.
sigmastandard deviation of the signal
llength-scale
pperiod
Returns
periodic covariance matrix
Exceptions
std::domain_errorif sigma <= 0, l <= 0, p <= 0 , x1 or x2 is nan or infinite

Definition at line 127 of file gp_periodic_cov.hpp.