source: pacpusframework/trunk/include/Pacpus/PacpusTools/matrice.h@ 66

Last change on this file since 66 was 66, checked in by Marek Kurdej, 11 years ago

Documentation: file info.

  • Property svn:keywords set to Id
File size: 2.4 KB
Line 
1// This file is part of the PACPUS framework distributed under the
2// CECILL-C License, Version 1.0.
3//
4/// @file
5/// @author Firstname Surname <firstname.surname@utc.fr>
6/// @date Month, Year
7/// @version $Id: matrice.h 66 2013-01-09 16:54:11Z kurdejma $
8/// @copyright Copyright (c) UTC/CNRS Heudiasyc 2006 - 2013. All rights reserved.
9/// @brief Matrix algebra functions.
10///
11/// Detailed description.
12
13#ifndef MATRIX_H
14#define MATRIX_H
15
16typedef enum
17{
18 ONES,
19 ZEROS,
20 IDENTITY
21} t_m;
22
23class matrice
24{
25 typedef double *ligne;
26 ligne *lignes;
27 unsigned short int n; // Nombre de lignes (1erparamètre).
28 unsigned short int m; // Nombre de colonnes (2èmeparamètre).
29
30public:
31 //constructeurs
32 matrice();
33 matrice(unsigned short int nl, unsigned short int nc);
34 matrice(unsigned short int nl, unsigned short int nc,t_m type);
35 matrice(const matrice &source); //constructeur par copie
36 //destructeur
37 virtual ~matrice(void);
38 void Alloue(unsigned short int nl, unsigned short int nc); //allocation de la matrice
39
40 // fonction pour le calcul de matrice
41 matrice &operator=(const matrice &m);//m=m1
42 matrice &operator=(double x); //m=x
43 operator double()const{return **lignes;}
44
45 matrice &operator+=(const matrice &m); //m+=m1
46 matrice &operator-=(const matrice &m); //m-=m1
47
48 matrice operator+(const matrice &m1) const; //m=m1+m2
49 matrice operator-(const matrice &m1) const; //m=m1-m2
50 matrice operator*(const matrice &m1) const; //m=m1*m2
51
52 matrice &operator+=(double x); //m+=x
53 matrice &operator-=(double x); //m-=x
54
55 matrice operator+(double x)const; //m+x
56 matrice operator-(double x)const; //m-x
57 matrice operator*(double x)const; //m*x
58 matrice operator/(double x)const; //m/x
59
60 friend matrice operator+(double x,matrice m1) {return m1+x ;} // x+m ;
61 friend matrice operator-(double x,matrice m1) {return m1-x ;} // x-m ;
62 friend matrice operator*(double x,matrice m1) {return m1*x ;} // x*m ;
63
64 matrice T(); //transposition
65 matrice I(); //inversion
66
67 double &operator()(unsigned short int i, unsigned short int j); // ecriture m(i,j)=x
68 double operator()(unsigned short int i, unsigned short int j) const; //lecture x=m(i,j)
69 double &operator()(unsigned short int i); // ecriture m(i)=x
70 double operator()(unsigned short int i) const; //lecture x=m(i)
71
72 void print(const char *nom);
73};
74
75#endif // MATRIX_H
Note: See TracBrowser for help on using the repository browser.