]> Dogcows Code - chaz/yoink/blob - src/stlplus/containers/matrix.hpp
testing new non-autotools build system
[chaz/yoink] / src / stlplus / containers / matrix.hpp
1 #ifndef STLPLUS_MATRIX
2 #define STLPLUS_MATRIX
3 ////////////////////////////////////////////////////////////////////////////////
4
5 // Author: Andy Rushton
6 // Copyright: (c) Southampton University 1999-2004
7 // (c) Andy Rushton 2004-2009
8 // License: BSD License, see ../docs/license.html
9
10 // General-purpose 2D matrix data structure
11
12 ////////////////////////////////////////////////////////////////////////////////
13 #include "containers_fixes.hpp"
14 #include <stdexcept>
15
16 namespace stlplus
17 {
18
19 ////////////////////////////////////////////////////////////////////////////////
20
21 template<typename T> class matrix
22 {
23 public:
24 matrix(unsigned rows = 0, unsigned cols = 0, const T& fill = T()) throw();
25 ~matrix(void) throw();
26
27 matrix(const matrix&) throw();
28 matrix& operator =(const matrix&) throw();
29
30 void resize(unsigned rows, unsigned cols, const T& fill = T()) throw();
31
32 unsigned rows(void) const throw();
33 unsigned columns(void) const throw();
34
35 void erase(const T& fill = T()) throw();
36 void erase(unsigned row, unsigned col, const T& fill = T()) throw(std::out_of_range);
37 void insert(unsigned row, unsigned col, const T&) throw(std::out_of_range);
38 const T& item(unsigned row, unsigned col) const throw(std::out_of_range);
39 T& item(unsigned row, unsigned col) throw(std::out_of_range);
40 const T& operator()(unsigned row, unsigned col) const throw(std::out_of_range);
41 T& operator()(unsigned row, unsigned col) throw(std::out_of_range);
42
43 void fill(const T& item = T()) throw();
44 void fill_column(unsigned col, const T& item = T()) throw(std::out_of_range);
45 void fill_row(unsigned row, const T& item = T()) throw(std::out_of_range);
46 void fill_leading_diagonal(const T& item = T()) throw();
47 void fill_trailing_diagonal(const T& item = T()) throw();
48 void make_identity(const T& one, const T& zero = T()) throw();
49
50 void transpose(void) throw();
51
52 private:
53 unsigned m_rows;
54 unsigned m_cols;
55 T** m_data;
56 };
57
58 ////////////////////////////////////////////////////////////////////////////////
59
60 } // end namespace stlplus
61
62 #include "matrix.tpp"
63 #endif
This page took 0.03431 seconds and 4 git commands to generate.