0d03312003-08-24Martin Nilsson #pike __REAL_VERSION__
df98272002-12-06Mirar (Pontus Hagland) inherit Tools.Shoot.Test;
75c9d12013-08-16Per Hedbor constant size = 100; constant name="Matrix multiplication ("+size+"x"+size+")";
df98272002-12-06Mirar (Pontus Hagland) 
3524712015-05-26Martin Nilsson array(array(float)) mkmatrix(int rows, int cols)
df98272002-12-06Mirar (Pontus Hagland) {
003e152006-04-24Henrik Grubbström (Grubba)  return map(enumerate(rows*cols,1,0), lambda(int f, float den)
df98272002-12-06Mirar (Pontus Hagland)  {
003e152006-04-24Henrik Grubbström (Grubba)  if (f & 1) return -((float)f)/den; return ((float)f)/den; }, (float)rows*cols)/cols;
df98272002-12-06Mirar (Pontus Hagland) }
75c9d12013-08-16Per Hedbor Math.Matrix gm1 = Math.Matrix(mkmatrix(size, size)); Math.Matrix gm2 = Math.Matrix(mkmatrix(size, size));
df98272002-12-06Mirar (Pontus Hagland) void test(int n) {
75c9d12013-08-16Per Hedbor  Math.Matrix m1 = gm1; Math.Matrix m2 = gm2;
df98272002-12-06Mirar (Pontus Hagland)  while (n--) m1=m1*m2;
75c9d12013-08-16Per Hedbor  // array q = (array(array(int)))(array)m1;
df98272002-12-06Mirar (Pontus Hagland) }
75c9d12013-08-16Per Hedbor int perform()
df98272002-12-06Mirar (Pontus Hagland) { test(100);
75c9d12013-08-16Per Hedbor  return 200 * 100 * 100 * 100; } string present_n( int ntot, int nruns, float real, float user ) { return sprintf("%.2f GF/s", (ntot/real/1000000000));
df98272002-12-06Mirar (Pontus Hagland) }