Last change
on this file since 3051 was 1968, checked in by ansari, 23 years ago |
arr1.icc modifie par erreur - revenu en arriere - Reza 26/4/2002
|
File size:
954 bytes
|
Line | |
---|
1 | // Fichier arr1.icc
|
---|
2 | // Exemple d'utilisation de tableaux
|
---|
3 | // Appel: runcxx -f arr1.icc
|
---|
4 | // Creation , remplissage d'une matrice
|
---|
5 | TMatrix<r_4> ma(7,9);
|
---|
6 | ma = RegularSequence(0.1, 0.05);
|
---|
7 | cout << "\n arr1.icc: ma = " << ma << endl;
|
---|
8 | float min, max;
|
---|
9 | // Utilisation des sous-tableaux
|
---|
10 | ma(Range(2,4), Range(4,7)) = M_PI;
|
---|
11 | cout << "\n Apres ma(Range(2,4), Range(4,7)) = " << ma << endl;
|
---|
12 | // Appel de methodes
|
---|
13 | ma.MinMax(min, max);
|
---|
14 | cout << " MinMax(ma) : min= " << min << " max= " << max << endl;
|
---|
15 | TMatrix<r_4> sma = Sin(ma);
|
---|
16 | cout << "\n test pour runcxx - sma = Sin(ma)= " << sma << endl;
|
---|
17 | sma.MinMax(min, max);
|
---|
18 | cout << " MinMax(sma) : min= " << min << " max= " << max << endl;
|
---|
19 |
|
---|
20 | // Vector , matrix multiplication
|
---|
21 | Vector v1(5);
|
---|
22 | v1 = 12.;
|
---|
23 | Vector v2(5);
|
---|
24 | v2 = 14;
|
---|
25 | Matrix m = v2*v1.Transpose();
|
---|
26 | cout << " m= v2*v1.Transpose() : " << m;
|
---|
27 | // Computing the scalar product
|
---|
28 | cout << " v1.v2 = " << (v1.Transpose()*v2).toScalar() << endl;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.