#include <stdio.h>
#include <stdlib.h>
#include <sys/param.h>
#include <sys/times.h>

#include <svl/SVL.h>

double clock_cpu_read() {	// returns CPU time used by this process so far
    struct tms tb;
    times(&tb);
    return (double)(tb.tms_utime+tb.tms_stime)/HZ;
}

void main(int argc, char **argv) {
    Mat g;		// we construct a 2-D array (grid) of doubles
			// but don't specify yet how big it is

    int n = argc>1 ? atoi(argv[1]) : 1024;
    printf("creating %dx%d array\n", n+1, n+1);

    double t0 = clock_cpu_read();	// start timer

    g.SetSize(n+1, n+1);		// set size of grid g (dynamic alloc)

    int i, j;
    for (i=0; i<=n; i++)		// zero the array g
	for (j=0; j<=n; j++)
	    g[i][j] = 0;
    
    double t1 = clock_cpu_read();	// stop timer
    printf("took %g seconds\n", t1-t0);
}

