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 
45  IPMetric(const IPMetric& other);
46 
48  IPMetric& operator=(const IPMetric& other);
49 
59  template<typename VecTypeA, typename VecTypeB>
60  typename VecTypeA::elem_type Evaluate(const VecTypeA& a, const VecTypeB& b);
61 
63  const KernelType& Kernel() const { return *kernel; }
65  KernelType& Kernel() { return *kernel; }
66 
68  template<typename Archive>
69  void serialize(Archive& ar, const uint32_t version);
70 
71  private:
73  KernelType* kernel;
75  bool kernelOwner;
76 };
77 
78 } // namespace metric
79 } // namespace mlpack
80 
81 // Include implementation.
82 #include "ip_metric_impl.hpp"
83 
84 #endif
void serialize(Archive &ar, const uint32_t version)
Serialize the metric.
IPMetric & operator=(const IPMetric &other)
Assign this metric to be a copy of the given metric.
VecTypeA::elem_type Evaluate(const VecTypeA &a, const VecTypeB &b)
Evaluate the metric.
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:63
The inner product metric, IPMetric, takes a given Mercer kernel (KernelType), and when Evaluate() is ...
Definition: ip_metric.hpp:32
KernelType & Kernel()
Modify the kernel.
Definition: ip_metric.hpp:65
~IPMetric()
Destroy the IPMetric object.