source: pacpusframework/branches/0.0.x/include/Pacpus/PacpusTools/matrice.h@ 328

Last change on this file since 328 was 91, checked in by DHERBOMEZ Gérald, 11 years ago

Improvement of the build system to avoid some workarounds

  • Property svn:keywords set to Id
File size: 3.2 KB
Line 
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 Jean Laneurit <firstname.surname@utc.fr>
7/// @date April, 2010
8/// @version $Id: matrice.h 91 2013-05-19 10:32:48Z gdherbom $
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
17typedef enum
18{
19 ONES,
20 ZEROS,
21 IDENTITY
22} t_m;
23
24/// Simple matrix.
25/// @todo Documentation
26class matrice
27{
28 typedef double *ligne;
29 ligne *lignes;
30 unsigned short int n; // Nombre de lignes (1erparamètre).
31 unsigned short int m; // Nombre de colonnes (2èmeparamètre).
32
33public:
34 /// Ctor
35 matrice();
36 /// Ctor
37 matrice(unsigned short int nl, unsigned short int nc);
38 /// Ctor
39 matrice(unsigned short int nl, unsigned short int nc,t_m type);
40 /// Copy ctor
41 matrice(const matrice &source); //constructeur par copie
42 /// Dtor
43 virtual ~matrice(void);
44
45 /// Allocates matrix data
46 /// @todo Rename
47 void Alloue(unsigned short int nl, unsigned short int nc);
48
49 /// Assignment operator for matrix operand
50 matrice &operator=(const matrice &m);//m=m1
51 /// Assignment operator for scalar operand
52 matrice &operator=(double x); //m=x
53 /// Conversion operator to double
54 /// @todo FIXME
55 operator double() const
56 {
57 return **lignes;
58 }
59
60 /// @todo Documentation
61 matrice &operator+=(const matrice &m); //m+=m1
62 /// @todo Documentation
63 matrice &operator-=(const matrice &m); //m-=m1
64
65 /// @todo Documentation
66 matrice operator+(const matrice &m1) const; //m=m1+m2
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
72 /// @todo Documentation
73 matrice &operator+=(double x); //m+=x
74 /// @todo Documentation
75 matrice &operator-=(double x); //m-=x
76
77 /// @todo Documentation
78 matrice operator+(double x)const; //m+x
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
86 /// @todo Documentation
87 friend matrice operator+(double x,matrice m1) {return m1+x ;} // x+m ;
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
93 /// Matrix transpose.
94 matrice T();
95 /// Matrix inverse.
96 matrice I();
97
98 /// @todo Documentation
99 double &operator()(unsigned short int i, unsigned short int j); // ecriture m(i,j)=x
100 /// @todo Documentation
101 double operator()(unsigned short int i, unsigned short int j) const; //lecture x=m(i,j)
102 /// @todo Documentation
103 double &operator()(unsigned short int i); // ecriture m(i)=x
104 /// @todo Documentation
105 double operator()(unsigned short int i) const; //lecture x=m(i)
106
107 /// @todo Documentation
108 void print(const char *nom);
109};
110
111#endif // MATRIX_H
Note: See TracBrowser for help on using the repository browser.