GMHIKernelRaw.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /**
  2. * @file GMHIKernelRaw.h
  3. * @author Erik Rodner, Alexander Freytag
  4. * @brief Fast multiplication with histogram intersection kernel matrices (Interface)
  5. */
  6. #ifndef _NICE_GMHIKERNELRAWINCLUDE
  7. #define _NICE_GMHIKERNELRAWINCLUDE
  8. #include <vector>
  9. #include <core/algebra/GenericMatrix.h>
  10. namespace NICE {
  11. /**
  12. * @class GMHIKernel
  13. * @brief Fast multiplication with histogram intersection kernel matrices
  14. * @author Erik Rodner, Alexander Freytag
  15. */
  16. class GMHIKernelRaw : public GenericMatrix
  17. {
  18. protected:
  19. typedef struct sparseVectorElement {
  20. uint example_index;
  21. double value;
  22. bool operator< (const sparseVectorElement & a) const
  23. {
  24. return value < a.value;
  25. }
  26. } sparseVectorElement;
  27. sparseVectorElement **examples_raw;
  28. uint *nnz_per_dimension;
  29. uint num_dimension;
  30. uint num_examples;
  31. void initData ( const std::vector< const NICE::SparseVector *> &_examples );
  32. public:
  33. /** simple constructor */
  34. GMHIKernelRaw( const std::vector< const NICE::SparseVector *> &_examples );
  35. /** multiply with a vector: A*x = y */
  36. virtual void multiply (NICE::Vector & y, const NICE::Vector & x) const;
  37. /** get the number of rows in A */
  38. virtual uint rows () const;
  39. /** get the number of columns in A */
  40. virtual uint cols () const;
  41. /** simple destructor */
  42. virtual ~GMHIKernelRaw();
  43. };
  44. }
  45. #endif