mlpack
Public Member Functions | Static Public Member Functions | List of all members
mlpack::kernel::LinearKernel Class Reference

The simple linear kernel (dot product). More...

#include <linear_kernel.hpp>

Public Member Functions

 LinearKernel ()
 This constructor does nothing; the linear kernel has no parameters to store.
 
template<typename Archive >
void serialize (Archive &, const uint32_t)
 Serialize the kernel (it has no members... do nothing).
 

Static Public Member Functions

template<typename VecTypeA , typename VecTypeB >
static double Evaluate (const VecTypeA &a, const VecTypeB &b)
 Simple evaluation of the dot product. More...
 

Detailed Description

The simple linear kernel (dot product).

For any two vectors \( x \) and \( y \),

\[ K(x, y) = x^T y \]

This kernel has no parameters and therefore the evaluation can be static.

Member Function Documentation

◆ Evaluate()

template<typename VecTypeA , typename VecTypeB >
static double mlpack::kernel::LinearKernel::Evaluate ( const VecTypeA &  a,
const VecTypeB &  b 
)
inlinestatic

Simple evaluation of the dot product.

This evaluation uses Armadillo's dot() function.

Template Parameters
VecTypeAType of first vector (should be arma::vec or arma::sp_vec).
VecTypeBType of second vector (arma::vec / arma::sp_vec).
Parameters
aFirst vector.
bSecond vector.
Returns
K(a, b).

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