00001 /* Saturation_Matrix class declaration. 00002 Copyright (C) 2001-2006 Roberto Bagnara <bagnara@cs.unipr.it> 00003 00004 This file is part of the Parma Polyhedra Library (PPL). 00005 00006 The PPL is free software; you can redistribute it and/or modify it 00007 under the terms of the GNU General Public License as published by the 00008 Free Software Foundation; either version 2 of the License, or (at your 00009 option) any later version. 00010 00011 The PPL is distributed in the hope that it will be useful, but WITHOUT 00012 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00013 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 00014 for more details. 00015 00016 You should have received a copy of the GNU General Public License 00017 along with this program; if not, write to the Free Software Foundation, 00018 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1307, USA. 00019 00020 For the most up-to-date information see the Parma Polyhedra Library 00021 site: http://www.cs.unipr.it/ppl/ . */ 00022 00023 #ifndef PPL_Saturation_Matrix_defs_hh 00024 #define PPL_Saturation_Matrix_defs_hh 1 00025 00026 #include "Saturation_Matrix.types.hh" 00027 #include "Linear_System.defs.hh" 00028 #include "Saturation_Row.defs.hh" 00029 #include <vector> 00030 #include <iosfwd> 00031 00032 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS 00034 00045 #endif // PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS 00046 00047 class Parma_Polyhedra_Library::Saturation_Matrix { 00048 public: 00050 Saturation_Matrix(); 00051 00056 Saturation_Matrix(dimension_type n_rows, dimension_type n_columns); 00057 00059 Saturation_Matrix(const Saturation_Matrix& y); 00060 00062 ~Saturation_Matrix(); 00063 00065 Saturation_Matrix& operator=(const Saturation_Matrix& y); 00066 00068 void swap(Saturation_Matrix& y); 00069 00071 Saturation_Row& operator[](dimension_type k); 00072 00074 const Saturation_Row& operator[](dimension_type k) const; 00075 00077 void clear(); 00078 00080 void transpose(); 00081 00083 void transpose_assign(const Saturation_Matrix& y); 00084 00086 static dimension_type max_num_rows(); 00087 00089 dimension_type num_columns() const; 00090 00092 dimension_type num_rows() const; 00093 00095 void sort_rows(); 00096 00098 00108 bool sorted_contains(const Saturation_Row& row) const; 00109 00111 void add_row(const Saturation_Row& row); 00112 00114 void rows_erase_to_end(dimension_type first_to_erase); 00115 00117 void columns_erase_to_end(dimension_type first_to_erase); 00118 00120 void resize(dimension_type new_n_rows, dimension_type new_n_columns); 00121 00123 bool OK() const; 00124 00125 PPL_OUTPUT_DECLARATIONS; 00126 00132 bool ascii_load(std::istream& s); 00133 00135 memory_size_type total_memory_in_bytes() const; 00136 00138 memory_size_type external_memory_in_bytes() const; 00139 00140 #ifndef NDEBUG 00142 bool check_sorted() const; 00143 #endif 00144 00145 private: 00147 std::vector<Saturation_Row> rows; 00148 00150 dimension_type row_size; 00151 00153 00154 struct Saturation_Row_Less_Than { 00155 bool operator()(const Saturation_Row& x, const Saturation_Row& y) const; 00156 }; 00157 00158 friend 00159 void Parma_Polyhedra_Library:: 00160 Linear_System::sort_and_remove_with_sat(Saturation_Matrix& sat); 00161 00162 }; 00163 00164 namespace std { 00165 00166 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS 00168 00169 #endif // PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS 00170 void swap(Parma_Polyhedra_Library::Saturation_Matrix& x, 00171 Parma_Polyhedra_Library::Saturation_Matrix& y); 00172 00173 } // namespace std 00174 00175 #include "Saturation_Matrix.inlines.hh" 00176 00177 #endif // !defined(PPL_Saturation_Matrix_defs_hh)