Loading...
Searching...
No Matches
gpr::Kronecker Class Reference

#include <gpr/covariance_functions/KernelOperator.h>

Public Member Functions

 Kronecker (Eigen::MatrixXd gram)
const Eigen::MatrixXd & gram () const noexcept
Eigen::MatrixXd apply (const Eigen::MatrixXd &scalar_kernel) const

Static Public Member Functions

static Kronecker identity (Eigen::Index dimension)

Detailed Description

Kronecker: \( K = k \otimes M \) for a fixed Gram \( M \).

\(M\) may be any finite square Gram, including the chart projector \(N N^T\). The identity Gram \(M = I\) yields \(K = k \otimes I\).

Definition at line 361 of file KernelOperator.h.

Constructor & Destructor Documentation

◆ Kronecker()

gpr::Kronecker::Kronecker ( Eigen::MatrixXd gram)
explicit

Definition at line 1168 of file KernelOperator.cpp.

1168 : gram_(std::move(gram))
1169{
1170 requireFiniteSquare(gram_, "kronecker gram");
1171}
const Eigen::MatrixXd & gram() const noexcept

Member Function Documentation

◆ apply()

Eigen::MatrixXd gpr::Kronecker::apply ( const Eigen::MatrixXd & scalar_kernel) const
nodiscard

\(K = k \otimes M\), where \(k\) is an \(n \times n\) scalar kernel.

Definition at line 1182 of file KernelOperator.cpp.

1183{
1184 requireFiniteSquare(scalar_kernel, "kronecker scalar kernel");
1185 const Eigen::Index n = scalar_kernel.rows();
1186 const Eigen::Index m = gram_.rows();
1187 Eigen::MatrixXd result(n * m, n * m);
1188 for (Eigen::Index i = 0; i < n; ++i) {
1189 for (Eigen::Index j = 0; j < n; ++j) {
1190 result.block(i * m, j * m, m, m) = scalar_kernel(i, j) * gram_;
1191 }
1192 }
1193 return result;
1194}

◆ gram()

const Eigen::MatrixXd & gpr::Kronecker::gram ( ) const
inlinenodiscardnoexcept

Definition at line 365 of file KernelOperator.h.

366 {
367 return gram_;
368 }

◆ identity()

Kronecker gpr::Kronecker::identity ( Eigen::Index dimension)
staticnodiscard

Definition at line 1173 of file KernelOperator.cpp.

1174{
1175 if (dimension <= 0) {
1176 throw std::invalid_argument(
1177 "kronecker identity requires a positive dimension");
1178 }
1179 return Kronecker(Eigen::MatrixXd::Identity(dimension, dimension));
1180}
Kronecker(Eigen::MatrixXd gram)

The documentation for this class was generated from the following files: