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

Last change on this file since 63 was 62, checked in by Marek Kurdej, 12 years ago

Update: license info.

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