GMStandard.h 930 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #ifndef GMSTANDARDINCLUDE
  2. #define GMSTANDARDINCLUDE
  3. #include "PartialGenericMatrix.h"
  4. namespace NICE
  5. {
  6. /** implementation of PartialGenericMatrix using simple direct multiplication */
  7. class GMStandard : public PartialGenericMatrix
  8. {
  9. protected:
  10. NICE::Matrix A;
  11. public:
  12. GMStandard (const NICE::Matrix & _A):A (_A)
  13. {
  14. };
  15. /** get the number of rows in A */
  16. uint rows () const
  17. {
  18. return A.rows ();
  19. };
  20. /** get the number of columns in A */
  21. uint cols () const
  22. {
  23. return A.cols ();
  24. };
  25. /** multiply with a vector: A*x = y */
  26. void multiply (NICE::Vector & y, const NICE::Vector & x) const
  27. {
  28. y.resize(rows());
  29. y.multiply (A, x);
  30. };
  31. virtual void multiply ( const PartialGenericMatrix::SetType & rowSet, const PartialGenericMatrix::SetType & columnSet, NICE::Vector & y, const NICE::Vector & x) const;
  32. virtual double getDiagonalElement ( uint i ) const;
  33. };
  34. }
  35. #endif