HyperspaceExplorer 0.7.1
Matrix.h
00001 /*
00002     Hyperspace Explorer - vizualizing higher-dimensional geometry
00003     Copyright (C) 2010  Lene Preuss <lene.preuss@gmail.com>
00004 
00005     This program is free software; you can redistribute it and/or modify
00006     it under the terms of the GNU General Public License as published by
00007     the Free Software Foundation; either version 2 of the License, or
00008     (at your option) any later version.
00009 
00010     This program is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013     GNU General Public License for more details.
00014 
00015     You should have received a copy of the GNU General Public License along
00016     with this program; if not, write to the Free Software Foundation, Inc.,
00017     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
00018 
00019 */
00020 
00021 #if !defined(MATRIX_H)
00022 #define MATRIX_H
00023 
00024 #include <string>
00025 
00026 namespace VecMath {
00027 
00028   template <unsigned D, typename N> class Vector;
00029   
00031 
00036   template <unsigned D, typename N = double> class Matrix {
00037     
00038     public:
00039     
00041       Matrix<D, N> ();
00043       Matrix<D, N> (unsigned ii, unsigned jj, N theta);
00044 
00046       N &operator () (unsigned i, unsigned j);
00048       const N &operator () (unsigned i, unsigned j) const;
00049 
00051       Matrix<D, N> operator *=(const Matrix<D, N> &);
00052 
00054       Matrix<D, N> operator - ();
00055 
00057       void scale(const Vector<D, N> &);
00058 
00060       std::string toString() const;
00062       operator std::string() const;
00063 
00064     private:
00065       
00067       N _M[D][D];
00068 
00069   };
00070 
00072   template <unsigned D, typename N>
00073   Matrix<D, N> operator *(const Matrix<D, N> &A, const Matrix<D, N> &B);
00074 
00076   template <unsigned D, typename N>
00077   Vector<D, N> operator *(const Matrix<D, N> &M, const Vector<D, N> &V);
00078   
00080   template <unsigned D, typename N>
00081   std::ostream &operator << (std::ostream &, const Matrix<D, N> &);
00082 
00083 }       // namespace VecMath
00084 
00085 #endif  // !defined(MATRIX_H)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends

Generated on Mon Apr 9 2012 20:25:16 for HyperspaceExplorer 0.7.1 by doxygen 1.7.4  -  Hosted bySourceForge.net Logo