-#ifndef STLPLUS_MATRIX\r
-#define STLPLUS_MATRIX\r
-////////////////////////////////////////////////////////////////////////////////\r
-\r
-// Author: Andy Rushton\r
-// Copyright: (c) Southampton University 1999-2004\r
-// (c) Andy Rushton 2004-2009\r
-// License: BSD License, see ../docs/license.html\r
-\r
-// General-purpose 2D matrix data structure \r
-\r
-////////////////////////////////////////////////////////////////////////////////\r
-#include "containers_fixes.hpp"\r
-#include <stdexcept>\r
-\r
-namespace stlplus\r
-{\r
-\r
- ////////////////////////////////////////////////////////////////////////////////\r
-\r
- template<typename T> class matrix\r
- {\r
- public:\r
- matrix(unsigned rows = 0, unsigned cols = 0, const T& fill = T()) throw();\r
- ~matrix(void) throw();\r
-\r
- matrix(const matrix&) throw();\r
- matrix& operator =(const matrix&) throw();\r
-\r
- void resize(unsigned rows, unsigned cols, const T& fill = T()) throw();\r
-\r
- unsigned rows(void) const throw();\r
- unsigned columns(void) const throw();\r
-\r
- void erase(const T& fill = T()) throw();\r
- void erase(unsigned row, unsigned col, const T& fill = T()) throw(std::out_of_range);\r
- void insert(unsigned row, unsigned col, const T&) throw(std::out_of_range);\r
- const T& item(unsigned row, unsigned col) const throw(std::out_of_range);\r
- T& item(unsigned row, unsigned col) throw(std::out_of_range);\r
- const T& operator()(unsigned row, unsigned col) const throw(std::out_of_range);\r
- T& operator()(unsigned row, unsigned col) throw(std::out_of_range);\r
-\r
- void fill(const T& item = T()) throw();\r
- void fill_column(unsigned col, const T& item = T()) throw(std::out_of_range);\r
- void fill_row(unsigned row, const T& item = T()) throw(std::out_of_range);\r
- void fill_leading_diagonal(const T& item = T()) throw();\r
- void fill_trailing_diagonal(const T& item = T()) throw();\r
- void make_identity(const T& one, const T& zero = T()) throw();\r
-\r
- void transpose(void) throw();\r
-\r
- private:\r
- unsigned m_rows;\r
- unsigned m_cols;\r
- T** m_data;\r
- };\r
-\r
- ////////////////////////////////////////////////////////////////////////////////\r
-\r
-} // end namespace stlplus\r
-\r
-#include "matrix.tpp"\r
-#endif\r
+#ifndef STLPLUS_MATRIX
+#define STLPLUS_MATRIX
+////////////////////////////////////////////////////////////////////////////////
+
+// Author: Andy Rushton
+// Copyright: (c) Southampton University 1999-2004
+// (c) Andy Rushton 2004-2009
+// License: BSD License, see ../docs/license.html
+
+// General-purpose 2D matrix data structure
+
+////////////////////////////////////////////////////////////////////////////////
+#include "containers_fixes.hpp"
+#include <stdexcept>
+
+namespace stlplus
+{
+
+ ////////////////////////////////////////////////////////////////////////////////
+
+ template<typename T> class matrix
+ {
+ public:
+ matrix(unsigned rows = 0, unsigned cols = 0, const T& fill = T()) throw();
+ ~matrix(void) throw();
+
+ matrix(const matrix&) throw();
+ matrix& operator =(const matrix&) throw();
+
+ void resize(unsigned rows, unsigned cols, const T& fill = T()) throw();
+
+ unsigned rows(void) const throw();
+ unsigned columns(void) const throw();
+
+ void erase(const T& fill = T()) throw();
+ void erase(unsigned row, unsigned col, const T& fill = T()) throw(std::out_of_range);
+ void insert(unsigned row, unsigned col, const T&) throw(std::out_of_range);
+ const T& item(unsigned row, unsigned col) const throw(std::out_of_range);
+ T& item(unsigned row, unsigned col) throw(std::out_of_range);
+ const T& operator()(unsigned row, unsigned col) const throw(std::out_of_range);
+ T& operator()(unsigned row, unsigned col) throw(std::out_of_range);
+
+ void fill(const T& item = T()) throw();
+ void fill_column(unsigned col, const T& item = T()) throw(std::out_of_range);
+ void fill_row(unsigned row, const T& item = T()) throw(std::out_of_range);
+ void fill_leading_diagonal(const T& item = T()) throw();
+ void fill_trailing_diagonal(const T& item = T()) throw();
+ void make_identity(const T& one, const T& zero = T()) throw();
+
+ void transpose(void) throw();
+
+ private:
+ unsigned m_rows;
+ unsigned m_cols;
+ T** m_data;
+ };
+
+ ////////////////////////////////////////////////////////////////////////////////
+
+} // end namespace stlplus
+
+#include "matrix.tpp"
+#endif