GMHIKernel.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /**
  2. * @file GMHIKernel.h
  3. * @author Erik Rodner, Alexander Freytag
  4. * @brief Fast multiplication with histogram intersection kernel matrices (Interface)
  5. * @date 01/02/2012
  6. */
  7. #ifndef _NICE_GMHIKERNELINCLUDE
  8. #define _NICE_GMHIKERNELINCLUDE
  9. #include <vector>
  10. #include <core/algebra/GenericMatrix.h>
  11. #include "ImplicitKernelMatrix.h"
  12. #include "FeatureMatrixT.h"
  13. #include "FastMinKernel.h"
  14. namespace NICE {
  15. /**
  16. * @class GMHIKernel
  17. * @brief Fast multiplication with histogram intersection kernel matrices
  18. * @author Erik Rodner, Alexander Freytag
  19. */
  20. class GMHIKernel : public ImplicitKernelMatrix
  21. {
  22. protected:
  23. FastMinKernel *fmk;
  24. const Quantization *q;
  25. ParameterizedFunction *pf;
  26. bool verbose;
  27. bool use_sparse_implementation;
  28. bool useOldPreparation;
  29. public:
  30. /** simple constructor */
  31. GMHIKernel( FastMinKernel *_fmk, ParameterizedFunction *_pf = NULL, const Quantization *_q = NULL );
  32. /** multiply with a vector: A*x = y */
  33. virtual void multiply (NICE::Vector & y, const NICE::Vector & x) const;
  34. /** get the number of rows in A */
  35. virtual uint rows () const;
  36. /** get the number of columns in A */
  37. virtual uint cols () const;
  38. /** simple destructor */
  39. virtual ~GMHIKernel();
  40. /** get the diagonal elements of the current matrix */
  41. virtual void getDiagonalElements ( Vector & diagonalElements ) const;
  42. virtual void getFirstDiagonalElement ( double & diagonalElement ) const;
  43. uint getNumParameters() const;
  44. void getParameters(Vector & parameters) const;
  45. void setParameters(const Vector & parameters);
  46. bool outOfBounds(const Vector & parameters) const;
  47. Vector getParameterLowerBounds() const;
  48. Vector getParameterUpperBounds() const;
  49. void setVerbose( const bool & _verbose);
  50. void setUseOldPreparation( const bool & _useOldPreparation);
  51. virtual double approxFrobNorm() const;
  52. virtual void setApproximationScheme(const int & _approxScheme);
  53. /** Persistent interface */
  54. virtual void restore ( std::istream & is, int format = 0 ) {};//fmk->restore( is, format );};
  55. virtual void store ( std::ostream & os, int format = 0 ) const {};//fmk->store( os, format );};
  56. virtual void clear () {};
  57. void setFastMinKernel(NICE::FastMinKernel * _fmk){fmk = _fmk;};
  58. };
  59. }
  60. #endif