OBOE 0.1
|
00001 // Copyright (c) 2004-2007 University of Geneva, HEC, Logilab 00002 // 00003 // OBOE is published under the Common Public License. 00004 // 00005 // Authors : 00006 // Nidhi Sawhney <nsawhney@yahoo.com> 00007 // The OBOE team 00008 // 00009 00010 #ifndef ACCPM_DYNMATRIX_H 00011 #define ACCPM_DYNMATRIX_H 00012 00013 #include "AccpmGenMatrix.h" 00014 00015 #ifdef SERIALIZATION 00016 #include <boost/archive/text_iarchive.hpp> 00017 #include <boost/archive/text_oarchive.hpp> 00018 #include <boost/serialization/base_object.hpp> 00019 #endif 00020 00026 namespace Accpm 00027 { 00028 00033 class AccpmDynMatrix { 00034 private: 00035 bool _preallocateRows; 00036 bool _preallocateCols; 00037 int _currentRow; 00038 int _currentCol; 00039 00040 AccpmGenMatrix _matrix; 00041 00044 AccpmDynMatrix& resize(int m, int n); 00045 #ifdef SERIALIZATION 00046 friend class boost::serialization::access; 00047 template<class Archive> 00048 void serialize(Archive &ar, const unsigned int file_version) 00049 { 00050 ar & _preallocateRows & _preallocateCols & _currentRow & _currentCol; 00051 ar & _matrix; 00052 } 00053 #endif 00054 public: 00055 // Operations of RealMatrix 00056 AccpmDynMatrix(bool preallocateRows = true, bool preallocateCols = true, int m = 0, int n = 0); 00057 AccpmDynMatrix(const AccpmGenMatrix &rhs, bool preallocateRows = true, bool preallocateCols = true); 00058 AccpmDynMatrix(const AccpmDynMatrix &); 00059 00060 AccpmDynMatrix& operator=(double s); 00061 AccpmDynMatrix& operator=(const AccpmDynMatrix &); 00062 00063 virtual ~AccpmDynMatrix(); 00064 00068 AccpmGenMatrix getM() const; 00069 00072 int addColumn(const AccpmVector &v); 00075 int addRow(const AccpmVector &v); 00076 int deleteColumn(int id); 00077 00078 int size(int n) const; 00079 std::ostream& Info(std::ostream& os) { _matrix.Info(os); return os; } 00080 friend std::ostream& operator<<(std::ostream& os, const AccpmDynMatrix &mat) { os << mat._matrix; return os; } 00081 }; 00082 } 00083 00084 #endif