CppAD: A C++ Algorithmic Differentiation Package  20130102
compute_assign.hpp
Go to the documentation of this file.
00001 /* $Id$ */
00002 # ifndef CPPAD_COMPUTE_ASSIGN_INCLUDED
00003 # define CPPAD_COMPUTE_ASSIGN_INCLUDED
00004 
00005 /* --------------------------------------------------------------------------
00006 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-12 Bradley M. Bell
00007 
00008 CppAD is distributed under multiple licenses. This distribution is under
00009 the terms of the 
00010                     Eclipse Public License Version 1.0.
00011 
00012 A copy of this license is included in the COPYING file of this distribution.
00013 Please visit http://www.coin-or.org/CppAD/ for information on other licenses.
00014 -------------------------------------------------------------------------- */
00015 
00016 /*
00017 -------------------------------------------------------------------------------
00018 $begin compute_assign$$
00019 $spell
00020      Op
00021      VecAD
00022      const
00023 $$
00024 
00025 $section AD Computed Assignment Operators$$
00026 
00027 $index assignment, operator$$
00028 $index operator, assignment$$
00029 
00030 $index +, computed assignment$$
00031 $index add, computed assignment$$
00032 $index plus, computed assignment$$
00033 
00034 $index -, computed assignment$$
00035 $index subtract, computed assignment$$
00036 $index minus, computed assignment$$
00037 
00038 $index *, computed assignment$$
00039 $index multiply, computed assignment$$
00040 $index times, computed assignment$$
00041 
00042 $index /, computed assignment$$
00043 $index divide, computed assignment$$
00044 
00045 $head Syntax$$
00046 $icode%x% %Op% %y%$$
00047 
00048 $head Purpose$$
00049 Performs computed assignment operations 
00050 where either $icode x$$ has type 
00051 $codei%AD<%Base%>%$$.
00052 
00053 $head Op$$
00054 The operator $icode Op$$ is one of the following
00055 $table
00056 $bold Op$$  $cnext $bold Meaning$$ $rnext
00057 $code +=$$   $cnext $icode x$$ is assigned $icode x$$ plus $icode y$$ $rnext
00058 $code -=$$   $cnext $icode x$$ is assigned $icode x$$ minus $icode y$$ $rnext
00059 $code *=$$   $cnext $icode x$$ is assigned $icode x$$ times $icode y$$ $rnext
00060 $code /=$$   $cnext $icode x$$ is assigned $icode x$$ divided by $icode y$$ 
00061 $tend
00062 
00063 $head Base$$
00064 The type $icode Base$$ is determined by the operand $icode x$$.
00065 
00066 $head x$$
00067 The operand $icode x$$ has the following prototype
00068 $codei%
00069      AD<%Base%> &%x%
00070 %$$
00071 
00072 $head y$$
00073 The operand $icode y$$ has the following prototype
00074 $codei%
00075      const %Type% &%y%
00076 %$$
00077 where $icode Type$$ is
00078 $codei%VecAD<%Base%>::reference%$$,
00079 $codei%AD<%Base%>%$$,
00080 $icode Base$$, or
00081 $code double$$.
00082 
00083 $head Result$$
00084 $index assignment, multiple$$
00085 $index multiple, assignment$$
00086 The result of this assignment 
00087 can be used as a reference to $icode x$$.
00088 For example, if $icode z$$ has the following type
00089 $codei%
00090      AD<%Base%> %z%
00091 %$$
00092 then the syntax
00093 $codei%
00094      %z% = %x% += %y%
00095 %$$
00096 will compute $icode x$$ plus $icode y$$
00097 and then assign this value to both $icode x$$ and $icode z$$. 
00098 
00099 
00100 $head Operation Sequence$$
00101 This is an $cref/atomic/glossary/Operation/Atomic/$$
00102 $cref/AD of Base/glossary/AD of Base/$$ operation
00103 and hence it is part of the current
00104 AD of $icode Base$$ 
00105 $cref/operation sequence/glossary/Operation/Sequence/$$.
00106 
00107 $children%
00108      example/add_eq.cpp%
00109      example/sub_eq.cpp%
00110      example/mul_eq.cpp%
00111      example/div_eq.cpp
00112 %$$
00113 
00114 $head Example$$
00115 The following files contain examples and tests of these functions.
00116 Each test returns true if it succeeds and false otherwise.
00117 $table
00118 $rref AddEq.cpp$$
00119 $rref sub_eq.cpp$$
00120 $rref mul_eq.cpp$$
00121 $rref div_eq.cpp$$
00122 $tend
00123 
00124 $head Derivative$$
00125 If $latex f$$ and $latex g$$ are 
00126 $cref/Base functions/glossary/Base Function/$$
00127 
00128 $subhead Addition$$
00129 $latex \[
00130      \D{[ f(x) + g(x) ]}{x} = \D{f(x)}{x} + \D{g(x)}{x}
00131 \] $$
00132 
00133 $subhead Subtraction$$
00134 $latex \[
00135      \D{[ f(x) - g(x) ]}{x} = \D{f(x)}{x} - \D{g(x)}{x}
00136 \] $$
00137 
00138 $subhead Multiplication$$
00139 $latex \[
00140      \D{[ f(x) * g(x) ]}{x} = g(x) * \D{f(x)}{x} + f(x) * \D{g(x)}{x}
00141 \] $$
00142 
00143 $subhead Division$$
00144 $latex \[
00145      \D{[ f(x) / g(x) ]}{x} = 
00146           [1/g(x)] * \D{f(x)}{x} - [f(x)/g(x)^2] * \D{g(x)}{x}
00147 \] $$
00148 
00149 $end 
00150 -----------------------------------------------------------------------------
00151 */
00152 # include <cppad/local/add_eq.hpp>
00153 # include <cppad/local/sub_eq.hpp>
00154 # include <cppad/local/mul_eq.hpp>
00155 # include <cppad/local/div_eq.hpp>
00156 
00157 # endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines