Diagonal
DiagonalKernelComputation
Bases: AbstractKernelComputation
Diagonal kernel computation class. Operations with the kernel assume a diagonal Gram matrix.
cross_covariance
For a given kernel, compute the cross-covariance matrix on an a pair
of input matrices with shape (N, D)
and (M, D)
.
Parameters:
-
kernel
(K
) βthe kernel function.
-
x
(Num[Array, 'N D']
) βthe first input matrix of shape
(N, D)
. -
y
(Num[Array, 'M D']
) βthe second input matrix of shape
(M, D)
.
Returns:
-
Float[Array, 'N M']
βThe computed cross-covariance of shape
(N, M)
.
diagonal
For a given kernel, compute the elementwise diagonal of the
NxN gram matrix on an input matrix of shape (N, D)
.
Parameters:
-
kernel
(K
) βthe kernel function.
-
inputs
(Num[Array, 'N D']
) βthe input matrix of shape
(N, D)
.
Returns:
-
Diagonal
βThe computed diagonal variance as a
Diagonal
linear operator.