MLPACK  1.0.4
laplacian_kernel.hpp
Go to the documentation of this file.
00001 
00022 #ifndef __MLPACK_CORE_KERNELS_LAPLACIAN_KERNEL_HPP
00023 #define __MLPACK_CORE_KERNELS_LAPLACIAN_KERNEL_HPP
00024 
00025 #include <mlpack/core.hpp>
00026 
00027 namespace mlpack {
00028 namespace kernel {
00029 
00040 class LaplacianKernel
00041 {
00042  public:
00046   LaplacianKernel() : bandwidth(1.0)
00047   { }
00048 
00054   LaplacianKernel(double bandwidth) :
00055       bandwidth(bandwidth)
00056   { }
00057 
00069   template<typename VecType>
00070   double Evaluate(const VecType& a, const VecType& b) const
00071   {
00072     // The precalculation of gamma saves us a little computation time.
00073     return exp(-metric::EuclideanDistance::Evaluate(a, b) / bandwidth);
00074   }
00075 
00083   double Evaluate(double t) const
00084   {
00085     // The precalculation of gamma saves us a little computation time.
00086     return exp(-t / bandwidth);
00087   }
00088 
00090   double Bandwidth() const { return bandwidth; }
00092   double& Bandwidth() { return bandwidth; }
00093 
00094  private:
00096   double bandwidth;
00097 };
00098 
00099 }; // namespace kernel
00100 }; // namespace mlpack
00101 
00102 #endif