lines 7-85 of file: example/multi_thread/multi_atomic_three.cpp

{xrst_begin multi_atomic_three_user}
{xrst_spell
   iterate
}

Defines a atomic_three Operation that Computes Square Root
##########################################################

Syntax
******

   ``atomic_user`` *a_square_root*

*a_square_root* ( *au* , *ay* )

Purpose
*******
This atomic function operation computes a square root using Newton's method.
It is meant to be very inefficient in order to demonstrate timing results.

au
**
This argument has prototype

   ``const`` *ADvector* & *au*

where *ADvector* is a
:ref:`simple vector class<SimpleVector-name>` with elements
of type ``AD<double>`` .
The size of *au* is three.

num_itr
=======
We use the notation

   *num_itr* = ``size_t`` ( ``Integer`` ( *au* [0] ) )

for the number of Newton iterations in the computation of the square root
function.  The component *au* [0] must be a
:ref:`glossary@Parameter` .

y_initial
=========
We use the notation

   *y_initial* = *au* [1]

for the initial value of the Newton iterate.

y_squared
=========
We use the notation

   *y_squared* = *au* [2]

for the value we are taking the square root of.

ay
**
This argument has prototype

   *ADvector* & *ay*

The size of *ay* is one and
*ay* [0] is the square root of *y_squared* .

Limitations
***********
Only zero order forward mode is implements for the
``atomic_user`` class.

Source
******
{xrst_literal
   // BEGIN USER C++
   // END USER C++
}

{xrst_end multi_atomic_three_user}
