mlpack  2.0.1
ip_metric.hpp
Go to the documentation of this file.
1 
15 #ifndef __MLPACK_METHODS_FASTMKS_IP_METRIC_HPP
16 #define __MLPACK_METHODS_FASTMKS_IP_METRIC_HPP
17 
18 namespace mlpack {
19 namespace metric {
20 
33 template<typename KernelType>
34 class IPMetric
35 {
36  public:
38  IPMetric();
39 
41  IPMetric(KernelType& kernel);
42 
44  ~IPMetric();
45 
55  template<typename VecTypeA, typename VecTypeB>
56  double Evaluate(const VecTypeA& a, const VecTypeB& b);
57 
59  const KernelType& Kernel() const { return *kernel; }
61  KernelType& Kernel() { return *kernel; }
62 
64  template<typename Archive>
65  void Serialize(Archive& ar, const unsigned int version);
66 
67  private:
69  KernelType* kernel;
72 };
73 
74 } // namespace metric
75 } // namespace mlpack
76 
77 // Include implementation.
78 #include "ip_metric_impl.hpp"
79 
80 #endif
IPMetric()
Create the IPMetric without an instantiated kernel.
Linear algebra utility functions, generally performed on matrices or vectors.
const KernelType & Kernel() const
Get the kernel.
Definition: ip_metric.hpp:59
bool kernelOwner
If true, we are responsible for deleting the kernel.
Definition: ip_metric.hpp:71
KernelType * kernel
The kernel we are using.
Definition: ip_metric.hpp:69
The inner product metric, IPMetric, takes a given Mercer kernel (KernelType), and when Evaluate() is ...
Definition: ip_metric.hpp:34
double Evaluate(const VecTypeA &a, const VecTypeB &b)
Evaluate the metric.
~IPMetric()
Destroy the IPMetric object.
KernelType & Kernel()
Modify the kernel.
Definition: ip_metric.hpp:61
void Serialize(Archive &ar, const unsigned int version)
Serialize the metric.