IKMLinearCombination.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /**
  2. * @file IKMLinearCombination.h
  3. * @brief Combination of several (implicit) kernel matrices, such as noise matrix and gp-hik kernel matrix (Interface)
  4. * @author Erik Rodner, Alexander Freytag
  5. * @date 02/14/2012
  6. */
  7. #ifndef _NICE_IKMLINEARCOMBINATIONINCLUDE
  8. #define _NICE_IKMLINEARCOMBINATIONINCLUDE
  9. #include <vector>
  10. #include "ImplicitKernelMatrix.h"
  11. namespace NICE {
  12. /**
  13. * @class IKMLinearCombination
  14. * @brief Combination of several (implicit) kernel matrices, such as noise matrix and gp-hik kernel matrix
  15. * @author Erik Rodner, Alexander Freytag
  16. */
  17. class IKMLinearCombination : public ImplicitKernelMatrix
  18. {
  19. protected:
  20. std::vector< ImplicitKernelMatrix * > matrices;
  21. std::vector<int> parameterRanges;
  22. bool verbose;
  23. void updateParameterRanges();
  24. public:
  25. /** simple constructor */
  26. IKMLinearCombination();
  27. /** simple destructor */
  28. virtual ~IKMLinearCombination();
  29. virtual void getDiagonalElements ( Vector & diagonalElements ) const;
  30. virtual void getFirstDiagonalElement ( double & diagonalElement ) const;
  31. virtual uint getNumParameters() const;
  32. virtual void getParameters(Vector & parameters) const;
  33. virtual void setParameters(const Vector & parameters);
  34. virtual bool outOfBounds(const Vector & parameters) const;
  35. void setVerbose(const bool & _verbose);
  36. virtual Vector getParameterLowerBounds() const;
  37. virtual Vector getParameterUpperBounds() const;
  38. void addModel ( ImplicitKernelMatrix *ikm );
  39. /** multiply with a vector: A*x = y */
  40. virtual void multiply (NICE::Vector & y, const NICE::Vector & x) const;
  41. /** get the number of rows in A */
  42. virtual uint rows () const;
  43. /** get the number of columns in A */
  44. virtual uint cols () const;
  45. virtual double approxFrobNorm() const;
  46. virtual void setApproximationScheme(const int & _approxScheme);
  47. ImplicitKernelMatrix * getModel(const uint & idx) const;
  48. inline int getNumberOfModels(){return matrices.size();};
  49. /** Persistent interface */
  50. virtual void restore ( std::istream & is, int format = 0 ) {};
  51. virtual void store ( std::ostream & os, int format = 0 ) const {};
  52. virtual void clear () {};
  53. };
  54. }
  55. #endif