Generated on Mon Jun 23 16:24:56 2008 for BIU-1.7.0 by doxygen 1.5.1

src/biu/Matrix.hh

Go to the documentation of this file.
00001 #ifndef MATRIX_HH
00002 #define MATRIX_HH
00003 
00004 #include <iostream>
00005 #include <vector>
00006 #include <cassert>
00007 #include "biu/assertbiu.hh"
00008 
00009 
00010 namespace biu {
00011 
00012 
00015     template <class T> class Matrix {
00016     protected:
00018         size_t rows;
00020         size_t cols;
00022         T **v;
00023     public:
00024             
00026         Matrix();
00030         Matrix(const size_t r, const size_t c);
00035         Matrix(const size_t r, const size_t c, const T &val);
00042         Matrix(const size_t r, const size_t c, const T mat[]);
00045         Matrix(const Matrix<T> &mat);
00049         Matrix& operator = (const Matrix<T> &mat);
00053         Matrix& operator = (const T &val);
00058         Matrix<T> operator + (const Matrix<T> &mat);
00062         Matrix<T> operator + (const T &c);
00067         Matrix<T> operator - (const Matrix<T> &mat);
00071         Matrix<T> operator - (const T &c);
00076         Matrix<T> operator * (const Matrix<T> &mat) const;
00080         Matrix<T> operator * (const T &c) const;
00085         std::vector<T> operator * (const std::vector<T> &vec) const;
00090         Matrix<T>& operator *= (const Matrix<T> &mat);
00094         Matrix<T>& operator *= (const T& c);
00099         inline bool operator == (const Matrix<T> &mat) const;
00104         inline bool operator == (const T &val) const;
00109         inline bool operator != (const Matrix<T> &mat) const;
00114         inline bool operator != (const T &val) const;
00118         inline T* const operator[](const size_t row);
00122         inline const T* const operator[](const size_t row) const;
00127         inline T at(const size_t r, const size_t c);
00130         inline size_t numRows() const;
00133         inline size_t numColumns() const;
00137         std::vector<T> columnVec(const size_t col) const;
00142         void resize(const size_t row, const size_t col);
00148         void resize(const size_t row, const size_t col, const T& defVal);
00150         ~Matrix();
00151         
00152     };
00153 
00154 } // namespace biu
00155 
00161 template <class T> inline
00162 std::istream&
00163 operator>>(std::istream& in,  biu::Matrix<T>& m);
00164 
00169 template <class T> inline
00170 std::ostream&
00171 operator << (std::ostream& out, const biu::Matrix<T>& m);
00172 
00173 #include "biu/Matrix.icc"
00174     
00175 #endif // define MATRIX_HH