Last change
on this file since 786 was 786, checked in by ansari, 26 years ago |
Programmes test de TArray<T> Reza 16/3/2000
|
File size:
1.3 KB
|
Rev | Line | |
---|
[786] | 1 | #include "machdefs.h"
|
---|
| 2 |
|
---|
| 3 | #include <math.h>
|
---|
| 4 | #include <iostream.h>
|
---|
| 5 |
|
---|
| 6 | #include "nbrandom.h"
|
---|
| 7 | #include "tarrinit.h"
|
---|
| 8 | #include "tarray.h"
|
---|
| 9 | #include "timing.h"
|
---|
| 10 |
|
---|
| 11 |
|
---|
| 12 | int main(int narg, char* arg[])
|
---|
| 13 | {
|
---|
| 14 |
|
---|
| 15 | SophyaInit();
|
---|
| 16 | InitTim(); // Initializing the CPU timer
|
---|
| 17 |
|
---|
| 18 |
|
---|
| 19 | int n = 5;
|
---|
| 20 | int i,j,k;
|
---|
| 21 |
|
---|
| 22 | if (narg > 1) n = atoi(arg[1]);
|
---|
| 23 |
|
---|
| 24 |
|
---|
| 25 | try {
|
---|
| 26 | cout << "\n -----> Testing TArray <---- " << endl;
|
---|
| 27 | TArray<int_4> ia(7,5);
|
---|
| 28 | ia = Sequence(10., 2.);
|
---|
| 29 | cout << " ----- matrix IA = \n " << ia << endl;
|
---|
| 30 | // Extraction de sous tableau
|
---|
| 31 | TArray<int_4> ic = ia(Range(2,3),Range(1,2));
|
---|
| 32 | cout << " ----- matrix IC IA(Range(2,3),Range(1,2)) = \n " << ic << endl;
|
---|
| 33 | ic = 0;
|
---|
| 34 | cout << " ----- matrix IC Apres (=0) = \n " << ic << endl;
|
---|
| 35 | cout << " ----- matrix IA Apres IC=0 = \n " << ia << endl;
|
---|
| 36 |
|
---|
| 37 | cout << " :::: 3 Dim arrays ::::: " << endl;
|
---|
| 38 | TArray<int_4>::SetMaxPrint(1000);
|
---|
| 39 | TArray<int_4> ib(8,7,2);
|
---|
| 40 | ib = 5;
|
---|
| 41 | cout << " ----- matrix IB = \n " << ib << endl;
|
---|
| 42 | ib(Range(1,4),Range(2,3)) *= 3;
|
---|
| 43 | cout << " -- matrix IB , Apres ib(Range(1,3),Range(2,1))*=3 : " << endl;
|
---|
| 44 | cout << ib;
|
---|
| 45 | }
|
---|
| 46 | catch (PThrowable exc) {
|
---|
| 47 | cerr << " catched Exception " << exc.Msg() << endl;
|
---|
| 48 | }
|
---|
| 49 | catch (...) {
|
---|
| 50 | cerr << " catched unknown (...) exception " << endl;
|
---|
| 51 | }
|
---|
| 52 | cout << " --------------- END of Programme -------------- " << endl;
|
---|
| 53 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.