mlpack  master
Public Member Functions | Private Attributes | List of all members
mlpack::kernel::SphericalKernel Class Reference

The spherical kernel, which is 1 when the distance between the two argument points is less than or equal to the bandwidth, or 0 otherwise. More...

Public Member Functions

 SphericalKernel (const double bandwidth=1.0)
 Construct the SphericalKernel with the given bandwidth. More...
 
template<typename VecTypeA , typename VecTypeB >
double ConvolutionIntegral (const VecTypeA &a, const VecTypeB &b) const
 Obtains the convolution integral [integral K(||x-a||)K(||b-x||)dx] for the two vectors. More...
 
template<typename VecTypeA , typename VecTypeB >
double Evaluate (const VecTypeA &a, const VecTypeB &b) const
 Evaluate the spherical kernel with the given two vectors. More...
 
double Evaluate (const double t) const
 Evaluate the kernel when only a distance is given, not two points. More...
 
double Gradient (double t)
 
double Normalizer (size_t dimension) const
 
template<typename Archive >
void Serialize (Archive &ar, const unsigned int)
 Serialize the object. More...
 

Private Attributes

double bandwidth
 
double bandwidthSquared
 

Detailed Description

The spherical kernel, which is 1 when the distance between the two argument points is less than or equal to the bandwidth, or 0 otherwise.

Definition at line 23 of file spherical_kernel.hpp.

Constructor & Destructor Documentation

mlpack::kernel::SphericalKernel::SphericalKernel ( const double  bandwidth = 1.0)
inline

Construct the SphericalKernel with the given bandwidth.

Definition at line 29 of file spherical_kernel.hpp.

Member Function Documentation

template<typename VecTypeA , typename VecTypeB >
double mlpack::kernel::SphericalKernel::ConvolutionIntegral ( const VecTypeA &  a,
const VecTypeB &  b 
) const
inline

Obtains the convolution integral [integral K(||x-a||)K(||b-x||)dx] for the two vectors.

Template Parameters
VecTypeAType of first vector (arma::vec, arma::sp_vec should be expected).
VecTypeBType of second vector.
Parameters
aFirst vector.
bSecond vector.
Returns
the convolution integral value.

Definition at line 62 of file spherical_kernel.hpp.

References bandwidth, mlpack::metric::LMetric< TPower, TTakeRoot >::Evaluate(), mlpack::Log::Fatal, and Normalizer().

template<typename VecTypeA , typename VecTypeB >
double mlpack::kernel::SphericalKernel::Evaluate ( const VecTypeA &  a,
const VecTypeB &  b 
) const
inline

Evaluate the spherical kernel with the given two vectors.

Template Parameters
VecTypeAType of first vector.
VecTypeBType of second vector.
Parameters
aFirst vector.
bSecond vector.
Returns
The kernel evaluation between the two vectors.

Definition at line 44 of file spherical_kernel.hpp.

References bandwidthSquared, and mlpack::metric::LMetric< TPower, TTakeRoot >::Evaluate().

double mlpack::kernel::SphericalKernel::Evaluate ( const double  t) const
inline

Evaluate the kernel when only a distance is given, not two points.

Parameters
tArgument to kernel.

Definition at line 99 of file spherical_kernel.hpp.

References bandwidth.

double mlpack::kernel::SphericalKernel::Gradient ( double  t)
inline

Definition at line 103 of file spherical_kernel.hpp.

References bandwidth.

double mlpack::kernel::SphericalKernel::Normalizer ( size_t  dimension) const
inline

Definition at line 88 of file spherical_kernel.hpp.

References bandwidth, and M_PI.

Referenced by ConvolutionIntegral().

template<typename Archive >
void mlpack::kernel::SphericalKernel::Serialize ( Archive &  ar,
const unsigned  int 
)
inline

Serialize the object.

Definition at line 109 of file spherical_kernel.hpp.

References bandwidth, bandwidthSquared, and mlpack::data::CreateNVP().

Member Data Documentation

double mlpack::kernel::SphericalKernel::bandwidth
private

Definition at line 116 of file spherical_kernel.hpp.

Referenced by ConvolutionIntegral(), Evaluate(), Gradient(), Normalizer(), and Serialize().

double mlpack::kernel::SphericalKernel::bandwidthSquared
private

Definition at line 117 of file spherical_kernel.hpp.

Referenced by Evaluate(), and Serialize().


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