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 #ifndef __GXX_EXPERIMENTAL_CXX0X__
00022 #define __GXX_EXPERIMENTAL_CXX0X__
00023 #endif
00024 #include <initializer_list>
00025 
00026 template <class T>
00027 class Matrix {
00028 public:
00029   Matrix();
00030   Matrix(unsigned int rows, unsigned int columns);
00031 //  Matrix(std::initializer_list<std::initializer_list<T>> init);
00032   Matrix(const Matrix<T> &other);
00033   Matrix<T> & operator= (const Matrix<T> &other);
00034   ~Matrix();
00035   // all operations modify the matrix in-place.
00036   void resize(unsigned int rows, unsigned int columns, T default_value = 0);
00037   void clear(void);
00038   T& operator () (unsigned int x, unsigned int y);
00039   const T& operator () (unsigned int x, unsigned int y) const;
00040   const T min() const;
00041   const T max() const;
00042   inline unsigned int minsize(void) {
00043     return ((m_rows < m_columns) ? m_rows : m_columns);
00044   }
00045   inline unsigned int columns(void) const {
00046     return m_columns;
00047   }
00048   inline unsigned int rows(void) const {
00049     return m_rows;
00050   }
00051 private:
00052   T **m_matrix;
00053   unsigned int m_rows;
00054   unsigned int m_columns;
00055 };
00056 
00057 #ifndef USE_EXPORT_KEYWORD
00058 #include "../src/src/matrix.cpp"
00059 //#define export /*export*/
00060 #endif
00061 
00062 #endif /* !defined(_MATRIX_H_) */
00063 


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