4 * Created on: 13 April. 2013
13 * Matrix class is defined by
21 #include "GenericMatrix.hxx"
25 class Matrix: public GenericMatrix
27 public: //----------------------------------------------------------------
34 * constructor with data
35 * @param dim : The number of rows and columns
40 * constructor with data
41 * @param numberOfRows : The number of rows
42 * @param numberOfColumns : The number of columns
44 Matrix ( int numberOfRows, int numberOfColumns ) ;
48 * @param matrix : The Matrix object to be copied
50 Matrix ( const Matrix& matrix ) ;
53 * deep copy of a matrix (values are copied)
54 * @param matrix : The Matrix object to be copied
56 Matrix deepCopy( ) const;
61 virtual ~Matrix ( void ) ;
63 const DoubleTab& getValues( void ) const ;
65 DoubleTab getValues( void ) ;
67 void setValues(const DoubleTab& values) ;
69 //returns the array of matrix coefficients
70 std::vector< double > getArray();
72 //returns the maximum coefficient
75 //returns the minimum coefficient
78 bool isSparseMatrix( void ) const ;
80 double& operator () ( int i, int j ) ;
82 double operator () ( int i, int j ) const ;
84 Matrix& operator+= (const Matrix& matrix) ;
86 Matrix& operator-= (const Matrix& matrix) ;
88 Matrix& operator*= (double value) ;
90 Matrix& operator*= (const Matrix& matrix) ;
92 Matrix& operator/= (double value) ;
94 Vector operator* (const Vector& vector) const ;
96 Matrix transpose() const ;
98 Matrix partMatrix(int row, int column) const ;
100 double determinant() const ;
102 const Matrix& operator= ( const Matrix& matrix ) ;
104 friend Matrix operator+ (const Matrix& matrix1, const Matrix& matrix2);
106 friend Matrix operator- (const Matrix& matrix1, const Matrix& matrix2);
108 friend Matrix operator* (double value , const Matrix& matrix ) ;
110 friend Matrix operator* (const Matrix& matrix, double value ) ;
112 friend Matrix operator/ (const Matrix& matrix, double value) ;
114 friend Matrix operator*(const Matrix& M, const Matrix& N) ;
116 friend std::ostream& operator<<(std::ostream& out, const Matrix& matrix ) ;
119 protected: //----------------------------------------------------------------
123 //This function is used in the computation of the determinant
124 int coefficient(int index) const ;
127 #endif /* MATRIX_HXX_ */