123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- #ifndef GENERICMATRIXINCLUDE
- #define GENERICMATRIXINCLUDE
- #include "core/basics/triplet.h"
- #include "AlgebraTools.h"
- #include "core/vector/SparseVector.h"
-
- namespace OBJREC {
- class GenericMatrix
- {
- protected:
- public:
-
- virtual void multiply ( NICE::Vector & y, const NICE::Vector & x ) const = 0;
-
- virtual uint rows() const = 0;
-
- virtual uint cols() const = 0;
-
- virtual ~GenericMatrix() {};
-
- };
- class GMSlowICE : public GenericMatrix
- {
- protected:
- NICE::Matrix A;
- public:
- GMSlowICE ( const NICE::Matrix & _A ) : A(_A) {};
-
-
- uint rows() const { return A.rows(); };
-
- uint cols() const { return A.cols(); };
-
- void multiply ( NICE::Vector & y, const NICE::Vector & x ) const
- { y.multiply ( A, x ); };
- };
- class GMSparse : public GenericMatrix
- {
- protected:
- std::vector< NICE::triplet<int, int, double> > A;
- uint m_rows;
- uint m_cols;
- public:
- GMSparse ( uint _rows, uint _cols ) : m_rows(_rows), m_cols(_cols) {}
- GMSparse ( const NICE::Matrix & A, double epsilon = 1e-9 );
-
- uint rows() const { return m_rows; };
-
- uint cols() const { return m_cols; };
-
- void multiply ( NICE::Vector & y, const NICE::Vector & x ) const;
- };
- class GMCovariance : public GenericMatrix
- {
- protected:
- const NICE::Matrix *data;
- uint m_rows;
- uint m_cols;
- public:
- GMCovariance ( const NICE::Matrix *data );
-
- uint rows() const { return m_rows; };
-
- uint cols() const { return m_cols; };
-
- void multiply ( NICE::Vector & y, const NICE::Vector & x ) const;
- };
- }
- #endif
|