| 1 |
souaissa |
108 |
//---------------------------------------------------------------------------
|
| 2 |
|
|
|
| 3 |
|
|
#ifndef sl_vecteurH
|
| 4 |
|
|
#define sl_vecteurH
|
| 5 |
|
|
//---------------------------------------------------------------------------
|
| 6 |
|
|
|
| 7 |
|
|
#include <iostream>
|
| 8 |
|
|
#include "matpleine.h"
|
| 9 |
|
|
#include "matcreuse.h"
|
| 10 |
|
|
|
| 11 |
|
|
#ifdef WINDOWS_VERSION
|
| 12 |
|
|
#ifdef BUILT_DLL_SOLVEUR
|
| 13 |
|
|
#define DLLPORTSOLVEUR __declspec(dllexport)
|
| 14 |
|
|
#else
|
| 15 |
|
|
#define DLLPORTSOLVEUR __declspec(dllimport)
|
| 16 |
|
|
#endif
|
| 17 |
|
|
#else
|
| 18 |
|
|
#define DLLPORTSOLVEUR
|
| 19 |
|
|
#endif
|
| 20 |
|
|
|
| 21 |
|
|
using namespace std;
|
| 22 |
|
|
|
| 23 |
|
|
class DLLPORTSOLVEUR Vecteur
|
| 24 |
|
|
{
|
| 25 |
|
|
private:
|
| 26 |
|
|
double* Data;
|
| 27 |
|
|
int NbRows;
|
| 28 |
|
|
void alloc(int rows);
|
| 29 |
|
|
void free();
|
| 30 |
|
|
void copy(const Vecteur& x);
|
| 31 |
|
|
void fill(const double& a);
|
| 32 |
|
|
public:
|
| 33 |
|
|
friend class Matrix;
|
| 34 |
|
|
friend class MatrixCr;
|
| 35 |
|
|
Vecteur();
|
| 36 |
|
|
Vecteur(int rows);
|
| 37 |
|
|
Vecteur(const double& val,int rows);
|
| 38 |
|
|
Vecteur(const Vecteur& x);
|
| 39 |
|
|
~Vecteur();
|
| 40 |
|
|
|
| 41 |
|
|
int Get_Size(void)const;
|
| 42 |
|
|
double& operator[](int i);
|
| 43 |
|
|
double& operator()(int i);
|
| 44 |
|
|
const double& operator[](int i)const;
|
| 45 |
|
|
const double& operator()(int i)const;
|
| 46 |
|
|
void resize(int new_size);
|
| 47 |
|
|
Vecteur& operator=(const Vecteur& x);
|
| 48 |
|
|
Vecteur& operator+=(const Vecteur& x);
|
| 49 |
|
|
Vecteur& operator-=(const Vecteur& x);
|
| 50 |
|
|
Vecteur& operator*=(const double& a);
|
| 51 |
|
|
Vecteur& operator/=(const double& a);
|
| 52 |
|
|
double norm_Scal() ;
|
| 53 |
|
|
friend Vecteur operator+(const Vecteur& x, const Vecteur& y);
|
| 54 |
|
|
friend Vecteur operator-(const Vecteur& x, const Vecteur& y);
|
| 55 |
|
|
friend Vecteur operator*(const Vecteur& x, const double& a);
|
| 56 |
|
|
friend Vecteur operator*(const double& a, const Vecteur& x);
|
| 57 |
|
|
friend Vecteur operator/(const Vecteur& x, const double& a);
|
| 58 |
|
|
|
| 59 |
|
|
friend double operator*(const Vecteur& x, const Vecteur& y);
|
| 60 |
|
|
friend ostream& operator <<(const ostream&, const Vecteur& y);
|
| 61 |
|
|
void affiche();
|
| 62 |
|
|
double Get_NormeUn();
|
| 63 |
|
|
double Get_NormeDeux();
|
| 64 |
|
|
int Get_size()const;
|
| 65 |
|
|
|
| 66 |
|
|
};
|
| 67 |
|
|
|
| 68 |
|
|
DLLPORTSOLVEUR double operator*(const Vecteur& x, const Vecteur& y);
|
| 69 |
|
|
DLLPORTSOLVEUR Vecteur operator+(const Vecteur& x, const Vecteur& y);
|
| 70 |
|
|
DLLPORTSOLVEUR Vecteur operator-(const Vecteur& x, const Vecteur& y);
|
| 71 |
|
|
DLLPORTSOLVEUR Vecteur operator*(const Vecteur& x, const double& a);
|
| 72 |
|
|
DLLPORTSOLVEUR Vecteur operator*(const double& a, const Vecteur& x);
|
| 73 |
|
|
DLLPORTSOLVEUR Vecteur operator/(const Vecteur& x, const double& a);
|
| 74 |
|
|
DLLPORTSOLVEUR ostream& operator <<(const ostream&, const Vecteur& y);
|
| 75 |
|
|
|
| 76 |
|
|
|
| 77 |
|
|
|
| 78 |
|
|
#endif
|