lucid  0.0.1
Lifting-based Uncertain Control Invariant Dynamics
Loading...
Searching...
No Matches
lucid::Kernel Class Referenceabstract

Represents a kernel function. More...

#include <Kernel.h>

Inheritance diagram for lucid::Kernel:
lucid::Parametrizable lucid::GaussianKernel lucid::ValleePoussinKernel

Public Member Functions

virtual bool is_stationary () const =0
 Check whether the kernel is is stationary.
 
template<class DerivedX, class DerivedY>
Matrix operator() (const MatrixBase< DerivedX > &x1, const MatrixBase< DerivedY > &x2) const
 Compute the kernel function on \( x_1 \) and \( x_2 \), both being matrices of row vectors in \( \texttip{\mathcal{X}}{Polish sample vector space} \subseteq \mathbb{R}^d \),.
 
template<class Derived>
Matrix operator() (const MatrixBase< Derived > &x) const
 Compute the kernel function on \( \texttip{x}{Element of the vector space} \), which is a matrix of row vectors in \( \texttip{\mathcal{X}}{Polish sample vector space} \subseteq \mathbb{R}^d \),.
 
template<class Derived>
Matrix operator() (const MatrixBase< Derived > &x, std::vector< Matrix > &gradient) const
 Compute the kernel function on \( \texttip{x}{Element of the vector space} \), which is a matrix of row vectors in \( \texttip{\mathcal{X}}{Polish sample vector space} \subseteq \mathbb{R}^d \),.
 
virtual std::unique_ptr< Kernelclone () const =0
 Clone the kernel.
 
virtual std::string to_string () const
 Get string representation of the kernel.
 
- Public Member Functions inherited from lucid::Parametrizable
template<IsAnyOf< int, double, const Vector & > T>
get (Parameter parameter) const
 Get the value of the specified parameter.
 
template<Parameter P>
internal::ParameterType< P >::ref_type get () const
 Get the value of the specified parameter.
 
std::variant< int, double, Vector > get (Parameter parameter) const
 Get the value of the specified parameter.
 
void set (Parameter parameter, const std::variant< int, double, Vector > &value)
 Set the parameter to the indicated value.
 
template<Parameter P>
void set (const std::variant< int, double, Vector > &value)
 Set the parameter to the indicated value.
 
void set (Parameter parameter, std::size_t idx, const std::variant< std::vector< int >, std::vector< double >, std::vector< Vector > > &values)
 Set the parameter to the index-th value among the indicated values.
 
template<Parameter P>
void set (std::size_t idx, const std::variant< std::vector< int >, std::vector< double >, std::vector< Vector > > &values)
 Set the parameter to the index-th value among the indicated values.
 
virtual void set (Parameter parameter, int value)
 Set the parameter to the indicated value.
 
virtual void set (Parameter parameter, double value)
 Set the parameter to the indicated value.
 
virtual void set (Parameter parameter, const Vector &value)
 Set the parameter to the indicated value.
 
template<Parameter P>
void set (typename internal::ParameterType< P >::ref_type value)
 Set the parameter to the indicated value.
 
bool has (const Parameter parameter) const
 Check whether the parameter is present in this object.
 
Parameters parameters () const
 Get read-only access to the parameters of the parametrizable object.
 
std::vector< Parameterparameters_list () const
 Get read-only access to the list of parameters of the parametrizable object.
 
Parametrizableload (const Parametrizable &o)
 Load parameters from another Parametrizable object.
 

Protected Member Functions

Matrix operator() (ConstMatrixRef x1, ConstMatrixRef x2, std::vector< Matrix > *gradient) const
 Compute the kernel function on \( x_1 \) and \( x_2 \), both being matrices of row vectors in \( \texttip{\mathcal{X}}{Polish sample vector space} \subseteq \mathbb{R}^d \),.
 
virtual Matrix apply_impl (ConstMatrixRef x1, ConstMatrixRef x2, std::vector< Matrix > *gradient) const =0
 Concrete implementation of operator()().
 
- Protected Member Functions inherited from lucid::Parametrizable
virtual int get_i (Parameter parameter) const
 Get the value of the specified parameter.
 
virtual double get_d (Parameter parameter) const
 Get the value of the specified parameter.
 
virtual const Vector & get_v (Parameter parameter) const
 Get the value of the specified parameter.
 

Additional Inherited Members

- Protected Attributes inherited from lucid::Parametrizable
Parameters parameters_
 Parameters supported by this object.
 

Detailed Description

Represents a kernel function.

Given a vector space \( \texttip{\mathcal{X}}{Polish sample vector space} \subseteq \mathbb{R}^d \), a kernel \( k : \mathcal{X} \times \mathcal{X} \to \mathbb{R} \) is a positive definite function that uniquely identifies a reproducing kernel Hilbert space (RKHS) \( \mathcal{H} \) that contains functions \( f : \mathcal{X} \to \mathbb{R} \). Moreover, we are guaranteed the property

\[f(x) = \langle f, k(x, \cdot) \rangle_\mathcal{H} \]

for all \( x \in \mathcal{X} \) and \( f \in \mathcal{H} \),

Member Function Documentation

◆ apply_impl()

virtual Matrix lucid::Kernel::apply_impl ( ConstMatrixRef x1,
ConstMatrixRef x2,
std::vector< Matrix > * gradient ) const
protectedpure virtual

Concrete implementation of operator()().

Parameters
x1\( \texttip{n_1}{Number of samples in the first matrix} \times \texttip{d}{Dimension of the vector space} \) first input matrix
x2\( \texttip{n_2}{Number of samples in the second matrix} \times \texttip{d}{Dimension of the vector space} \) second input matrix
[out]gradientpointer to store the gradient of the kernel function with respect to the kernel parameters
Returns
kernel value

Implemented in lucid::GaussianKernel, and lucid::ValleePoussinKernel.

◆ clone()

virtual std::unique_ptr< Kernel > lucid::Kernel::clone ( ) const
nodiscardpure virtual

Clone the kernel.

Create a new instance of the kernel with the same parameters.

Returns
new instance of the kernel

Implemented in lucid::GaussianKernel, and lucid::ValleePoussinKernel.

◆ is_stationary()

virtual bool lucid::Kernel::is_stationary ( ) const
nodiscardpure virtual

Check whether the kernel is is stationary.

Returns
true if the kernel is is stationary
false if the kernel is not is stationary

Implemented in lucid::GaussianKernel, and lucid::ValleePoussinKernel.

◆ operator()() [1/4]

template<class Derived>
Matrix lucid::Kernel::operator() ( const MatrixBase< Derived > & x) const
inline

Compute the kernel function on \( \texttip{x}{Element of the vector space} \), which is a matrix of row vectors in \( \texttip{\mathcal{X}}{Polish sample vector space} \subseteq \mathbb{R}^d \),.

\[k(x, x) . \]

Template Parameters
Derivedtype of the input matrix
Parameters
x\( \texttip{n}{Number of samples} \times \texttip{d}{Dimension of the vector space} \) input matrix
Returns
kernel value

◆ operator()() [2/4]

template<class Derived>
Matrix lucid::Kernel::operator() ( const MatrixBase< Derived > & x,
std::vector< Matrix > & gradient ) const
inline

Compute the kernel function on \( \texttip{x}{Element of the vector space} \), which is a matrix of row vectors in \( \texttip{\mathcal{X}}{Polish sample vector space} \subseteq \mathbb{R}^d \),.

\[k(x, x) . \]

Moreover, compute the gradient of the kernel function and store it in gradient.

Template Parameters
Derivedtype of the input matrix
Parameters
x\( \texttip{n}{Number of samples} \times \texttip{d}{Dimension of the vector space} \) input matrix
[out]gradientgradient of the kernel function with respect to the parameters dimensions
Returns
kernel value

◆ operator()() [3/4]

template<class DerivedX, class DerivedY>
Matrix lucid::Kernel::operator() ( const MatrixBase< DerivedX > & x1,
const MatrixBase< DerivedY > & x2 ) const
inline

Compute the kernel function on \( x_1 \) and \( x_2 \), both being matrices of row vectors in \( \texttip{\mathcal{X}}{Polish sample vector space} \subseteq \mathbb{R}^d \),.

\[k(x_1, x_2) . \]

Precondition
x1 and x2 must have the same number of columns.
Template Parameters
DerivedXtype of the first input matrix
DerivedYtype of the second input matrix
Parameters
x1\( \texttip{n_1}{Number of samples in the first matrix} \times \texttip{d}{Dimension of the vector space} \) first input row matrix
x2\( \texttip{n_2}{Number of samples in the second matrix} \times \texttip{d}{Dimension of the vector space} \) second input row matrix
Returns
kernel value

◆ operator()() [4/4]

Matrix lucid::Kernel::operator() ( ConstMatrixRef x1,
ConstMatrixRef x2,
std::vector< Matrix > * gradient ) const
protected

Compute the kernel function on \( x_1 \) and \( x_2 \), both being matrices of row vectors in \( \texttip{\mathcal{X}}{Polish sample vector space} \subseteq \mathbb{R}^d \),.

\[k(x_1, x_2) . \]

If gradient is not nullptr, the gradient of the kernel function with respect to the parameters is computed and stored in *gradient.

Precondition
x1 and x2 must have the same number of columns.
Parameters
x1\( \texttip{n_1}{Number of samples in the first matrix} \times \texttip{d}{Dimension of the vector space} \) first input matrix
x2\( \texttip{n_2}{Number of samples in the second matrix} \times \texttip{d}{Dimension of the vector space} \) second input matrix
[out]gradientpointer to store the gradient of the kernel function with respect to the kernel parameters
Returns
kernel value

◆ to_string()

std::string lucid::Kernel::to_string ( ) const
nodiscardvirtual

Get string representation of the kernel.

Returns
string representation Obtain the string representation of this object.
string representation of this object

Reimplemented in lucid::GaussianKernel, and lucid::ValleePoussinKernel.


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