home *** CD-ROM | disk | FTP | other *** search
- /*
- * RCCL Version 1.0 Author : Vincent Hayward
- * School of Electrical Engineering
- * Purdue University
- * Dir : src
- * File : speed.c
- * Remarks : Measure how much time critical functions take to execute.
- * Usage : make speed, run speed 3 or speed 4
- */
-
- #include "../h/which.h"
- #include "../h/rccl.h"
- #include "../h/manip.h"
- #include "../h/umac.h"
-
- JNTS j = {" ",0., 0., 0., 0., 0., 0.};
- FORCE f = {1., 1., 1., 1., 1., 1.};
-
- main(argc,argv)
- char **argv;
- {
- int i, n = 1;
- double d = 1.;
- float f = 1.;
- double d1, d2;
- TRSF t, u, v;
- double t1, t2, lt, cputim_(); /* fortran cc .. -lU77 */
- double fact = 1000000.;
-
- jns_to_tr_n(&t, &j, NO);
-
- i = atoi(*(argv+1));
- while(i--)
- n *= 10;
-
- i = n;
- t1 = cputim_();
- while (i--)
- tr_to_jns_n(&j, &t, YES);
- t2 = cputim_();
-
- lt = ((t2 - t1) * fact) / n;
- printf("solutions time = %f\n", lt);
-
- i = n;
- t1 = cputim_();
- while (i--)
- jns_to_tr_n(&t, &j, YES);
- t2 = cputim_();
-
- lt = ((t2 - t1) * fact) / n;
- printf("handpos time = %f\n", lt);
-
- n *= 10;
-
- i = n;
- t1 = cputim_();
- while (i--) {
- ++rtime;
- jacobT_n(&j, &f);
- }
- t2 = cputim_();
-
- lt = ((t2 - t1) * fact) / n;
- printf("Jacobian time = %f\n", lt);
-
- i = n;
- t1 = cputim_();
- while (i--)
- invert(&u, &t);
- t2 = cputim_();
-
- lt = ((t2 - t1) * fact) / n;
- printf("invert time = %f\n", lt);
-
-
- i = n;
- t1 = cputim_();
- while (i--)
- trmult(&v, &t, &u);
- t2 = cputim_();
-
- lt = ((t2 - t1) * fact) / n;
- printf("trmult time = %f\n", lt);
-
-
- i = n;
- t1 = cputim_();
- while (i--)
- SINCOS(d1, d2, .7);
- t2 = cputim_();
-
- lt = ((t2 - t1) * fact) / n;
- printf("sin+cos time = %f\n", lt);
- }
-