<?xml version='1.0'?>
<html xmlns='http://www.w3.org/1999/xhtml'
      xmlns:math='http://www.w3.org/1998/Math/MathML'
>
<head>
<title>Speed Testing Derivative of Matrix Multiply</title>
<meta name="description" id="description" content="Speed Testing Derivative of Matrix Multiply"/>
<meta name="keywords" id="keywords" content=" link_mat_mul matrix multiply speed test multiple "/>
<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='_link_mat_mul_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="link_det_minor.xml" target="_top">Prev</a>
</td><td><a href="link_ode.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>speed</option>
<option>speed_main</option>
<option>link_mat_mul</option>
</select>
</td>
<td>
<select onchange='choose_down3(this)'>
<option>CppAD-&gt;</option>
<option>Install</option>
<option>Introduction</option>
<option>AD</option>
<option>ADFun</option>
<option>preprocessor</option>
<option>multi_thread</option>
<option>library</option>
<option>ipopt_solve</option>
<option>Example</option>
<option>speed</option>
<option>Appendix</option>
</select>
</td>
<td>
<select onchange='choose_down2(this)'>
<option>speed-&gt;</option>
<option>speed_main</option>
<option>speed_utility</option>
<option>speed_double</option>
<option>speed_adolc</option>
<option>speed_cppad</option>
<option>speed_fadbad</option>
<option>speed_sacado</option>
</select>
</td>
<td>
<select onchange='choose_down1(this)'>
<option>speed_main-&gt;</option>
<option>link_det_lu</option>
<option>link_det_minor</option>
<option>link_mat_mul</option>
<option>link_ode</option>
<option>link_poly</option>
<option>link_sparse_hessian</option>
<option>link_sparse_jacobian</option>
<option>microsoft_timer</option>
</select>
</td>
<td>link_mat_mul</td>
<td>
<select onchange='choose_current0(this)'>
<option>Headings-&gt;</option>
<option>Prototype</option>
<option>Purpose</option>
<option>Return Value</option>
<option>n</option>
<option>repeat</option>
<option>x</option>
<option>z</option>
<option>dz</option>
</select>
</td>
</tr></table><br/>









<center><b><big><big>Speed Testing Derivative of Matrix Multiply</big></big></b></center>
<br/>
<b><big><a name="Prototype" id="Prototype">Prototype</a></big></b>

<br/>

<code><font color="blue"><span style='white-space: nowrap'>extern&#xA0;bool&#xA0;link_mat_mul(<br/>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;size_t&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;</span></font><i><font color="black"><span style='white-space: nowrap'>size</span></font></i><font color="blue"><span style='white-space: nowrap'>&#xA0;&#xA0;&#xA0;&#xA0;,&#xA0;<br/>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;size_t&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;</span></font><i><font color="black"><span style='white-space: nowrap'>repeat</span></font></i><font color="blue"><span style='white-space: nowrap'>&#xA0;&#xA0;,&#xA0;<br/>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;CppAD::vector&lt;double&gt;&amp;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;</span></font><i><font color="black"><span style='white-space: nowrap'>x</span></font></i><font color="blue"><span style='white-space: nowrap'>&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;,<br/>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;CppAD::vector&lt;double&gt;&amp;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;</span></font><i><font color="black"><span style='white-space: nowrap'>z</span></font></i><font color="blue"><span style='white-space: nowrap'>&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;,<br/>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;CppAD::vector&lt;double&gt;&amp;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;</span></font><i><font color="black"><span style='white-space: nowrap'>dz</span></font></i><font color="blue"><span style='white-space: nowrap'>&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;<br/>
);<br/>
</span></font></code>
<br/>
<b><big><a name="Purpose" id="Purpose">Purpose</a></big></b>
<br/>
Each <a href="speed_main.xml#package" target="_top"><span style='white-space: nowrap'>package</span></a>

must define a version of this routine as specified below.
This is used by the <a href="speed_main.xml" target="_top"><span style='white-space: nowrap'>speed_main</span></a>
 program 
to run the corresponding speed and correctness tests.

<br/>
<br/>
<b><big><a name="Return Value" id="Return Value">Return Value</a></big></b>
<br/>
If this speed test is not yet
supported by a particular 
<code><i><font color="black"><span style='white-space: nowrap'>package</span></font></i></code>
,
the corresponding return value for <code><font color="blue">link_mat_mul</font></code> 
should be <code><font color="blue">false</font></code>.

<br/>
<br/>
<b><big><a name="n" id="n">n</a></big></b>
<br/>
The argument 
<code><i><font color="black"><span style='white-space: nowrap'>n</span></font></i></code>
 is the number of rows and columns
in the square matrix 
<code><i><font color="black"><span style='white-space: nowrap'>x</span></font></i></code>
.

<br/>
<br/>
<b><big><a name="repeat" id="repeat">repeat</a></big></b>
<br/>
The argument 
<code><i><font color="black"><span style='white-space: nowrap'>repeat</span></font></i></code>
 is the number of different argument values
that the derivative of 
<code><i><font color="black"><span style='white-space: nowrap'>z</span></font></i></code>
 (or just the value of 
<code><i><font color="black"><span style='white-space: nowrap'>z</span></font></i></code>
) 
will be computed. 

<br/>
<br/>
<b><big><a name="x" id="x">x</a></big></b>
<br/>
The argument 
<code><i><font color="black"><span style='white-space: nowrap'>x</span></font></i></code>
 is a vector with 

<code><i><font color="black"><span style='white-space: nowrap'>x</span></font></i><font color="blue"><span style='white-space: nowrap'>.size()&#xA0;=&#xA0;</span></font><i><font color="black"><span style='white-space: nowrap'>size</span></font></i><font color="blue"><span style='white-space: nowrap'>&#xA0;*&#xA0;</span></font><i><font color="black"><span style='white-space: nowrap'>size</span></font></i></code>
 elements.
The input value of its elements does not matter. 
The output value of its elements is the last random matrix
that is multiplied and then summed to form 
<code><i><font color="black"><span style='white-space: nowrap'>z</span></font></i></code>
;

<math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><mrow>
<msub><mi mathvariant='italic'>x</mi>
<mrow><mi mathvariant='italic'>i</mi>
<mo stretchy="false">,</mo>
<mi mathvariant='italic'>j</mi>
</mrow>
</msub>
<mo stretchy="false">=</mo>
<mi mathvariant='italic'>x</mi>
<mo stretchy="false">[</mo>
<mi mathvariant='italic'>i</mi>
<mo stretchy="false">*</mo>
<mi mathvariant='italic'>s</mi>
<mo stretchy="false">+</mo>
<mi mathvariant='italic'>j</mi>
<mo stretchy="false">]</mo>
</mrow></math>

where 
<code><i><font color="black"><span style='white-space: nowrap'>s</span></font></i><font color="blue"><span style='white-space: nowrap'>&#xA0;=&#xA0;</span></font><i><font color="black"><span style='white-space: nowrap'>size</span></font></i></code>
.

<br/>
<br/>
<b><big><a name="z" id="z">z</a></big></b>
<br/>
The argument 
<code><i><font color="black"><span style='white-space: nowrap'>z</span></font></i></code>
 is a vector with one element.
The input value of the element does not matter.
The output of its element the sum of the elements of 

<code><i><font color="black"><span style='white-space: nowrap'>y</span></font></i><font color="blue"><span style='white-space: nowrap'>&#xA0;=&#xA0;</span></font><i><font color="black"><span style='white-space: nowrap'>x</span></font></i><font color="blue"><span style='white-space: nowrap'>&#xA0;*&#xA0;</span></font><i><font color="black"><span style='white-space: nowrap'>x</span></font></i></code>
; i.e.,

<math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><mrow>
<mtable rowalign="center" ><mtr><mtd columnalign="right" >
<msub><mi mathvariant='italic'>y</mi>
<mrow><mi mathvariant='italic'>i</mi>
<mo stretchy="false">,</mo>
<mi mathvariant='italic'>j</mi>
</mrow>
</msub>
</mtd><mtd columnalign="center" >
<mo stretchy="false">=</mo>
</mtd><mtd columnalign="left" >
<munderover><mo displaystyle='true' largeop='true'>&#x02211;</mo>
<mrow><mi mathvariant='italic'>k</mi>
<mo stretchy="false">=</mo>
<mn>0</mn>
</mrow>
<mrow><mi mathvariant='italic'>s</mi>
<mn>-1</mn>
</mrow>
</munderover>
<msub><mi mathvariant='italic'>x</mi>
<mrow><mi mathvariant='italic'>i</mi>
<mo stretchy="false">,</mo>
<mi mathvariant='italic'>k</mi>
</mrow>
</msub>
<msub><mi mathvariant='italic'>x</mi>
<mrow><mi mathvariant='italic'>k</mi>
<mo stretchy="false">,</mo>
<mi mathvariant='italic'>j</mi>
</mrow>
</msub>
</mtd></mtr><mtr><mtd columnalign="right" >
<mi mathvariant='italic'>z</mi>
</mtd><mtd columnalign="center" >
<mo stretchy="false">=</mo>
</mtd><mtd columnalign="left" >
<munderover><mo displaystyle='true' largeop='true'>&#x02211;</mo>
<mrow><mi mathvariant='italic'>i</mi>
<mo stretchy="false">=</mo>
<mn>0</mn>
</mrow>
<mrow><mi mathvariant='italic'>s</mi>
<mn>-1</mn>
</mrow>
</munderover>
<munderover><mo displaystyle='true' largeop='true'>&#x02211;</mo>
<mrow><mi mathvariant='italic'>j</mi>
<mo stretchy="false">=</mo>
<mn>0</mn>
</mrow>
<mrow><mi mathvariant='italic'>s</mi>
<mn>-1</mn>
</mrow>
</munderover>
<msub><mi mathvariant='italic'>y</mi>
<mrow><mi mathvariant='italic'>i</mi>
<mo stretchy="false">,</mo>
<mi mathvariant='italic'>j</mi>
</mrow>
</msub>
</mtd></mtr></mtable>
</mrow></math>

<br/>
<b><big><a name="dz" id="dz">dz</a></big></b>
<br/>
The argument 
<code><i><font color="black"><span style='white-space: nowrap'>dz</span></font></i></code>
 is a vector with 

<code><i><font color="black"><span style='white-space: nowrap'>dz</span></font></i><font color="blue"><span style='white-space: nowrap'>.size()&#xA0;=&#xA0;</span></font><i><font color="black"><span style='white-space: nowrap'>size</span></font></i><font color="blue"><span style='white-space: nowrap'>&#xA0;*&#xA0;</span></font><i><font color="black"><span style='white-space: nowrap'>size</span></font></i></code>
.
The input values of its elements do not matter.
The output value of its elements form the
derivative of 
<code><i><font color="black"><span style='white-space: nowrap'>z</span></font></i></code>
 with respect to 
<code><i><font color="black"><span style='white-space: nowrap'>x</span></font></i></code>
.


<hr/>Input File: speed/src/link_mat_mul.cpp

</body>
</html>
