1 | // %pacpus:license{
|
---|
2 | // This file is part of the PACPUS framework distributed under the
|
---|
3 | // CECILL-C License, Version 1.0.
|
---|
4 | // %pacpus:license}
|
---|
5 | /// @file
|
---|
6 | /// @author Firstname Surname <firstname.surname@utc.fr>
|
---|
7 | /// @date Month, Year
|
---|
8 | /// @version $Id: matrice.h 76 2013-01-10 17:05:10Z kurdejma $
|
---|
9 | /// @copyright Copyright (c) UTC/CNRS Heudiasyc 2006 - 2013. All rights reserved.
|
---|
10 | /// @brief Matrix algebra functions.
|
---|
11 | ///
|
---|
12 | /// Detailed description.
|
---|
13 |
|
---|
14 | #ifndef MATRIX_H
|
---|
15 | #define MATRIX_H
|
---|
16 |
|
---|
17 | #include "PacpusToolsConfig.h"
|
---|
18 |
|
---|
19 | typedef enum
|
---|
20 | {
|
---|
21 | ONES,
|
---|
22 | ZEROS,
|
---|
23 | IDENTITY
|
---|
24 | } t_m;
|
---|
25 |
|
---|
26 | /// Simple matrix.
|
---|
27 | /// @todo Documentation
|
---|
28 | class PACPUS_TOOLS_API matrice
|
---|
29 | {
|
---|
30 | typedef double *ligne;
|
---|
31 | ligne *lignes;
|
---|
32 | unsigned short int n; // Nombre de lignes (1erparamètre).
|
---|
33 | unsigned short int m; // Nombre de colonnes (2èmeparamètre).
|
---|
34 |
|
---|
35 | public:
|
---|
36 | /// Ctor
|
---|
37 | matrice();
|
---|
38 | /// Ctor
|
---|
39 | matrice(unsigned short int nl, unsigned short int nc);
|
---|
40 | /// Ctor
|
---|
41 | matrice(unsigned short int nl, unsigned short int nc,t_m type);
|
---|
42 | /// Copy ctor
|
---|
43 | matrice(const matrice &source); //constructeur par copie
|
---|
44 | /// Dtor
|
---|
45 | virtual ~matrice(void);
|
---|
46 |
|
---|
47 | /// Allocates matrix data
|
---|
48 | /// @todo Rename
|
---|
49 | void Alloue(unsigned short int nl, unsigned short int nc);
|
---|
50 |
|
---|
51 | /// Assignment operator for matrix operand
|
---|
52 | matrice &operator=(const matrice &m);//m=m1
|
---|
53 | /// Assignment operator for scalar operand
|
---|
54 | matrice &operator=(double x); //m=x
|
---|
55 | /// Conversion operator to double
|
---|
56 | /// @todo FIXME
|
---|
57 | operator double() const
|
---|
58 | {
|
---|
59 | return **lignes;
|
---|
60 | }
|
---|
61 |
|
---|
62 | /// @todo Documentation
|
---|
63 | matrice &operator+=(const matrice &m); //m+=m1
|
---|
64 | /// @todo Documentation
|
---|
65 | matrice &operator-=(const matrice &m); //m-=m1
|
---|
66 |
|
---|
67 | /// @todo Documentation
|
---|
68 | matrice operator+(const matrice &m1) const; //m=m1+m2
|
---|
69 | /// @todo Documentation
|
---|
70 | matrice operator-(const matrice &m1) const; //m=m1-m2
|
---|
71 | /// @todo Documentation
|
---|
72 | matrice operator*(const matrice &m1) const; //m=m1*m2
|
---|
73 |
|
---|
74 | /// @todo Documentation
|
---|
75 | matrice &operator+=(double x); //m+=x
|
---|
76 | /// @todo Documentation
|
---|
77 | matrice &operator-=(double x); //m-=x
|
---|
78 |
|
---|
79 | /// @todo Documentation
|
---|
80 | matrice operator+(double x)const; //m+x
|
---|
81 | /// @todo Documentation
|
---|
82 | matrice operator-(double x)const; //m-x
|
---|
83 | /// @todo Documentation
|
---|
84 | matrice operator*(double x)const; //m*x
|
---|
85 | /// @todo Documentation
|
---|
86 | matrice operator/(double x)const; //m/x
|
---|
87 |
|
---|
88 | /// @todo Documentation
|
---|
89 | friend matrice operator+(double x,matrice m1) {return m1+x ;} // x+m ;
|
---|
90 | /// @todo Documentation
|
---|
91 | friend matrice operator-(double x,matrice m1) {return m1-x ;} // x-m ;
|
---|
92 | /// @todo Documentation
|
---|
93 | friend matrice operator*(double x,matrice m1) {return m1*x ;} // x*m ;
|
---|
94 |
|
---|
95 | /// Matrix transpose.
|
---|
96 | matrice T();
|
---|
97 | /// Matrix inverse.
|
---|
98 | matrice I();
|
---|
99 |
|
---|
100 | /// @todo Documentation
|
---|
101 | double &operator()(unsigned short int i, unsigned short int j); // ecriture m(i,j)=x
|
---|
102 | /// @todo Documentation
|
---|
103 | double operator()(unsigned short int i, unsigned short int j) const; //lecture x=m(i,j)
|
---|
104 | /// @todo Documentation
|
---|
105 | double &operator()(unsigned short int i); // ecriture m(i)=x
|
---|
106 | /// @todo Documentation
|
---|
107 | double operator()(unsigned short int i) const; //lecture x=m(i)
|
---|
108 |
|
---|
109 | /// @todo Documentation
|
---|
110 | void print(const char *nom);
|
---|
111 | };
|
---|
112 |
|
---|
113 | #endif // MATRIX_H
|
---|