Sophie

Sophie

distrib > Fedora > 14 > x86_64 > by-pkgid > 39da2e642be5eb48375f19991c31eb2c > files > 740

cppad-doc-20100101.4-1.fc14.noarch.rpm

<?xml version='1.0'?>
<?xml-stylesheet type='text/xsl' href='pmathml.xsl'?>
<html xmlns='http://www.w3.org/1999/xhtml'>
<head>
<title>Run One Speed Test and Print Results</title>
<meta name="description" id="description" content="Run One Speed Test and Print Results"/>
<meta name="keywords" id="keywords" content=" Speedtest test speed "/>
<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='_speedtest_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="speed_test.cpp.xml" target="_top">Prev</a>
</td><td><a href="speed_program.cpp.xml" target="_top">Next</a>
</td><td>
<select onchange='choose_across0(this)'>
<option>Index-&gt;</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-&gt;</option>
<option>CppAD</option>
<option>library</option>
<option>SpeedTest</option>
</select>
</td>
<td>
<select onchange='choose_down2(this)'>
<option>CppAD-&gt;</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_down1(this)'>
<option>library-&gt;</option>
<option>ErrorHandler</option>
<option>NearEqual</option>
<option>speed_test</option>
<option>SpeedTest</option>
<option>NumericType</option>
<option>CheckNumericType</option>
<option>SimpleVector</option>
<option>CheckSimpleVector</option>
<option>nan</option>
<option>pow_int</option>
<option>Poly</option>
<option>LuDetAndSolve</option>
<option>RombergOne</option>
<option>RombergMul</option>
<option>Runge45</option>
<option>Rosen34</option>
<option>OdeErrControl</option>
<option>OdeGear</option>
<option>OdeGearControl</option>
<option>BenderQuad</option>
<option>LuRatio</option>
<option>std_math_unary</option>
<option>CppAD_vector</option>
<option>TrackNewDel</option>
</select>
</td>
<td>
<select onchange='choose_down0(this)'>
<option>SpeedTest-&gt;</option>
<option>speed_program.cpp</option>
</select>
</td>
<td>
<select onchange='choose_current0(this)'>
<option>Headings-&gt;</option>
<option>Syntax</option>
<option>Purpose</option>
<option>Motivation</option>
<option>Include</option>
<option>Test</option>
<option>---..size</option>
<option>---..repeat</option>
<option>---..name</option>
<option>first</option>
<option>last</option>
<option>inc</option>
<option>rate</option>
<option>Errors</option>
<option>Example</option>
</select>
</td>
</tr></table><br/>






<center><b><big><big>Run One Speed Test and Print Results</big></big></b></center>
<br/>
<b><big><a name="Syntax" id="Syntax">Syntax</a></big></b>


<code><font color="blue"><br/>
# include &lt;cppad/speed_test.hpp&gt;</font></code>
<code><span style='white-space: nowrap'><br/>
</span></code><code><font color="blue"><span style='white-space: nowrap'>SpeedTest(</span></font></code><i><span style='white-space: nowrap'>Test</span></i><code><font color="blue"><span style='white-space: nowrap'>,&#xA0;</span></font></code><i><span style='white-space: nowrap'>first</span></i><code><font color="blue"><span style='white-space: nowrap'>,&#xA0;</span></font></code><i><span style='white-space: nowrap'>inc</span></i><code><font color="blue"><span style='white-space: nowrap'>,&#xA0;</span></font></code><i><span style='white-space: nowrap'>last</span></i><code><font color="blue"><span style='white-space: nowrap'>)</span></font></code>


<br/>
<br/>
<b><big><a name="Purpose" id="Purpose">Purpose</a></big></b>
<br/>
The <code><font color="blue">SpeedTest</font></code> function executes a speed test
for various sized problems
and reports the results on standard output; i.e. <code><font color="blue">std::cout</font></code>.
The size of each test problem is included in its report
(unless <i>first</i> is equal to <i>last</i>).

<br/>
<br/>
<b><big><a name="Motivation" id="Motivation">Motivation</a></big></b>
<br/>
It is important to separate small calculation units
and test them individually.
This way individual changes can be tested in the context of the
routine that they are in.
On many machines, accurate timing of a very short execution 
sequences is not possible.
In addition,
there may be set up time for a test that
we do not really want included in the timing.
For this reason <code><font color="blue">SpeedTest</font></code>
automatically determines how many times to 
repeat the section of the test that we wish to time.


<br/>
<br/>
<b><big><a name="Include" id="Include">Include</a></big></b>
<br/>
The file <code><font color="blue">speed_test.hpp</font></code> contains the 
<code><font color="blue">SpeedTest</font></code> function.
This file is included by <code><font color="blue">cppad/cppad.hpp</font></code>
but it can also be included separately with out the rest of 
the <code><font color="blue">CppAD</font></code> routines.

<br/>
<br/>
<b><big><a name="Test" id="Test">Test</a></big></b>
<br/>
The <code><font color="blue">SpeedTest</font></code> argument <i>Test</i> is a function with the syntax
<code><font color="blue"><span style='white-space: nowrap'><br/>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;</span></font></code><i><span style='white-space: nowrap'>name</span></i><code><font color="blue"><span style='white-space: nowrap'>&#xA0;=&#xA0;</span></font></code><i><span style='white-space: nowrap'>Test</span></i><code><font color="blue"><span style='white-space: nowrap'>(</span></font></code><i><span style='white-space: nowrap'>size</span></i><code><font color="blue"><span style='white-space: nowrap'>,&#xA0;</span></font></code><i><span style='white-space: nowrap'>repeat</span></i><code><font color="blue"><span style='white-space: nowrap'>)<br/>
</span></font></code><br/>
<b><a name="Test.size" id="Test.size">size</a></b>
<br/>
The <i>Test</i> argument <i>size</i> has prototype
<code><font color="blue"><span style='white-space: nowrap'><br/>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;size_t&#xA0;</span></font></code><i><span style='white-space: nowrap'>size</span></i><code><font color="blue"><span style='white-space: nowrap'><br/>
</span></font></code>It specifies the size for this test.

<br/>
<br/>
<b><a name="Test.repeat" id="Test.repeat">repeat</a></b>
<br/>
The <i>Test</i> argument <i>repeat</i> has prototype
<code><font color="blue"><span style='white-space: nowrap'><br/>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;size_t&#xA0;</span></font></code><i><span style='white-space: nowrap'>repeat</span></i><code><font color="blue"><span style='white-space: nowrap'><br/>
</span></font></code>It specifies the number of times to repeat the test.

<br/>
<br/>
<b><a name="Test.name" id="Test.name">name</a></b>
<br/>
The <i>Test</i> result <i>name</i> has prototype
<code><font color="blue"><span style='white-space: nowrap'><br/>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;std::string&#xA0;</span></font></code><i><span style='white-space: nowrap'>name</span></i><code><font color="blue"><span style='white-space: nowrap'><br/>
</span></font></code>The results for this test are reported on <code><font color="blue">std::cout</font></code>
with <i>name</i> as an identifier for the test.
It is assumed that,
for the duration of this call to <code><font color="blue">SpeedTest</font></code>,
<i>Test</i> will always return 
the same value for <i>name</i>.
If <i>name</i> is the empty string, 
no test name is reported by <code><font color="blue">SpeedTest</font></code>.

<br/>
<br/>
<b><big><a name="first" id="first">first</a></big></b>
<br/>
The <code><font color="blue">SpeedTest</font></code> argument <i>first</i> has prototype
<code><font color="blue"><span style='white-space: nowrap'><br/>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;size_t&#xA0;</span></font></code><i><span style='white-space: nowrap'>first</span></i><code><font color="blue"><span style='white-space: nowrap'><br/>
</span></font></code>It specifies the size of the first test problem reported by this call to 
<code><font color="blue">SpeedTest</font></code>.
	
<br/>
<br/>
<b><big><a name="last" id="last">last</a></big></b>
<br/>
The <code><font color="blue">SpeedTest</font></code> argument <i>last</i> has prototype
<code><font color="blue"><span style='white-space: nowrap'><br/>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;size_t&#xA0;</span></font></code><i><span style='white-space: nowrap'>last</span></i><code><font color="blue"><span style='white-space: nowrap'><br/>
</span></font></code>It specifies the size of the last test problem reported by this call to 
<code><font color="blue">SpeedTest</font></code>.

<br/>
<br/>
<b><big><a name="inc" id="inc">inc</a></big></b>
<br/>
The <code><font color="blue">SpeedTest</font></code> argument <i>inc</i> has prototype
<code><font color="blue"><span style='white-space: nowrap'><br/>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;int&#xA0;</span></font></code><i><span style='white-space: nowrap'>inc</span></i><code><font color="blue"><span style='white-space: nowrap'><br/>
</span></font></code>It specifies the increment between problem sizes; i.e.,
all values of <i>size</i> in calls to <i>Test</i> are given by
<code><font color="blue"><span style='white-space: nowrap'><br/>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;</span></font></code><i><span style='white-space: nowrap'>size</span></i><code><font color="blue"><span style='white-space: nowrap'>&#xA0;=&#xA0;</span></font></code><i><span style='white-space: nowrap'>first</span></i><code><font color="blue"><span style='white-space: nowrap'>&#xA0;+&#xA0;</span></font></code><i><span style='white-space: nowrap'>j</span></i><code><font color="blue"><span style='white-space: nowrap'>&#xA0;*&#xA0;</span></font></code><i><span style='white-space: nowrap'>inc</span></i><code><font color="blue"><span style='white-space: nowrap'><br/>
</span></font></code>where <i>j</i> is a positive integer.
The increment can be positive or negative but it cannot be zero.
The values <i>first</i>, <i>last</i> and <i>inc</i> must 
satisfy the relation

<math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><mrow>
<mi mathvariant='italic'>inc</mi>
<mo stretchy="false">*</mo>
<mo stretchy="false">(</mo>
<mi mathvariant='italic'>last</mi>
<mo stretchy="false">-</mo>
<mi mathvariant='italic'>first</mi>
<mo stretchy="false">)</mo>
<mo stretchy="false">&#x02265;</mo>
<mn>0</mn>
</mrow></math>

<br/>
<b><big><a name="rate" id="rate">rate</a></big></b>
<br/>
The value displayed in the <code><font color="blue">rate</font></code> column on <code><font color="blue">std::cout</font></code>
is defined as the value of <i>repeat</i> divided by the 
corresponding elapsed execution time in seconds.
The elapsed execution time is measured by the difference in
<code><font color='blue'><pre style='display:inline'> 
	(double) clock() / (double) CLOCKS_PER_SEC
</pre></font></code>

in the context of the standard <code><font color="blue">&lt;ctime&gt;</font></code> definitions.


<br/>
<br/>
<b><big><a name="Errors" id="Errors">Errors</a></big></b>
<br/>
If one of the restrictions above is violated,
the CppAD error handler is used to report the error.
You can redefine this action using the instructions in
<a href="errorhandler.xml" target="_top"><span style='white-space: nowrap'>ErrorHandler</span></a>


<br/>
<br/>
<b><big><a name="Example" id="Example">Example</a></big></b>

<br/>
The section <a href="speed_program.cpp.xml" target="_top"><span style='white-space: nowrap'>speed_program.cpp</span></a>
 contains an example usage
of <code><font color="blue">SpeedTest</font></code>.


<hr/>Input File: cppad/speed_test.hpp

</body>
</html>