123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163 |
- namespace NICE
- {
- /** implementation of GenericMatrix using a sparse representation of a matrix as a collection of sparse vectors
- * @remark the functions in this class do not really exploit the sparseness of the involved vectors */
- class GMSparseVectorMatrix : public GenericMatrix
- {
- protected:
- //! the sparse matrix
- std::vector < NICE::SparseVector * >A;
-
- uint m_rows;
-
- uint m_cols;
-
- bool newvectors;
- public:
-
- GMSparseVectorMatrix ()
- {
- resize (0, 0);
- };
-
- GMSparseVectorMatrix (uint _rows, uint _cols);
-
- GMSparseVectorMatrix (const NICE::Matrix & iceA, double epsilon = 1e-9);
-
- ~GMSparseVectorMatrix ();
-
- void resize (int _rows, int _cols);
-
- void clear ();
-
- uint rows () const
- {
- return m_rows;
- };
-
- uint cols () const
- {
- return m_cols;
- };
-
- void multiply (NICE::Vector & y, const NICE::Vector & x) const;
-
- NICE::SparseVector & operator[] (int i) const;
-
- void restore (std::istream & is, int format = 0);
-
- void store (std::ostream & os, int format = 0) const;
-
- void setDel (bool del = true);
-
- void addRow (const NICE::Vector & x);
-
- void addRow (NICE::SparseVector * x);
-
- void mult (GMSparseVectorMatrix & y, GMSparseVectorMatrix & out, bool transpx =
- false, bool transpy = false);
-
- void mult (NICE::SparseVector & y, GMSparseVectorMatrix & out, bool transpx =
- false, bool transpy = false);
-
- void mult2 (GMSparseVectorMatrix & y, GMSparseVectorMatrix & out, bool transpx =
- false, bool transpy = false);
- };
- }
|