/mobile Handheld Friendly website

 performance measurements

Each table row shows performance measurements for this C CINT program with a particular command-line input value N.

 N  CPU secs Elapsed secs Memory KB Code B ≈ CPU Load
50013.0513.075,380394  2% 1% 2% 100%
3,000461.70461.785,912394  0% 1% 0% 100%
5,5001,413.761,414.016,180394  0% 0% 0% 100%

Read the ↓ make, command line, and program output logs to see how this program was run.

Read spectral-norm benchmark to see what this program should do.

 notes

cint 5.18.00, July 2, 2010

Here CINT is only being used as a C interpreter but a CINT script can call compiled classes/functions and compiled code can make callbacks to CINT interpreted functions.

 spectral-norm C CINT program source code

/*  
 * The Computer Language Benchmarks Game
 * http://benchmarksgame.alioth.debian.org/
 *
 * Contributed by Sebastien Loisel
 * modified by Isaac Gouy for CINT
 */

#include <stdio.h>
#include <stdlib.h>
#include <math.h>

double eval_A(int i, int j) { return 1.0/((i+j)*(i+j+1)/2+i+1); }

void eval_A_times_u(int N, const double u[], double Au[])
{
  int i,j;
  for(i=0;i<N;i++)
    {
      Au[i]=0;
      for(j=0;j<N;j++) Au[i]+=eval_A(i,j)*u[j];
    }
}

void eval_At_times_u(int N, const double u[], double Au[])
{
  int i,j;
  for(i=0;i<N;i++)
    {
      Au[i]=0;
      for(j=0;j<N;j++) Au[i]+=eval_A(j,i)*u[j];
    }
}

void eval_AtA_times_u(int N, const double u[], double AtAu[])
{ 
   double * v = (double *) malloc(N * sizeof(double));
   eval_A_times_u(N,u,v); 
   eval_At_times_u(N,v,AtAu); 
}


int main(int argc, char ** argv)
{
  int i;
  int N = atoi(argv[1]);

  double vBv,vv;
  double * u = (double *) malloc(N * sizeof(double));
  double * v = (double *) malloc(N * sizeof(double));

  for(i=0;i<N;i++) u[i]=1;
  for(i=0;i<10;i++)
    {
      eval_AtA_times_u(N,u,v);
      eval_AtA_times_u(N,v,u);
    }
  vBv=vv=0;
  for(i=0;i<N;i++) { vBv+=u[i]*v[i]; vv+=v[i]*v[i]; }
  printf("%0.9f\n",sqrt(vBv/vv));
  return 0;
}

 make, command-line, and program output logs

Thu, 21 Apr 2011 21:34:05 GMT

COMMAND LINE:
/usr/local/src/cint/bin/cint -K -p -E -E -J0  spectralnorm.cint 5500

PROGRAM OUTPUT:
1.274224153

Revised BSD license

  Home   Conclusions   License   Play