source: Sophya/trunk/SophyaProg/Tests/tblitz.cc@ 224

Last change on this file since 224 was 224, checked in by ansari, 26 years ago

Creation module DPC/Tests Reza 09/04/99

File size: 1.2 KB
RevLine 
[224]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"
8using namespace blitz ;
9
10main(int narg, char *arg[])
11{
12PeidaInit();
13InitTim();
14
15char strg[128];
16int N1,N2, k, kk, i, j;
17N1 = 1;
18N2 = 10;
19if (narg > 1) N1 = atoi(arg[1]);
20if (narg > 2) N2 = atoi(arg[2]);
21
22cout << N1 << " Tests avec " << N2 << " multiplications" << endl;
23
24int sx = 300;
25int sy = 200;
26
27ImageR4 img(sx, sy), i2(sx, sy), ir(sx, sy);
28for(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
43Array<float,2> a1(sy, sx), a2(sy, sx), a3(sy, sx);
44firstIndex ii;
45secondIndex jj;
46
47for(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
57exit(0);
58}
Note: See TracBrowser for help on using the repository browser.