matrix.h
Go to the documentation of this file.
00001 /*
00002  *   Copyright (c) 2007 John Weaver
00003  *
00004  *   This program is free software; you can redistribute it and/or modify
00005  *   it under the terms of the GNU General Public License as published by
00006  *   the Free Software Foundation; either version 2 of the License, or
00007  *   (at your option) any later version.
00008  *
00009  *   This program is distributed in the hope that it will be useful,
00010  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  *   GNU General Public License for more details.
00013  *
00014  *   You should have received a copy of the GNU General Public License
00015  *   along with this program; if not, write to the Free Software
00016  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00017  */
00018 
00019 #if !defined(_MATRIX_H_)
00020 #define _MATRIX_H_
00021 
00022 #include <initializer_list>
00023 
00024 template <class T>
00025 class Matrix {
00026 public:
00027   Matrix();
00028   Matrix(unsigned int rows, unsigned int columns);
00029 //  Matrix(std::initializer_list<std::initializer_list<T>> init);
00030   Matrix(const Matrix<T> &other);
00031   Matrix<T> & operator= (const Matrix<T> &other);
00032   ~Matrix();
00033   // all operations modify the matrix in-place.
00034   void resize(unsigned int rows, unsigned int columns, T default_value = 0);
00035   void clear(void);
00036   T& operator () (unsigned int x, unsigned int y);
00037   const T& operator () (unsigned int x, unsigned int y) const;
00038   const T min() const;
00039   const T max() const;
00040   inline unsigned int minsize(void) {
00041     return ((m_rows < m_columns) ? m_rows : m_columns);
00042   }
00043   inline unsigned int columns(void) const {
00044     return m_columns;
00045   }
00046   inline unsigned int rows(void) const {
00047     return m_rows;
00048   }
00049 private:
00050   T **m_matrix;
00051   unsigned int m_rows;
00052   unsigned int m_columns;
00053 };
00054 
00055 #ifndef USE_EXPORT_KEYWORD
00056 #include "matrix.cpp"
00057 //#define export /*export*/
00058 #endif
00059 
00060 #endif /* !defined(_MATRIX_H_) */
00061 


explorer
Author(s): Daniel Neuhold , Torsten Andre
autogenerated on Thu Jun 6 2019 20:59:53