123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121 |
- #ifndef GENERICMATRIXINCLUDE
- #define GENERICMATRIXINCLUDE
- #include "core/basics/triplet.h"
- #include "core/vector/SparseVectorT.h"
- namespace NICE
- {
- class GenericMatrix
- {
- 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 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;
- public:
- GMCovariance ( const NICE::Matrix * data );
-
- uint rows () const
- {
- return data->rows();
- };
-
- uint cols () const
- {
- return data->rows();
- };
-
- void multiply ( NICE::Vector & y, const NICE::Vector & x ) const;
- };
- }
- #endif
|