Salome HOME
initial project version
[tools/solverlab.git] / CDMATH / base / inc / Matrix.hxx
1 /*
2  * Matrix.hxx
3  *
4  *  Created on: 13 April. 2013
5  *      Authors: CDMAT
6  */
7
8 #ifndef MATRIX_HXX_
9 #define MATRIX_HXX_
10
11
12 /**
13  * Matrix class is defined by
14  * - number of rows
15  * - number of columns
16  * - values array
17  */
18
19 #include <iostream>
20
21 #include "GenericMatrix.hxx"
22
23 class Vector ;
24
25 class Matrix: public GenericMatrix
26 {
27     public: //----------------------------------------------------------------
28     /**
29      * default constructor
30      */
31     Matrix ( void ) ;
32
33     /**
34      * constructor with data
35      * @param dim : The number of rows and columns
36      */
37     Matrix ( int dim ) ;
38
39     /**
40      * constructor with data
41      * @param numberOfRows : The number of rows
42      * @param numberOfColumns : The number of columns
43      */
44     Matrix ( int numberOfRows, int numberOfColumns ) ;
45
46     /**
47      * constructor by copy
48      * @param matrix : The Matrix object to be copied
49      */
50     Matrix ( const Matrix& matrix ) ;
51
52     /**
53      * deep copy of a matrix (values are copied)
54      * @param matrix : The Matrix object to be copied
55      */
56     Matrix deepCopy(  ) const;
57
58     /**
59      * destructor
60      */
61     virtual ~Matrix ( void ) ;
62
63     bool isSparseMatrix( void ) const ;
64
65     double& operator () ( int i, int j ) ;
66
67     double operator () ( int i, int j ) const ;
68
69     Matrix& operator+= (const Matrix& matrix) ;
70
71     Matrix& operator-= (const Matrix& matrix) ;
72
73     Matrix& operator*= (double value) ;
74
75     Matrix& operator*= (const Matrix& matrix) ;
76
77     Matrix& operator/= (double value) ;
78
79     Vector operator* (const Vector& vector) const ;
80
81     Matrix transpose() const ;
82
83     Matrix partMatrix(int row, int column) const ;
84
85     double determinant() const ;
86
87     const Matrix& operator= ( const Matrix& matrix ) ;
88
89     friend Matrix operator+ (const Matrix& matrix1, const Matrix& matrix2);
90
91     friend Matrix operator- (const Matrix& matrix1, const Matrix& matrix2);
92
93     friend Matrix operator* (double value , const Matrix& matrix ) ;
94
95     friend Matrix operator* (const Matrix& matrix, double value ) ;
96
97     friend Matrix operator/ (const Matrix& matrix, double value) ;
98
99     friend Matrix operator*(const Matrix& M, const Matrix& N) ;
100
101     friend std::ostream& operator<<(std::ostream& out, const Matrix& matrix ) ;
102
103 };
104
105 #endif /* MATRIX_HXX_ */