X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fyoink;a=blobdiff_plain;f=src%2Fstlplus%2Fcontainers%2Fmatrix.hpp;fp=src%2Fstlplus%2Fcontainers%2Fmatrix.hpp;h=ab6cce1ba6e85b1f37efcb927d393b92d0a9d50d;hp=9a0fa69c46fe7c36cbb1a753c5fbbf82314777e8;hb=4f6e4488a55f7e3ba3f7485d78177f793c0eab9a;hpb=574af38ed616d1adfa5e6ce35f67cda1f707f89d diff --git a/src/stlplus/containers/matrix.hpp b/src/stlplus/containers/matrix.hpp index 9a0fa69..ab6cce1 100644 --- a/src/stlplus/containers/matrix.hpp +++ b/src/stlplus/containers/matrix.hpp @@ -1,63 +1,63 @@ -#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 - -namespace stlplus -{ - - //////////////////////////////////////////////////////////////////////////////// - - template 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 +#ifndef STLPLUS_MATRIX +#define STLPLUS_MATRIX +//////////////////////////////////////////////////////////////////////////////// + +// Author: Andy Rushton +// Copyright: (c) Southampton University 1999-2004 +// (c) Andy Rushton 2004 onwards +// License: BSD License, see ../docs/license.html + +// General-purpose 2D matrix data structure + +//////////////////////////////////////////////////////////////////////////////// +#include "containers_fixes.hpp" +#include + +namespace stlplus +{ + + //////////////////////////////////////////////////////////////////////////////// + + template 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