Browse Source

first draft

Erik Rodner 9 years ago
parent
commit
737ab05388
2 changed files with 70 additions and 0 deletions
  1. 26 0
      GMHIKernelPartial.cpp
  2. 44 0
      GMHIKernelPartial.h

+ 26 - 0
GMHIKernelPartial.cpp

@@ -0,0 +1,26 @@
+/**
+* @file GMHIKernelPartial.cpp
+* @author Erik Rodner
+
+*/
+#include "GMHIKernelPartial.h"
+
+using namespace NICE;
+
+void GMHIKernelPartial::multiply (const PartialGenericMatrix::SetType & rowSet, const PartialGenericMatrix::SetType & columnSet, NICE::Vector & y, const NICE::Vector & x) const
+{
+  NICE::VVector A;
+  NICE::VVector B;
+  // prepare to calculate sum_i x_i K(x,x_i)
+  fmk->hik_prepare_alpha_multiplications(x, A, B);
+
+  fmk->hik_kernel_multiply(A, B, x, y);
+}
+
+double GMHIKernelPartial::getDiagonalElement( uint i ) const
+{
+    Vector diag;
+    this->getDiagonalElements(diag);
+    return diag[i];
+};
+

+ 44 - 0
GMHIKernelPartial.h

@@ -0,0 +1,44 @@
+/**
+* @file GMHIKernelPartial.h
+* @author Erik Rodner
+* @brief Fast multiplication with subset histogram intersection kernel matrices (Interface)
+* @date 15/09/2015
+
+*/
+#ifndef _NICE_GMHIKERNELPARTIALINCLUDE
+#define _NICE_GMHIKERNELPARTIALINCLUDE
+
+#include <vector>
+
+#include <core/algebra/PartialGenericMatrix.h>
+
+#include "GMHIKernel.h"
+
+namespace NICE {
+
+ /**
+ * @class GMHIKernelPartial
+ * @brief Fast multiplication with histogram intersection kernel sub-matrices
+ * @author Erik Rodner
+ */
+
+class GMHIKernelPartial : public GMHIKernel, PartialGenericMatrix
+{
+
+  protected:
+
+
+  public:
+
+    /** simple constructor */
+    GMHIKernelPartial( FastMinKernel *_fmk, ParameterizedFunction *_pf = NULL, const Quantization *_q = NULL )
+        : GMHIKernel ( _fmk, _pf, _q ) {};
+
+    /** multiply a submatrix with a vector: A*x = y */
+    virtual void multiply (const PartialGenericMatrix::SetType & rowSet, const PartialGenericMatrix::SetType & columnSet, NICE::Vector & y, const NICE::Vector & x) const;
+
+    virtual double getDiagonalElement( uint i ) const;
+};
+
+}
+#endif