QMatrix.hh
Go to the documentation of this file.00001
00011 #ifndef __QMATRIX_HH_
00012 #define __QMATRIX_HH_
00013
00014
00015 #include <gsl/gsl_matrix.h>
00016 #include <map>
00017 #include <iostream>
00018 #include <QObject.hh>
00019
00020 Q_BEGIN_NAMESPACE
00021 class QVector;
00022
00023 class QMatrix : public QObject {
00024 public:
00028 QMatrix() ;
00034 QMatrix(int nrow, int ncol);
00039 QMatrix(const QVector& vec);
00044 QMatrix(const QMatrix& orig);
00048 virtual ~QMatrix();
00055 void Resize(int nrow, int ncol);
00060 inline int GetNRow()const {return m ? m->size1 : 0;}
00065 inline int GetNCol()const {return m ? m->size2: 0;}
00070 void Initialize(double val=0);
00074 void SetToIdentity();
00080 void SetCol(int ncol,const QVector& vec);
00086 void SetRow(int nrow,const QVector& vec);
00092 void Set(const std::map<int,int>& p);
00098 QVector GetCol(int ncol) const;
00104 QVector GetRow(int nrow) const;
00113 QVector GetRowByColumnIntValue(int col,int val) const;
00120 double& operator()(int i, int j);
00129 double operator() (int i,int j) const;
00135 const QMatrix& operator=(const QMatrix& orig);
00139 QMatrix operator-();
00145 const QMatrix & operator*=(double t);
00153 const QMatrix & operator*=(const QMatrix& other);
00159 const QMatrix & operator/=(double t);
00165 const QMatrix & operator+=(const QMatrix& mat);
00171 const QMatrix & operator-=(const QMatrix& mat);
00179 const QMatrix& Mult(const QMatrix&mat);
00187 const QMatrix& Div(const QMatrix& mat);
00193 QMatrix operator*(const QMatrix& mat);
00199 QMatrix operator*(double t);
00205 QMatrix operator/(double t);
00211 QMatrix operator+(const QMatrix& mat);
00217 QMatrix operator-(const QMatrix& mat);
00223 QVector operator*(const QVector& vec);
00228 QMatrix T() const;
00233 const QMatrix& Transpose();
00238 QMatrix Inv() const;
00243 const QMatrix& Invert();
00248 double Det() const;
00249
00250 protected:
00255 QMatrix (const gsl_matrix* mat);
00256 private:
00257 gsl_matrix* m;
00258 friend class QVector;
00259 };
00260
00261
00268 QMatrix operator*(double t, const QMatrix&mat);
00269
00270
00271 std::ostream& operator<<(std::ostream&s,const QMatrix& m);
00272
00273 Q_END_NAMESPACE
00274 #endif