| Last change
 on this file since 226 was             224, checked in by ansari, 27 years ago | 
        
          | 
Creation module DPC/Tests Reza 09/04/99
 | 
        
          | File size:
            1.2 KB | 
      
      
| Line |  | 
|---|
| 1 | #include <stdio.h> | 
|---|
| 2 | #include <iostream.h> | 
|---|
| 3 | #include "nbrandom.h" | 
|---|
| 4 | #include "timing.h" | 
|---|
| 5 | #include "cimage.h" | 
|---|
| 6 |  | 
|---|
| 7 | #include "blitz/array.h" | 
|---|
| 8 | using namespace blitz ; | 
|---|
| 9 |  | 
|---|
| 10 | main(int narg, char *arg[]) | 
|---|
| 11 | { | 
|---|
| 12 | PeidaInit(); | 
|---|
| 13 | InitTim(); | 
|---|
| 14 |  | 
|---|
| 15 | char strg[128]; | 
|---|
| 16 | int N1,N2, k, kk, i, j; | 
|---|
| 17 | N1 = 1; | 
|---|
| 18 | N2 = 10; | 
|---|
| 19 | if (narg > 1)  N1 = atoi(arg[1]); | 
|---|
| 20 | if (narg > 2)  N2 = atoi(arg[2]); | 
|---|
| 21 |  | 
|---|
| 22 | cout << N1 << " Tests avec " << N2 << " multiplications" << endl; | 
|---|
| 23 |  | 
|---|
| 24 | int sx = 300; | 
|---|
| 25 | int sy = 200; | 
|---|
| 26 |  | 
|---|
| 27 | ImageR4  img(sx, sy), i2(sx, sy), ir(sx, sy); | 
|---|
| 28 | for(kk=0; kk<N1; kk++) { | 
|---|
| 29 | cout << kk << " - Remplissage image (" << sx << "x" << sy << ") , " << N2 << " mult. " << endl; | 
|---|
| 30 | for(i=0; i<sx; i++) | 
|---|
| 31 | for(j=0; j<sy; j++) img(i,j) = frand01()*10.*j+20.*i; | 
|---|
| 32 | for(i=0; i<sx; i++) | 
|---|
| 33 | for(j=0; j<sy; j++) i2(i,j) =  frand01()*10.*j+20.*i; | 
|---|
| 34 |  | 
|---|
| 35 | for(k=0; k<N2; k++) ir = img * i2; | 
|---|
| 36 | sprintf(strg, "Img T[%d] ", kk); | 
|---|
| 37 | PrtTim(strg); | 
|---|
| 38 | } | 
|---|
| 39 |  | 
|---|
| 40 |  | 
|---|
| 41 | cout << "\n ====  Test avec Blitz++ " << endl; | 
|---|
| 42 |  | 
|---|
| 43 | Array<float,2> a1(sy, sx), a2(sy, sx), a3(sy, sx); | 
|---|
| 44 | firstIndex ii; | 
|---|
| 45 | secondIndex jj; | 
|---|
| 46 |  | 
|---|
| 47 | for(kk=0; kk<N1; kk++) { | 
|---|
| 48 | cout << kk << " BlitzArray (" << sx << "x" << sy << ") , " << N2 << " mult. " << endl; | 
|---|
| 49 | a1 = frand01()*10.*jj+20.*ii; | 
|---|
| 50 | a2 = frand01()*10.*jj+20.*ii; | 
|---|
| 51 | for(k=0; k<N2; k++) a3 = a1*a2; | 
|---|
| 52 | sprintf(strg, "Blitz-Array T[%d] ", kk); | 
|---|
| 53 | PrtTim(strg); | 
|---|
| 54 | } | 
|---|
| 55 |  | 
|---|
| 56 |  | 
|---|
| 57 | exit(0); | 
|---|
| 58 | } | 
|---|
       
      
  Note:
 See   
TracBrowser
 for help on using the repository browser.