Prev Next speed_main

Speed Testing Main Program

Syntax
speed/package/package option seed

Purpose
A version of this program runs the correctness tests or the speed tests for one AD package identified by package.

package

AD Package
The value package can specify one of the following AD packages: adolc , cppad , fadbad , sacado .

double
The value package can be double in which case the function values (instead of derivatives) are computed using double precision operations. This enables one to compare the speed of computing function values in double to the speed of the derivative computations. (It is often useful to divide the speed of the derivative computation by the speed of the function evaluation in double.)

profile
In the special case where package is profile, the CppAD package is compiled and run with profiling to aid in determining where it is spending most of its time.

option
It the argument option specifies which test to run and has the following possible values: correct , speed , det_minor , det_lu , poly .

correct
If option is equal to correct, all of the correctness tests are run.

speed
If option is equal to speed, all of the speed tests are run.

det_lu
If option is equal to det_lu, the correctness and speed test for the gradient of the determinant using LU factorization tests are run. Each package defines a version of this test with the following prototype:
     extern void compute_det_lu(
          size_t                     size      , 
          size_t                     repeat    , 
          CppAD::vector<double>      &matrix   ,
          CppAD::vector<double>      &gradient 
     );

size
The argument size is the number of rows and columns in the matrix.

repeat
The argument repeat is the number of different matrices that the gradient is computed for.

matrix
The argument matrix is a vector with size*size elements. The input value of its elements does not matter. The output value of its elements is the last matrix that the gradient is computed for.

gradient
The argument gradient is a vector with size*size elements. The input value of its elements does not matter. The output value of its elements is the gradient of the determinant of matrix with respect to its elements. gradient is computed for. (If package is double, only the first element of gradient is used and it is actually the determinant value instead of the gradient value.)

det_minor
If option is equal to det_minor, the correctness and speed test for the gradient of the determinant using expansion by minors are run. Each package defines a version of this test with the following prototype:
     extern void compute_det_minor(
          size_t                     size      , 
          size_t                     repeat    , 
          CppAD::vector<double>      &matrix   ,
          CppAD::vector<double>      &gradient 
     );

size
The argument size is the number of rows and columns in the matrix.

repeat
The argument repeat is the number of different matrices that the gradient is computed for.

matrix
The argument matrix is a vector with size*size elements. The input value of its elements does not matter. The output value of its elements is the last matrix that the gradient is computed for.

gradient
The argument gradient is a vector with size*size elements. The input value of its elements does not matter. The output value of its elements is the gradient of the determinant of matrix with respect to its elements. gradient is computed for. (If package is double, only the first element of gradient is used and it is actually the determinant value instead of the gradient value.)

poly
If option is equal to poly, the correctness and speed test for the derivative of a polynomial are run. Each package defines a version of this test with the following prototype:
     extern void compute_poly(
          size_t                     size     , 
          size_t                     repeat   , 
          CppAD::vector<double>      &a       ,
          CppAD::vector<double>      &z       ,
          CppAD::vector<double>      &ddp      
     );

size
The argument size is the order of the polynomial (the number of coefficients in the polynomial).

repeat
The argument repeat is the number of different argument values that the polynomial will be differentiated at.

a
The argument a is a vector with size*size elements. The input value of its elements does not matter. The output value of its is the coefficients of the last polynomial that is differentiated (i-th element is coefficient of order  i ).

z
The argument z is a vector with one element. The input value of the element does not matter. The output its value is the polynomial argument value were the derivative was computed.

ddp
The argument ddp is a vector with one element. The input value of the element does not matter. The output its value is the second derivative of the polynomial value with respect to it's argument value. (If package is double, only the first element of ddp is used and it is actually the polynomial value instead of the gradient value.)

seed
The random number simulator uniform_01 is initialized with the call
     uniform_01(
seed)
before any of the testing routines (listed above) are called.

Correctness Results
An output line is generated for each correctness test stating of the test passed or failed.

Speed Results
For each speed test, corresponds to three lines of output. The name of the package and test are printed on the first line, the vector of problem sizes are printed on the next line, and the rates corresponding to the different problem sizes are printed on the third line. The rate is the number of times per second that the calculation was repeated.
Input File: speed/main.cpp