<?xml version='1.0'?> <?xml-stylesheet type='text/xsl' href='pmathml.xsl'?> <html xmlns='http://www.w3.org/1999/xhtml'> <head> <title>Program That Runs the Speed Examples</title> <meta name="description" id="description" content="Program That Runs the Speed Examples"/> <meta name="keywords" id="keywords" content=" speed example program "/> <style type='text/css'> body { color : black } body { background-color : white } A:link { color : blue } A:visited { color : purple } A:active { color : purple } </style> <script type='text/javascript' language='JavaScript' src='_speed_example.cpp_xml.js'> </script> </head> <body> <table><tr> <td> <a href="http://www.coin-or.org/CppAD/" target="_top"><img border="0" src="_image.gif"/></a> </td> <td><a href="example.cpp.xml" target="_top">Prev</a> </td><td><a href="luvecad.xml" target="_top">Next</a> </td><td> <select onchange='choose_across0(this)'> <option>Index-></option> <option>contents</option> <option>reference</option> <option>index</option> <option>search</option> <option>external</option> </select> </td> <td> <select onchange='choose_up0(this)'> <option>Up-></option> <option>CppAD</option> <option>Example</option> <option>ExampleUtility</option> <option>speed_example.cpp</option> </select> </td> <td> <select onchange='choose_down3(this)'> <option>CppAD-></option> <option>Install</option> <option>Introduction</option> <option>AD</option> <option>ADFun</option> <option>library</option> <option>Example</option> <option>configure</option> <option>Appendix</option> </select> </td> <td> <select onchange='choose_down2(this)'> <option>Example-></option> <option>General</option> <option>ExampleUtility</option> <option>ListAllExamples</option> <option>test_vector</option> </select> </td> <td> <select onchange='choose_down1(this)'> <option>ExampleUtility-></option> <option>Example.cpp</option> <option>speed_example.cpp</option> <option>LuVecAD</option> </select> </td> <td>speed_example.cpp</td> <td>Headings</td> </tr></table><br/> <center><b><big><big>Program That Runs the Speed Examples</big></big></b></center> <code><font color="blue"><pre style='display:inline'> # include <cppad/cppad.hpp> // various example routines extern bool det_of_minor(void); extern bool det_by_lu(void); extern bool det_by_minor(void); extern bool ode_evaluate(void); extern bool sparse_evaluate(void); extern bool speed_test(void); namespace { // function that runs one test static size_t Run_ok_count = 0; static size_t Run_error_count = 0; bool Run(bool TestOk(void), std::string name) { bool ok = true; size_t width = 20; std::cout.width( width ); std::cout.setf( std::ios_base::left ); std::cout << name; // ok &= name.size() < width; ok &= TestOk(); if( ok ) { std::cout << "OK" << std::endl; Run_ok_count++; } else { std::cout << "Error" << std::endl; Run_error_count++; } return ok; } } // main program that runs all the tests int main(void) { bool ok = true; using std::cout; using std::endl; ok &= Run(det_of_minor, "det_of_minor" ); ok &= Run(det_by_minor, "det_by_minor" ); ok &= Run(det_by_lu, "det_by_lu" ); ok &= Run(ode_evaluate, "ode_evaluate" ); ok &= Run(sparse_evaluate, "sparse_evaluate" ); // check for memory leak in previous calculations if( CPPAD_TRACK_COUNT() != 0 ) cout << "Error: memroy leak detected" << endl; assert( ok || (Run_error_count > 0) ); if( ok ) cout << "The " << int(Run_ok_count) << " tests above passed."; else cout << int(Run_error_count) << " tests above failed."; cout << endl; bool speed_test_ok = speed_test(); if( speed_test_ok ) cout << "speed_test also passed correctness test" << endl; else { cout << "speed_test failed its correctness test (OK if "; cout << "other processes are running at same time)" << endl; } return static_cast<int>( ! ok ); } </pre> </font></code> <hr/>Input File: speed/example/example.cpp </body> </html>