template<typename T_x , typename T_sigma , typename T_l , typename T_p >
Eigen::Matrix< return_type_t< T_x, T_sigma, T_l, T_p >, Eigen::Dynamic, Eigen::Dynamic > stan::math::gp_periodic_cov |
( |
const std::vector< T_x > & |
x, |
|
|
const T_sigma & |
sigma, |
|
|
const T_l & |
l, |
|
|
const T_p & |
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_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 |
- Parameters
-
x | std::vector of input elements. This function assumes that all elements of x have the same size. |
sigma | standard deviation of the signal |
l | length-scale |
p | period |
- Returns
- periodic covariance matrix
- Exceptions
-
std::domain_error | if sigma <= 0, l <= 0, p <= 0 or x is nan or infinite |
Definition at line 47 of file gp_periodic_cov.hpp.