MLPACK
1.0.8
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
src
mlpack
core
kernels
laplacian_kernel.hpp
Go to the documentation of this file.
1
22
#ifndef __MLPACK_CORE_KERNELS_LAPLACIAN_KERNEL_HPP
23
#define __MLPACK_CORE_KERNELS_LAPLACIAN_KERNEL_HPP
24
25
#include <
mlpack/core.hpp
>
26
27
namespace
mlpack {
28
namespace
kernel {
29
40
class
LaplacianKernel
41
{
42
public
:
46
LaplacianKernel
() :
bandwidth
(1.0)
47
{ }
48
54
LaplacianKernel
(
double
bandwidth
) :
55
bandwidth(bandwidth)
56
{ }
57
69
template
<
typename
VecType>
70
double
Evaluate
(
const
VecType& a,
const
VecType& b)
const
71
{
72
// The precalculation of gamma saves us a little computation time.
73
return
exp(-
metric::EuclideanDistance::Evaluate
(a, b) /
bandwidth
);
74
}
75
84
double
Evaluate
(
const
double
t)
const
85
{
86
// The precalculation of gamma saves us a little computation time.
87
return
exp(-t /
bandwidth
);
88
}
89
91
double
Bandwidth
()
const
{
return
bandwidth
; }
93
double
&
Bandwidth
() {
return
bandwidth
; }
94
95
private
:
97
double
bandwidth
;
98
};
99
101
template
<>
102
class
KernelTraits
<
LaplacianKernel
>
103
{
104
public
:
106
static
const
bool
IsNormalized
=
true
;
107
};
108
109
};
// namespace kernel
110
};
// namespace mlpack
111
112
#endif
Generated by
1.8.3.1