mlpack  master
ip_metric.hpp
Go to the documentation of this file.
1 
13 #ifndef MLPACK_METHODS_FASTMKS_IP_METRIC_HPP
14 #define MLPACK_METHODS_FASTMKS_IP_METRIC_HPP
15 
16 namespace mlpack {
17 namespace metric {
18 
31 template<typename KernelType>
32 class IPMetric
33 {
34  public:
36  IPMetric();
37 
39  IPMetric(KernelType& kernel);
40 
42  ~IPMetric();
43 
53  template<typename VecTypeA, typename VecTypeB>
54  typename VecTypeA::elem_type Evaluate(const VecTypeA& a, const VecTypeB& b);
55 
57  const KernelType& Kernel() const { return *kernel; }
59  KernelType& Kernel() { return *kernel; }
60 
62  template<typename Archive>
63  void Serialize(Archive& ar, const unsigned int version);
64 
65  private:
67  KernelType* kernel;
70 };
71 
72 } // namespace metric
73 } // namespace mlpack
74 
75 // Include implementation.
76 #include "ip_metric_impl.hpp"
77 
78 #endif
IPMetric()
Create the IPMetric without an instantiated kernel.
Linear algebra utility functions, generally performed on matrices or vectors.
Definition: binarize.hpp:18
const KernelType & Kernel() const
Get the kernel.
Definition: ip_metric.hpp:57
bool kernelOwner
If true, we are responsible for deleting the kernel.
Definition: ip_metric.hpp:69
KernelType * kernel
The kernel we are using.
Definition: ip_metric.hpp:67
The inner product metric, IPMetric, takes a given Mercer kernel (KernelType), and when Evaluate() is ...
Definition: ip_metric.hpp:32
~IPMetric()
Destroy the IPMetric object.
KernelType & Kernel()
Modify the kernel.
Definition: ip_metric.hpp:59
VecTypeA::elem_type Evaluate(const VecTypeA &a, const VecTypeB &b)
Evaluate the metric.
void Serialize(Archive &ar, const unsigned int version)
Serialize the metric.