% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/GEMSS.R
\name{compute_kernel}
\alias{compute_kernel}
\title{Compute the Correlation Matrix for Specified Kernels}
\usage{
compute_kernel(X1, X2 = NULL, theta, type)
}
\arguments{
\item{X1}{a matrix of input locations, where each row represents an observation.}

\item{X2}{a matrix of design locations. If \code{NULL}, the correlation
is calculated between \code{X1} and itself.}

\item{theta}{a \code{p x 1} numeric vector of lengthscale parameters
corresponding to each dimension.}

\item{type}{a character string specifying the kernel type. Must be one of
"\code{Gaussian}", "\code{Matern5_2}", or "\code{Matern3_2}".}
}
\value{
a numeric matrix of dimensions \code{nrow(X1) x nrow(X2)}.
}
\description{
Calculates the correlation matrix between two sets of locations using
stationary kernels. This function supports Gaussian, Matern 5/2, and
Matern 3/2 correlation structures in a multivariate product form.
}
\details{
For multivariate inputs, the correlation function is defined as the product
of univariate kernels across all \eqn{p} dimensions:
\deqn{C(\mathbf{x}, \mathbf{y}, \mathbf{\theta}) = \prod_{k=1}^{p} c_k(|x_k - y_k|, \theta_k)}

The available univariate correlation functions \eqn{c(d)} (where \eqn{d = |x - y|}) are:
\itemize{
\item "\code{Gaussian}": \deqn{c(d, \theta) = \exp\left(-\frac{d^2}{\theta}\right)}
\item "\code{Matern5_2}": \deqn{c(d, \theta) = \left(1 + \frac{\sqrt{5}d}{\theta} + \frac{5d^2}{3\theta^2}\right) \exp\left(-\frac{\sqrt{5}d}{\theta}\right)}
\item "\code{Matern3_2}": \deqn{c(d, \theta) = \left(1 + \frac{\sqrt{3}d}{\theta}\right) \exp\left(-\frac{\sqrt{3}d}{\theta}\right)}
}
}
