Skip to content

Constant Diagonal

gpjax.kernels.computations.constant_diagonal

Kernel = tp.TypeVar('Kernel', bound='gpjax.kernels.base.AbstractKernel') module-attribute
ConstantDiagonalKernelComputation dataclass

Bases: AbstractKernelComputation

__init__() -> None
gram(kernel: Kernel, x: Float[Array, 'N D']) -> LinearOperator

Compute the Gram matrix.

Compute Gram covariance operator of the kernel function.

Parameters:

Name Type Description Default
kernel Kernel

the kernel function.

required
x Float[Array, 'N D']

The inputs to the kernel function.

required
Returns
LinearOperator: Gram covariance operator of the kernel function.
diagonal(kernel: Kernel, inputs: Float[Array, 'N D']) -> Diagonal

Compute the diagonal Gram matrix's entries.

For a given kernel, compute the elementwise diagonal of the NxN gram matrix on an input matrix of shape NΓ—DN\times D.

Parameters:

Name Type Description Default
kernel Kernel

the kernel function.

required
inputs Float[Array, 'N D']

The input matrix.

required
Returns
Diagonal: The computed diagonal variance entries.
cross_covariance(kernel: Kernel, x: Float[Array, 'N D'], y: Float[Array, 'M D']) -> Float[Array, 'N M']

Compute the cross-covariance matrix.

For a given kernel, compute the NxM covariance matrix on a pair of input matrices of shape NxD and MxD.

Parameters:

Name Type Description Default
kernel Kernel

the kernel function.

required
x Float[Array, 'N D']

The input matrix.

required
y Float[Array, 'M D']

The input matrix.

required
Returns
Float[Array, "N M"]: The computed square Gram matrix.