Bonjour tout le monde,
J'ai commencé un cours de math orienté à l'informatique.
Nous voyons les matrices.
Je n'y comprends absolument rien.
J'ai été voir sur Wikipedia pour la définition de matrice mais ça me semble très compliqué ce qu'ils racontent.
Sauriez-vous m'expliquer ces termes svp :
Dimensionner une matrice
Serialiser
Deserialiser
J'ai ce code :
Merci d'avance pour votre aide.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55 function CMatrice(NL,NC) { // MEMBRES DE LA CLASSE CMatrice this.NL = 0; this.NC = 0; this.Valeurs = null; // CONSTRUCTEUR DE LA CLASSE CMatrice this.Dimensionner(NL,NC); } CMatrice.prototype.Dimensionner = function(NL,NC) { //if ( (NL == undefined) || (NC == undefined) ) return false; if ( (typeof NL != "number") || (typeof NC != "number") ) return false; if ( (NL < 1) || (NC < 1) ) return false; //if ( (this.NL != parseInt(NL)) || (this.NC != parseInt(NC)) ) return false; this.NL = parseInt(NL); this.NC = parseInt(NC); this.Valeurs = new Array(null); for (var il=1; il <= this.NL; il++) { this.Valeurs[il] = new Array(null); for (var ic=1; ic <= this.NC; ic++) this.Valeurs[il][ic] = 0; } return true; } CMatrice.prototype.Serialiser = function(sep_cellule,sep_ligne) { if (typeof sep_cellule != "string") sep_cellule = "\t"; if (typeof sep_ligne != "string") sep_ligne = "\n"; var Resultat = ""; Resultat += this.NL + sep_ligne + this.NC + sep_ligne; if (this.NL == 0) return Resultat; for (var il=1; il <= this.NL; il++) { for (var ic=1; ic < this.NC; ic++) Resultat += this.Valeurs[il][ic] + sep_cellule; Resultat += this.Valeurs[il][this.NC] + sep_ligne; } return Resultat; } CMatrice.prototype.Deserialiser = function(Donnees,sep_cellule,sep_ligne) { if (typeof Donnees != "string") return false; if (typeof sep_cellule != "string") sep_cellule = "\t"; if (typeof sep_ligne != "string") sep_ligne = "\n"; var Lignes = Donnees.split(sep_ligne); if (Lignes.length < 3) return false; if (!this.Dimensionner(parseInt(Lignes[0]),parseInt(Lignes[1]))) return false; for (var il=1; il <= this.NL; il++) { var Cellules = Lignes[il+1].split(sep_cellule); if (Cellules.length != this.NC) return false; for (var ic=1; ic <= this.NC; ic++) this.Valeurs[il][ic] = parseFloat(Cellules[ic-1]); } return true; }
beegees
Partager