Codebase list cppad / 4e7f905
Imported Upstream version 2016.00.00.1 Barak A. Pearlmutter 8 years ago
562 changed file(s) with 7831 addition(s) and 9628 deletion(s). Raw diff Collapse all Expand all
0 # $Id: CMakeLists.txt 3772 2015-12-31 14:01:01Z bradbell $
0 # $Id: CMakeLists.txt 3786 2016-02-08 13:14:26Z bradbell $
11 # -----------------------------------------------------------------------------
22 # CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33 #
1616 CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
1717
1818 # cppad_version is used by set_version.sh to get the version number.
19 SET(cppad_version "20160000.0" )
19 SET(cppad_version "20160000.1" )
2020 SET(cppad_url "http://www.coin-or.org/CppAD" )
2121 SET(cppad_description "Differentiation of C++ Algorithms" )
2222
142142 # sacado_prefix
143143 optional_package(sacado_prefix "sacado install prefix")
144144 # -----------------------------------------------------------------------------
145 # cppad_has_colpack, colpack_libs
145 # cppad_has_colpack, colpack_libs, cppad_lib
146146 #
147147 IF( colpack_prefix )
148148 SET(cppad_has_colpack 1)
149149 SET( colpack_libs "ColPack" )
150 SET( cppad_lib "cppad_lib" )
150151 ELSE( colpack_prefix )
151152 SET(cppad_has_colpack 0)
152153 SET( colpack_libs "" )
154 SET( cppad_lib "" )
153155 ENDIF( colpack_prefix )
154156 # =============================================================================
155157 # automated system configuration
287289 #
288290 ADD_SUBDIRECTORY(cppad)
289291 ADD_SUBDIRECTORY(pkgconfig)
290 ADD_SUBDIRECTORY(cppad_lib)
292 IF( colpack_prefix )
293 ADD_SUBDIRECTORY(cppad_lib)
294 ENDIF( colpack_prefix)
291295 #
292296 ADD_SUBDIRECTORY(compare_c)
293297 add_to_list(check_depends check_compare_c)
99 # A copy of this license is included in the COPYING file of this distribution.
1010 # Please visit http://www.coin-or.org/CppAD/ for information on other licenses.
1111 # -----------------------------------------------------------------------------
12 move_sed='s|list_files.sh|ls_files.sh|'
13 move_list='
14 '
15 cat << EOF > junk.sed
16 s|^# cppad_has_colpack, colpack_libs|&, cppad_lib|
17 s|^\\tSET( colpack_libs "ColPack" )|&\\
18 SET( cppad_lib "cppad_lib" )|
19 s|^\\tSET( colpack_libs "" )|&\\
20 SET( cppad_lib "" )|
21 s|^\\tcppad_lib\$|\\t\${cppad_lib}|
22 #
23 s|^ADD_SUBDIRECTORY(cppad_lib)|IF( colpack_prefix )\\
24 &\\
25 ENDIF( colpack_prefix)|
26 EOF
27 # -----------------------------------------------------------------------------
1228 if [ $0 != "bin/batch_edit.sh" ]
1329 then
1430 echo "bin/batch_edit.sh: must be executed from its parent directory"
1531 exit 1
1632 fi
17 # -----------------------------------------------------------------------------
18 # 1. With a few exceptions, move cppad/*.hpp to cppad/utility/*.hpp
19 # 2. Remove index commands that became redundant when the words in
20 # section, head, and subhead commands were automatically indexed.
21 # 3. Change include gaurd from CPPAD_<NAME>_INCLUDED to CPPAD_<NAME>_HPP
22 # 4. Make the source code control $Id$ commands more uniform.
23 # 5. Remove invisible white space
24 # 6. Create utility.hpp (includes entire utilty directory)
25 # 7. cppad/utility/CMakeLists.txt create deprecated include file links
2633 # -----------------------------------------------------------------------------
2734 # bash function that echos and executes a command
2835 echo_eval() {
3037 eval $*
3138 }
3239 # -----------------------------------------------------------------------------
33 #
40 cp bin/batch_edit.sh $HOME/trash/batch_edit.sh
3441 git reset --hard
42 cp $HOME/trash/batch_edit.sh bin/batch_edit.sh
3543 # ---------------------------------------------------------------------------
36 # cleanup from a previous run
37 #
38 list='
39 cppad/utility
40 cppad/utility.hpp
41 junk.sed
42 '
43 for name in $list
44 list_all=`git ls-files`
45 for file in $list_all
4446 do
45 if [ -e "$name" ]
47 if [ "$file" != 'bin/batch_edit.sh' ]
4648 then
47 echo_eval "rm -r $name"
49 echo_eval sed -f junk.sed -i $file
4850 fi
4951 done
50 echo_eval mkdir cppad/utility
51 # ---------------------------------------------------------------------------
52 # files that are hand edited
53 list='
54 add_copyright.sh
55 reduce_index.py
56 doxyfile.sh
57 batch_edit.sh
58 '
59 for file in $list
52 # ----------------------------------------------------------------------------
53 for old in $move_list
6054 do
61 echo_eval cp bin/new/$file bin/$file
62 done
63 chmod +x bin/batch_edit.sh
64 # ---------------------------------------------------------------------------
65 # cppad/*.hpp files, move to utility drectory
66 # except for cppad.hpp, configure.hpp, configure.hpp.in
67 #
68 list=`ls cppad/*.hpp | sed \
69 -e 's|cppad/||' \
70 -e '/cppad\.hpp/d' \
71 -e '/configure\.hpp/d' \
72 -e '/base_require.hpp/d' `
73 for file in $list
74 do
75 echo_eval git mv cppad/$file cppad/utility/$file
76 cat << EOF >> junk.sed
77 s|^# include <cppad/$file>|# include <cppad/utility/$file>|
78 s|^\\tcppad/$file%|\\tcppad/utility/$file%|
79 s|^\\tcppad/$file |\\tcppad/utility/$file |
80 s|^\\tcppad/$file\$|\\tcppad/utility/$file|
81 s|^\\t%cppad/$file\$|\\t%cppad/utility/$file|
82 s|%cppad/$file%|%cppad/utility/$file%|
83 EOF
84 done
85 # ---------------------------------------------------------------------------
86 # junk.sed
87 cat << EOF >> junk.sed
88 # fix double word errors inside of mindex commands
89 # that are created by reduce_index.py below
90 s|mindex SparseJacobian jacobian|mindex SparseJacobian|
91 s|index OdeErrControl control|index OdeErrControl|
92 s|mindex OdeGearControl control|mindex OdeGearControl|
93 s|mindex bool CppAD::vector vectorBool|mindex bool vectorBool|
94 s|mindex Bender BenderQuad|mindex BenderQuad|
95 s|mindex log log1p|mindex log1p|
96 #
97 # change include gaurd to more standard fom
98 # (works better when you have name.h and name.hpp)
99 s|# *ifndef *CPPAD_\\([A-Z0-9_]*\\)_INCLUDED|# ifndef CPPAD_\\1_HPP|
100 s|# *define *CPPAD_\\([A-Z0-9_]*\\)_INCLUDED|# define CPPAD_\\1_HPP|
101 #
102 # change source code control Id commands to be more iniform
103 s|^# \$Id[^\$]*\$\$|# \$Id\$|
104 s|^// \$Id[^\$]*\$\$|// \$Id\$|
105 s|^/\\* *\$Id[^\$]*\$ *\\*/\$|// \$Id\$|
106 EOF
107 # ----------------------------------------------------------------------------
108 list=`git ls-files | sed -n \
109 -e '/\.omh$/p' \
110 -e '/\.hpp$/p' \
111 -e '/\.hpp\.in$/p' \
112 -e '/\.cpp$/p' \
113 -e '/makefile.am$/p' \
114 `
115 for file in $list
116 do
117 # remove redundant index entries
118 bin/reduce_index.py $file
119 # see comments in junk.sed above
120 sed -f junk.sed -i $file
121 # remove invisible white space
122 sed -e 's|[ \t][ \t]*$||' -e 's| *\t|\t|g' -i $file
55 new=`echo $old | sed -e "$move_sed"`
56 echo_eval git mv $old $new
12357 done
12458 # ----------------------------------------------------------------------------
125 # move changes corresponding to new include gaurd
126 sed -e 's|_INCLUDED|_HPP|' -i bin/check_define.sh
127 sed -e 's|_INCLUDED|_HPP|' -i bin/check_include_def.sh
128 # ----------------------------------------------------------------------------
129 # create utility.hpp and
130 # change examples to use utility.hpp instead if individual include files
131 list=`ls cppad/utility/*.hpp`
132 for file in $list
133 do
134 echo "# include <$file>" >> cppad/utility.hpp
135 root=`echo $file | sed -e 's|.*/||'`
136 sed \
137 -e "s|$codei%# *include *<cppad/$root>|%# include <cppad/utility.hpp>|" \
138 -e "s|$code *# *include *<cppad/$root>|%# include <cppad/utility.hpp>|" \
139 -i $file
140 done
141 bin/add_copyright.sh cppad/utility.hpp
142 sed \
143 -e '1s/$/\n# ifndef CPPAD_UTILITY_HPP\n# define CPPAD_UTILITY_HPP/' \
144 -e '$s/$/\n# endif/' \
145 -i cppad/utility.hpp
146 git add cppad/utility.hpp
147 #
148 sed -e 's|\tcppad/base_require.hpp|\tcppad/utility.hpp\n&|' -i makefile.am
149 # ----------------------------------------------------------------------------
150 # use utility.hpp in cppad.hpp
151 sed \
152 -e '25,48d' \
153 -e '24s|$|\n# include <cppad/utility.hpp>|' \
154 -i cppad/cppad.hpp
155 # ----------------------------------------------------------------------------
156 # change examples and documentation to use utility.hpp
157 list=`git ls-files | sed -n \
158 -e '/\.omh$/p' \
159 -e '/^example\//p' \
160 -e '/^cppad_ipopt\/example\//p' \
161 `
162 for file in $list
163 do
164 sed \
165 -e 's|^# *include *<cppad/utility/[a-z_]*\.hpp>]*>|# include <cppad/utility.hpp>|' \
166 -i $file
167 done
168 # ----------------------------------------------------------------------------
169 # create cppad/utility/CMakeLists.txt and delete cppad/*.h
170 #
171 cmake_file='cppad/utility/CMakeLists.txt'
172 touch $cmake_file
173 bin/add_copyright.sh $cmake_file
174 echo "FOREACH(old_include_file" >> $cmake_file
175 #
176 list=`git ls-files cppad/utility/*.hpp`
177 for file in $list
178 do
179 name=`echo $file | sed -e 's|cppad/utility/||'`
180 echo " $name" >> $cmake_file
181 done
182 #
183 list=`git ls-files cppad/*.h`
184 for file in $list
185 do
186 name=`echo $file | sed -e 's|cppad/||'`
187 echo " $name" >> $cmake_file
188 git rm $file
189 done
190 cat << EOF >> $cmake_file
191 )
192 FILE(WRITE
193 \${CMAKE_BINARY_DIR}/cppad/utility/\${old_include_file}
194 "# include <cppad/utility.hpp>\\n"
195 )
196 ENDFOREACH(old_include_file)
197 EOF
198 git add $cmake_file
199 #
200 git checkout CMakeLists.txt
201 sed \
202 -e 's|ADD_SUBDIRECTORY(cppad_lib)|&\nADD_SUBDIRECTORY(cppad/utility)|' \
203 -e '329s|cppad/|${CMAKE_BINARY_DIR}/cppad/utility/|' \
204 -e '331,331d' \
205 -e '334s|cppad/|${CMAKE_SOURCE_DIR}/cppad/|' \
206 -i CMakeLists.txt
207 sed -e '/\tcppad\/.*\.h \\/d' -i makefile.am
59 # files that were hand edited and cached using 'git_new.sh to'
60 if [ -e new ]
61 then
62 echo_eval git_new.sh from
63 fi
20864 # ----------------------------------------------------------------------------
20965 echo "$0: OK"
21066 exit 0
00 #! /bin/bash -e
1 # $Id: check_all.sh 3770 2015-12-31 12:28:29Z bradbell $
1 # $Id: check_all.sh 3785 2016-02-08 12:53:06Z bradbell $
22 # -----------------------------------------------------------------------------
33 # CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
44 #
4747 fi
4848 top_srcdir=`pwd`
4949 echo "top_srcdir = $top_srcdir"
50 #
51 if ! random_zero_one=`expr $RANDOM % 2`
52 then
53 # expr exit status is 1 when the expression result is zero
54 # supress shell exit in this case
55 :
56 fi
57 echo "random_zero_one = $random_zero_one"
5058 # ---------------------------------------------------------------------------
5159 # circular shift program list and set program to first entry in list
5260 next_program() {
5462 program=`echo "$program_list" | sed -e 's| *\([^ ]*\).*|\1|'`
5563 }
5664 # ---------------------------------------------------------------------------
57 list="
58 $HOME/prefix/cppad
59 build
60 "
61 for name in $list
62 do
63 if [ -e "$name" ]
64 then
65 echo_log_eval rm -r $name
66 fi
67 done
68 random_zero_one=`expr $RANDOM % 2`
69 echo "random_zero_one = $random_zero_one"
65 if [ -e "$HOME/prefix/cppad" ]
66 then
67 echo_log_eval rm -r $HOME/prefix/cppad
68 fi
7069 # ---------------------------------------------------------------------------
7170 # Create package to run test in
7271 echo "bin/package.sh"
0 # $Id: makefile.am 2580 2012-11-17 22:01:48Z bradbell $
0 # $Id: makefile.am 3785 2016-02-08 12:53:06Z bradbell $
11 # -----------------------------------------------------------------------------
2 # CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-12 Bradley M. Bell
2 # CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33 #
44 # CppAD is distributed under multiple licenses. This distribution is under
5 # the terms of the
5 # the terms of the
66 # GNU General Public License Version 3.
77 #
88 # A copy of this license is included in the COPYING file of this distribution.
1010 # -----------------------------------------------------------------------------
1111 # automake input file
1212 # See ./CMakeLists.txt for specifications.
13 #
13 #
1414 BUILT_SOURCES = det_by_minor_c.c det_by_minor_cpp.cpp
1515 det_by_minor_c.c: det_by_minor.c
1616 cp $(srcdir)/det_by_minor.c det_by_minor_c.c
2323 # erase configures choice of flags
2424 DEFS =
2525 #
26 # AM_CXXFLAGS = -g
27 # AM_CFLAGS = -g
26 # AM_CXXFLAGS = -g
27 # AM_CFLAGS = -g
2828 #
29 AM_CXXFLAGS = -O2 -DNDEBUG
30 AM_CFLAGS = -O2 -DNDEBUG
29 AM_CXXFLAGS = -O2 -DNDEBUG
30 AM_CFLAGS = -O2 -DNDEBUG
3131 #
3232 check_PROGRAMS = det_by_minor_c det_by_minor_cpp
3333 #
00 #! /bin/sh
11 # Guess values for system-dependent variables and create Makefiles.
2 # Generated by GNU Autoconf 2.69 for cppad 20160000.0.
2 # Generated by GNU Autoconf 2.69 for cppad 20160000.1.
33 #
44 # Report bugs to <cppad@list.coin-or.org>.
55 #
579579 # Identity of this package.
580580 PACKAGE_NAME='cppad'
581581 PACKAGE_TARNAME='cppad'
582 PACKAGE_VERSION='20160000.0'
583 PACKAGE_STRING='cppad 20160000.0'
582 PACKAGE_VERSION='20160000.1'
583 PACKAGE_STRING='cppad 20160000.1'
584584 PACKAGE_BUGREPORT='cppad@list.coin-or.org'
585585 PACKAGE_URL=''
586586
14061406 # Omit some internal or obsolete options to make the list less imposing.
14071407 # This message is too long to be a string in the A/UX 3.1 sh.
14081408 cat <<_ACEOF
1409 \`configure' configures cppad 20160000.0 to adapt to many kinds of systems.
1409 \`configure' configures cppad 20160000.1 to adapt to many kinds of systems.
14101410
14111411 Usage: $0 [OPTION]... [VAR=VALUE]...
14121412
14761476
14771477 if test -n "$ac_init_help"; then
14781478 case $ac_init_help in
1479 short | recursive ) echo "Configuration of cppad 20160000.0:";;
1479 short | recursive ) echo "Configuration of cppad 20160000.1:";;
14801480 esac
14811481 cat <<\_ACEOF
14821482
16101610 test -n "$ac_init_help" && exit $ac_status
16111611 if $ac_init_version; then
16121612 cat <<\_ACEOF
1613 cppad configure 20160000.0
1613 cppad configure 20160000.1
16141614 generated by GNU Autoconf 2.69
16151615
16161616 Copyright (C) 2012 Free Software Foundation, Inc.
22392239 This file contains any messages produced by compilers while
22402240 running configure, to aid debugging if configure makes a mistake.
22412241
2242 It was created by cppad $as_me 20160000.0, which was
2242 It was created by cppad $as_me 20160000.1, which was
22432243 generated by GNU Autoconf 2.69. Invocation command line was
22442244
22452245 $ $0 $@
31293129
31303130 # Define the identity of the package.
31313131 PACKAGE='cppad'
3132 VERSION='20160000.0'
3132 VERSION='20160000.1'
31333133
31343134
31353135 cat >>confdefs.h <<_ACEOF
85818581 # report actual input values of CONFIG_FILES etc. instead of their
85828582 # values after options handling.
85838583 ac_log="
8584 This file was extended by cppad $as_me 20160000.0, which was
8584 This file was extended by cppad $as_me 20160000.1, which was
85858585 generated by GNU Autoconf 2.69. Invocation command line was
85868586
85878587 CONFIG_FILES = $CONFIG_FILES
86388638 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
86398639 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
86408640 ac_cs_version="\\
8641 cppad config.status 20160000.0
8641 cppad config.status 20160000.1
86428642 configured by $0, generated by GNU Autoconf 2.69,
86438643 with options \\"\$ac_cs_config\\"
86448644
0 dnl $Id: configure.ac 3772 2015-12-31 14:01:01Z bradbell $
0 dnl $Id: configure.ac 3786 2016-02-08 13:14:26Z bradbell $
11 dnl ---------------------------------------------------------------------------
22 dnl CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33 dnl
1111 dnl
1212 dnl Process this file with autoconf to produce a configure script.
1313 dnl package version bug-report
14 AC_INIT([cppad], [20160000.0], [cppad@list.coin-or.org])
14 AC_INIT([cppad], [20160000.1], [cppad@list.coin-or.org])
1515 AM_SILENT_RULES([yes])
1616
1717 dnl By defalut disable maintainer mode when running configure;
0 # $Id: CMakeLists.txt 3754 2015-11-26 22:23:05Z bradbell $
0 # $Id: CMakeLists.txt 3785 2016-02-08 12:53:06Z bradbell $
11 # -----------------------------------------------------------------------------
22 # CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33 #
4343 # List of libraries to be linked into the specified target
4444 TARGET_LINK_LIBRARIES(cppad_ipopt_example
4545 cppad_ipopt
46 cppad_lib
46 ${cppad_lib}
4747 ${ipopt_LIBRARIES}
4848 ${colpack_libs}
4949 )
0 /* $Id: example.cpp 2506 2012-10-24 19:36:49Z bradbell $ */
0 // $Id: example.cpp 3785 2016-02-08 12:53:06Z bradbell $
11 /* --------------------------------------------------------------------------
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-12 Bradley M. Bell
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33
44 CppAD is distributed under multiple licenses. This distribution is under
5 the terms of the
5 the terms of the
66 GNU General Public License Version 3.
77
88 A copy of this license is included in the COPYING file of this distribution.
5050 ok &= Run( ipopt_get_started, "ipopt_get_started" );
5151 ok &= Run( ode_simple_check, "ode_simple_check" );
5252 ok &= Run( ode_fast_check, "ode_fast_check" );
53
53
5454 // check for errors
5555 using std::cout;
5656 using std::endl;
0 # $Id: makefile.am 2683 2012-12-30 18:17:03Z bradbell $
0 # $Id: makefile.am 3785 2016-02-08 12:53:06Z bradbell $
11 # -----------------------------------------------------------------------------
2 # CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-12 Bradley M. Bell
2 # CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33 #
44 # CppAD is distributed under multiple licenses. This distribution is under
5 # the terms of the
5 # the terms of the
66 # GNU General Public License Version 3.
77 #
88 # A copy of this license is included in the COPYING file of this distribution.
1919 #
2020 check_PROGRAMS = example
2121 #
22 AM_CXXFLAGS = -g $(CXX_FLAGS)
22 AM_CXXFLAGS = -g $(CXX_FLAGS)
2323 #
2424 AM_CPPFLAGS = -I. \
2525 -I$(top_srcdir) \
3434 $(FCLIBS) \
3535 $(PTHREAD_LIB) \
3636 $(DL_LIB)
37 AM_LDFLAGS = -L../src
37 AM_LDFLAGS = -L../src
3838 #
3939 example_SOURCES = \
4040 example.cpp \
0 $Id: ode1.omh 2683 2012-12-30 18:17:03Z bradbell $
0 $Id: ode1.omh 3785 2016-02-08 12:53:06Z bradbell $
11 /* --------------------------------------------------------------------------
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-12 Bradley M. Bell
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33
44 CppAD is distributed under multiple licenses. This distribution is under
5 the terms of the
5 the terms of the
66 GNU General Public License Version 3.
77
88 A copy of this license is included in the COPYING file of this distribution.
1717 cppad_ipopt/example/ode_run.hpp%
1818 cppad_ipopt/example/ode_check.cpp
1919 %$$
20
20
2121
2222 $end
0 /* $Id: ode_check.cpp 3623 2015-01-29 11:42:49Z bradbell $ */
0 // $Id: ode_check.cpp 3785 2016-02-08 12:53:06Z bradbell $
11 /* --------------------------------------------------------------------------
22 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33
44 CppAD is distributed under multiple licenses. This distribution is under
5 the terms of the
5 the terms of the
66 GNU General Public License Version 3.
77
88 A copy of this license is included in the COPYING file of this distribution.
4747 { y_0[j] = x[j];
4848 y_1[j] = x[Ny + j];
4949 y_2[j] = x[2 * Ny + j];
50 }
50 }
5151
5252 // Check some of the optimal a value
5353 Number rel_tol = max_step * max_step;
5555 Number check_a[] = {a0, a1, a2}; // see the y_one function
5656 for(j = 0; j < Na; j++)
5757 {
58 ok &= CppAD::NearEqual(
58 ok &= CppAD::NearEqual(
5959 check_a[j], a[j], rel_tol, abs_tol
6060 );
6161 }
0 /* $Id: ode_fast_check.cpp 2506 2012-10-24 19:36:49Z bradbell $ */
0 // $Id: ode_fast_check.cpp 3785 2016-02-08 12:53:06Z bradbell $
11 /* --------------------------------------------------------------------------
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-10 Bradley M. Bell
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33
44 CppAD is distributed under multiple licenses. This distribution is under
5 the terms of the
5 the terms of the
66 GNU General Public License Version 3.
77
88 A copy of this license is included in the COPYING file of this distribution.
3131 ipopt_ode_case<FG_fast>(retape, N, x);
3232 ok &= ode_check(N, x);
3333 }
34
34
3535 return ok;
3636 }
0 /* $Id: ode_simple_check.cpp 2506 2012-10-24 19:36:49Z bradbell $ */
0 // $Id: ode_simple_check.cpp 3785 2016-02-08 12:53:06Z bradbell $
11 /* --------------------------------------------------------------------------
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-10 Bradley M. Bell
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33
44 CppAD is distributed under multiple licenses. This distribution is under
5 the terms of the
5 the terms of the
66 GNU General Public License Version 3.
77
88 A copy of this license is included in the COPYING file of this distribution.
3131 ipopt_ode_case<FG_simple>(retape, N, x);
3232 ok &= ode_check(N, x);
3333 }
34
34
3535 return ok;
3636 }
0 # $Id: CMakeLists.txt 3754 2015-11-26 22:23:05Z bradbell $
0 # $Id: CMakeLists.txt 3785 2016-02-08 12:53:06Z bradbell $
11 # -----------------------------------------------------------------------------
22 # CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33 #
4444 TARGET_LINK_LIBRARIES(
4545 cppad_ipopt_speed
4646 cppad_ipopt
47 cppad_lib
47 ${cppad_lib}
4848 ${ipopt_LIBRARIES}
4949 ${colpack_libs}
5050 )
0 # $Id: makefile.am 2506 2012-10-24 19:36:49Z bradbell $
0 # $Id: makefile.am 3785 2016-02-08 12:53:06Z bradbell $
11 # -----------------------------------------------------------------------------
2 # CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-12 Bradley M. Bell
2 # CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33 #
44 # CppAD is distributed under multiple licenses. This distribution is under
5 # the terms of the
5 # the terms of the
66 # GNU General Public License Version 3.
77 #
88 # A copy of this license is included in the COPYING file of this distribution.
1616 EXTRA_DIST = test.sh.in
1717 #
1818 check_PROGRAMS = speed
19 #
19 #
2020 # BEGIN OPTIMIZE
2121 AM_CXXFLAGS = -O2 -DNDEBUG $(CXX_FLAGS)
2222 # END OPTIMIZE
3737 $(FCLIBS) \
3838 $(PTHREAD_LIB) \
3939 $(DL_LIB)
40 AM_LDFLAGS = -L../src
40 AM_LDFLAGS = -L../src
4141 #
4242 # Cannot use ../src/libcppad_ipopt.a becasue it is compiled for debugging
43 # so build an optimized version here to use here.
43 # so build an optimized version here to use here.
4444 speed_SOURCES = \
4545 speed.cpp \
4646 ../src/cppad_ipopt_nlp.cpp \
4949 ../src/jac_g_map.cpp \
5050 ../src/sparse_map2vec.cpp \
5151 ../src/vec_fun_pattern.cpp \
52 ode_speed.cpp
52 ode_speed.cpp
5353
5454 test: check
5555 ./test.sh
0 /* $Id: ode_speed.cpp 2769 2013-03-05 14:28:47Z bradbell $ */
0 // $Id: ode_speed.cpp 3785 2016-02-08 12:53:06Z bradbell $
11 /* --------------------------------------------------------------------------
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-13 Bradley M. Bell
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33
44 CppAD is distributed under multiple licenses. This distribution is under
5 the terms of the
5 the terms of the
66 GNU General Public License Version 3.
77
88 A copy of this license is included in the COPYING file of this distribution.
0 /* $Id: speed.cpp 2506 2012-10-24 19:36:49Z bradbell $ */
0 // $Id: speed.cpp 3785 2016-02-08 12:53:06Z bradbell $
11 /* --------------------------------------------------------------------------
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-11 Bradley M. Bell
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33
44 CppAD is distributed under multiple licenses. This distribution is under
5 the terms of the
5 the terms of the
66 GNU General Public License Version 3.
77
88 A copy of this license is included in the COPYING file of this distribution.
2424
2525 name = "simple_retape_yes";
2626 seconds = ode_speed(name, count);
27 printf("ode %20s: seconds = %5.2f: eval_r_count = %d\n",
27 printf("ode %20s: seconds = %5.2f: eval_r_count = %d\n",
2828 name, seconds, int(count) );
2929
3030 name = "simple_retape_no";
4141 seconds = ode_speed(name, count);
4242 printf("ode %20s: seconds = %5.2f: eval_r_count = %d\n",
4343 name, seconds, int(count) );
44
44
4545 return 0;
4646 }
0 /* $Id: hes_fg_map.cpp 3223 2014-03-19 15:13:26Z bradbell $ */
0 // $Id: hes_fg_map.cpp 3785 2016-02-08 12:53:06Z bradbell $
11 /* --------------------------------------------------------------------------
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-14 Bradley M. Bell
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33
44 CppAD is distributed under multiple licenses. This distribution is under
5 the terms of the
5 the terms of the
66 GNU General Public License Version 3.
77
88 A copy of this license is included in the COPYING file of this distribution.
1717 /*!
1818 \{
1919 \file hes_fg_map.cpp
20 \brief Creates a mapping between two representations for Hessian of fg.
20 \brief Creates a mapping between two representations for Hessian of fg.
2121 */
2222
2323
2424 /*!
2525 Create mapping from CppAD to Ipopt sparse representations of Hessian of F(x).
2626
27 The functions
27 The functions
2828 \f$ f : {\bf R}^n \rightarrow {\bf R} \f$ and
29 \f$ g : {\bf R}^n \rightarrow {\bf R}^m \f$ are defined by the
29 \f$ g : {\bf R}^n \rightarrow {\bf R}^m \f$ are defined by the
3030 \ref Users_Representation.
31 We define the function
31 We define the function
3232 \f$ F : {\bf R}^n \rightarrow {\bf R} \f$ by
3333 \f[
3434 F(x) = \sum_{i=0}^m fg(x)_i
3737 \param fg_info
3838 For <tt>k = 0 , ... , K-1</tt>,
3939 for <tt>ell = 0 , ... , L[k]</tt>,
40 the function call
40 the function call
4141 \verbatim
42 fg_info->index(k, ell, I, J);
42 fg_info->index(k, ell, I, J);
4343 \endverbatim
44 is made by \c hes_fg_map.
44 is made by \c hes_fg_map.
4545 The values \c k and \c ell are inputs.
46 The input size of \c I ( \c J )
46 The input size of \c I ( \c J )
4747 is greater than or equal <tt>p[k] ( q[k] )</tt>
4848 and this size is not changed.
4949 The input values of the elements of \c I and \c J are not specified.
6565 i.e., \f$ x \in {\bf R}^n \f$.
6666
6767 \param K
68 is the number of functions \f$ r_k ( u ) \f$ used for the representation of
68 is the number of functions \f$ r_k ( u ) \f$ used for the representation of
6969 \f$ f(x) \f$ and \f$ g(x) \f$.
7070
7171 \param L
8989 \param pattern_hes_r
9090 is a vector with size \c K.
9191 For <tt>k = 0 , ... , K-1, pattern_jac_r[k]</tt>
92 is a CppAD sparsity pattern for the Hessian of the function
92 is a CppAD sparsity pattern for the Hessian of the function
9393 \f[
9494 R(u) = \sum_{i=0}^{p[k]-1} r_k (u)_i
9595 \f]
107107
108108 \param index_hes_fg:
109109 On input, this is empty; i.e., <tt>index_jac_g.size() == 0</tt>.
110 On output, it is the index mapping from \f$ (i, j) \f$ in the Jacobian of
110 On output, it is the index mapping from \f$ (i, j) \f$ in the Jacobian of
111111 \f$ g(x) \f$ to the corresponding index value used by Ipopt to represent
112112 the Jacobian.
113113 Furthermore, if <tt>index_jac_g[i].find(j) == index_jac_g[i].end()</tt>,
114114 then the \f$ (i, j)\f$ entry in the Jacobian of \f$ g(x) \f$ is always zero.
115115 */
116116 void hes_fg_map(
117 cppad_ipopt_fg_info* fg_info ,
117 cppad_ipopt_fg_info* fg_info ,
118118 size_t m ,
119119 size_t n ,
120120 size_t K ,
140140 CPPAD_ASSERT_UNKNOWN( q[k]*q[k] == pattern_hes_r[k].size() );
141141 }
142142 # endif
143
143
144144 // Now compute pattern for fg
145145 // (use standard set representation because can be huge).
146146 CppAD::vector< std::set<size_t> > pattern_hes_fg(n);
147147 for(k = 0; k < K; k++) for(ell = 0; ell < L[k]; ell++)
148 { fg_info->index(k, ell, I, J);
149 for(i = 0; i < q[k]; i++)
148 { fg_info->index(k, ell, I, J);
149 for(i = 0; i < q[k]; i++)
150150 { for(j = 0; j < q[k]; j++)
151151 { ij = i * q[k] + j;
152152 if( pattern_hes_r[k][ij] )
155155 }
156156 }
157157
158 // Now compute the mapping from (i, j) in the Hessian of fg to the
158 // Now compute the mapping from (i, j) in the Hessian of fg to the
159159 // corresponding index value used by Ipopt to represent the Hessian.
160160 CPPAD_ASSERT_UNKNOWN( index_hes_fg.size() == 0 );
161161 index_hes_fg.resize(n);
162162 std::set<size_t>::const_iterator itr;
163163 ell = 0;
164164 for(i = 0; i < n; i++)
165 { for( itr = pattern_hes_fg[i].begin();
165 { for( itr = pattern_hes_fg[i].begin();
166166 itr != pattern_hes_fg[i].end(); itr++)
167167 {
168168 index_hes_fg[i][*itr] = ell++;
0 /* $Id: jac_g_map.cpp 3223 2014-03-19 15:13:26Z bradbell $ */
0 // $Id: jac_g_map.cpp 3785 2016-02-08 12:53:06Z bradbell $
11 /* --------------------------------------------------------------------------
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-14 Bradley M. Bell
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33
44 CppAD is distributed under multiple licenses. This distribution is under
5 the terms of the
5 the terms of the
66 GNU General Public License Version 3.
77
88 A copy of this license is included in the COPYING file of this distribution.
1616 /*!
1717 \{
1818 \file jac_g_map.cpp
19 \brief Creates a mapping between two representations for Jacobian of g.
19 \brief Creates a mapping between two representations for Jacobian of g.
2020 */
2121
2222
2323 /*!
2424 Create mapping from CppAD to Ipopt sparse representations of Jacobian of g.
2525
26 The functions
26 The functions
2727 \f$ f : {\bf R}^n \rightarrow {\bf R} \f$ and
2828 \f$ g : {\bf R}^n \rightarrow {\bf R}^m \f$ are defined by
2929 the \ref Users_Representation.
3131 \param fg_info
3232 For <tt>k = 0 , ... , K-1</tt>,
3333 for <tt>ell = 0 , ... , L[k]</tt>,
34 the function call
34 the function call
3535 \verbatim
36 fg_info->index(k, ell, I, J);
36 fg_info->index(k, ell, I, J);
3737 \endverbatim
38 is made by \c jac_g_map.
38 is made by \c jac_g_map.
3939 The values \c k and \c ell are inputs.
40 The input size of \c I ( \c J )
40 The input size of \c I ( \c J )
4141 is greater than or equal <tt>p[k] ( q[k] )</tt>
4242 and this size is not changed.
4343 The input values of the elements of \c I and \c J are not specified.
5959 i.e., \f$ x \in {\bf R}^n \f$.
6060
6161 \param K
62 is the number of functions \f$ r_k ( u ) \f$ used for the representation of
62 is the number of functions \f$ r_k ( u ) \f$ used for the representation of
6363 \f$ f(x) \f$ and \f$ g(x) \f$.
6464
6565 \param L
8383 \param pattern_jac_r
8484 is a vector with size \c K.
8585 For <tt>k = 0 , ... , K-1, pattern_jac_r[k]</tt>
86 is a CppAD sparsity pattern for the Jacobian of the function
86 is a CppAD sparsity pattern for the Jacobian of the function
8787 \f$ r_k : {\bf R}^{q(k)} \rightarrow {\bf R}^{p(k)} \f$.
8888 As such, <tt>pattern_jac_r[k].size() == p[k] * q[k]</tt>.
8989
9999
100100 \param index_jac_g:
101101 On input, this is empty; i.e., <tt>index_jac_g.size() == 0</tt>.
102 On output, it is the index mapping from \f$ (i, j) \f$ in the Jacobian of
102 On output, it is the index mapping from \f$ (i, j) \f$ in the Jacobian of
103103 \f$ g(x) \f$ to the corresponding index value used by Ipopt to represent
104104 the Jacobian.
105105 Furthermore, if <tt>index_jac_g[i].find(j) == index_jac_g[i].end()</tt>,
106106 then the \f$ (i, j)\f$ entry in the Jacobian of \f$ g(x) \f$ is always zero.
107107 */
108108 void jac_g_map(
109 cppad_ipopt_fg_info* fg_info ,
109 cppad_ipopt_fg_info* fg_info ,
110110 size_t m ,
111111 size_t n ,
112112 size_t K ,
136136 // (use standard set representation because can be huge).
137137 CppAD::vector< std::set<size_t> > pattern_jac_g(m);
138138 for(k = 0; k < K; k++) for(ell = 0; ell < L[k]; ell++)
139 { fg_info->index(k, ell, I, J);
139 { fg_info->index(k, ell, I, J);
140140 for(i = 0; i < p[k]; i++) if( I[i] != 0 )
141141 { for(j = 0; j < q[k]; j++)
142142 { ij = i * q[k] + j;
146146 }
147147 }
148148
149 // Now compute the mapping from (i, j) in the Jacobian of g to the
149 // Now compute the mapping from (i, j) in the Jacobian of g to the
150150 // corresponding index value used by Ipopt to represent the Jacobian.
151151 CPPAD_ASSERT_UNKNOWN( index_jac_g.size() == 0 );
152152 index_jac_g.resize(m);
153153 std::set<size_t>::const_iterator itr;
154154 ell = 0;
155155 for(i = 0; i < m; i++)
156 { for( itr = pattern_jac_g[i].begin();
156 { for( itr = pattern_jac_g[i].begin();
157157 itr != pattern_jac_g[i].end(); itr++)
158158 {
159159 index_jac_g[i][*itr] = ell++;
0 # $Id: makefile.am 2683 2012-12-30 18:17:03Z bradbell $
0 # $Id: makefile.am 3785 2016-02-08 12:53:06Z bradbell $
11 # -----------------------------------------------------------------------------
2 # CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-12 Bradley M. Bell
2 # CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33 #
44 # CppAD is distributed under multiple licenses. This distribution is under
5 # the terms of the
5 # the terms of the
66 # GNU General Public License Version 3.
77 #
88 # A copy of this license is included in the COPYING file of this distribution.
1414 DEFS =
1515 #
1616 #
17 AM_CXXFLAGS = -g $(CXX_FLAGS)
17 AM_CXXFLAGS = -g $(CXX_FLAGS)
1818 #
1919 AM_CPPFLAGS = \
2020 -I. \
3737 sparse_map2vec.cpp \
3838 sparse_map2vec.hpp \
3939 vec_fun_pattern.cpp \
40 vec_fun_pattern.hpp
40 vec_fun_pattern.hpp
4141 endif
0 /* $Id: sparse_map2vec.cpp 3223 2014-03-19 15:13:26Z bradbell $ */
0 // $Id: sparse_map2vec.cpp 3785 2016-02-08 12:53:06Z bradbell $
11 /* --------------------------------------------------------------------------
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-14 Bradley M. Bell
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33
44 CppAD is distributed under multiple licenses. This distribution is under
5 the terms of the
5 the terms of the
66 GNU General Public License Version 3.
77
88 A copy of this license is included in the COPYING file of this distribution.
0 /* $Id: vec_fun_pattern.cpp 3223 2014-03-19 15:13:26Z bradbell $ */
0 // $Id: vec_fun_pattern.cpp 3785 2016-02-08 12:53:06Z bradbell $
11 /* --------------------------------------------------------------------------
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-14 Bradley M. Bell
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33
44 CppAD is distributed under multiple licenses. This distribution is under
5 the terms of the
5 the terms of the
66 GNU General Public License Version 3.
77
88 A copy of this license is included in the COPYING file of this distribution.
6666 On input, For <tt>k = 0 , ... , K-1, pattern_jac_r[k]</tt>
6767 is a vector of length p[k] * q[k]
6868 and the value of its elements does not matter.
69 On output it is a CppAD sparsity pattern for the Jacobian of
69 On output it is a CppAD sparsity pattern for the Jacobian of
7070 \f$ r_k (u) \f$.
7171
7272 \param pattern_hes_r
7474 On input, For <tt>k = 0 , ... , K-1, pattern_hes_r[k]</tt>
7575 is a vector of length q[k] * q[k]
7676 and the value of its elements does not matter.
77 On output it is a CppAD sparsity pattern for the Hessian of
77 On output it is a CppAD sparsity pattern for the Hessian of
7878 \f$ R : {\bf R}^{q[k]} \rightarrow {\bf R} \f$ which is defined by
7979 \f[
8080 R(u) = \sum_{i=0}^{p[k]-1} r_k (u)_i
107107 if( retape[k] )
108108 { for(i = 0; i < p[k]; i++)
109109 { for(j = 0; j < q[k]; j++)
110 pattern_jac_r[k][i*q[k] + j] = true;
110 pattern_jac_r[k][i*q[k] + j] = true;
111111 }
112112 for(i = 0; i < q[k]; i++)
113113 { for(j = 0; j < q[k]; j++)
114 pattern_hes_r[k][i*q[k] + j] = true;
114 pattern_hes_r[k][i*q[k] + j] = true;
115115 }
116116 }
117 else
117 else
118118 { // check assumptions about r_k
119119 CPPAD_ASSERT_UNKNOWN( r_fun[k].Range() == p[k] );
120120 CPPAD_ASSERT_UNKNOWN( r_fun[k].Domain() == q[k] );
122122 // pattern for the identity matrix
123123 CppAD::vectorBool pattern_domain(q[k] * q[k]);
124124 for(i = 0; i < q[k]; i++)
125 { for(j = 0; j < q[k]; j++)
125 { for(j = 0; j < q[k]; j++)
126126 pattern_domain[i*q[k] + j] = (i == j);
127127 }
128128 // use forward mode to compute Jacobian sparsity
129 pattern_jac_r[k] =
129 pattern_jac_r[k] =
130130 r_fun[k].ForSparseJac(q[k], pattern_domain);
131131 // user reverse mode to compute Hessian sparsity
132132 CppAD::vectorBool pattern_ones(p[k]);
0 # $Id: CMakeLists.txt 3754 2015-11-26 22:23:05Z bradbell $
0 # $Id: CMakeLists.txt 3785 2016-02-08 12:53:06Z bradbell $
11 # -----------------------------------------------------------------------------
22 # CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33 #
3535 # List of libraries to be linked into the specified target
3636 TARGET_LINK_LIBRARIES(cppad_ipopt_test
3737 cppad_ipopt
38 cppad_lib
38 ${cppad_lib}
3939 ${ipopt_LIBRARIES}
4040 ${colpack_libs}
4141 )
0 # $Id: makefile.am 2506 2012-10-24 19:36:49Z bradbell $
0 # $Id: makefile.am 3785 2016-02-08 12:53:06Z bradbell $
11 # -----------------------------------------------------------------------------
2 # CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-12 Bradley M. Bell
2 # CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33 #
44 # CppAD is distributed under multiple licenses. This distribution is under
5 # the terms of the
5 # the terms of the
66 # GNU General Public License Version 3.
77 #
88 # A copy of this license is included in the COPYING file of this distribution.
1717 #
1818 check_PROGRAMS = test_more
1919 #
20 AM_CXXFLAGS = -g $(CXX_FLAGS)
20 AM_CXXFLAGS = -g $(CXX_FLAGS)
2121 #
2222 AM_CPPFLAGS = -I. \
2323 -I$(top_srcdir) \
3232 $(FCLIBS) \
3333 $(PTHREAD_LIB) \
3434 $(DL_LIB)
35 AM_LDFLAGS = -L../src
35 AM_LDFLAGS = -L../src
3636 #
3737 test_more_SOURCES = \
3838 test_more.cpp \
0 /* $Id: multiple_solution.cpp 2896 2013-09-17 21:23:55Z bradbell $ */
0 // $Id: multiple_solution.cpp 3785 2016-02-08 12:53:06Z bradbell $
11 /* --------------------------------------------------------------------------
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-13 Bradley M. Bell
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33
44 CppAD is distributed under multiple licenses. This distribution is under
5 the terms of the
5 the terms of the
66 GNU General Public License Version 3.
77
88 A copy of this license is included in the COPYING file of this distribution.
4141 size_t domain_size(size_t k)
4242 { size_t q;
4343 switch(k)
44 { case 0: q = 1; break;
44 { case 0: q = 1; break;
4545 default: assert(0);
4646 }
4747 return q;
8080 {
8181 assert( u.size() == 1 );
8282 ADVector r(1);
83 r[0] = u[0] ;
83 r[0] = u[0] ;
8484 return r;
8585 }
8686 };
9292 // number of independent variables (domain dimension for f and g)
9393 size_t n = 2;
9494 // number of constraints (range dimension for g)
95 size_t m = 2;
95 size_t m = 2;
9696 // initial value of the independent variables
9797 NumberVector x_i(n);
9898 NumberVector x_l(n);
0 /* $Id: test_more.cpp 2506 2012-10-24 19:36:49Z bradbell $ */
0 // $Id: test_more.cpp 3785 2016-02-08 12:53:06Z bradbell $
11 /* --------------------------------------------------------------------------
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-12 Bradley M. Bell
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33
44 CppAD is distributed under multiple licenses. This distribution is under
5 the terms of the
5 the terms of the
66 GNU General Public License Version 3.
77
88 A copy of this license is included in the COPYING file of this distribution.
5252 ok &= Run( multiple_solution, "multiple_solution" );
5353 ok &= Run( retape_k1_l1, "retape_k1_l1" );
5454 ok &= Run( retape_k1_l2, "retape_k1_l2" );
55
55
5656 // check for errors
5757 using std::cout;
5858 using std::endl;
99 # Please visit http://www.coin-or.org/CppAD/ for information on other licenses.
1010 # -----------------------------------------------------------------------------
1111 # Build and install the cppad_lib shared library
12
12 #
13 # string(REGEX REPLACE <regular_expression>
14 # <replace_expression> <output variable>
15 # <input> [<input>...])
16 #
17 # (year - 2000) dot (remove leading 0 from mmdd) dot (release)
18 # Note that the dot (release) is optional
19 # Also name that when mmdd is 0000 get (year - 2000) dot dot (release)
20 STRING(REGEX REPLACE
21 "20([0-9][0-9])0*([0-9]*)([.]?[0-9]*)"
22 "\\1.\\2\\3"
23 soversion
24 ${cppad_version}
25 )
26 # In case where mmdd is 0000, dot (release) is present. Convert to
27 # (year - 2000) dot 0 dot (release)
28 STRING(REGEX REPLACE
29 "([.][.])"
30 ".0."
31 soversion
32 ${soversion}
33 )
34 MESSAGE(STATUS "soversion=${soversion}")
35 #
1336 # add_library(<name> [STATIC | SHARED | MODULE] [EXCLUDE_FROM_ALL]
1437 # source1 source2 ... sourceN)
1538 # )
1639 ADD_LIBRARY( cppad_lib SHARED
1740 cppad_colpack.cpp
1841 )
19
20 # Add extra compiler flags
21 add_cppad_cxx_flags( cppad_lib )
22
42 # set_target_properties(target1 target2 ...
43 # PROPERTIES prop1 value1 prop2 value2 ...)
44 SET_TARGET_PROPERTIES( cppad_lib PROPERTIES SOVERSION ${soversion} )
45 #
2346 # install(TARGETS myExe mySharedLib myStaticLib
2447 # RUNTIME DESTINATION bin
2548 # LIBRARY DESTINATION lib
6363 onmouseover='MouseOver(1)'
6464 onmouseout='MouseOut(1)'
6565 ><img src='_close.gif' name='folder1' align='middle' />
66 <u>cppad-20160000.0: A Package for Differentiation of C++ Algorithms</u></a>
66 <u>cppad-20160000.1: A Package for Differentiation of C++ Algorithms</u></a>
6767
6868 <span id='children1'>
69 <br/><a href="cppad.xml" target="_top">cppad-20160000.0: A Package for Differentiation of C++ Algorithms</a>
69 <br/><a href="cppad.xml" target="_top">cppad-20160000.1: A Package for Differentiation of C++ Algorithms</a>
7070
7171 <br/>&#xA0;&#xA0;&#xA0;&#xA0;<a href="_contents_xml.htm" target="_top">Table of Contents</a>
7272
173173
174174 <tr valign="top"><td><a href="http://www.coin-or.org/download/source/CppAD/" target="_top">http://www.coin-or.org/download/source/CppAD/</a></td><td><a href="whats_new_09.xml#06-25" target="_top">whats_new_09#06-25</a></td></tr>
175175
176 <tr valign="top"><td><a href="http://www.coin-or.org/download/source/CppAD/cppad-20160000.0.epl.tgz" target="_top">http://www.coin-or.org/download/source/CppAD/cppad-20160000.0.epl.tgz</a></td><td><a href="download.xml#Compressed Archives" target="_top">download#Compressed Archives</a></td></tr>
177
178 <tr valign="top"><td><a href="http://www.coin-or.org/download/source/CppAD/cppad-20160000.0.gpl.tgz" target="_top">http://www.coin-or.org/download/source/CppAD/cppad-20160000.0.gpl.tgz</a></td><td><a href="download.xml#Compressed Archives" target="_top">download#Compressed Archives</a></td></tr>
176 <tr valign="top"><td><a href="http://www.coin-or.org/download/source/CppAD/cppad-20160000.1.epl.tgz" target="_top">http://www.coin-or.org/download/source/CppAD/cppad-20160000.1.epl.tgz</a></td><td><a href="download.xml#Compressed Archives" target="_top">download#Compressed Archives</a></td></tr>
177
178 <tr valign="top"><td><a href="http://www.coin-or.org/download/source/CppAD/cppad-20160000.1.gpl.tgz" target="_top">http://www.coin-or.org/download/source/CppAD/cppad-20160000.1.gpl.tgz</a></td><td><a href="download.xml#Compressed Archives" target="_top">download#Compressed Archives</a></td></tr>
179179
180180 <tr valign="top"><td><a href="http://www.coin-or.org/foundation.html" target="_top">http://www.coin-or.org/foundation.html</a></td><td><a href="cppad.xml#Introduction" target="_top">CppAD#Introduction</a></td></tr>
181181
11211121 &#160;&#160;&#160;<a href="simple_ad_bthread.cpp.xml" target="_top">A&#xA0;Simple&#xA0;Boost&#xA0;Threading&#xA0;AD:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
11221122 &#160;&#160;&#160;<a href="simple_ad_openmp.cpp.xml" target="_top">A&#xA0;Simple&#xA0;OpenMP&#xA0;AD:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
11231123 &#160;&#160;&#160;<a href="introduction.xml" target="_top">An&#xA0;Introduction&#xA0;by&#xA0;Example&#xA0;to&#xA0;Algorithmic&#xA0;Differentiation</a><br/>
1124 &#160;&#160;&#160;<a href="cppad.xml" target="_top">cppad-20160000.0:&#xA0;A&#xA0;Package&#xA0;for&#xA0;Differentiation&#xA0;of&#xA0;C++&#xA0;Algorithms</a><br/>
1124 &#160;&#160;&#160;<a href="cppad.xml" target="_top">cppad-20160000.1:&#xA0;A&#xA0;Package&#xA0;for&#xA0;Differentiation&#xA0;of&#xA0;C++&#xA0;Algorithms</a><br/>
11251125 ADFun&#160;<a href="comparechange.xml" target="_top">Comparison&#xA0;Changes&#xA0;During&#xA0;Zero&#xA0;Order&#xA0;Forward&#xA0;Mode</a><br/>
11261126 &#160;&#160;&#160;&#160;&#160;&#160;<a href="compare_change.xml" target="_top">Comparison&#xA0;Changes&#xA0;Between&#xA0;Taping&#xA0;and&#xA0;Zero&#xA0;Order&#xA0;Forward</a><br/>
11271127 &#160;&#160;&#160;&#160;&#160;&#160;<a href="dependent.xml" target="_top">Stop&#xA0;Recording&#xA0;and&#xA0;Store&#xA0;Operation&#xA0;Sequence</a><br/>
11281128 Adolc&#160;<a href="auto_tools.xml" target="_top">Auto&#xA0;Tools&#xA0;Unix&#xA0;Test&#xA0;and&#xA0;Installation</a><br/>
11291129 Automatic&#160;<a href="introduction.xml" target="_top">An&#xA0;Introduction&#xA0;by&#xA0;Example&#xA0;to&#xA0;Algorithmic&#xA0;Differentiation</a><br/>
1130 a&#160;<a href="luratio.xml#LU.A" target="_top">LU&#xA0;Factorization&#xA0;of&#xA0;A&#xA0;Square&#xA0;Matrix&#xA0;and&#xA0;Stability&#xA0;Calculation:&#160;LU.A</a><br/>
1131 &#160;&#160;<a href="luratio.xml" target="_top">LU&#xA0;Factorization&#xA0;of&#xA0;A&#xA0;Square&#xA0;Matrix&#xA0;and&#xA0;Stability&#xA0;Calculation</a><br/>
1132 &#160;&#160;<a href="repeat_det_by_minor_c.xml" target="_top">Repeat&#xA0;det_by_minor&#xA0;Routine&#xA0;A&#xA0;Specified&#xA0;Number&#xA0;of&#xA0;Times</a><br/>
1133 &#160;&#160;<a href="uniform_01_c.xml#a" target="_top">Simulate&#xA0;a&#xA0;[0,1]&#xA0;Uniform&#xA0;Random&#xA0;Variate:&#160;a</a><br/>
1134 &#160;&#160;<a href="uniform_01_c.xml" target="_top">Simulate&#xA0;a&#xA0;[0,1]&#xA0;Uniform&#xA0;Random&#xA0;Variate</a><br/>
1135 &#160;&#160;<a href="det_by_minor_c.xml#a" target="_top">Compute&#xA0;Determinant&#xA0;using&#xA0;Expansion&#xA0;by&#xA0;Minors:&#160;a</a><br/>
1136 &#160;&#160;<a href="det_of_minor_c.xml#a" target="_top">Determinant&#xA0;of&#xA0;a&#xA0;Minor:&#160;a</a><br/>
1137 &#160;&#160;<a href="det_of_minor_c.xml#Determinant of A" target="_top">Determinant&#xA0;of&#xA0;a&#xA0;Minor:&#160;Determinant&#xA0;of&#xA0;A</a><br/>
1138 &#160;&#160;<a href="det_of_minor_c.xml" target="_top">Determinant&#xA0;of&#xA0;a&#xA0;Minor</a><br/>
1139 &#160;&#160;<a href="old_mat_mul.hpp.xml" target="_top">Define&#xA0;Matrix&#xA0;Multiply&#xA0;as&#xA0;a&#xA0;User&#xA0;Atomic&#xA0;Operation</a><br/>
1140 &#160;&#160;<a href="old_mat_mul.cpp.xml" target="_top">Old&#xA0;Matrix&#xA0;Multiply&#xA0;as&#xA0;a&#xA0;User&#xA0;Atomic&#xA0;Operation:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1141 &#160;&#160;<a href="omp_efficient.xml" target="_top">Check&#xA0;If&#xA0;A&#xA0;Memory&#xA0;Allocation&#xA0;is&#xA0;Efficient&#xA0;for&#xA0;Another&#xA0;Use</a><br/>
1142 &#160;&#160;<a href="omp_delete_array.xml" target="_top">Return&#xA0;A&#xA0;Raw&#xA0;Array&#xA0;to&#xA0;The&#xA0;Available&#xA0;Memory&#xA0;for&#xA0;a&#xA0;Thread</a><br/>
1143 &#160;&#160;<a href="omp_delete_array.xml" target="_top">Return&#xA0;A&#xA0;Raw&#xA0;Array&#xA0;to&#xA0;The&#xA0;Available&#xA0;Memory&#xA0;for&#xA0;a&#xA0;Thread</a><br/>
1144 &#160;&#160;<a href="omp_create_array.xml" target="_top">Allocate&#xA0;Memory&#xA0;and&#xA0;Create&#xA0;A&#xA0;Raw&#xA0;Array</a><br/>
1145 &#160;&#160;<a href="omp_available.xml" target="_top">Amount&#xA0;of&#xA0;Memory&#xA0;Available&#xA0;for&#xA0;Quick&#xA0;Use&#xA0;by&#xA0;a&#xA0;Thread</a><br/>
1146 &#160;&#160;<a href="omp_inuse.xml" target="_top">Amount&#xA0;of&#xA0;Memory&#xA0;a&#xA0;Thread&#xA0;is&#xA0;Currently&#xA0;Using</a><br/>
1147 &#160;&#160;<a href="omp_free_available.xml" target="_top">Free&#xA0;Memory&#xA0;Currently&#xA0;Available&#xA0;for&#xA0;Quick&#xA0;Use&#xA0;by&#xA0;a&#xA0;Thread</a><br/>
1148 &#160;&#160;<a href="omp_get_memory.xml" target="_top">Get&#xA0;At&#xA0;Least&#xA0;A&#xA0;Specified&#xA0;Amount&#xA0;of&#xA0;Memory</a><br/>
1149 &#160;&#160;<a href="omp_alloc.xml" target="_top">A&#xA0;Quick&#xA0;OpenMP&#xA0;Memory&#xA0;Allocator&#xA0;Used&#xA0;by&#xA0;CppAD</a><br/>
1150 &#160;&#160;<a href="sacado_poly.cpp.xml" target="_top">Sacado&#xA0;Speed:&#xA0;Second&#xA0;Derivative&#xA0;of&#xA0;a&#xA0;Polynomial</a><br/>
1151 &#160;&#160;<a href="fadbad_poly.cpp.xml" target="_top">Fadbad&#xA0;Speed:&#xA0;Second&#xA0;Derivative&#xA0;of&#xA0;a&#xA0;Polynomial</a><br/>
1152 &#160;&#160;<a href="cppad_poly.cpp.xml" target="_top">CppAD&#xA0;Speed:&#xA0;Second&#xA0;Derivative&#xA0;of&#xA0;a&#xA0;Polynomial</a><br/>
1153 &#160;&#160;<a href="adolc_alloc_mat.xml" target="_top">Adolc&#xA0;Test&#xA0;Utility:&#xA0;Allocate&#xA0;and&#xA0;Free&#xA0;Memory&#xA0;For&#xA0;a&#xA0;Matrix</a><br/>
1154 &#160;&#160;<a href="adolc_poly.cpp.xml" target="_top">Adolc&#xA0;Speed:&#xA0;Second&#xA0;Derivative&#xA0;of&#xA0;a&#xA0;Polynomial</a><br/>
1155 &#160;&#160;<a href="double_poly.cpp.xml" target="_top">Double&#xA0;Speed:&#xA0;Evaluate&#xA0;a&#xA0;Polynomial</a><br/>
1156 &#160;&#160;<a href="uniform_01.xml" target="_top">Simulate&#xA0;a&#xA0;[0,1]&#xA0;Uniform&#xA0;Random&#xA0;Variate</a><br/>
1157 &#160;&#160;<a href="sparse_hes_fun.xml" target="_top">Evaluate&#xA0;a&#xA0;Function&#xA0;That&#xA0;Has&#xA0;a&#xA0;Sparse&#xA0;Hessian</a><br/>
1158 &#160;&#160;<a href="sparse_hes_fun.xml" target="_top">Evaluate&#xA0;a&#xA0;Function&#xA0;That&#xA0;Has&#xA0;a&#xA0;Sparse&#xA0;Hessian</a><br/>
1159 &#160;&#160;<a href="sparse_jac_fun.xml" target="_top">Evaluate&#xA0;a&#xA0;Function&#xA0;That&#xA0;Has&#xA0;a&#xA0;Sparse&#xA0;Jacobian</a><br/>
1160 &#160;&#160;<a href="sparse_jac_fun.xml" target="_top">Evaluate&#xA0;a&#xA0;Function&#xA0;That&#xA0;Has&#xA0;a&#xA0;Sparse&#xA0;Jacobian</a><br/>
1161 &#160;&#160;<a href="ode_evaluate.xml" target="_top">Evaluate&#xA0;a&#xA0;Function&#xA0;Defined&#xA0;in&#xA0;Terms&#xA0;of&#xA0;an&#xA0;ODE</a><br/>
1162 &#160;&#160;<a href="mat_sum_sq.cpp.xml" target="_top">Sum&#xA0;of&#xA0;the&#xA0;Elements&#xA0;of&#xA0;the&#xA0;Square&#xA0;of&#xA0;a&#xA0;Matrix:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1163 &#160;&#160;<a href="mat_sum_sq.xml" target="_top">Sum&#xA0;Elements&#xA0;of&#xA0;a&#xA0;Matrix&#xA0;Times&#xA0;Itself</a><br/>
1164 &#160;&#160;<a href="det_by_minor.xml#det.a" target="_top">Determinant&#xA0;Using&#xA0;Expansion&#xA0;by&#xA0;Minors:&#160;det.a</a><br/>
1165 &#160;&#160;<a href="det_of_minor.cpp.xml" target="_top">Determinant&#xA0;of&#xA0;a&#xA0;Minor:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1166 &#160;&#160;<a href="det_of_minor.xml#a" target="_top">Determinant&#xA0;of&#xA0;a&#xA0;Minor:&#160;a</a><br/>
1167 &#160;&#160;<a href="det_of_minor.xml#Determinant of A" target="_top">Determinant&#xA0;of&#xA0;a&#xA0;Minor:&#160;Determinant&#xA0;of&#xA0;A</a><br/>
1168 &#160;&#160;<a href="det_of_minor.xml" target="_top">Determinant&#xA0;of&#xA0;a&#xA0;Minor</a><br/>
1169 &#160;&#160;<a href="det_by_lu.xml#det.a" target="_top">Determinant&#xA0;Using&#xA0;Expansion&#xA0;by&#xA0;Lu&#xA0;Factorization:&#160;det.a</a><br/>
1170 &#160;&#160;<a href="link_poly.xml#a" target="_top">Speed&#xA0;Testing&#xA0;Second&#xA0;Derivative&#xA0;of&#xA0;a&#xA0;Polynomial:&#160;a</a><br/>
1171 &#160;&#160;<a href="link_poly.xml" target="_top">Speed&#xA0;Testing&#xA0;Second&#xA0;Derivative&#xA0;of&#xA0;a&#xA0;Polynomial</a><br/>
1172 &#160;&#160;<a href="stack_machine.cpp.xml" target="_top">Example&#xA0;Differentiating&#xA0;a&#xA0;Stack&#xA0;Machine&#xA0;Interpreter</a><br/>
1173 &#160;&#160;<a href="mul_level_adolc_ode.cpp.xml" target="_top">Taylor's&#xA0;Ode&#xA0;Solver:&#xA0;A&#xA0;Multi-Level&#xA0;Adolc&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1174 &#160;&#160;<a href="mul_level_ode.cpp.xml" target="_top">Taylor's&#xA0;Ode&#xA0;Solver:&#xA0;A&#xA0;Multi-Level&#xA0;AD&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1175 &#160;&#160;<a href="ode_stiff.cpp.xml" target="_top">A&#xA0;Stiff&#xA0;Ode:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1176 &#160;&#160;<a href="change_param.cpp.xml" target="_top">Computing&#xA0;a&#xA0;Jacobian&#xA0;With&#xA0;Constants&#xA0;that&#xA0;Change</a><br/>
1177 &#160;&#160;<a href="ipopt_solve.xml" target="_top">Use&#xA0;Ipopt&#xA0;to&#xA0;Solve&#xA0;a&#xA0;Nonlinear&#xA0;Programming&#xA0;Problem</a><br/>
1178 &#160;&#160;<a href="to_string.xml" target="_top">Convert&#xA0;Certain&#xA0;Types&#xA0;to&#xA0;a&#xA0;String</a><br/>
1179 &#160;&#160;<a href="index_sort.xml" target="_top">Returns&#xA0;Indices&#xA0;that&#xA0;Sort&#xA0;a&#xA0;Vector</a><br/>
1180 &#160;&#160;<a href="ta_available.xml" target="_top">Amount&#xA0;of&#xA0;Memory&#xA0;Available&#xA0;for&#xA0;Quick&#xA0;Use&#xA0;by&#xA0;a&#xA0;Thread</a><br/>
1181 &#160;&#160;<a href="ta_inuse.xml" target="_top">Amount&#xA0;of&#xA0;Memory&#xA0;a&#xA0;Thread&#xA0;is&#xA0;Currently&#xA0;Using</a><br/>
1182 &#160;&#160;<a href="ta_free_available.xml" target="_top">Free&#xA0;Memory&#xA0;Currently&#xA0;Available&#xA0;for&#xA0;Quick&#xA0;Use&#xA0;by&#xA0;a&#xA0;Thread</a><br/>
1183 &#160;&#160;<a href="ta_get_memory.xml" target="_top">Get&#xA0;At&#xA0;Least&#xA0;A&#xA0;Specified&#xA0;Amount&#xA0;of&#xA0;Memory</a><br/>
1184 &#160;&#160;<a href="thread_alloc.xml" target="_top">A&#xA0;Fast&#xA0;Multi-Threading&#xA0;Memory&#xA0;Allocator</a><br/>
1185 &#160;&#160;<a href="rosen34.xml" target="_top">A&#xA0;3rd&#xA0;and&#xA0;4th&#xA0;Order&#xA0;Rosenbrock&#xA0;ODE&#xA0;Solver</a><br/>
1186 &#160;&#160;<a href="rombergmul.xml#a" target="_top">Multi-dimensional&#xA0;Romberg&#xA0;Integration:&#160;a</a><br/>
1187 &#160;&#160;<a href="rombergone.xml#a" target="_top">One&#xA0;DimensionalRomberg&#xA0;Integration:&#160;a</a><br/>
1188 &#160;&#160;<a href="luinvert.xml#LU.A" target="_top">Invert&#xA0;an&#xA0;LU&#xA0;Factored&#xA0;Equation:&#160;LU.A</a><br/>
1189 &#160;&#160;<a href="lufactor.xml#LU.A" target="_top">LU&#xA0;Factorization&#xA0;of&#xA0;A&#xA0;Square&#xA0;Matrix:&#160;LU.A</a><br/>
1190 &#160;&#160;<a href="lufactor.xml" target="_top">LU&#xA0;Factorization&#xA0;of&#xA0;A&#xA0;Square&#xA0;Matrix</a><br/>
1191 &#160;&#160;<a href="lusolve.xml#A" target="_top">Compute&#xA0;Determinant&#xA0;and&#xA0;Solve&#xA0;Linear&#xA0;Equations:&#160;A</a><br/>
1192 &#160;&#160;<a href="poly.xml#a" target="_top">Evaluate&#xA0;a&#xA0;Polynomial&#xA0;or&#xA0;its&#xA0;Derivative:&#160;a</a><br/>
1193 &#160;&#160;<a href="poly.xml" target="_top">Evaluate&#xA0;a&#xA0;Polynomial&#xA0;or&#xA0;its&#xA0;Derivative</a><br/>
1194 &#160;&#160;<a href="nan.xml" target="_top">Obtain&#xA0;Nan&#xA0;or&#xA0;Determine&#xA0;if&#xA0;a&#xA0;Value&#xA0;is&#xA0;Nan</a><br/>
1195 &#160;&#160;<a href="simplevector.xml" target="_top">Definition&#xA0;of&#xA0;a&#xA0;Simple&#xA0;Vector</a><br/>
1196 &#160;&#160;<a href="numerictype.xml" target="_top">Definition&#xA0;of&#xA0;a&#xA0;Numeric&#xA0;Type</a><br/>
1197 &#160;&#160;<a href="time_test.xml" target="_top">Determine&#xA0;Amount&#xA0;of&#xA0;Time&#xA0;to&#xA0;Execute&#xA0;a&#xA0;Test</a><br/>
1198 &#160;&#160;<a href="nearequal.xml#a" target="_top">Determine&#xA0;if&#xA0;Two&#xA0;Values&#xA0;Are&#xA0;Nearly&#xA0;Equal:&#160;a</a><br/>
1199 &#160;&#160;<a href="team_pthread.cpp.xml" target="_top">Pthread&#xA0;Implementation&#xA0;of&#xA0;a&#xA0;Team&#xA0;of&#xA0;AD&#xA0;Threads</a><br/>
1200 &#160;&#160;<a href="team_bthread.cpp.xml" target="_top">Boost&#xA0;Thread&#xA0;Implementation&#xA0;of&#xA0;a&#xA0;Team&#xA0;of&#xA0;AD&#xA0;Threads</a><br/>
1201 &#160;&#160;<a href="team_openmp.cpp.xml" target="_top">OpenMP&#xA0;Implementation&#xA0;of&#xA0;a&#xA0;Team&#xA0;of&#xA0;AD&#xA0;Threads</a><br/>
1202 &#160;&#160;<a href="team_thread.hpp.xml" target="_top">Specifications&#xA0;for&#xA0;A&#xA0;Team&#xA0;of&#xA0;AD&#xA0;Threads</a><br/>
1203 &#160;&#160;<a href="multi_newton.cpp.xml" target="_top">A&#xA0;Multi-Threaded&#xA0;Newton's&#xA0;Method</a><br/>
1204 &#160;&#160;<a href="team_example.cpp.xml" target="_top">Using&#xA0;a&#xA0;Team&#xA0;of&#xA0;AD&#xA0;Threads:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1205 &#160;&#160;<a href="simple_ad_pthread.cpp.xml" target="_top">A&#xA0;Simple&#xA0;pthread&#xA0;AD:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1206 &#160;&#160;<a href="simple_ad_bthread.cpp.xml" target="_top">A&#xA0;Simple&#xA0;Boost&#xA0;Threading&#xA0;AD:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1207 &#160;&#160;<a href="simple_ad_openmp.cpp.xml" target="_top">A&#xA0;Simple&#xA0;OpenMP&#xA0;AD:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1208 &#160;&#160;<a href="a11c_pthread.cpp.xml" target="_top">A&#xA0;Simple&#xA0;Parallel&#xA0;Pthread&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1209 &#160;&#160;<a href="a11c_bthread.cpp.xml" target="_top">A&#xA0;Simple&#xA0;Boost&#xA0;Thread&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1210 &#160;&#160;<a href="a11c_openmp.cpp.xml" target="_top">A&#xA0;Simple&#xA0;OpenMP&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1211 &#160;&#160;<a href="multi_thread.xml" target="_top">Using&#xA0;CppAD&#xA0;in&#xA0;a&#xA0;Multi-Threading&#xA0;Environment</a><br/>
1212 &#160;&#160;<a href="funcheck.xml#a" target="_top">Check&#xA0;an&#xA0;ADFun&#xA0;Sequence&#xA0;of&#xA0;Operations:&#160;a</a><br/>
1213 &#160;&#160;<a href="sub_sparse_hes.cpp.xml" target="_top">Computing&#xA0;Sparse&#xA0;Hessian&#xA0;for&#xA0;a&#xA0;Subset&#xA0;of&#xA0;Variables</a><br/>
1214 &#160;&#160;<a href="sparsity_sub.cpp.xml" target="_top">Sparsity&#xA0;Patterns&#xA0;For&#xA0;a&#xA0;Subset&#xA0;of&#xA0;Variables:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1215 &#160;&#160;<a href="base_require.cpp.xml" target="_top">Using&#xA0;a&#xA0;User&#xA0;Defined&#xA0;AD&#xA0;Base&#xA0;Type:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1216 &#160;&#160;<a href="base_require.xml" target="_top">AD&lt;Base&gt;&#xA0;Requirements&#xA0;for&#xA0;a&#xA0;CppAD&#xA0;Base&#xA0;Type</a><br/>
1217 &#160;&#160;<a href="parvar.xml" target="_top">Is&#xA0;an&#xA0;AD&#xA0;Object&#xA0;a&#xA0;Parameter&#xA0;or&#xA0;Variable</a><br/>
1218 &#160;&#160;<a href="nearequalext.xml#a" target="_top">Compare&#xA0;AD&#xA0;and&#xA0;Base&#xA0;Objects&#xA0;for&#xA0;Nearly&#xA0;Equal:&#160;a</a><br/>
1219 &#160;&#160;<a href="atomic_hes_sparse.cpp.xml#Test with x_1 Both a Variable and a Parameter" target="_top">Atomic&#xA0;Operation&#xA0;Hessian&#xA0;Sparsity:&#xA0;Example&#xA0;and&#xA0;Test:&#160;Test&#xA0;with&#xA0;x_1&#xA0;Both&#xA0;a&#xA0;Variable&#xA0;and&#xA0;a&#xA0;Parameter</a><br/>
1220 &#160;&#160;<a href="atomic_hes_sparse.cpp.xml#Test with x_1 Both a Variable and a Parameter" target="_top">Atomic&#xA0;Operation&#xA0;Hessian&#xA0;Sparsity:&#xA0;Example&#xA0;and&#xA0;Test:&#160;Test&#xA0;with&#xA0;x_1&#xA0;Both&#xA0;a&#xA0;Variable&#xA0;and&#xA0;a&#xA0;Parameter</a><br/>
1221 &#160;&#160;<a href="var2par.cpp.xml" target="_top">Convert&#xA0;an&#xA0;AD&#xA0;Variable&#xA0;to&#xA0;a&#xA0;Parameter:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1222 &#160;&#160;<a href="var2par.xml" target="_top">Convert&#xA0;an&#xA0;AD&#xA0;Variable&#xA0;to&#xA0;a&#xA0;Parameter</a><br/>
1223 &#160;&#160;<a href="cppad.xml" target="_top">cppad-20160000.0:&#xA0;A&#xA0;Package&#xA0;for&#xA0;Differentiation&#xA0;of&#xA0;C++&#xA0;Algorithms</a><br/>
12241130 a11c&#160;<a href="thread_test.cpp.xml#a11c" target="_top">Run&#xA0;Multi-Threading&#xA0;Examples&#xA0;and&#xA0;Speed&#xA0;Tests:&#160;a11c</a><br/>
12251131 abort&#160;<a href="abort_recording.cpp.xml" target="_top">Abort&#xA0;Current&#xA0;Recording:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
12261132 &#160;&#160;&#160;&#160;&#160;&#160;<a href="abort_recording.xml" target="_top">Abort&#xA0;Recording&#xA0;of&#xA0;an&#xA0;Operation&#xA0;Sequence</a><br/>
14631369 algorithm&#160;<a href="conj_grad.cpp.xml#Algorithm" target="_top">Differentiate&#xA0;Conjugate&#xA0;Gradient&#xA0;Algorithm:&#xA0;Example&#xA0;and&#xA0;Test:&#160;Algorithm</a><br/>
14641370 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="exp_eps.xml" target="_top">An&#xA0;Epsilon&#xA0;Accurate&#xA0;Exponential&#xA0;Approximation</a><br/>
14651371 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="exp_2.xml" target="_top">Second&#xA0;Order&#xA0;Exponential&#xA0;Approximation</a><br/>
1466 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="cppad.xml" target="_top">cppad-20160000.0:&#xA0;A&#xA0;Package&#xA0;for&#xA0;Differentiation&#xA0;of&#xA0;C++&#xA0;Algorithms</a><br/>
1372 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="cppad.xml" target="_top">cppad-20160000.1:&#xA0;A&#xA0;Package&#xA0;for&#xA0;Differentiation&#xA0;of&#xA0;C++&#xA0;Algorithms</a><br/>
14671373 algorithm<b>:</b>&#160;<a href="conj_grad.cpp.xml" target="_top">Differentiate&#xA0;Conjugate&#xA0;Gradient&#xA0;Algorithm:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
14681374 algorithmic&#160;<a href="ad_in_c.cpp.xml" target="_top">Example&#xA0;and&#xA0;Test&#xA0;Linking&#xA0;CppAD&#xA0;to&#xA0;Languages&#xA0;Other&#xA0;than&#xA0;C++</a><br/>
14691375 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="introduction.xml#Preface.Algorithmic Differentiation" target="_top">An&#xA0;Introduction&#xA0;by&#xA0;Example&#xA0;to&#xA0;Algorithmic&#xA0;Differentiation:&#160;Preface.Algorithmic&#xA0;Differentiation</a><br/>
14701376 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="introduction.xml" target="_top">An&#xA0;Introduction&#xA0;by&#xA0;Example&#xA0;to&#xA0;Algorithmic&#xA0;Differentiation</a><br/>
1471 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="cppad.xml" target="_top">cppad-20160000.0:&#xA0;A&#xA0;Package&#xA0;for&#xA0;Differentiation&#xA0;of&#xA0;C++&#xA0;Algorithms</a><br/>
1472 algorithms&#160;<a href="cppad.xml" target="_top">cppad-20160000.0:&#xA0;A&#xA0;Package&#xA0;for&#xA0;Differentiation&#xA0;of&#xA0;C++&#xA0;Algorithms</a><br/>
1377 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="cppad.xml" target="_top">cppad-20160000.1:&#xA0;A&#xA0;Package&#xA0;for&#xA0;Differentiation&#xA0;of&#xA0;C++&#xA0;Algorithms</a><br/>
1378 algorithms&#160;<a href="cppad.xml" target="_top">cppad-20160000.1:&#xA0;A&#xA0;Package&#xA0;for&#xA0;Differentiation&#xA0;of&#xA0;C++&#xA0;Algorithms</a><br/>
14731379 alignment&#160;<a href="ta_create_array.xml#Alignment" target="_top">Allocate&#xA0;An&#xA0;Array&#xA0;and&#xA0;Call&#xA0;Default&#xA0;Constructor&#xA0;for&#xA0;its&#xA0;Elements:&#160;Alignment</a><br/>
14741380 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="ta_get_memory.xml#Alignment" target="_top">Get&#xA0;At&#xA0;Least&#xA0;A&#xA0;Specified&#xA0;Amount&#xA0;of&#xA0;Memory:&#160;Alignment</a><br/>
14751381 all&#160;<a href="listallexamples.xml" target="_top">List&#xA0;of&#xA0;All&#xA0;the&#xA0;CppAD&#xA0;Examples</a><br/>
15271433 &#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="ta_inuse.xml" target="_top">Amount&#xA0;of&#xA0;Memory&#xA0;a&#xA0;Thread&#xA0;is&#xA0;Currently&#xA0;Using</a><br/>
15281434 &#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="ta_get_memory.xml" target="_top">Get&#xA0;At&#xA0;Least&#xA0;A&#xA0;Specified&#xA0;Amount&#xA0;of&#xA0;Memory</a><br/>
15291435 &#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="time_test.xml" target="_top">Determine&#xA0;Amount&#xA0;of&#xA0;Time&#xA0;to&#xA0;Execute&#xA0;a&#xA0;Test</a><br/>
1530 an&#160;<a href="zdouble.xml" target="_top">zdouble:&#xA0;An&#xA0;AD&#xA0;Base&#xA0;Type&#xA0;With&#xA0;Absolute&#xA0;Zero</a><br/>
1531 &#160;&#160;&#160;<a href="ipopt_nlp_ode_problem.xml" target="_top">An&#xA0;ODE&#xA0;Inverse&#xA0;Problem&#xA0;Example</a><br/>
1532 &#160;&#160;&#160;<a href="reverse_identity.xml" target="_top">An&#xA0;Important&#xA0;Reverse&#xA0;Mode&#xA0;Identity</a><br/>
1533 &#160;&#160;&#160;<a href="ode_evaluate.xml" target="_top">Evaluate&#xA0;a&#xA0;Function&#xA0;Defined&#xA0;in&#xA0;Terms&#xA0;of&#xA0;an&#xA0;ODE</a><br/>
1534 &#160;&#160;&#160;<a href="speed.xml" target="_top">Speed&#xA0;Test&#xA0;an&#xA0;Operator&#xA0;Overloading&#xA0;AD&#xA0;Package</a><br/>
1535 &#160;&#160;&#160;<a href="ode_taylor.cpp.xml" target="_top">Taylor's&#xA0;Ode&#xA0;Solver:&#xA0;An&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1536 &#160;&#160;&#160;<a href="ad_fun.cpp.xml" target="_top">Creating&#xA0;Your&#xA0;Own&#xA0;Interface&#xA0;to&#xA0;an&#xA0;ADFun&#xA0;Object</a><br/>
1537 &#160;&#160;&#160;<a href="ta_delete_array.xml" target="_top">Deallocate&#xA0;An&#xA0;Array&#xA0;and&#xA0;Call&#xA0;Destructor&#xA0;for&#xA0;its&#xA0;Elements</a><br/>
1538 &#160;&#160;&#160;<a href="ta_create_array.xml" target="_top">Allocate&#xA0;An&#xA0;Array&#xA0;and&#xA0;Call&#xA0;Default&#xA0;Constructor&#xA0;for&#xA0;its&#xA0;Elements</a><br/>
1539 &#160;&#160;&#160;<a href="odegearcontrol.xml" target="_top">An&#xA0;Error&#xA0;Controller&#xA0;for&#xA0;Gear's&#xA0;Ode&#xA0;Solvers</a><br/>
1540 &#160;&#160;&#160;<a href="odegear.xml" target="_top">An&#xA0;Arbitrary&#xA0;Order&#xA0;Gear&#xA0;Method</a><br/>
1541 &#160;&#160;&#160;<a href="odeerrcontrol.xml" target="_top">An&#xA0;Error&#xA0;Controller&#xA0;for&#xA0;ODE&#xA0;Solvers</a><br/>
1542 &#160;&#160;&#160;<a href="runge45.xml" target="_top">An&#xA0;Embedded&#xA0;4th&#xA0;and&#xA0;5th&#xA0;Order&#xA0;Runge-Kutta&#xA0;ODE&#xA0;Solver</a><br/>
1543 &#160;&#160;&#160;<a href="luinvert.xml" target="_top">Invert&#xA0;an&#xA0;LU&#xA0;Factored&#xA0;Equation</a><br/>
1544 &#160;&#160;&#160;<a href="check_for_nan.xml" target="_top">Check&#xA0;an&#xA0;ADFun&#xA0;Object&#xA0;For&#xA0;Nan&#xA0;Results</a><br/>
1545 &#160;&#160;&#160;<a href="optimize.xml" target="_top">Optimize&#xA0;an&#xA0;ADFun&#xA0;Object&#xA0;Tape</a><br/>
1546 &#160;&#160;&#160;<a href="funcheck.xml" target="_top">Check&#xA0;an&#xA0;ADFun&#xA0;Sequence&#xA0;of&#xA0;Operations</a><br/>
1547 &#160;&#160;&#160;<a href="abort_recording.xml" target="_top">Abort&#xA0;Recording&#xA0;of&#xA0;an&#xA0;Operation&#xA0;Sequence</a><br/>
1548 &#160;&#160;&#160;<a href="funconstruct.xml" target="_top">Construct&#xA0;an&#xA0;ADFun&#xA0;Object&#xA0;and&#xA0;Stop&#xA0;Recording</a><br/>
1549 &#160;&#160;&#160;<a href="parvar.xml" target="_top">Is&#xA0;an&#xA0;AD&#xA0;Object&#xA0;a&#xA0;Parameter&#xA0;or&#xA0;Variable</a><br/>
1550 &#160;&#160;&#160;<a href="atomic_matrix_mul.hpp.xml" target="_top">Matrix&#xA0;Multiply&#xA0;as&#xA0;an&#xA0;Atomic&#xA0;Operation</a><br/>
1551 &#160;&#160;&#160;<a href="atomic_reciprocal.cpp.xml" target="_top">Reciprocal&#xA0;as&#xA0;an&#xA0;Atomic&#xA0;Operation:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1552 &#160;&#160;&#160;<a href="numeric_limits.xml" target="_top">Numeric&#xA0;Limits&#xA0;For&#xA0;an&#xA0;AD&#xA0;and&#xA0;Base&#xA0;Types</a><br/>
1553 &#160;&#160;&#160;<a href="var2par.cpp.xml" target="_top">Convert&#xA0;an&#xA0;AD&#xA0;Variable&#xA0;to&#xA0;a&#xA0;Parameter:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1554 &#160;&#160;&#160;<a href="var2par.xml" target="_top">Convert&#xA0;an&#xA0;AD&#xA0;Variable&#xA0;to&#xA0;a&#xA0;Parameter</a><br/>
1555 &#160;&#160;&#160;<a href="ad_to_string.xml" target="_top">Convert&#xA0;An&#xA0;AD&#xA0;or&#xA0;Base&#xA0;Type&#xA0;to&#xA0;String</a><br/>
1556 &#160;&#160;&#160;<a href="value.xml" target="_top">Convert&#xA0;From&#xA0;an&#xA0;AD&#xA0;Type&#xA0;to&#xA0;its&#xA0;Base&#xA0;Type</a><br/>
1557 &#160;&#160;&#160;<a href="exp_eps.xml" target="_top">An&#xA0;Epsilon&#xA0;Accurate&#xA0;Exponential&#xA0;Approximation</a><br/>
1558 &#160;&#160;&#160;<a href="introduction.xml" target="_top">An&#xA0;Introduction&#xA0;by&#xA0;Example&#xA0;to&#xA0;Algorithmic&#xA0;Differentiation</a><br/>
15591436 analytic&#160;<a href="ipopt_nlp_ode_problem.xml#Measurements.Simulation Analytic Solution" target="_top">An&#xA0;ODE&#xA0;Inverse&#xA0;Problem&#xA0;Example:&#160;Measurements.Simulation&#xA0;Analytic&#xA0;Solution</a><br/>
15601437 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="ipopt_solve_ode_inverse.cpp.xml#Measurements.Simulation Analytic Solution" target="_top">ODE&#xA0;Inverse&#xA0;Problem&#xA0;Definitions:&#xA0;Source&#xA0;Code:&#160;Measurements.Simulation&#xA0;Analytic&#xA0;Solution</a><br/>
1561 and&#160;<a href="lu_ratio.cpp.xml" target="_top">LuRatio:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1562 &#160;&#160;&#160;&#160;<a href="luratio.xml" target="_top">LU&#xA0;Factorization&#xA0;of&#xA0;A&#xA0;Square&#xA0;Matrix&#xA0;and&#xA0;Stability&#xA0;Calculation</a><br/>
1563 &#160;&#160;&#160;&#160;<a href="opt_val_hes.cpp.xml" target="_top">opt_val_hes:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1564 &#160;&#160;&#160;&#160;<a href="opt_val_hes.xml" target="_top">Jacobian&#xA0;and&#xA0;Hessian&#xA0;of&#xA0;Optimal&#xA0;Values</a><br/>
1565 &#160;&#160;&#160;&#160;<a href="bender_quad.cpp.xml" target="_top">BenderQuad:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1566 &#160;&#160;&#160;&#160;<a href="benderquad.xml" target="_top">Computing&#xA0;Jacobian&#xA0;and&#xA0;Hessian&#xA0;of&#xA0;Bender's&#xA0;Reduced&#xA0;Objective</a><br/>
1567 &#160;&#160;&#160;&#160;<a href="main_compare_c.xml" target="_top">Main&#xA0;Program&#xA0;For&#xA0;Comparing&#xA0;C&#xA0;and&#xA0;C++&#xA0;Speed</a><br/>
1568 &#160;&#160;&#160;&#160;<a href="compare_c.xml" target="_top">Compare&#xA0;Speed&#xA0;of&#xA0;C&#xA0;and&#xA0;C++</a><br/>
1569 &#160;&#160;&#160;&#160;<a href="zdouble.cpp.xml" target="_top">zdouble:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1570 &#160;&#160;&#160;&#160;<a href="zdouble.xml#Syntax.Constructor and Assignment" target="_top">zdouble:&#xA0;An&#xA0;AD&#xA0;Base&#xA0;Type&#xA0;With&#xA0;Absolute&#xA0;Zero:&#160;Syntax.Constructor&#xA0;and&#xA0;Assignment</a><br/>
1571 &#160;&#160;&#160;&#160;<a href="old_mat_mul.cpp.xml" target="_top">Old&#xA0;Matrix&#xA0;Multiply&#xA0;as&#xA0;a&#xA0;User&#xA0;Atomic&#xA0;Operation:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1572 &#160;&#160;&#160;&#160;<a href="old_tan.cpp.xml" target="_top">Old&#xA0;Tan&#xA0;and&#xA0;Tanh&#xA0;as&#xA0;User&#xA0;Atomic&#xA0;Operations:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1573 &#160;&#160;&#160;&#160;<a href="old_tan.cpp.xml" target="_top">Old&#xA0;Tan&#xA0;and&#xA0;Tanh&#xA0;as&#xA0;User&#xA0;Atomic&#xA0;Operations:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1574 &#160;&#160;&#160;&#160;<a href="old_reciprocal.cpp.xml" target="_top">Old&#xA0;Atomic&#xA0;Operation&#xA0;Reciprocal:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1575 &#160;&#160;&#160;&#160;<a href="ipopt_ode_speed.cpp.xml" target="_top">Speed&#xA0;Test&#xA0;for&#xA0;Both&#xA0;Simple&#xA0;and&#xA0;Fast&#xA0;Representations</a><br/>
1576 &#160;&#160;&#160;&#160;<a href="ipopt_nlp_ode_check.cpp.xml" target="_top">Correctness&#xA0;Check&#xA0;for&#xA0;Both&#xA0;Simple&#xA0;and&#xA0;Fast&#xA0;Representations</a><br/>
1577 &#160;&#160;&#160;&#160;<a href="ipopt_nlp_ode.xml" target="_top">Example&#xA0;Simultaneous&#xA0;Solution&#xA0;of&#xA0;Forward&#xA0;and&#xA0;Inverse&#xA0;Problem</a><br/>
1578 &#160;&#160;&#160;&#160;<a href="ipopt_nlp_get_started.cpp.xml" target="_top">Nonlinear&#xA0;Programming&#xA0;Using&#xA0;CppAD&#xA0;and&#xA0;Ipopt:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1579 &#160;&#160;&#160;&#160;<a href="ipopt_nlp_get_started.cpp.xml" target="_top">Nonlinear&#xA0;Programming&#xA0;Using&#xA0;CppAD&#xA0;and&#xA0;Ipopt:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1580 &#160;&#160;&#160;&#160;<a href="omp_alloc.cpp.xml" target="_top">OpenMP&#xA0;Memory&#xA0;Allocator:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1581 &#160;&#160;&#160;&#160;<a href="omp_create_array.xml" target="_top">Allocate&#xA0;Memory&#xA0;and&#xA0;Create&#xA0;A&#xA0;Raw&#xA0;Array</a><br/>
1582 &#160;&#160;&#160;&#160;<a href="omp_max_num_threads.xml" target="_top">Set&#xA0;and&#xA0;Get&#xA0;Maximum&#xA0;Number&#xA0;of&#xA0;Threads&#xA0;for&#xA0;omp_alloc&#xA0;Allocator</a><br/>
1583 &#160;&#160;&#160;&#160;<a href="tracknewdel.cpp.xml" target="_top">Tracking&#xA0;Use&#xA0;of&#xA0;New&#xA0;and&#xA0;Delete:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1584 &#160;&#160;&#160;&#160;<a href="tracknewdel.cpp.xml" target="_top">Tracking&#xA0;Use&#xA0;of&#xA0;New&#xA0;and&#xA0;Delete:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1585 &#160;&#160;&#160;&#160;<a href="tracknewdel.xml" target="_top">Routines&#xA0;That&#xA0;Track&#xA0;Use&#xA0;of&#xA0;New&#xA0;and&#xA0;Delete</a><br/>
1586 &#160;&#160;&#160;&#160;<a href="whats_new_03.xml" target="_top">Changes&#xA0;and&#xA0;Additions&#xA0;to&#xA0;CppAD&#xA0;During&#xA0;2003</a><br/>
1587 &#160;&#160;&#160;&#160;<a href="whats_new_04.xml" target="_top">Changes&#xA0;and&#xA0;Additions&#xA0;to&#xA0;CppAD&#xA0;During&#xA0;2004</a><br/>
1588 &#160;&#160;&#160;&#160;<a href="whats_new_05.xml" target="_top">Changes&#xA0;and&#xA0;Additions&#xA0;to&#xA0;CppAD&#xA0;During&#xA0;2005</a><br/>
1589 &#160;&#160;&#160;&#160;<a href="whats_new_06.xml" target="_top">Changes&#xA0;and&#xA0;Additions&#xA0;to&#xA0;CppAD&#xA0;During&#xA0;2006</a><br/>
1590 &#160;&#160;&#160;&#160;<a href="whats_new_07.xml" target="_top">Changes&#xA0;and&#xA0;Additions&#xA0;to&#xA0;CppAD&#xA0;During&#xA0;2007</a><br/>
1591 &#160;&#160;&#160;&#160;<a href="whats_new_08.xml" target="_top">Changes&#xA0;and&#xA0;Additions&#xA0;to&#xA0;CppAD&#xA0;During&#xA0;2008</a><br/>
1592 &#160;&#160;&#160;&#160;<a href="whats_new_09.xml" target="_top">Changes&#xA0;and&#xA0;Additions&#xA0;to&#xA0;CppAD&#xA0;During&#xA0;2009</a><br/>
1593 &#160;&#160;&#160;&#160;<a href="whats_new_10.xml" target="_top">Changes&#xA0;and&#xA0;Additions&#xA0;to&#xA0;CppAD&#xA0;During&#xA0;2010</a><br/>
1594 &#160;&#160;&#160;&#160;<a href="whats_new_11.xml" target="_top">Changes&#xA0;and&#xA0;Additions&#xA0;to&#xA0;CppAD&#xA0;During&#xA0;2011</a><br/>
1595 &#160;&#160;&#160;&#160;<a href="whats_new_12.xml" target="_top">CppAD&#xA0;Changes&#xA0;and&#xA0;Additions&#xA0;During&#xA0;2012</a><br/>
1596 &#160;&#160;&#160;&#160;<a href="whats_new_13.xml" target="_top">CppAD&#xA0;Changes&#xA0;and&#xA0;Additions&#xA0;During&#xA0;2013</a><br/>
1597 &#160;&#160;&#160;&#160;<a href="whats_new_14.xml" target="_top">CppAD&#xA0;Changes&#xA0;and&#xA0;Additions&#xA0;During&#xA0;2014</a><br/>
1598 &#160;&#160;&#160;&#160;<a href="whats_new_15.xml" target="_top">CppAD&#xA0;Changes&#xA0;and&#xA0;Additions&#xA0;During&#xA0;2015</a><br/>
1599 &#160;&#160;&#160;&#160;<a href="whats_new.xml" target="_top">Changes&#xA0;and&#xA0;Additions&#xA0;to&#xA0;CppAD</a><br/>
1600 &#160;&#160;&#160;&#160;<a href="wish_list.xml#Comparison Changes and Optimization" target="_top">The&#xA0;CppAD&#xA0;Wish&#xA0;List:&#160;Comparison&#xA0;Changes&#xA0;and&#xA0;Optimization</a><br/>
1601 &#160;&#160;&#160;&#160;<a href="bib.xml#Abramowitz and Stegun" target="_top">Bibliography:&#160;Abramowitz&#xA0;and&#xA0;Stegun</a><br/>
1602 &#160;&#160;&#160;&#160;<a href="tan_reverse.xml" target="_top">Tangent&#xA0;and&#xA0;Hyperbolic&#xA0;Tangent&#xA0;Reverse&#xA0;Mode&#xA0;Theory</a><br/>
1603 &#160;&#160;&#160;&#160;<a href="acos_reverse.xml" target="_top">Inverse&#xA0;Cosine&#xA0;and&#xA0;Hyperbolic&#xA0;Cosine&#xA0;Reverse&#xA0;Mode&#xA0;Theory</a><br/>
1604 &#160;&#160;&#160;&#160;<a href="asin_reverse.xml" target="_top">Inverse&#xA0;Sine&#xA0;and&#xA0;Hyperbolic&#xA0;Sine&#xA0;Reverse&#xA0;Mode&#xA0;Theory</a><br/>
1605 &#160;&#160;&#160;&#160;<a href="atan_reverse.xml" target="_top">Inverse&#xA0;Tangent&#xA0;and&#xA0;Hyperbolic&#xA0;Tangent&#xA0;Reverse&#xA0;Mode&#xA0;Theory</a><br/>
1606 &#160;&#160;&#160;&#160;<a href="sin_cos_reverse.xml" target="_top">Trigonometric&#xA0;and&#xA0;Hyperbolic&#xA0;Sine&#xA0;and&#xA0;Cosine&#xA0;Reverse&#xA0;Theory</a><br/>
1607 &#160;&#160;&#160;&#160;<a href="sin_cos_reverse.xml" target="_top">Trigonometric&#xA0;and&#xA0;Hyperbolic&#xA0;Sine&#xA0;and&#xA0;Cosine&#xA0;Reverse&#xA0;Theory</a><br/>
1608 &#160;&#160;&#160;&#160;<a href="tan_forward.xml" target="_top">Tangent&#xA0;and&#xA0;Hyperbolic&#xA0;Tangent&#xA0;Forward&#xA0;Taylor&#xA0;Polynomial&#xA0;Theory</a><br/>
1609 &#160;&#160;&#160;&#160;<a href="acos_forward.xml" target="_top">Inverse&#xA0;Cosine&#xA0;and&#xA0;Hyperbolic&#xA0;Cosine&#xA0;Forward&#xA0;Mode&#xA0;Theory</a><br/>
1610 &#160;&#160;&#160;&#160;<a href="asin_forward.xml" target="_top">Inverse&#xA0;Sine&#xA0;and&#xA0;Hyperbolic&#xA0;Sine&#xA0;Forward&#xA0;Mode&#xA0;Theory</a><br/>
1611 &#160;&#160;&#160;&#160;<a href="atan_forward.xml" target="_top">Inverse&#xA0;Tangent&#xA0;and&#xA0;Hyperbolic&#xA0;Tangent&#xA0;Forward&#xA0;Mode&#xA0;Theory</a><br/>
1612 &#160;&#160;&#160;&#160;<a href="sin_cos_forward.xml" target="_top">Trigonometric&#xA0;and&#xA0;Hyperbolic&#xA0;Sine&#xA0;and&#xA0;Cosine&#xA0;Forward&#xA0;Theory</a><br/>
1613 &#160;&#160;&#160;&#160;<a href="sin_cos_forward.xml" target="_top">Trigonometric&#xA0;and&#xA0;Hyperbolic&#xA0;Sine&#xA0;and&#xA0;Cosine&#xA0;Forward&#xA0;Theory</a><br/>
1614 &#160;&#160;&#160;&#160;<a href="faq.xml#Assignment and Independent" target="_top">Frequently&#xA0;Asked&#xA0;Questions&#xA0;and&#xA0;Answers:&#160;Assignment&#xA0;and&#xA0;Independent</a><br/>
1615 &#160;&#160;&#160;&#160;<a href="faq.xml" target="_top">Frequently&#xA0;Asked&#xA0;Questions&#xA0;and&#xA0;Answers</a><br/>
1616 &#160;&#160;&#160;&#160;<a href="adolc_alloc_mat.xml" target="_top">Adolc&#xA0;Test&#xA0;Utility:&#xA0;Allocate&#xA0;and&#xA0;Free&#xA0;Memory&#xA0;For&#xA0;a&#xA0;Matrix</a><br/>
1617 &#160;&#160;&#160;&#160;<a href="sparse_hes_fun.cpp.xml" target="_top">sparse_hes_fun:&#xA0;Example&#xA0;and&#xA0;test</a><br/>
1618 &#160;&#160;&#160;&#160;<a href="sparse_jac_fun.cpp.xml" target="_top">sparse_jac_fun:&#xA0;Example&#xA0;and&#xA0;test</a><br/>
1619 &#160;&#160;&#160;&#160;<a href="ode_evaluate.cpp.xml" target="_top">ode_evaluate:&#xA0;Example&#xA0;and&#xA0;test</a><br/>
1620 &#160;&#160;&#160;&#160;<a href="mat_sum_sq.cpp.xml" target="_top">Sum&#xA0;of&#xA0;the&#xA0;Elements&#xA0;of&#xA0;the&#xA0;Square&#xA0;of&#xA0;a&#xA0;Matrix:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1621 &#160;&#160;&#160;&#160;<a href="det_by_minor.cpp.xml" target="_top">Determinant&#xA0;Using&#xA0;Expansion&#xA0;by&#xA0;Minors:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1622 &#160;&#160;&#160;&#160;<a href="det_of_minor.cpp.xml" target="_top">Determinant&#xA0;of&#xA0;a&#xA0;Minor:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1623 &#160;&#160;&#160;&#160;<a href="det_by_lu.cpp.xml" target="_top">Determinant&#xA0;Using&#xA0;Lu&#xA0;Factorization:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1624 &#160;&#160;&#160;&#160;<a href="lu_vec_ad_ok.cpp.xml" target="_top">Lu&#xA0;Factor&#xA0;and&#xA0;Solve&#xA0;With&#xA0;Recorded&#xA0;Pivoting:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1625 &#160;&#160;&#160;&#160;<a href="lu_vec_ad_ok.cpp.xml" target="_top">Lu&#xA0;Factor&#xA0;and&#xA0;Solve&#xA0;With&#xA0;Recorded&#xA0;Pivoting:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1626 &#160;&#160;&#160;&#160;<a href="lu_vec_ad.cpp.xml" target="_top">Lu&#xA0;Factor&#xA0;and&#xA0;Solve&#xA0;with&#xA0;Recorded&#xA0;Pivoting</a><br/>
1627 &#160;&#160;&#160;&#160;<a href="example.cpp.xml" target="_top">CppAD&#xA0;Examples&#xA0;and&#xA0;Tests</a><br/>
1628 &#160;&#160;&#160;&#160;<a href="ode_taylor.cpp.xml" target="_top">Taylor's&#xA0;Ode&#xA0;Solver:&#xA0;An&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1629 &#160;&#160;&#160;&#160;<a href="mul_level_adolc_ode.cpp.xml" target="_top">Taylor's&#xA0;Ode&#xA0;Solver:&#xA0;A&#xA0;Multi-Level&#xA0;Adolc&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1630 &#160;&#160;&#160;&#160;<a href="mul_level_ode.cpp.xml" target="_top">Taylor's&#xA0;Ode&#xA0;Solver:&#xA0;A&#xA0;Multi-Level&#xA0;AD&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1631 &#160;&#160;&#160;&#160;<a href="ode_stiff.cpp.xml" target="_top">A&#xA0;Stiff&#xA0;Ode:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1632 &#160;&#160;&#160;&#160;<a href="mul_level.cpp.xml" target="_top">Multiple&#xA0;Level&#xA0;of&#xA0;AD:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1633 &#160;&#160;&#160;&#160;<a href="jac_lu_det.cpp.xml" target="_top">Gradient&#xA0;of&#xA0;Determinant&#xA0;Using&#xA0;Lu&#xA0;Factorization:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1634 &#160;&#160;&#160;&#160;<a href="jac_minor_det.cpp.xml" target="_top">Gradient&#xA0;of&#xA0;Determinant&#xA0;Using&#xA0;Expansion&#xA0;by&#xA0;Minors:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1635 &#160;&#160;&#160;&#160;<a href="interface2c.cpp.xml" target="_top">Interfacing&#xA0;to&#xA0;C:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1636 &#160;&#160;&#160;&#160;<a href="hes_lu_det.cpp.xml" target="_top">Gradient&#xA0;of&#xA0;Determinant&#xA0;Using&#xA0;LU&#xA0;Factorization:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1637 &#160;&#160;&#160;&#160;<a href="hes_minor_det.cpp.xml" target="_top">Gradient&#xA0;of&#xA0;Determinant&#xA0;Using&#xA0;Expansion&#xA0;by&#xA0;Minors:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1638 &#160;&#160;&#160;&#160;<a href="eigen_det.cpp.xml" target="_top">Using&#xA0;Eigen&#xA0;To&#xA0;Compute&#xA0;Determinant:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1639 &#160;&#160;&#160;&#160;<a href="eigen_array.cpp.xml" target="_top">Using&#xA0;Eigen&#xA0;Arrays:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1640 &#160;&#160;&#160;&#160;<a href="conj_grad.cpp.xml" target="_top">Differentiate&#xA0;Conjugate&#xA0;Gradient&#xA0;Algorithm:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1641 &#160;&#160;&#160;&#160;<a href="ad_in_c.cpp.xml" target="_top">Example&#xA0;and&#xA0;Test&#xA0;Linking&#xA0;CppAD&#xA0;to&#xA0;Languages&#xA0;Other&#xA0;than&#xA0;C++</a><br/>
1642 &#160;&#160;&#160;&#160;<a href="ipopt_solve_retape.cpp.xml" target="_top">Nonlinear&#xA0;Programming&#xA0;Retaping:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1643 &#160;&#160;&#160;&#160;<a href="ipopt_solve_get_started.cpp.xml" target="_top">Nonlinear&#xA0;Programming&#xA0;Using&#xA0;CppAD&#xA0;and&#xA0;Ipopt:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1644 &#160;&#160;&#160;&#160;<a href="ipopt_solve_get_started.cpp.xml" target="_top">Nonlinear&#xA0;Programming&#xA0;Using&#xA0;CppAD&#xA0;and&#xA0;Ipopt:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1645 &#160;&#160;&#160;&#160;<a href="to_string.cpp.xml" target="_top">to_string:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1646 &#160;&#160;&#160;&#160;<a href="index_sort.cpp.xml" target="_top">Index&#xA0;Sort:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1647 &#160;&#160;&#160;&#160;<a href="ta_delete_array.xml" target="_top">Deallocate&#xA0;An&#xA0;Array&#xA0;and&#xA0;Call&#xA0;Destructor&#xA0;for&#xA0;its&#xA0;Elements</a><br/>
1648 &#160;&#160;&#160;&#160;<a href="ta_create_array.xml" target="_top">Allocate&#xA0;An&#xA0;Array&#xA0;and&#xA0;Call&#xA0;Default&#xA0;Constructor&#xA0;for&#xA0;its&#xA0;Elements</a><br/>
1649 &#160;&#160;&#160;&#160;<a href="thread_alloc.cpp.xml" target="_top">Fast&#xA0;Multi-Threading&#xA0;Memory&#xA0;Allocator:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1650 &#160;&#160;&#160;&#160;<a href="vector_bool.cpp.xml" target="_top">CppAD::vectorBool&#xA0;Class:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1651 &#160;&#160;&#160;&#160;<a href="cppad_vector.cpp.xml" target="_top">CppAD::vector&#xA0;Template&#xA0;Class:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1652 &#160;&#160;&#160;&#160;<a href="cppad_vector.xml#Memory and Parallel Mode" target="_top">The&#xA0;CppAD::vector&#xA0;Template&#xA0;Class:&#160;Memory&#xA0;and&#xA0;Parallel&#xA0;Mode</a><br/>
1653 &#160;&#160;&#160;&#160;<a href="ode_gear_control.cpp.xml" target="_top">OdeGearControl:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1654 &#160;&#160;&#160;&#160;<a href="ode_gear.cpp.xml" target="_top">OdeGear:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1655 &#160;&#160;&#160;&#160;<a href="ode_err_maxabs.cpp.xml" target="_top">OdeErrControl:&#xA0;Example&#xA0;and&#xA0;Test&#xA0;Using&#xA0;Maxabs&#xA0;Argument</a><br/>
1656 &#160;&#160;&#160;&#160;<a href="ode_err_control.cpp.xml" target="_top">OdeErrControl:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1657 &#160;&#160;&#160;&#160;<a href="rosen_34.cpp.xml" target="_top">Rosen34:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1658 &#160;&#160;&#160;&#160;<a href="rosen34.xml" target="_top">A&#xA0;3rd&#xA0;and&#xA0;4th&#xA0;Order&#xA0;Rosenbrock&#xA0;ODE&#xA0;Solver</a><br/>
1659 &#160;&#160;&#160;&#160;<a href="runge45_2.cpp.xml" target="_top">Runge45:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1660 &#160;&#160;&#160;&#160;<a href="runge45_1.cpp.xml" target="_top">Runge45:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1661 &#160;&#160;&#160;&#160;<a href="runge45.xml" target="_top">An&#xA0;Embedded&#xA0;4th&#xA0;and&#xA0;5th&#xA0;Order&#xA0;Runge-Kutta&#xA0;ODE&#xA0;Solver</a><br/>
1662 &#160;&#160;&#160;&#160;<a href="rombergmul.cpp.xml" target="_top">One&#xA0;Dimensional&#xA0;Romberg&#xA0;Integration:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1663 &#160;&#160;&#160;&#160;<a href="romberg_one.cpp.xml" target="_top">One&#xA0;Dimensional&#xA0;Romberg&#xA0;Integration:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1664 &#160;&#160;&#160;&#160;<a href="lu_invert.cpp.xml" target="_top">LuInvert:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1665 &#160;&#160;&#160;&#160;<a href="lu_factor.cpp.xml" target="_top">LuFactor:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1666 &#160;&#160;&#160;&#160;<a href="lu_solve.cpp.xml" target="_top">LuSolve&#xA0;With&#xA0;Complex&#xA0;Arguments:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1667 &#160;&#160;&#160;&#160;<a href="lusolve.xml#Factor and Invert" target="_top">Compute&#xA0;Determinant&#xA0;and&#xA0;Solve&#xA0;Linear&#xA0;Equations:&#160;Factor&#xA0;and&#xA0;Invert</a><br/>
1668 &#160;&#160;&#160;&#160;<a href="lusolve.xml" target="_top">Compute&#xA0;Determinant&#xA0;and&#xA0;Solve&#xA0;Linear&#xA0;Equations</a><br/>
1669 &#160;&#160;&#160;&#160;<a href="ludetandsolve.xml" target="_top">Compute&#xA0;Determinants&#xA0;and&#xA0;Solve&#xA0;Equations&#xA0;by&#xA0;LU&#xA0;Factorization</a><br/>
1670 &#160;&#160;&#160;&#160;<a href="poly.cpp.xml" target="_top">Polynomial&#xA0;Evaluation:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1671 &#160;&#160;&#160;&#160;<a href="pow_int.cpp.xml" target="_top">The&#xA0;Pow&#xA0;Integer&#xA0;Exponent:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1672 &#160;&#160;&#160;&#160;<a href="nan.cpp.xml" target="_top">nan:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1673 &#160;&#160;&#160;&#160;<a href="check_simple_vector.cpp.xml" target="_top">The&#xA0;CheckSimpleVector&#xA0;Function:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1674 &#160;&#160;&#160;&#160;<a href="simple_vector.cpp.xml" target="_top">Simple&#xA0;Vector&#xA0;Template&#xA0;Class:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1675 &#160;&#160;&#160;&#160;<a href="simplevector.xml#Element Constructor and Destructor" target="_top">Definition&#xA0;of&#xA0;a&#xA0;Simple&#xA0;Vector:&#160;Element&#xA0;Constructor&#xA0;and&#xA0;Destructor</a><br/>
1676 &#160;&#160;&#160;&#160;<a href="check_numeric_type.cpp.xml" target="_top">The&#xA0;CheckNumericType&#xA0;Function:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1677 &#160;&#160;&#160;&#160;<a href="numeric_type.cpp.xml" target="_top">The&#xA0;NumericType:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1678 &#160;&#160;&#160;&#160;<a href="time_test.cpp.xml" target="_top">time_test:&#xA0;Example&#xA0;and&#xA0;test</a><br/>
1679 &#160;&#160;&#160;&#160;<a href="elapsed_seconds.cpp.xml" target="_top">Elapsed&#xA0;Seconds:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1680 &#160;&#160;&#160;&#160;<a href="speed_test.cpp.xml" target="_top">speed_test:&#xA0;Example&#xA0;and&#xA0;test</a><br/>
1681 &#160;&#160;&#160;&#160;<a href="speedtest.xml" target="_top">Run&#xA0;One&#xA0;Speed&#xA0;Test&#xA0;and&#xA0;Print&#xA0;Results</a><br/>
1682 &#160;&#160;&#160;&#160;<a href="speed_test.xml" target="_top">Run&#xA0;One&#xA0;Speed&#xA0;Test&#xA0;and&#xA0;Return&#xA0;Results</a><br/>
1683 &#160;&#160;&#160;&#160;<a href="near_equal.cpp.xml" target="_top">NearEqual&#xA0;Function:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1684 &#160;&#160;&#160;&#160;<a href="error_handler.cpp.xml" target="_top">Replacing&#xA0;The&#xA0;CppAD&#xA0;Error&#xA0;Handler:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1685 &#160;&#160;&#160;&#160;<a href="team_example.cpp.xml" target="_top">Using&#xA0;a&#xA0;Team&#xA0;of&#xA0;AD&#xA0;Threads:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1686 &#160;&#160;&#160;&#160;<a href="simple_ad_pthread.cpp.xml" target="_top">A&#xA0;Simple&#xA0;pthread&#xA0;AD:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1687 &#160;&#160;&#160;&#160;<a href="simple_ad_bthread.cpp.xml" target="_top">A&#xA0;Simple&#xA0;Boost&#xA0;Threading&#xA0;AD:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1688 &#160;&#160;&#160;&#160;<a href="simple_ad_openmp.cpp.xml" target="_top">A&#xA0;Simple&#xA0;OpenMP&#xA0;AD:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1689 &#160;&#160;&#160;&#160;<a href="a11c_pthread.cpp.xml" target="_top">A&#xA0;Simple&#xA0;Parallel&#xA0;Pthread&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1690 &#160;&#160;&#160;&#160;<a href="a11c_bthread.cpp.xml" target="_top">A&#xA0;Simple&#xA0;Boost&#xA0;Thread&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1691 &#160;&#160;&#160;&#160;<a href="a11c_openmp.cpp.xml" target="_top">A&#xA0;Simple&#xA0;OpenMP&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1692 &#160;&#160;&#160;&#160;<a href="thread_test.cpp.xml" target="_top">Run&#xA0;Multi-Threading&#xA0;Examples&#xA0;and&#xA0;Speed&#xA0;Tests</a><br/>
1693 &#160;&#160;&#160;&#160;<a href="check_for_nan.cpp.xml" target="_top">ADFun&#xA0;Checking&#xA0;For&#xA0;Nan:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1694 &#160;&#160;&#160;&#160;<a href="optimize.cpp.xml" target="_top">ADFun&#xA0;Operation&#xA0;Sequence&#xA0;Optimization:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1695 &#160;&#160;&#160;&#160;<a href="fun_check.cpp.xml" target="_top">ADFun&#xA0;Check&#xA0;and&#xA0;Re-Tape:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1696 &#160;&#160;&#160;&#160;<a href="fun_check.cpp.xml" target="_top">ADFun&#xA0;Check&#xA0;and&#xA0;Re-Tape:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1697 &#160;&#160;&#160;&#160;<a href="sparse_sub_hes.cpp.xml" target="_top">Sparse&#xA0;Hessian&#xA0;on&#xA0;Subset&#xA0;of&#xA0;Variables:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1698 &#160;&#160;&#160;&#160;<a href="sparse_hessian.cpp.xml" target="_top">Sparse&#xA0;Hessian:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1699 &#160;&#160;&#160;&#160;<a href="sparse_jacobian.cpp.xml" target="_top">Sparse&#xA0;Jacobian:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1700 &#160;&#160;&#160;&#160;<a href="rev_two.cpp.xml" target="_top">Second&#xA0;Partials&#xA0;Reverse&#xA0;Driver:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1701 &#160;&#160;&#160;&#160;<a href="for_two.cpp.xml" target="_top">Subset&#xA0;of&#xA0;Second&#xA0;Order&#xA0;Partials:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1702 &#160;&#160;&#160;&#160;<a href="hes_lagrangian.cpp.xml" target="_top">Hessian&#xA0;of&#xA0;Lagrangian&#xA0;and&#xA0;&#xA0;ADFun&#xA0;Default&#xA0;Constructor:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1703 &#160;&#160;&#160;&#160;<a href="hes_lagrangian.cpp.xml" target="_top">Hessian&#xA0;of&#xA0;Lagrangian&#xA0;and&#xA0;&#xA0;ADFun&#xA0;Default&#xA0;Constructor:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1704 &#160;&#160;&#160;&#160;<a href="hessian.cpp.xml" target="_top">Hessian:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1705 &#160;&#160;&#160;&#160;<a href="rev_one.cpp.xml" target="_top">First&#xA0;Order&#xA0;Derivative&#xA0;Driver:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1706 &#160;&#160;&#160;&#160;<a href="for_one.cpp.xml" target="_top">First&#xA0;Order&#xA0;Partial&#xA0;Driver:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1707 &#160;&#160;&#160;&#160;<a href="jacobian.cpp.xml" target="_top">Jacobian:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1708 &#160;&#160;&#160;&#160;<a href="drivers.xml" target="_top">First&#xA0;and&#xA0;Second&#xA0;Derivatives:&#xA0;Easy&#xA0;Drivers</a><br/>
1709 &#160;&#160;&#160;&#160;<a href="bool_sparsity.cpp.xml" target="_top">Using&#xA0;vectorBool&#xA0;Sparsity&#xA0;To&#xA0;Conserve&#xA0;Memory:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1710 &#160;&#160;&#160;&#160;<a href="sparsity_sub.cpp.xml" target="_top">Sparsity&#xA0;Patterns&#xA0;For&#xA0;a&#xA0;Subset&#xA0;of&#xA0;Variables:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1711 &#160;&#160;&#160;&#160;<a href="rev_sparse_hes.cpp.xml" target="_top">Reverse&#xA0;Mode&#xA0;Hessian&#xA0;Sparsity:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1712 &#160;&#160;&#160;&#160;<a href="dependency.cpp.xml" target="_top">Computing&#xA0;Dependency:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1713 &#160;&#160;&#160;&#160;<a href="rev_sparse_jac.cpp.xml" target="_top">Reverse&#xA0;Mode&#xA0;Jacobian&#xA0;Sparsity:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1714 &#160;&#160;&#160;&#160;<a href="for_sparse_jac.cpp.xml" target="_top">Forward&#xA0;Mode&#xA0;Jacobian&#xA0;Sparsity:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1715 &#160;&#160;&#160;&#160;<a href="reverse_any.cpp.xml" target="_top">Reverse&#xA0;Mode&#xA0;General&#xA0;Case:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1716 &#160;&#160;&#160;&#160;<a href="reverse_three.cpp.xml" target="_top">Third&#xA0;Order&#xA0;Reverse&#xA0;Mode:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1717 &#160;&#160;&#160;&#160;<a href="hes_times_dir.cpp.xml" target="_top">Hessian&#xA0;Times&#xA0;Direction:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1718 &#160;&#160;&#160;&#160;<a href="reverse_two.cpp.xml" target="_top">Second&#xA0;Order&#xA0;Reverse&#xA0;ModeExample&#xA0;and&#xA0;Test</a><br/>
1719 &#160;&#160;&#160;&#160;<a href="reverse_one.cpp.xml" target="_top">First&#xA0;Order&#xA0;Reverse&#xA0;Mode:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1720 &#160;&#160;&#160;&#160;<a href="number_skip.cpp.xml" target="_top">Number&#xA0;of&#xA0;Variables&#xA0;That&#xA0;Can&#xA0;be&#xA0;Skipped:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1721 &#160;&#160;&#160;&#160;<a href="capacity_order.cpp.xml" target="_top">Controlling&#xA0;Taylor&#xA0;Coefficient&#xA0;Memory&#xA0;Allocation:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1722 &#160;&#160;&#160;&#160;<a href="compare_change.cpp.xml" target="_top">CompareChange&#xA0;and&#xA0;Re-Tape:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1723 &#160;&#160;&#160;&#160;<a href="compare_change.cpp.xml" target="_top">CompareChange&#xA0;and&#xA0;Re-Tape:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1724 &#160;&#160;&#160;&#160;<a href="compare_change.xml" target="_top">Comparison&#xA0;Changes&#xA0;Between&#xA0;Taping&#xA0;and&#xA0;Zero&#xA0;Order&#xA0;Forward</a><br/>
1725 &#160;&#160;&#160;&#160;<a href="forward_dir.cpp.xml" target="_top">Forward&#xA0;Mode:&#xA0;Example&#xA0;and&#xA0;Test&#xA0;of&#xA0;Multiple&#xA0;Directions</a><br/>
1726 &#160;&#160;&#160;&#160;<a href="forward_order.cpp.xml" target="_top">Forward&#xA0;Mode:&#xA0;Example&#xA0;and&#xA0;Test&#xA0;of&#xA0;Multiple&#xA0;Orders</a><br/>
1727 &#160;&#160;&#160;&#160;<a href="forward.cpp.xml" target="_top">Forward&#xA0;Mode:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1728 &#160;&#160;&#160;&#160;<a href="funeval.xml" target="_top">Evaluate&#xA0;ADFun&#xA0;Functions,&#xA0;Derivatives,&#xA0;and&#xA0;Sparsity&#xA0;Patterns</a><br/>
1729 &#160;&#160;&#160;&#160;<a href="seq_property.cpp.xml" target="_top">ADFun&#xA0;Sequence&#xA0;Properties:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1730 &#160;&#160;&#160;&#160;<a href="abort_recording.cpp.xml" target="_top">Abort&#xA0;Current&#xA0;Recording:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1731 &#160;&#160;&#160;&#160;<a href="dependent.xml" target="_top">Stop&#xA0;Recording&#xA0;and&#xA0;Store&#xA0;Operation&#xA0;Sequence</a><br/>
1732 &#160;&#160;&#160;&#160;<a href="fun_assign.cpp.xml" target="_top">ADFun&#xA0;Assignment:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1733 &#160;&#160;&#160;&#160;<a href="funconstruct.xml" target="_top">Construct&#xA0;an&#xA0;ADFun&#xA0;Object&#xA0;and&#xA0;Stop&#xA0;Recording</a><br/>
1734 &#160;&#160;&#160;&#160;<a href="independent.cpp.xml" target="_top">Independent&#xA0;and&#xA0;ADFun&#xA0;Constructor:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1735 &#160;&#160;&#160;&#160;<a href="independent.cpp.xml" target="_top">Independent&#xA0;and&#xA0;ADFun&#xA0;Constructor:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1736 &#160;&#160;&#160;&#160;<a href="independent.xml" target="_top">Declare&#xA0;Independent&#xA0;Variables&#xA0;and&#xA0;Start&#xA0;Recording</a><br/>
1737 &#160;&#160;&#160;&#160;<a href="complex_poly.cpp.xml" target="_top">Complex&#xA0;Polynomial:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1738 &#160;&#160;&#160;&#160;<a href="mul_level_adolc.cpp.xml" target="_top">Using&#xA0;Adolc&#xA0;with&#xA0;Multiple&#xA0;Levels&#xA0;of&#xA0;Taping:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1739 &#160;&#160;&#160;&#160;<a href="base_require.cpp.xml" target="_top">Using&#xA0;a&#xA0;User&#xA0;Defined&#xA0;AD&#xA0;Base&#xA0;Type:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1740 &#160;&#160;&#160;&#160;<a href="vec_ad.cpp.xml" target="_top">AD&#xA0;Vectors&#xA0;that&#xA0;Record&#xA0;Index&#xA0;Operations:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1741 &#160;&#160;&#160;&#160;<a href="vecad.xml#Speed and Memory" target="_top">AD&#xA0;Vectors&#xA0;that&#xA0;Record&#xA0;Index&#xA0;Operations:&#160;Speed&#xA0;and&#xA0;Memory</a><br/>
1742 &#160;&#160;&#160;&#160;<a href="equal_op_seq.cpp.xml" target="_top">EqualOpSeq:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1743 &#160;&#160;&#160;&#160;<a href="par_var.cpp.xml" target="_top">AD&#xA0;Parameter&#xA0;and&#xA0;Variable&#xA0;Functions:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1744 &#160;&#160;&#160;&#160;<a href="par_var.cpp.xml" target="_top">AD&#xA0;Parameter&#xA0;and&#xA0;Variable&#xA0;Functions:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1745 &#160;&#160;&#160;&#160;<a href="bool_fun.cpp.xml" target="_top">AD&#xA0;Boolean&#xA0;Functions:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1746 &#160;&#160;&#160;&#160;<a href="near_equal_ext.cpp.xml" target="_top">Compare&#xA0;AD&#xA0;with&#xA0;Base&#xA0;Objects:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1747 &#160;&#160;&#160;&#160;<a href="nearequalext.xml" target="_top">Compare&#xA0;AD&#xA0;and&#xA0;Base&#xA0;Objects&#xA0;for&#xA0;Nearly&#xA0;Equal</a><br/>
1748 &#160;&#160;&#160;&#160;<a href="compare.cpp.xml" target="_top">AD&#xA0;Binary&#xA0;Comparison&#xA0;Operators:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1749 &#160;&#160;&#160;&#160;<a href="boolvalued.xml" target="_top">Bool&#xA0;Valued&#xA0;Operations&#xA0;and&#xA0;Functions&#xA0;with&#xA0;AD&#xA0;Arguments</a><br/>
1750 &#160;&#160;&#160;&#160;<a href="atomic_mat_mul.cpp.xml" target="_top">User&#xA0;Atomic&#xA0;Matrix&#xA0;Multiply:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1751 &#160;&#160;&#160;&#160;<a href="atomic_hes_sparse.cpp.xml#Test with x_1 Both a Variable and a Parameter" target="_top">Atomic&#xA0;Operation&#xA0;Hessian&#xA0;Sparsity:&#xA0;Example&#xA0;and&#xA0;Test:&#160;Test&#xA0;with&#xA0;x_1&#xA0;Both&#xA0;a&#xA0;Variable&#xA0;and&#xA0;a&#xA0;Parameter</a><br/>
1752 &#160;&#160;&#160;&#160;<a href="atomic_hes_sparse.cpp.xml" target="_top">Atomic&#xA0;Operation&#xA0;Hessian&#xA0;Sparsity:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1753 &#160;&#160;&#160;&#160;<a href="atomic_tangent.cpp.xml" target="_top">Tan&#xA0;and&#xA0;Tanh&#xA0;as&#xA0;User&#xA0;Atomic&#xA0;Operations:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1754 &#160;&#160;&#160;&#160;<a href="atomic_tangent.cpp.xml" target="_top">Tan&#xA0;and&#xA0;Tanh&#xA0;as&#xA0;User&#xA0;Atomic&#xA0;Operations:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1755 &#160;&#160;&#160;&#160;<a href="atomic_sparsity.cpp.xml#Use Atomic Function.forsparse_jac and rev_sparse_jac" target="_top">Atomic&#xA0;Sparsity&#xA0;Patterns:&#xA0;Example&#xA0;and&#xA0;Test:&#160;Use&#xA0;Atomic&#xA0;Function.forsparse_jac&#xA0;and&#xA0;rev_sparse_jac</a><br/>
1756 &#160;&#160;&#160;&#160;<a href="atomic_sparsity.cpp.xml" target="_top">Atomic&#xA0;Sparsity&#xA0;Patterns:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1757 &#160;&#160;&#160;&#160;<a href="atomic_reciprocal.cpp.xml" target="_top">Reciprocal&#xA0;as&#xA0;an&#xA0;Atomic&#xA0;Operation:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1758 &#160;&#160;&#160;&#160;<a href="atomic_norm_sq.cpp.xml" target="_top">Atomic&#xA0;Euclidean&#xA0;Norm&#xA0;Squared:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1759 &#160;&#160;&#160;&#160;<a href="atomic_get_started.cpp.xml" target="_top">Getting&#xA0;Started&#xA0;with&#xA0;Atomic&#xA0;Operations:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1760 &#160;&#160;&#160;&#160;<a href="checkpoint.cpp.xml" target="_top">Simple&#xA0;Checkpointing:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1761 &#160;&#160;&#160;&#160;<a href="num_limits.cpp.xml" target="_top">Numeric&#xA0;Limits:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1762 &#160;&#160;&#160;&#160;<a href="numeric_limits.xml" target="_top">Numeric&#xA0;Limits&#xA0;For&#xA0;an&#xA0;AD&#xA0;and&#xA0;Base&#xA0;Types</a><br/>
1763 &#160;&#160;&#160;&#160;<a href="interp_retape.cpp.xml" target="_top">Interpolation&#xA0;With&#xA0;Retaping:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1764 &#160;&#160;&#160;&#160;<a href="interp_onetape.cpp.xml" target="_top">Interpolation&#xA0;With&#xA0;Out&#xA0;Retaping:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1765 &#160;&#160;&#160;&#160;<a href="tape_index.cpp.xml" target="_top">Taping&#xA0;Array&#xA0;Index&#xA0;Operation:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1766 &#160;&#160;&#160;&#160;<a href="cond_exp.cpp.xml" target="_top">Conditional&#xA0;Expressions:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1767 &#160;&#160;&#160;&#160;<a href="azmul.cpp.xml" target="_top">AD&#xA0;Absolute&#xA0;Zero&#xA0;Multiplication:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1768 &#160;&#160;&#160;&#160;<a href="pow.cpp.xml" target="_top">The&#xA0;AD&#xA0;Power&#xA0;Function:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1769 &#160;&#160;&#160;&#160;<a href="atan2.cpp.xml" target="_top">The&#xA0;AD&#xA0;atan2&#xA0;Function:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1770 &#160;&#160;&#160;&#160;<a href="sign.cpp.xml" target="_top">Sign&#xA0;Function:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1771 &#160;&#160;&#160;&#160;<a href="log1p.cpp.xml" target="_top">The&#xA0;AD&#xA0;log1p&#xA0;Function:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1772 &#160;&#160;&#160;&#160;<a href="expm1.cpp.xml" target="_top">The&#xA0;AD&#xA0;exp&#xA0;Function:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1773 &#160;&#160;&#160;&#160;<a href="erf.cpp.xml" target="_top">The&#xA0;AD&#xA0;erf&#xA0;Function:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1774 &#160;&#160;&#160;&#160;<a href="atanh.cpp.xml" target="_top">The&#xA0;AD&#xA0;atanh&#xA0;Function:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1775 &#160;&#160;&#160;&#160;<a href="asinh.cpp.xml" target="_top">The&#xA0;AD&#xA0;asinh&#xA0;Function:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1776 &#160;&#160;&#160;&#160;<a href="acosh.cpp.xml" target="_top">The&#xA0;AD&#xA0;acosh&#xA0;Function:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1777 &#160;&#160;&#160;&#160;<a href="abs.cpp.xml" target="_top">AD&#xA0;Absolute&#xA0;Value&#xA0;Function:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1778 &#160;&#160;&#160;&#160;<a href="tanh.cpp.xml" target="_top">The&#xA0;AD&#xA0;tanh&#xA0;Function:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1779 &#160;&#160;&#160;&#160;<a href="tan.cpp.xml" target="_top">The&#xA0;AD&#xA0;tan&#xA0;Function:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1780 &#160;&#160;&#160;&#160;<a href="sqrt.cpp.xml" target="_top">The&#xA0;AD&#xA0;sqrt&#xA0;Function:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1781 &#160;&#160;&#160;&#160;<a href="sinh.cpp.xml" target="_top">The&#xA0;AD&#xA0;sinh&#xA0;Function:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1782 &#160;&#160;&#160;&#160;<a href="sin.cpp.xml" target="_top">The&#xA0;AD&#xA0;sin&#xA0;Function:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1783 &#160;&#160;&#160;&#160;<a href="log10.cpp.xml" target="_top">The&#xA0;AD&#xA0;log10&#xA0;Function:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1784 &#160;&#160;&#160;&#160;<a href="log.cpp.xml" target="_top">The&#xA0;AD&#xA0;log&#xA0;Function:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1785 &#160;&#160;&#160;&#160;<a href="exp.cpp.xml" target="_top">The&#xA0;AD&#xA0;exp&#xA0;Function:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1786 &#160;&#160;&#160;&#160;<a href="cosh.cpp.xml" target="_top">The&#xA0;AD&#xA0;cosh&#xA0;Function:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1787 &#160;&#160;&#160;&#160;<a href="cos.cpp.xml" target="_top">The&#xA0;AD&#xA0;cos&#xA0;Function:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1788 &#160;&#160;&#160;&#160;<a href="atan.cpp.xml" target="_top">The&#xA0;AD&#xA0;atan&#xA0;Function:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1789 &#160;&#160;&#160;&#160;<a href="asin.cpp.xml" target="_top">The&#xA0;AD&#xA0;asin&#xA0;Function:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1790 &#160;&#160;&#160;&#160;<a href="acos.cpp.xml" target="_top">The&#xA0;AD&#xA0;acos&#xA0;Function:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1791 &#160;&#160;&#160;&#160;<a href="div_eq.cpp.xml" target="_top">AD&#xA0;Computed&#xA0;Assignment&#xA0;Division:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1792 &#160;&#160;&#160;&#160;<a href="mul_eq.cpp.xml" target="_top">AD&#xA0;Computed&#xA0;Assignment&#xA0;Multiplication:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1793 &#160;&#160;&#160;&#160;<a href="sub_eq.cpp.xml" target="_top">AD&#xA0;Computed&#xA0;Assignment&#xA0;Subtraction:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1794 &#160;&#160;&#160;&#160;<a href="addeq.cpp.xml" target="_top">AD&#xA0;Computed&#xA0;Assignment&#xA0;Addition:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1795 &#160;&#160;&#160;&#160;<a href="div.cpp.xml" target="_top">AD&#xA0;Binary&#xA0;Division:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1796 &#160;&#160;&#160;&#160;<a href="mul.cpp.xml" target="_top">AD&#xA0;Binary&#xA0;Multiplication:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1797 &#160;&#160;&#160;&#160;<a href="sub.cpp.xml" target="_top">AD&#xA0;Binary&#xA0;Subtraction:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1798 &#160;&#160;&#160;&#160;<a href="add.cpp.xml" target="_top">AD&#xA0;Binary&#xA0;Addition:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1799 &#160;&#160;&#160;&#160;<a href="unary_minus.cpp.xml" target="_top">AD&#xA0;Unary&#xA0;Minus&#xA0;Operator:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1800 &#160;&#160;&#160;&#160;<a href="unary_plus.cpp.xml" target="_top">AD&#xA0;Unary&#xA0;Plus&#xA0;Operator:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1801 &#160;&#160;&#160;&#160;<a href="arithmetic.xml" target="_top">AD&#xA0;Arithmetic&#xA0;Operators&#xA0;and&#xA0;Computed&#xA0;Assignments</a><br/>
1802 &#160;&#160;&#160;&#160;<a href="advalued.xml" target="_top">AD&#xA0;Valued&#xA0;Operations&#xA0;and&#xA0;Functions</a><br/>
1803 &#160;&#160;&#160;&#160;<a href="var2par.cpp.xml" target="_top">Convert&#xA0;an&#xA0;AD&#xA0;Variable&#xA0;to&#xA0;a&#xA0;Parameter:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1804 &#160;&#160;&#160;&#160;<a href="print_for_string.cpp.xml" target="_top">Print&#xA0;During&#xA0;Zero&#xA0;Order&#xA0;Forward&#xA0;Mode:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1805 &#160;&#160;&#160;&#160;<a href="print_for_cout.cpp.xml" target="_top">Printing&#xA0;During&#xA0;Forward&#xA0;Mode:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1806 &#160;&#160;&#160;&#160;<a href="ad_output.cpp.xml" target="_top">AD&#xA0;Output&#xA0;Operator:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1807 &#160;&#160;&#160;&#160;<a href="ad_input.cpp.xml" target="_top">AD&#xA0;Output&#xA0;Operator:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1808 &#160;&#160;&#160;&#160;<a href="integer.cpp.xml" target="_top">Convert&#xA0;From&#xA0;AD&#xA0;to&#xA0;Integer:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1809 &#160;&#160;&#160;&#160;<a href="value.cpp.xml" target="_top">Convert&#xA0;From&#xA0;AD&#xA0;to&#xA0;its&#xA0;Base&#xA0;Type:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1810 &#160;&#160;&#160;&#160;<a href="convert.xml" target="_top">Conversion&#xA0;and&#xA0;I/O&#xA0;of&#xA0;AD&#xA0;Objects</a><br/>
1811 &#160;&#160;&#160;&#160;<a href="ad_assign.cpp.xml" target="_top">AD&#xA0;Assignment:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1812 &#160;&#160;&#160;&#160;<a href="ad_ctor.cpp.xml" target="_top">AD&#xA0;Constructors:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1813 &#160;&#160;&#160;&#160;<a href="exp_eps_cppad.xml" target="_top">exp_eps:&#xA0;CppAD&#xA0;Forward&#xA0;and&#xA0;Reverse&#xA0;Sweeps</a><br/>
1814 &#160;&#160;&#160;&#160;<a href="exp_eps_for0.xml" target="_top">exp_eps:&#xA0;Operation&#xA0;Sequence&#xA0;and&#xA0;Zero&#xA0;Order&#xA0;Forward&#xA0;Sweep</a><br/>
1815 &#160;&#160;&#160;&#160;<a href="exp_2_cppad.xml" target="_top">exp_2:&#xA0;CppAD&#xA0;Forward&#xA0;and&#xA0;Reverse&#xA0;Sweeps</a><br/>
1816 &#160;&#160;&#160;&#160;<a href="exp_2_for0.xml" target="_top">exp_2:&#xA0;Operation&#xA0;Sequence&#xA0;and&#xA0;Zero&#xA0;Order&#xA0;Forward&#xA0;Mode</a><br/>
1817 &#160;&#160;&#160;&#160;<a href="auto_tools.xml#make.Examples and Tests" target="_top">Auto&#xA0;Tools&#xA0;Unix&#xA0;Test&#xA0;and&#xA0;Installation:&#160;make.Examples&#xA0;and&#xA0;Tests</a><br/>
1818 &#160;&#160;&#160;&#160;<a href="auto_tools.xml" target="_top">Auto&#xA0;Tools&#xA0;Unix&#xA0;Test&#xA0;and&#xA0;Installation</a><br/>
1819 &#160;&#160;&#160;&#160;<a href="cmake_check.xml" target="_top">Checking&#xA0;the&#xA0;CppAD&#xA0;Examples&#xA0;and&#xA0;Tests</a><br/>
1820 &#160;&#160;&#160;&#160;<a href="get_sacado.sh.xml" target="_top">Download&#xA0;and&#xA0;Install&#xA0;Sacado&#xA0;in&#xA0;Build&#xA0;Directory</a><br/>
1821 &#160;&#160;&#160;&#160;<a href="get_ipopt.sh.xml" target="_top">Download&#xA0;and&#xA0;Install&#xA0;Ipopt&#xA0;in&#xA0;Build&#xA0;Directory</a><br/>
1822 &#160;&#160;&#160;&#160;<a href="ipopt_prefix.xml#Examples and Tests" target="_top">Including&#xA0;the&#xA0;cppad_ipopt&#xA0;Library&#xA0;and&#xA0;Tests:&#160;Examples&#xA0;and&#xA0;Tests</a><br/>
1823 &#160;&#160;&#160;&#160;<a href="ipopt_prefix.xml" target="_top">Including&#xA0;the&#xA0;cppad_ipopt&#xA0;Library&#xA0;and&#xA0;Tests</a><br/>
1824 &#160;&#160;&#160;&#160;<a href="get_fadbad.sh.xml" target="_top">Download&#xA0;and&#xA0;Install&#xA0;Fadbad&#xA0;in&#xA0;Build&#xA0;Directory</a><br/>
1825 &#160;&#160;&#160;&#160;<a href="get_eigen.sh.xml" target="_top">Download&#xA0;and&#xA0;Install&#xA0;Eigen&#xA0;in&#xA0;Build&#xA0;Directory</a><br/>
1826 &#160;&#160;&#160;&#160;<a href="eigen_prefix.xml" target="_top">Including&#xA0;the&#xA0;Eigen&#xA0;Examples&#xA0;and&#xA0;Tests</a><br/>
1827 &#160;&#160;&#160;&#160;<a href="get_colpack.sh.xml" target="_top">Download&#xA0;and&#xA0;Install&#xA0;ColPack&#xA0;in&#xA0;Build&#xA0;Directory</a><br/>
1828 &#160;&#160;&#160;&#160;<a href="colpack_hes.cpp.xml" target="_top">Using&#xA0;ColPack:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1829 &#160;&#160;&#160;&#160;<a href="colpack_jac.cpp.xml" target="_top">Using&#xA0;ColPack:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1830 &#160;&#160;&#160;&#160;<a href="get_adolc.sh.xml" target="_top">Download&#xA0;and&#xA0;Install&#xA0;Adolc&#xA0;in&#xA0;Build&#xA0;Directory</a><br/>
1831 &#160;&#160;&#160;&#160;<a href="adolc_prefix.xml" target="_top">Including&#xA0;the&#xA0;ADOL-C&#xA0;Examples&#xA0;and&#xA0;Tests</a><br/>
1832 &#160;&#160;&#160;&#160;<a href="cmake.xml#cppad_profile_flag.Eigen and Fadbad" target="_top">Using&#xA0;CMake&#xA0;to&#xA0;Configure&#xA0;CppAD:&#160;cppad_profile_flag.Eigen&#xA0;and&#xA0;Fadbad</a><br/>
1833 &#160;&#160;&#160;&#160;<a href="download.xml#Compressed Archives.Windows File Extraction and Testing" target="_top">Download&#xA0;The&#xA0;CppAD&#xA0;Source&#xA0;Code:&#160;Compressed&#xA0;Archives.Windows&#xA0;File&#xA0;Extraction&#xA0;and&#xA0;Testing</a><br/>
1834 &#160;&#160;&#160;&#160;<a href="install.xml" target="_top">CppAD&#xA0;Download,&#xA0;Test,&#xA0;and&#xA0;Install&#xA0;Instructions</a><br/>
18351438 another&#160;<a href="omp_efficient.xml" target="_top">Check&#xA0;If&#xA0;A&#xA0;Memory&#xA0;Allocation&#xA0;is&#xA0;Efficient&#xA0;for&#xA0;Another&#xA0;Use</a><br/>
18361439 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="base_to_string.xml" target="_top">Extending&#xA0;to_string&#xA0;To&#xA0;Another&#xA0;Floating&#xA0;Point&#xA0;Type</a><br/>
18371440 answers&#160;<a href="faq.xml" target="_top">Frequently&#xA0;Asked&#xA0;Questions&#xA0;and&#xA0;Answers</a><br/>
18741477 &#160;&#160;&#160;&#160;&#160;&#160;<a href="ta_create_array.xml" target="_top">Allocate&#xA0;An&#xA0;Array&#xA0;and&#xA0;Call&#xA0;Default&#xA0;Constructor&#xA0;for&#xA0;its&#xA0;Elements</a><br/>
18751478 &#160;&#160;&#160;&#160;&#160;&#160;<a href="tape_index.cpp.xml" target="_top">Taping&#xA0;Array&#xA0;Index&#xA0;Operation:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
18761479 arrays<b>:</b>&#160;<a href="eigen_array.cpp.xml" target="_top">Using&#xA0;Eigen&#xA0;Arrays:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1877 as&#160;<a href="old_mat_mul.hpp.xml" target="_top">Define&#xA0;Matrix&#xA0;Multiply&#xA0;as&#xA0;a&#xA0;User&#xA0;Atomic&#xA0;Operation</a><br/>
1878 &#160;&#160;&#160;<a href="old_mat_mul.cpp.xml" target="_top">Old&#xA0;Matrix&#xA0;Multiply&#xA0;as&#xA0;a&#xA0;User&#xA0;Atomic&#xA0;Operation:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1879 &#160;&#160;&#160;<a href="old_tan.cpp.xml" target="_top">Old&#xA0;Tan&#xA0;and&#xA0;Tanh&#xA0;as&#xA0;User&#xA0;Atomic&#xA0;Operations:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1880 &#160;&#160;&#160;<a href="atomic_matrix_mul.hpp.xml" target="_top">Matrix&#xA0;Multiply&#xA0;as&#xA0;an&#xA0;Atomic&#xA0;Operation</a><br/>
1881 &#160;&#160;&#160;<a href="atomic_tangent.cpp.xml" target="_top">Tan&#xA0;and&#xA0;Tanh&#xA0;as&#xA0;User&#xA0;Atomic&#xA0;Operations:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
1882 &#160;&#160;&#160;<a href="atomic_reciprocal.cpp.xml" target="_top">Reciprocal&#xA0;as&#xA0;an&#xA0;Atomic&#xA0;Operation:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
18831480 asin&#160;<a href="asin_reverse.xml" target="_top">Inverse&#xA0;Sine&#xA0;and&#xA0;Hyperbolic&#xA0;Sine&#xA0;Reverse&#xA0;Mode&#xA0;Theory</a><br/>
18841481 &#160;&#160;&#160;&#160;&#160;<a href="asin_forward.xml" target="_top">Inverse&#xA0;Sine&#xA0;and&#xA0;Hyperbolic&#xA0;Sine&#xA0;Forward&#xA0;Mode&#xA0;Theory</a><br/>
18851482 &#160;&#160;&#160;&#160;&#160;<a href="asin.cpp.xml" target="_top">The&#xA0;AD&#xA0;asin&#xA0;Function:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
19241521 assignments&#160;<a href="arithmetic.xml" target="_top">AD&#xA0;Arithmetic&#xA0;Operators&#xA0;and&#xA0;Computed&#xA0;Assignments</a><br/>
19251522 assumption&#160;<a href="ad_output.xml#Assumption" target="_top">AD&#xA0;Output&#xA0;Stream&#xA0;Operator:&#160;Assumption</a><br/>
19261523 assumptions&#160;<a href="compare.xml#Assumptions" target="_top">AD&#xA0;Binary&#xA0;Comparison&#xA0;Operators:&#160;Assumptions</a><br/>
1927 at&#160;<a href="omp_get_memory.xml" target="_top">Get&#xA0;At&#xA0;Least&#xA0;A&#xA0;Specified&#xA0;Amount&#xA0;of&#xA0;Memory</a><br/>
1928 &#160;&#160;&#160;<a href="ta_get_memory.xml" target="_top">Get&#xA0;At&#xA0;Least&#xA0;A&#xA0;Specified&#xA0;Amount&#xA0;of&#xA0;Memory</a><br/>
19291524 atan&#160;<a href="atan_forward.xml" target="_top">Inverse&#xA0;Tangent&#xA0;and&#xA0;Hyperbolic&#xA0;Tangent&#xA0;Forward&#xA0;Mode&#xA0;Theory</a><br/>
19301525 &#160;&#160;&#160;&#160;&#160;<a href="atan.cpp.xml" target="_top">The&#xA0;AD&#xA0;atan&#xA0;Function:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
19311526 &#160;&#160;&#160;&#160;&#160;<a href="atan.xml" target="_top">Inverse&#xA0;Tangent&#xA0;Function:&#xA0;atan</a><br/>
19951590 atomic<b>_</b>user&#160;<a href="atomic_ctor.xml#atomic_user" target="_top">Atomic&#xA0;Function&#xA0;Constructor:&#160;atomic_user</a><br/>
19961591 auto&#160;<a href="auto_tools.xml" target="_top">Auto&#xA0;Tools&#xA0;Unix&#xA0;Test&#xA0;and&#xA0;Installation</a><br/>
19971592 automatic&#160;<a href="ad_in_c.cpp.xml" target="_top">Example&#xA0;and&#xA0;Test&#xA0;Linking&#xA0;CppAD&#xA0;to&#xA0;Languages&#xA0;Other&#xA0;than&#xA0;C++</a><br/>
1998 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="cppad.xml" target="_top">cppad-20160000.0:&#xA0;A&#xA0;Package&#xA0;for&#xA0;Differentiation&#xA0;of&#xA0;C++&#xA0;Algorithms</a><br/>
1593 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="cppad.xml" target="_top">cppad-20160000.1:&#xA0;A&#xA0;Package&#xA0;for&#xA0;Differentiation&#xA0;of&#xA0;C++&#xA0;Algorithms</a><br/>
19991594 available&#160;<a href="memory_leak.xml#available" target="_top">Memory&#xA0;Leak&#xA0;Detection:&#160;available</a><br/>
20001595 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="omp_delete_array.xml" target="_top">Return&#xA0;A&#xA0;Raw&#xA0;Array&#xA0;to&#xA0;The&#xA0;Available&#xA0;Memory&#xA0;for&#xA0;a&#xA0;Thread</a><br/>
20011596 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="omp_available.xml" target="_top">Amount&#xA0;of&#xA0;Memory&#xA0;Available&#xA0;for&#xA0;Quick&#xA0;Use&#xA0;by&#xA0;a&#xA0;Thread</a><br/>
20251620 &#160;&#160;&#160;&#160;&#160;<a href="ad_ctor.xml" target="_top">AD&#xA0;Constructors</a><br/>
20261621 BenderQuad&#160;<a href="bender_quad.cpp.xml" target="_top">BenderQuad:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
20271622 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="benderquad.xml" target="_top">Computing&#xA0;Jacobian&#xA0;and&#xA0;Hessian&#xA0;of&#xA0;Bender's&#xA0;Reduced&#xA0;Objective</a><br/>
2028 b&#160;<a href="rombergmul.xml#b" target="_top">Multi-dimensional&#xA0;Romberg&#xA0;Integration:&#160;b</a><br/>
2029 &#160;&#160;<a href="rombergone.xml#b" target="_top">One&#xA0;DimensionalRomberg&#xA0;Integration:&#160;b</a><br/>
2030 &#160;&#160;<a href="lusolve.xml#B" target="_top">Compute&#xA0;Determinant&#xA0;and&#xA0;Solve&#xA0;Linear&#xA0;Equations:&#160;B</a><br/>
2031 &#160;&#160;<a href="nan.xml#hasnan.b" target="_top">Obtain&#xA0;Nan&#xA0;or&#xA0;Determine&#xA0;if&#xA0;a&#xA0;Value&#xA0;is&#xA0;Nan:&#160;hasnan.b</a><br/>
2032 &#160;&#160;<a href="nan.xml#isnan.b" target="_top">Obtain&#xA0;Nan&#xA0;or&#xA0;Determine&#xA0;if&#xA0;a&#xA0;Value&#xA0;is&#xA0;Nan:&#160;isnan.b</a><br/>
2033 &#160;&#160;<a href="nearequal.xml#b" target="_top">Determine&#xA0;if&#xA0;Two&#xA0;Values&#xA0;Are&#xA0;Nearly&#xA0;Equal:&#160;b</a><br/>
2034 &#160;&#160;<a href="check_for_nan.xml#b" target="_top">Check&#xA0;an&#xA0;ADFun&#xA0;Object&#xA0;For&#xA0;Nan&#xA0;Results:&#160;b</a><br/>
2035 &#160;&#160;<a href="vecad.xml#size_t Indexing.b" target="_top">AD&#xA0;Vectors&#xA0;that&#xA0;Record&#xA0;Index&#xA0;Operations:&#160;size_t&#xA0;Indexing.b</a><br/>
2036 &#160;&#160;<a href="equalopseq.xml#b" target="_top">Check&#xA0;if&#xA0;Two&#xA0;Value&#xA0;are&#xA0;Identically&#xA0;Equal:&#160;b</a><br/>
2037 &#160;&#160;<a href="parvar.xml#b" target="_top">Is&#xA0;an&#xA0;AD&#xA0;Object&#xA0;a&#xA0;Parameter&#xA0;or&#xA0;Variable:&#160;b</a><br/>
2038 &#160;&#160;<a href="boolfun.xml#b" target="_top">AD&#xA0;Boolean&#xA0;Functions:&#160;b</a><br/>
2039 &#160;&#160;<a href="nearequalext.xml#b" target="_top">Compare&#xA0;AD&#xA0;and&#xA0;Base&#xA0;Objects&#xA0;for&#xA0;Nearly&#xA0;Equal:&#160;b</a><br/>
2040 &#160;&#160;<a href="compare.xml#b" target="_top">AD&#xA0;Binary&#xA0;Comparison&#xA0;Operators:&#160;b</a><br/>
2041 &#160;&#160;<a href="value.xml#b" target="_top">Convert&#xA0;From&#xA0;an&#xA0;AD&#xA0;Type&#xA0;to&#xA0;its&#xA0;Base&#xA0;Type:&#160;b</a><br/>
20421623 background&#160;<a href="mul_level.xml#Background" target="_top">Using&#xA0;Multiple&#xA0;Levels&#xA0;of&#xA0;AD:&#160;Background</a><br/>
20431624 base&#160;<a href="zdouble.xml#Base Type Requirements" target="_top">zdouble:&#xA0;An&#xA0;AD&#xA0;Base&#xA0;Type&#xA0;With&#xA0;Absolute&#xA0;Zero:&#160;Base&#xA0;Type&#xA0;Requirements</a><br/>
20441625 &#160;&#160;&#160;&#160;&#160;<a href="zdouble.xml" target="_top">zdouble:&#xA0;An&#xA0;AD&#xA0;Base&#xA0;Type&#xA0;With&#xA0;Absolute&#xA0;Zero</a><br/>
21451726 &#160;&#160;&#160;&#160;&#160;&#160;<a href="get_adolc.sh.xml" target="_top">Download&#xA0;and&#xA0;Install&#xA0;Adolc&#xA0;in&#xA0;Build&#xA0;Directory</a><br/>
21461727 &#160;&#160;&#160;&#160;&#160;&#160;<a href="cmake.xml#CMake Command.Build Directory" target="_top">Using&#xA0;CMake&#xA0;to&#xA0;Configure&#xA0;CppAD:&#160;CMake&#xA0;Command.Build&#xA0;Directory</a><br/>
21471728 bvector&#160;<a href="ipopt_solve.xml#Bvector" target="_top">Use&#xA0;Ipopt&#xA0;to&#xA0;Solve&#xA0;a&#xA0;Nonlinear&#xA0;Programming&#xA0;Problem:&#160;Bvector</a><br/>
2148 by&#160;<a href="det_by_minor_c.xml" target="_top">Compute&#xA0;Determinant&#xA0;using&#xA0;Expansion&#xA0;by&#xA0;Minors</a><br/>
2149 &#160;&#160;&#160;<a href="omp_available.xml" target="_top">Amount&#xA0;of&#xA0;Memory&#xA0;Available&#xA0;for&#xA0;Quick&#xA0;Use&#xA0;by&#xA0;a&#xA0;Thread</a><br/>
2150 &#160;&#160;&#160;<a href="omp_free_available.xml" target="_top">Free&#xA0;Memory&#xA0;Currently&#xA0;Available&#xA0;for&#xA0;Quick&#xA0;Use&#xA0;by&#xA0;a&#xA0;Thread</a><br/>
2151 &#160;&#160;&#160;<a href="omp_alloc.xml" target="_top">A&#xA0;Quick&#xA0;OpenMP&#xA0;Memory&#xA0;Allocator&#xA0;Used&#xA0;by&#xA0;CppAD</a><br/>
2152 &#160;&#160;&#160;<a href="sacado_det_minor.cpp.xml" target="_top">Sacado&#xA0;Speed:&#xA0;Gradient&#xA0;of&#xA0;Determinant&#xA0;by&#xA0;Minor&#xA0;Expansion</a><br/>
2153 &#160;&#160;&#160;<a href="fadbad_det_minor.cpp.xml" target="_top">Fadbad&#xA0;Speed:&#xA0;Gradient&#xA0;of&#xA0;Determinant&#xA0;by&#xA0;Minor&#xA0;Expansion</a><br/>
2154 &#160;&#160;&#160;<a href="cppad_det_minor.cpp.xml" target="_top">CppAD&#xA0;Speed:&#xA0;Gradient&#xA0;of&#xA0;Determinant&#xA0;by&#xA0;Minor&#xA0;Expansion</a><br/>
2155 &#160;&#160;&#160;<a href="adolc_det_minor.cpp.xml" target="_top">Adolc&#xA0;Speed:&#xA0;Gradient&#xA0;of&#xA0;Determinant&#xA0;by&#xA0;Minor&#xA0;Expansion</a><br/>
2156 &#160;&#160;&#160;<a href="double_det_minor.cpp.xml" target="_top">Double&#xA0;Speed:&#xA0;Determinant&#xA0;by&#xA0;Minor&#xA0;Expansion</a><br/>
2157 &#160;&#160;&#160;<a href="det_grad_33.xml" target="_top">Check&#xA0;Gradient&#xA0;of&#xA0;Determinant&#xA0;of&#xA0;3&#xA0;by&#xA0;3&#xA0;matrix</a><br/>
2158 &#160;&#160;&#160;<a href="det_33.xml" target="_top">Check&#xA0;Determinant&#xA0;of&#xA0;3&#xA0;by&#xA0;3&#xA0;matrix</a><br/>
2159 &#160;&#160;&#160;<a href="det_by_minor.cpp.xml" target="_top">Determinant&#xA0;Using&#xA0;Expansion&#xA0;by&#xA0;Minors:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
2160 &#160;&#160;&#160;<a href="det_by_minor.xml" target="_top">Determinant&#xA0;Using&#xA0;Expansion&#xA0;by&#xA0;Minors</a><br/>
2161 &#160;&#160;&#160;<a href="det_by_lu.xml" target="_top">Determinant&#xA0;Using&#xA0;Expansion&#xA0;by&#xA0;Lu&#xA0;Factorization</a><br/>
2162 &#160;&#160;&#160;<a href="link_det_minor.xml" target="_top">Speed&#xA0;Testing&#xA0;Gradient&#xA0;of&#xA0;Determinant&#xA0;by&#xA0;Minor&#xA0;Expansion</a><br/>
2163 &#160;&#160;&#160;<a href="jac_minor_det.cpp.xml" target="_top">Gradient&#xA0;of&#xA0;Determinant&#xA0;Using&#xA0;Expansion&#xA0;by&#xA0;Minors:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
2164 &#160;&#160;&#160;<a href="hes_minor_det.cpp.xml" target="_top">Gradient&#xA0;of&#xA0;Determinant&#xA0;Using&#xA0;Expansion&#xA0;by&#xA0;Minors:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
2165 &#160;&#160;&#160;<a href="exampleutility.xml" target="_top">Utility&#xA0;Routines&#xA0;used&#xA0;by&#xA0;CppAD&#xA0;Examples</a><br/>
2166 &#160;&#160;&#160;<a href="ta_free_all.xml" target="_top">Free&#xA0;All&#xA0;Memory&#xA0;That&#xA0;Was&#xA0;Allocated&#xA0;for&#xA0;Use&#xA0;by&#xA0;thread_alloc</a><br/>
2167 &#160;&#160;&#160;<a href="ta_available.xml" target="_top">Amount&#xA0;of&#xA0;Memory&#xA0;Available&#xA0;for&#xA0;Quick&#xA0;Use&#xA0;by&#xA0;a&#xA0;Thread</a><br/>
2168 &#160;&#160;&#160;<a href="ta_free_available.xml" target="_top">Free&#xA0;Memory&#xA0;Currently&#xA0;Available&#xA0;for&#xA0;Quick&#xA0;Use&#xA0;by&#xA0;a&#xA0;Thread</a><br/>
2169 &#160;&#160;&#160;<a href="ludetandsolve.xml" target="_top">Compute&#xA0;Determinants&#xA0;and&#xA0;Solve&#xA0;Equations&#xA0;by&#xA0;LU&#xA0;Factorization</a><br/>
2170 &#160;&#160;&#160;<a href="introduction.xml" target="_top">An&#xA0;Introduction&#xA0;by&#xA0;Example&#xA0;to&#xA0;Algorithmic&#xA0;Differentiation</a><br/>
21711729
21721730 <b><big><a name="C">C</a></big></b>
21731731 <br/>
21741732 C&#160;<a href="interface2c.cpp.xml" target="_top">Interfacing&#xA0;to&#xA0;C:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
21751733 &#160;&#160;<a href="ad_in_c.cpp.xml" target="_top">Example&#xA0;and&#xA0;Test&#xA0;Linking&#xA0;CppAD&#xA0;to&#xA0;Languages&#xA0;Other&#xA0;than&#xA0;C++</a><br/>
21761734 &#160;&#160;&#160;&#160;&#160;compare<b>&#xA0;</b>speed<b>&#xA0;</b>with<b>&#xA0;</b>C<b>++</b>&#160;<a href="compare_c.xml" target="_top">Compare&#xA0;Speed&#xA0;of&#xA0;C&#xA0;and&#xA0;C++</a><br/>
2177 C<b>++</b>&#160;<a href="cppad.xml" target="_top">cppad-20160000.0:&#xA0;A&#xA0;Package&#xA0;for&#xA0;Differentiation&#xA0;of&#xA0;C++&#xA0;Algorithms</a><br/>
1735 C<b>++</b>&#160;<a href="cppad.xml" target="_top">cppad-20160000.1:&#xA0;A&#xA0;Package&#xA0;for&#xA0;Differentiation&#xA0;of&#xA0;C++&#xA0;Algorithms</a><br/>
21781736 &#160;&#160;&#160;&#160;&#160;compare<b>&#xA0;</b>speed<b>&#xA0;</b>with<b>&#xA0;</b>C&#160;<a href="compare_c.xml" target="_top">Compare&#xA0;Speed&#xA0;of&#xA0;C&#xA0;and&#xA0;C++</a><br/>
21791737 CheckNumericType&#160;<a href="checknumerictype.xml" target="_top">Check&#xA0;NumericType&#xA0;Class&#xA0;Concept</a><br/>
21801738 CheckSimpleVector&#160;<a href="checksimplevector.xml" target="_top">Check&#xA0;Simple&#xA0;Vector&#xA0;Concept</a><br/>
21981756 CppAD&#160;<a href="vector_bool.cpp.xml" target="_top">CppAD::vectorBool&#xA0;Class:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
21991757 &#160;&#160;&#160;&#160;&#160;&#160;<a href="cppad_vector.cpp.xml" target="_top">CppAD::vector&#xA0;Template&#xA0;Class:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
22001758 &#160;&#160;&#160;&#160;&#160;&#160;<a href="cppad_vector.xml" target="_top">The&#xA0;CppAD::vector&#xA0;Template&#xA0;Class</a><br/>
2201 &#160;&#160;&#160;&#160;&#160;&#160;<a href="cppad.xml" target="_top">cppad-20160000.0:&#xA0;A&#xA0;Package&#xA0;for&#xA0;Differentiation&#xA0;of&#xA0;C++&#xA0;Algorithms</a><br/>
1759 &#160;&#160;&#160;&#160;&#160;&#160;<a href="cppad.xml" target="_top">cppad-20160000.1:&#xA0;A&#xA0;Package&#xA0;for&#xA0;Differentiation&#xA0;of&#xA0;C++&#xA0;Algorithms</a><br/>
22021760 CppADTrackDelVec&#160;<a href="tracknewdel.xml" target="_top">Routines&#xA0;That&#xA0;Track&#xA0;Use&#xA0;of&#xA0;New&#xA0;and&#xA0;Delete</a><br/>
22031761 CppADTrackExtend&#160;<a href="tracknewdel.xml" target="_top">Routines&#xA0;That&#xA0;Track&#xA0;Use&#xA0;of&#xA0;New&#xA0;and&#xA0;Delete</a><br/>
22041762 CppADTrackNewVec&#160;<a href="tracknewdel.xml" target="_top">Routines&#xA0;That&#xA0;Track&#xA0;Use&#xA0;of&#xA0;New&#xA0;and&#xA0;Delete</a><br/>
22131771 &#160;&#160;&#160;&#160;<a href="bib.xml#The C++ Programming Language" target="_top">Bibliography:&#160;The&#xA0;C++&#xA0;Programming&#xA0;Language</a><br/>
22141772 &#160;&#160;&#160;&#160;<a href="ad_in_c.cpp.xml" target="_top">Example&#xA0;and&#xA0;Test&#xA0;Linking&#xA0;CppAD&#xA0;to&#xA0;Languages&#xA0;Other&#xA0;than&#xA0;C++</a><br/>
22151773 &#160;&#160;&#160;&#160;<a href="utility.xml#C++ Concepts" target="_top">Some&#xA0;General&#xA0;Purpose&#xA0;Utilities:&#160;C++&#xA0;Concepts</a><br/>
2216 &#160;&#160;&#160;&#160;<a href="cppad.xml" target="_top">cppad-20160000.0:&#xA0;A&#xA0;Package&#xA0;for&#xA0;Differentiation&#xA0;of&#xA0;C++&#xA0;Algorithms</a><br/>
1774 &#160;&#160;&#160;&#160;<a href="cppad.xml" target="_top">cppad-20160000.1:&#xA0;A&#xA0;Package&#xA0;for&#xA0;Differentiation&#xA0;of&#xA0;C++&#xA0;Algorithms</a><br/>
22171775 c<b>++</b>11&#160;<a href="cmake.xml#cppad_cxx_flags.C++11" target="_top">Using&#xA0;CMake&#xA0;to&#xA0;Configure&#xA0;CppAD:&#160;cppad_cxx_flags.C++11</a><br/>
22181776 c<b>:</b>&#160;<a href="interface2c.cpp.xml" target="_top">Interfacing&#xA0;to&#xA0;C:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
22191777 calculating&#160;<a href="sparse.xml" target="_top">Calculating&#xA0;Sparsity&#xA0;Patterns</a><br/>
26532211 &#160;&#160;&#160;&#160;&#160;&#160;<a href="cmake.xml" target="_top">Using&#xA0;CMake&#xA0;to&#xA0;Configure&#xA0;CppAD</a><br/>
26542212 &#160;&#160;&#160;&#160;&#160;&#160;<a href="download.xml" target="_top">Download&#xA0;The&#xA0;CppAD&#xA0;Source&#xA0;Code</a><br/>
26552213 &#160;&#160;&#160;&#160;&#160;&#160;<a href="install.xml" target="_top">CppAD&#xA0;Download,&#xA0;Test,&#xA0;and&#xA0;Install&#xA0;Instructions</a><br/>
2656 cppad<b>-</b>20160000<b>.</b>0<b>:</b>&#160;<a href="cppad.xml" target="_top">cppad-20160000.0:&#xA0;A&#xA0;Package&#xA0;for&#xA0;Differentiation&#xA0;of&#xA0;C++&#xA0;Algorithms</a><br/>
2657 cppad<b>.</b>hpp&#160;<a href="cppad.xml" target="_top">cppad-20160000.0:&#xA0;A&#xA0;Package&#xA0;for&#xA0;Differentiation&#xA0;of&#xA0;C++&#xA0;Algorithms</a><br/>
2214 cppad<b>-</b>20160000<b>.</b>1<b>:</b>&#160;<a href="cppad.xml" target="_top">cppad-20160000.1:&#xA0;A&#xA0;Package&#xA0;for&#xA0;Differentiation&#xA0;of&#xA0;C++&#xA0;Algorithms</a><br/>
2215 cppad<b>.</b>hpp&#160;<a href="cppad.xml" target="_top">cppad-20160000.1:&#xA0;A&#xA0;Package&#xA0;for&#xA0;Differentiation&#xA0;of&#xA0;C++&#xA0;Algorithms</a><br/>
26582216 cppad<b>::</b>numeric<b>_</b>limits&#160;<a href="base_limits.xml#CppAD::numeric_limits" target="_top">Base&#xA0;Type&#xA0;Requirements&#xA0;for&#xA0;Numeric&#xA0;Limits:&#160;CppAD::numeric_limits</a><br/>
26592217 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="numeric_limits.xml#CppAD::numeric_limits" target="_top">Numeric&#xA0;Limits&#xA0;For&#xA0;an&#xA0;AD&#xA0;and&#xA0;Base&#xA0;Types:&#160;CppAD::numeric_limits</a><br/>
26602218 cppad<b>::</b>vector&#160;<a href="test_vector.xml#CppAD::vector" target="_top">Choosing&#xA0;The&#xA0;Vector&#xA0;Testing&#xA0;Template&#xA0;Class:&#160;CppAD::vector</a><br/>
27302288 Dependent&#160;<a href="fun_check.cpp.xml" target="_top">ADFun&#xA0;Check&#xA0;and&#xA0;Re-Tape:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
27312289 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="dependent.xml" target="_top">Stop&#xA0;Recording&#xA0;and&#xA0;Store&#xA0;Operation&#xA0;Sequence</a><br/>
27322290 Domain&#160;<a href="seq_property.cpp.xml" target="_top">ADFun&#xA0;Sequence&#xA0;Properties:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
2733 d&#160;<a href="det_of_minor_c.xml#d" target="_top">Determinant&#xA0;of&#xA0;a&#xA0;Minor:&#160;d</a><br/>
2734 &#160;&#160;<a href="det_33.xml#d" target="_top">Check&#xA0;Determinant&#xA0;of&#xA0;3&#xA0;by&#xA0;3&#xA0;matrix:&#160;d</a><br/>
2735 &#160;&#160;<a href="det_by_minor.xml#det.d" target="_top">Determinant&#xA0;Using&#xA0;Expansion&#xA0;by&#xA0;Minors:&#160;det.d</a><br/>
2736 &#160;&#160;<a href="det_of_minor.xml#d" target="_top">Determinant&#xA0;of&#xA0;a&#xA0;Minor:&#160;d</a><br/>
2737 &#160;&#160;<a href="det_by_lu.xml#det.d" target="_top">Determinant&#xA0;Using&#xA0;Expansion&#xA0;by&#xA0;Lu&#xA0;Factorization:&#160;det.d</a><br/>
27382291 data&#160;<a href="cppad_vector.xml#vectorBool.data" target="_top">The&#xA0;CppAD::vector&#xA0;Template&#xA0;Class:&#160;vectorBool.data</a><br/>
27392292 &#160;&#160;&#160;&#160;&#160;<a href="cppad_vector.xml#data" target="_top">The&#xA0;CppAD::vector&#xA0;Template&#xA0;Class:&#160;data</a><br/>
27402293 datadir&#160;<a href="cmake.xml" target="_top">Using&#xA0;CMake&#xA0;to&#xA0;Configure&#xA0;CppAD</a><br/>
28982451 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="exp_2_for2.xml#Operation Sequence.Derivative" target="_top">exp_2:&#xA0;Second&#xA0;Order&#xA0;Forward&#xA0;Mode:&#160;Operation&#xA0;Sequence.Derivative</a><br/>
28992452 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="exp_2_for1.xml#Operation Sequence.Derivative" target="_top">exp_2:&#xA0;First&#xA0;Order&#xA0;Forward&#xA0;Mode:&#160;Operation&#xA0;Sequence.Derivative</a><br/>
29002453 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="get_started.cpp.xml#Derivative" target="_top">Getting&#xA0;Started&#xA0;Using&#xA0;CppAD&#xA0;to&#xA0;Compute&#xA0;Derivatives:&#160;Derivative</a><br/>
2901 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="cppad.xml" target="_top">cppad-20160000.0:&#xA0;A&#xA0;Package&#xA0;for&#xA0;Differentiation&#xA0;of&#xA0;C++&#xA0;Algorithms</a><br/>
2454 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="cppad.xml" target="_top">cppad-20160000.1:&#xA0;A&#xA0;Package&#xA0;for&#xA0;Differentiation&#xA0;of&#xA0;C++&#xA0;Algorithms</a><br/>
29022455 derivative<b>:</b>&#160;<a href="revone.xml" target="_top">First&#xA0;Order&#xA0;Derivative:&#xA0;Driver&#xA0;Routine</a><br/>
29032456 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="forone.xml" target="_top">First&#xA0;Order&#xA0;Partial&#xA0;Derivative:&#xA0;Driver&#xA0;Routine</a><br/>
29042457 derivatives&#160;<a href="old_usead_2.cpp.xml" target="_top">Using&#xA0;AD&#xA0;to&#xA0;Compute&#xA0;Atomic&#xA0;Function&#xA0;Derivatives</a><br/>
30112564 differentiation&#160;<a href="ad_in_c.cpp.xml" target="_top">Example&#xA0;and&#xA0;Test&#xA0;Linking&#xA0;CppAD&#xA0;to&#xA0;Languages&#xA0;Other&#xA0;than&#xA0;C++</a><br/>
30122565 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="introduction.xml#Preface.Algorithmic Differentiation" target="_top">An&#xA0;Introduction&#xA0;by&#xA0;Example&#xA0;to&#xA0;Algorithmic&#xA0;Differentiation:&#160;Preface.Algorithmic&#xA0;Differentiation</a><br/>
30132566 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="introduction.xml" target="_top">An&#xA0;Introduction&#xA0;by&#xA0;Example&#xA0;to&#xA0;Algorithmic&#xA0;Differentiation</a><br/>
3014 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="cppad.xml" target="_top">cppad-20160000.0:&#xA0;A&#xA0;Package&#xA0;for&#xA0;Differentiation&#xA0;of&#xA0;C++&#xA0;Algorithms</a><br/>
3015 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="cppad.xml" target="_top">cppad-20160000.0:&#xA0;A&#xA0;Package&#xA0;for&#xA0;Differentiation&#xA0;of&#xA0;C++&#xA0;Algorithms</a><br/>
2567 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="cppad.xml" target="_top">cppad-20160000.1:&#xA0;A&#xA0;Package&#xA0;for&#xA0;Differentiation&#xA0;of&#xA0;C++&#xA0;Algorithms</a><br/>
2568 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="cppad.xml" target="_top">cppad-20160000.1:&#xA0;A&#xA0;Package&#xA0;for&#xA0;Differentiation&#xA0;of&#xA0;C++&#xA0;Algorithms</a><br/>
30162569 dimension&#160;<a href="rombergmul.xml" target="_top">Multi-dimensional&#xA0;Romberg&#xA0;Integration</a><br/>
30172570 dimensional&#160;<a href="rombergmul.cpp.xml" target="_top">One&#xA0;Dimensional&#xA0;Romberg&#xA0;Integration:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
30182571 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="rombergmul.xml" target="_top">Multi-dimensional&#xA0;Romberg&#xA0;Integration</a><br/>
36443197 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="colpack_hes.cpp.xml" target="_top">Using&#xA0;ColPack:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
36453198 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="colpack_jac.cpp.xml" target="_top">Using&#xA0;ColPack:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
36463199 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="colpack_prefix.xml#Example" target="_top">Including&#xA0;the&#xA0;ColPack&#xA0;Sparsity&#xA0;Calculations:&#160;Example</a><br/>
3647 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="cppad.xml#Example" target="_top">cppad-20160000.0:&#xA0;A&#xA0;Package&#xA0;for&#xA0;Differentiation&#xA0;of&#xA0;C++&#xA0;Algorithms:&#160;Example</a><br/>
3200 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="cppad.xml#Example" target="_top">cppad-20160000.1:&#xA0;A&#xA0;Package&#xA0;for&#xA0;Differentiation&#xA0;of&#xA0;C++&#xA0;Algorithms:&#160;Example</a><br/>
36483201 examples&#160;<a href="wish_list.xml#Machine Epsilon in Examples" target="_top">The&#xA0;CppAD&#xA0;Wish&#xA0;List:&#160;Machine&#xA0;Epsilon&#xA0;in&#xA0;Examples</a><br/>
36493202 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="speed_example.cpp.xml" target="_top">Run&#xA0;the&#xA0;Speed&#xA0;Examples</a><br/>
36503203 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="example.cpp.xml" target="_top">CppAD&#xA0;Examples&#xA0;and&#xA0;Tests</a><br/>
38103363 ForSparseJac&#160;<a href="for_sparse_jac.cpp.xml" target="_top">Forward&#xA0;Mode&#xA0;Jacobian&#xA0;Sparsity:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
38113364 Forward&#160;<a href="capacity_order.xml" target="_top">Controlling&#xA0;Taylor&#xA0;Coefficients&#xA0;Memory&#xA0;Allocation</a><br/>
38123365 FunCheck&#160;<a href="fun_check.cpp.xml" target="_top">ADFun&#xA0;Check&#xA0;and&#xA0;Re-Tape:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
3813 f&#160;<a href="comparechange.xml#f" target="_top">Comparison&#xA0;Changes&#xA0;During&#xA0;Zero&#xA0;Order&#xA0;Forward&#xA0;Mode:&#160;f</a><br/>
3814 &#160;&#160;<a href="link_ode.xml#f" target="_top">Speed&#xA0;Testing&#xA0;the&#xA0;Jacobian&#xA0;of&#xA0;Ode&#xA0;Solution:&#160;f</a><br/>
3815 &#160;&#160;<a href="odegearcontrol.xml#Fun.f" target="_top">An&#xA0;Error&#xA0;Controller&#xA0;for&#xA0;Gear's&#xA0;Ode&#xA0;Solvers:&#160;Fun.f</a><br/>
3816 &#160;&#160;<a href="odegear.xml#Fun.f" target="_top">An&#xA0;Arbitrary&#xA0;Order&#xA0;Gear&#xA0;Method:&#160;Fun.f</a><br/>
3817 &#160;&#160;<a href="rosen34.xml#Fun.f" target="_top">A&#xA0;3rd&#xA0;and&#xA0;4th&#xA0;Order&#xA0;Rosenbrock&#xA0;ODE&#xA0;Solver:&#160;Fun.f</a><br/>
3818 &#160;&#160;<a href="runge45.xml#Fun.f" target="_top">An&#xA0;Embedded&#xA0;4th&#xA0;and&#xA0;5th&#xA0;Order&#xA0;Runge-Kutta&#xA0;ODE&#xA0;Solver:&#160;Fun.f</a><br/>
3819 &#160;&#160;<a href="rombergmul.xml#F" target="_top">Multi-dimensional&#xA0;Romberg&#xA0;Integration:&#160;F</a><br/>
3820 &#160;&#160;<a href="rombergone.xml#F" target="_top">One&#xA0;DimensionalRomberg&#xA0;Integration:&#160;F</a><br/>
3821 &#160;&#160;<a href="check_for_nan.xml#f" target="_top">Check&#xA0;an&#xA0;ADFun&#xA0;Object&#xA0;For&#xA0;Nan&#xA0;Results:&#160;f</a><br/>
3822 &#160;&#160;<a href="optimize.xml#f" target="_top">Optimize&#xA0;an&#xA0;ADFun&#xA0;Object&#xA0;Tape:&#160;f</a><br/>
3823 &#160;&#160;<a href="funcheck.xml#f" target="_top">Check&#xA0;an&#xA0;ADFun&#xA0;Sequence&#xA0;of&#xA0;Operations:&#160;f</a><br/>
3824 &#160;&#160;<a href="sparse_hessian.xml#f" target="_top">Sparse&#xA0;Hessian:&#xA0;Easy&#xA0;Driver:&#160;f</a><br/>
3825 &#160;&#160;<a href="sparse_jacobian.xml#f" target="_top">Sparse&#xA0;Jacobian:&#xA0;Easy&#xA0;Driver:&#160;f</a><br/>
3826 &#160;&#160;<a href="revtwo.xml#f" target="_top">Reverse&#xA0;Mode&#xA0;Second&#xA0;Partial&#xA0;Derivative&#xA0;Driver:&#160;f</a><br/>
3827 &#160;&#160;<a href="fortwo.xml#f" target="_top">Forward&#xA0;Mode&#xA0;Second&#xA0;Partial&#xA0;Derivative&#xA0;Driver:&#160;f</a><br/>
3828 &#160;&#160;<a href="hessian.xml#f" target="_top">Hessian:&#xA0;Easy&#xA0;Driver:&#160;f</a><br/>
3829 &#160;&#160;<a href="revone.xml#f" target="_top">First&#xA0;Order&#xA0;Derivative:&#xA0;Driver&#xA0;Routine:&#160;f</a><br/>
3830 &#160;&#160;<a href="forone.xml#f" target="_top">First&#xA0;Order&#xA0;Partial&#xA0;Derivative:&#xA0;Driver&#xA0;Routine:&#160;f</a><br/>
3831 &#160;&#160;<a href="jacobian.xml#f" target="_top">Jacobian:&#xA0;Driver&#xA0;Routine:&#160;f</a><br/>
3832 &#160;&#160;<a href="revsparsehes.xml#f" target="_top">Hessian&#xA0;Sparsity&#xA0;Pattern:&#xA0;Reverse&#xA0;Mode:&#160;f</a><br/>
3833 &#160;&#160;<a href="revsparsejac.xml#f" target="_top">Jacobian&#xA0;Sparsity&#xA0;Pattern:&#xA0;Reverse&#xA0;Mode:&#160;f</a><br/>
3834 &#160;&#160;<a href="forsparsejac.xml#f" target="_top">Jacobian&#xA0;Sparsity&#xA0;Pattern:&#xA0;Forward&#xA0;Mode:&#160;f</a><br/>
3835 &#160;&#160;<a href="reverse_any.xml#f" target="_top">Any&#xA0;Order&#xA0;Reverse&#xA0;Mode:&#160;f</a><br/>
3836 &#160;&#160;<a href="reverse_two.xml#f" target="_top">Second&#xA0;Order&#xA0;Reverse&#xA0;Mode:&#160;f</a><br/>
3837 &#160;&#160;<a href="reverse_one.xml#f" target="_top">First&#xA0;Order&#xA0;Reverse&#xA0;Mode:&#160;f</a><br/>
3838 &#160;&#160;<a href="number_skip.xml#f" target="_top">Number&#xA0;of&#xA0;Variables&#xA0;that&#xA0;Can&#xA0;be&#xA0;Skipped:&#160;f</a><br/>
3839 &#160;&#160;<a href="capacity_order.xml#f" target="_top">Controlling&#xA0;Taylor&#xA0;Coefficients&#xA0;Memory&#xA0;Allocation:&#160;f</a><br/>
3840 &#160;&#160;<a href="compare_change.xml#f" target="_top">Comparison&#xA0;Changes&#xA0;Between&#xA0;Taping&#xA0;and&#xA0;Zero&#xA0;Order&#xA0;Forward:&#160;f</a><br/>
3841 &#160;&#160;<a href="size_order.xml#f" target="_top">Number&#xA0;Taylor&#xA0;Coefficient&#xA0;Orders&#xA0;Currently&#xA0;Stored:&#160;f</a><br/>
3842 &#160;&#160;<a href="forward_dir.xml#f" target="_top">Multiple&#xA0;Directions&#xA0;Forward&#xA0;Mode:&#160;f</a><br/>
3843 &#160;&#160;<a href="forward_order.xml#f" target="_top">Multiple&#xA0;Order&#xA0;Forward&#xA0;Mode:&#160;f</a><br/>
3844 &#160;&#160;<a href="forward_two.xml#f" target="_top">Second&#xA0;Order&#xA0;Forward&#xA0;Mode:&#xA0;Derivative&#xA0;Values:&#160;f</a><br/>
3845 &#160;&#160;<a href="forward_one.xml#f" target="_top">First&#xA0;Order&#xA0;Forward&#xA0;Mode:&#xA0;Derivative&#xA0;Values:&#160;f</a><br/>
3846 &#160;&#160;<a href="forward_zero.xml#f" target="_top">Zero&#xA0;Order&#xA0;Forward&#xA0;Mode:&#xA0;Function&#xA0;Values:&#160;f</a><br/>
3847 &#160;&#160;<a href="seq_property.xml#f" target="_top">ADFun&#xA0;Sequence&#xA0;Properties:&#160;f</a><br/>
3848 &#160;&#160;<a href="dependent.xml#f" target="_top">Stop&#xA0;Recording&#xA0;and&#xA0;Store&#xA0;Operation&#xA0;Sequence:&#160;f</a><br/>
3849 &#160;&#160;<a href="atomic_reverse.xml#F, G, H" target="_top">Atomic&#xA0;Reverse&#xA0;Mode:&#160;F,&#xA0;G,&#xA0;H</a><br/>
3366 f&#160;<a href="atomic_reverse.xml#F, G, H" target="_top">Atomic&#xA0;Reverse&#xA0;Mode:&#160;F,&#xA0;G,&#xA0;H</a><br/>
38503367 f<b>.</b>forward<b>(</b>0&#160;<a href="printfor.xml#f.Forward(0, x)" target="_top">Printing&#xA0;AD&#xA0;Values&#xA0;During&#xA0;Forward&#xA0;Mode:&#160;f.Forward(0,&#xA0;x)</a><br/>
38513368 f<b>_</b>1&#160;<a href="exp_eps_rev2.xml#Index 2: f_1" target="_top">exp_eps:&#xA0;Second&#xA0;Order&#xA0;Reverse&#xA0;Sweep:&#160;Index&#xA0;2:&#xA0;f_1</a><br/>
38523369 &#160;&#160;&#160;&#160;<a href="exp_eps_rev1.xml#Index 2: f_1" target="_top">exp_eps:&#xA0;First&#xA0;Order&#xA0;Reverse&#xA0;Sweep:&#160;Index&#xA0;2:&#xA0;f_1</a><br/>
39613478 &#160;&#160;&#160;&#160;&#160;<a href="base_alloc.hpp.xml#Include File" target="_top">Example&#xA0;AD&lt;Base&gt;&#xA0;Where&#xA0;Base&#xA0;Constructor&#xA0;Allocates&#xA0;Memory:&#160;Include&#xA0;File</a><br/>
39623479 &#160;&#160;&#160;&#160;&#160;<a href="download.xml#Compressed Archives.Windows File Extraction and Testing" target="_top">Download&#xA0;The&#xA0;CppAD&#xA0;Source&#xA0;Code:&#160;Compressed&#xA0;Archives.Windows&#xA0;File&#xA0;Extraction&#xA0;and&#xA0;Testing</a><br/>
39633480 &#160;&#160;&#160;&#160;&#160;<a href="download.xml#Compressed Archives.Unix File Extraction" target="_top">Download&#xA0;The&#xA0;CppAD&#xA0;Source&#xA0;Code:&#160;Compressed&#xA0;Archives.Unix&#xA0;File&#xA0;Extraction</a><br/>
3964 &#160;&#160;&#160;&#160;&#160;<a href="cppad.xml#Include File" target="_top">cppad-20160000.0:&#xA0;A&#xA0;Package&#xA0;for&#xA0;Differentiation&#xA0;of&#xA0;C++&#xA0;Algorithms:&#160;Include&#xA0;File</a><br/>
3481 &#160;&#160;&#160;&#160;&#160;<a href="cppad.xml#Include File" target="_top">cppad-20160000.1:&#xA0;A&#xA0;Package&#xA0;for&#xA0;Differentiation&#xA0;of&#xA0;C++&#xA0;Algorithms:&#160;Include&#xA0;File</a><br/>
39653482 file<b>_</b>name&#160;<a href="check_for_nan.xml#Error Message.file_name" target="_top">Check&#xA0;an&#xA0;ADFun&#xA0;Object&#xA0;For&#xA0;Nan&#xA0;Results:&#160;Error&#xA0;Message.file_name</a><br/>
39663483 files&#160;<a href="addon.xml#Library Files" target="_top">CppAD&#xA0;Addons:&#160;Library&#xA0;Files</a><br/>
39673484 &#160;&#160;&#160;&#160;&#160;&#160;<a href="addon.xml#Include Files" target="_top">CppAD&#xA0;Addons:&#160;Include&#xA0;Files</a><br/>
40303547 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="rombergmul.xml#FloatVector" target="_top">Multi-dimensional&#xA0;Romberg&#xA0;Integration:&#160;FloatVector</a><br/>
40313548 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="lufactor.xml#FloatVector" target="_top">LU&#xA0;Factorization&#xA0;of&#xA0;A&#xA0;Square&#xA0;Matrix:&#160;FloatVector</a><br/>
40323549 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="lusolve.xml#FloatVector" target="_top">Compute&#xA0;Determinant&#xA0;and&#xA0;Solve&#xA0;Linear&#xA0;Equations:&#160;FloatVector</a><br/>
4033 for&#160;<a href="license.xml" target="_top">Your&#xA0;License&#xA0;for&#xA0;the&#xA0;CppAD&#xA0;Software</a><br/>
4034 &#160;&#160;&#160;&#160;<a href="main_compare_c.xml" target="_top">Main&#xA0;Program&#xA0;For&#xA0;Comparing&#xA0;C&#xA0;and&#xA0;C++&#xA0;Speed</a><br/>
4035 &#160;&#160;&#160;&#160;<a href="ipopt_ode_speed.cpp.xml" target="_top">Speed&#xA0;Test&#xA0;for&#xA0;Both&#xA0;Simple&#xA0;and&#xA0;Fast&#xA0;Representations</a><br/>
4036 &#160;&#160;&#160;&#160;<a href="ipopt_nlp_ode_check.cpp.xml" target="_top">Correctness&#xA0;Check&#xA0;for&#xA0;Both&#xA0;Simple&#xA0;and&#xA0;Fast&#xA0;Representations</a><br/>
4037 &#160;&#160;&#160;&#160;<a href="ipopt_nlp_ode_run.hpp.xml" target="_top">Driver&#xA0;for&#xA0;Running&#xA0;the&#xA0;Ipopt&#xA0;ODE&#xA0;Example</a><br/>
4038 &#160;&#160;&#160;&#160;<a href="epsilon.xml" target="_top">Machine&#xA0;Epsilon&#xA0;For&#xA0;AD&#xA0;Types</a><br/>
4039 &#160;&#160;&#160;&#160;<a href="old_max_num_threads.xml" target="_top">Set&#xA0;Maximum&#xA0;Number&#xA0;of&#xA0;Threads&#xA0;for&#xA0;omp_alloc&#xA0;Allocator</a><br/>
4040 &#160;&#160;&#160;&#160;<a href="omp_efficient.xml" target="_top">Check&#xA0;If&#xA0;A&#xA0;Memory&#xA0;Allocation&#xA0;is&#xA0;Efficient&#xA0;for&#xA0;Another&#xA0;Use</a><br/>
4041 &#160;&#160;&#160;&#160;<a href="omp_delete_array.xml" target="_top">Return&#xA0;A&#xA0;Raw&#xA0;Array&#xA0;to&#xA0;The&#xA0;Available&#xA0;Memory&#xA0;for&#xA0;a&#xA0;Thread</a><br/>
4042 &#160;&#160;&#160;&#160;<a href="omp_available.xml" target="_top">Amount&#xA0;of&#xA0;Memory&#xA0;Available&#xA0;for&#xA0;Quick&#xA0;Use&#xA0;by&#xA0;a&#xA0;Thread</a><br/>
4043 &#160;&#160;&#160;&#160;<a href="omp_free_available.xml" target="_top">Free&#xA0;Memory&#xA0;Currently&#xA0;Available&#xA0;for&#xA0;Quick&#xA0;Use&#xA0;by&#xA0;a&#xA0;Thread</a><br/>
4044 &#160;&#160;&#160;&#160;<a href="omp_max_num_threads.xml" target="_top">Set&#xA0;and&#xA0;Get&#xA0;Maximum&#xA0;Number&#xA0;of&#xA0;Threads&#xA0;for&#xA0;omp_alloc&#xA0;Allocator</a><br/>
4045 &#160;&#160;&#160;&#160;<a href="adolc_alloc_mat.xml" target="_top">Adolc&#xA0;Test&#xA0;Utility:&#xA0;Allocate&#xA0;and&#xA0;Free&#xA0;Memory&#xA0;For&#xA0;a&#xA0;Matrix</a><br/>
4046 &#160;&#160;&#160;&#160;<a href="eigen_plugin.hpp.xml" target="_top">Source&#xA0;Code&#xA0;for&#xA0;eigen_plugin.hpp</a><br/>
4047 &#160;&#160;&#160;&#160;<a href="ta_free_all.xml" target="_top">Free&#xA0;All&#xA0;Memory&#xA0;That&#xA0;Was&#xA0;Allocated&#xA0;for&#xA0;Use&#xA0;by&#xA0;thread_alloc</a><br/>
4048 &#160;&#160;&#160;&#160;<a href="ta_delete_array.xml" target="_top">Deallocate&#xA0;An&#xA0;Array&#xA0;and&#xA0;Call&#xA0;Destructor&#xA0;for&#xA0;its&#xA0;Elements</a><br/>
4049 &#160;&#160;&#160;&#160;<a href="ta_create_array.xml" target="_top">Allocate&#xA0;An&#xA0;Array&#xA0;and&#xA0;Call&#xA0;Default&#xA0;Constructor&#xA0;for&#xA0;its&#xA0;Elements</a><br/>
4050 &#160;&#160;&#160;&#160;<a href="ta_available.xml" target="_top">Amount&#xA0;of&#xA0;Memory&#xA0;Available&#xA0;for&#xA0;Quick&#xA0;Use&#xA0;by&#xA0;a&#xA0;Thread</a><br/>
4051 &#160;&#160;&#160;&#160;<a href="ta_hold_memory.xml" target="_top">Control&#xA0;When&#xA0;Thread&#xA0;Alloc&#xA0;Retains&#xA0;Memory&#xA0;For&#xA0;Future&#xA0;Use</a><br/>
4052 &#160;&#160;&#160;&#160;<a href="ta_free_available.xml" target="_top">Free&#xA0;Memory&#xA0;Currently&#xA0;Available&#xA0;for&#xA0;Quick&#xA0;Use&#xA0;by&#xA0;a&#xA0;Thread</a><br/>
4053 &#160;&#160;&#160;&#160;<a href="ta_parallel_setup.xml" target="_top">Setup&#xA0;thread_alloc&#xA0;For&#xA0;Use&#xA0;in&#xA0;Multi-Threading&#xA0;Environment</a><br/>
4054 &#160;&#160;&#160;&#160;<a href="odegearcontrol.xml" target="_top">An&#xA0;Error&#xA0;Controller&#xA0;for&#xA0;Gear's&#xA0;Ode&#xA0;Solvers</a><br/>
4055 &#160;&#160;&#160;&#160;<a href="odeerrcontrol.xml" target="_top">An&#xA0;Error&#xA0;Controller&#xA0;for&#xA0;ODE&#xA0;Solvers</a><br/>
4056 &#160;&#160;&#160;&#160;<a href="team_thread.hpp.xml" target="_top">Specifications&#xA0;for&#xA0;A&#xA0;Team&#xA0;of&#xA0;AD&#xA0;Threads</a><br/>
4057 &#160;&#160;&#160;&#160;<a href="check_for_nan.cpp.xml" target="_top">ADFun&#xA0;Checking&#xA0;For&#xA0;Nan:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
4058 &#160;&#160;&#160;&#160;<a href="check_for_nan.xml" target="_top">Check&#xA0;an&#xA0;ADFun&#xA0;Object&#xA0;For&#xA0;Nan&#xA0;Results</a><br/>
4059 &#160;&#160;&#160;&#160;<a href="sub_sparse_hes.cpp.xml" target="_top">Computing&#xA0;Sparse&#xA0;Hessian&#xA0;for&#xA0;a&#xA0;Subset&#xA0;of&#xA0;Variables</a><br/>
4060 &#160;&#160;&#160;&#160;<a href="sparsity_sub.cpp.xml" target="_top">Sparsity&#xA0;Patterns&#xA0;For&#xA0;a&#xA0;Subset&#xA0;of&#xA0;Variables:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
4061 &#160;&#160;&#160;&#160;<a href="base_limits.xml" target="_top">Base&#xA0;Type&#xA0;Requirements&#xA0;for&#xA0;Numeric&#xA0;Limits</a><br/>
4062 &#160;&#160;&#160;&#160;<a href="base_std_math.xml" target="_top">Base&#xA0;Type&#xA0;Requirements&#xA0;for&#xA0;Standard&#xA0;Math&#xA0;Functions</a><br/>
4063 &#160;&#160;&#160;&#160;<a href="base_ordered.xml" target="_top">Base&#xA0;Type&#xA0;Requirements&#xA0;for&#xA0;Ordered&#xA0;Comparisons</a><br/>
4064 &#160;&#160;&#160;&#160;<a href="base_identical.xml" target="_top">Base&#xA0;Type&#xA0;Requirements&#xA0;for&#xA0;Identically&#xA0;Equal&#xA0;Comparisons</a><br/>
4065 &#160;&#160;&#160;&#160;<a href="base_cond_exp.xml" target="_top">Base&#xA0;Type&#xA0;Requirements&#xA0;for&#xA0;Conditional&#xA0;Expressions</a><br/>
4066 &#160;&#160;&#160;&#160;<a href="base_require.xml" target="_top">AD&lt;Base&gt;&#xA0;Requirements&#xA0;for&#xA0;a&#xA0;CppAD&#xA0;Base&#xA0;Type</a><br/>
4067 &#160;&#160;&#160;&#160;<a href="nearequalext.xml" target="_top">Compare&#xA0;AD&#xA0;and&#xA0;Base&#xA0;Objects&#xA0;for&#xA0;Nearly&#xA0;Equal</a><br/>
4068 &#160;&#160;&#160;&#160;<a href="numeric_limits.xml" target="_top">Numeric&#xA0;Limits&#xA0;For&#xA0;an&#xA0;AD&#xA0;and&#xA0;Base&#xA0;Types</a><br/>
4069 &#160;&#160;&#160;&#160;<a href="exp_apx_main.cpp.xml" target="_top">Correctness&#xA0;Tests&#xA0;For&#xA0;Exponential&#xA0;Approximation&#xA0;in&#xA0;Introduction</a><br/>
4070 &#160;&#160;&#160;&#160;<a href="cppad.xml" target="_top">cppad-20160000.0:&#xA0;A&#xA0;Package&#xA0;for&#xA0;Differentiation&#xA0;of&#xA0;C++&#xA0;Algorithms</a><br/>
40713550 for<b>_</b>jac<b>_</b>sparse&#160;<a href="old_atomic.xml#for_jac_sparse" target="_top">User&#xA0;Defined&#xA0;Atomic&#xA0;AD&#xA0;Functions:&#160;for_jac_sparse</a><br/>
40723551 for<b>_</b>sparse<b>_</b>jac&#160;<a href="atomic_matrix_mul.hpp.xml#for_sparse_jac" target="_top">Matrix&#xA0;Multiply&#xA0;as&#xA0;an&#xA0;Atomic&#xA0;Operation:&#160;for_sparse_jac</a><br/>
40733552 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="atomic_mat_mul.cpp.xml#Use Atomic Function.for_sparse_jac" target="_top">User&#xA0;Atomic&#xA0;Matrix&#xA0;Multiply:&#xA0;Example&#xA0;and&#xA0;Test:&#160;Use&#xA0;Atomic&#xA0;Function.for_sparse_jac</a><br/>
44873966 <br/>
44883967 Integer&#160;<a href="integer.cpp.xml" target="_top">Convert&#xA0;From&#xA0;AD&#xA0;to&#xA0;Integer:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
44893968 Ipopt&#160;<a href="auto_tools.xml" target="_top">Auto&#xA0;Tools&#xA0;Unix&#xA0;Test&#xA0;and&#xA0;Installation</a><br/>
4490 i&#160;<a href="revtwo.xml#i" target="_top">Reverse&#xA0;Mode&#xA0;Second&#xA0;Partial&#xA0;Derivative&#xA0;Driver:&#160;i</a><br/>
4491 &#160;&#160;<a href="revone.xml#i" target="_top">First&#xA0;Order&#xA0;Derivative:&#xA0;Driver&#xA0;Routine:&#160;i</a><br/>
4492 &#160;&#160;<a href="vecad.xml#size_t Indexing.i" target="_top">AD&#xA0;Vectors&#xA0;that&#xA0;Record&#xA0;Index&#xA0;Operations:&#160;size_t&#xA0;Indexing.i</a><br/>
4493 &#160;&#160;<a href="integer.xml#i" target="_top">Convert&#xA0;From&#xA0;AD&#xA0;to&#xA0;Integer:&#160;i</a><br/>
44943969 i<b>(</b>k<br/>
44953970 &#160;&#160;&#160;&#160;&#160;0<b>)</b>&#160;<a href="ipopt_nlp_ode_fast.xml#Trapezoidal Approximation.Range Indices I(k,0)" target="_top">ODE&#xA0;Fitting&#xA0;Using&#xA0;Fast&#xA0;Representation:&#160;Trapezoidal&#xA0;Approximation.Range&#xA0;Indices&#xA0;I(k,0)</a><br/>
44963971 &#160;&#160;&#160;&#160;&#160;0<b>)</b>&#160;<a href="ipopt_nlp_ode_fast.xml#Initial Condition.Range Indices I(k,0)" target="_top">ODE&#xA0;Fitting&#xA0;Using&#xA0;Fast&#xA0;Representation:&#160;Initial&#xA0;Condition.Range&#xA0;Indices&#xA0;I(k,0)</a><br/>
45684043 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="cmake.xml" target="_top">Using&#xA0;CMake&#xA0;to&#xA0;Configure&#xA0;CppAD</a><br/>
45694044 important&#160;<a href="reverse_identity.xml" target="_top">An&#xA0;Important&#xA0;Reverse&#xA0;Mode&#xA0;Identity</a><br/>
45704045 improvements&#160;<a href="optimize.xml#Improvements" target="_top">Optimize&#xA0;an&#xA0;ADFun&#xA0;Object&#xA0;Tape:&#160;Improvements</a><br/>
4571 in&#160;<a href="omp_in_parallel.xml" target="_top">Is&#xA0;The&#xA0;Current&#xA0;Execution&#xA0;in&#xA0;OpenMP&#xA0;Parallel&#xA0;Mode</a><br/>
4572 &#160;&#160;&#160;<a href="wish_list.xml#Machine Epsilon in Examples" target="_top">The&#xA0;CppAD&#xA0;Wish&#xA0;List:&#160;Machine&#xA0;Epsilon&#xA0;in&#xA0;Examples</a><br/>
4573 &#160;&#160;&#160;<a href="speed_double.xml" target="_top">Speed&#xA0;Test&#xA0;of&#xA0;Functions&#xA0;in&#xA0;Double</a><br/>
4574 &#160;&#160;&#160;<a href="ode_evaluate.xml" target="_top">Evaluate&#xA0;a&#xA0;Function&#xA0;Defined&#xA0;in&#xA0;Terms&#xA0;of&#xA0;an&#xA0;ODE</a><br/>
4575 &#160;&#160;&#160;<a href="ta_in_parallel.xml" target="_top">Is&#xA0;The&#xA0;Current&#xA0;Execution&#xA0;in&#xA0;Parallel&#xA0;Mode</a><br/>
4576 &#160;&#160;&#160;<a href="ta_parallel_setup.xml" target="_top">Setup&#xA0;thread_alloc&#xA0;For&#xA0;Use&#xA0;in&#xA0;Multi-Threading&#xA0;Environment</a><br/>
4577 &#160;&#160;&#160;<a href="team_pthread.cpp.xml#Bug in Cygwin" target="_top">Pthread&#xA0;Implementation&#xA0;of&#xA0;a&#xA0;Team&#xA0;of&#xA0;AD&#xA0;Threads:&#160;Bug&#xA0;in&#xA0;Cygwin</a><br/>
4578 &#160;&#160;&#160;<a href="multi_thread.xml" target="_top">Using&#xA0;CppAD&#xA0;in&#xA0;a&#xA0;Multi-Threading&#xA0;Environment</a><br/>
4579 &#160;&#160;&#160;<a href="exp_apx_main.cpp.xml" target="_top">Correctness&#xA0;Tests&#xA0;For&#xA0;Exponential&#xA0;Approximation&#xA0;in&#xA0;Introduction</a><br/>
4580 &#160;&#160;&#160;<a href="get_sacado.sh.xml" target="_top">Download&#xA0;and&#xA0;Install&#xA0;Sacado&#xA0;in&#xA0;Build&#xA0;Directory</a><br/>
4581 &#160;&#160;&#160;<a href="get_ipopt.sh.xml" target="_top">Download&#xA0;and&#xA0;Install&#xA0;Ipopt&#xA0;in&#xA0;Build&#xA0;Directory</a><br/>
4582 &#160;&#160;&#160;<a href="get_fadbad.sh.xml" target="_top">Download&#xA0;and&#xA0;Install&#xA0;Fadbad&#xA0;in&#xA0;Build&#xA0;Directory</a><br/>
4583 &#160;&#160;&#160;<a href="get_eigen.sh.xml" target="_top">Download&#xA0;and&#xA0;Install&#xA0;Eigen&#xA0;in&#xA0;Build&#xA0;Directory</a><br/>
4584 &#160;&#160;&#160;<a href="get_colpack.sh.xml" target="_top">Download&#xA0;and&#xA0;Install&#xA0;ColPack&#xA0;in&#xA0;Build&#xA0;Directory</a><br/>
4585 &#160;&#160;&#160;<a href="get_adolc.sh.xml" target="_top">Download&#xA0;and&#xA0;Install&#xA0;Adolc&#xA0;in&#xA0;Build&#xA0;Directory</a><br/>
45864046 in<b>_</b>parallel&#160;<a href="omp_in_parallel.xml" target="_top">Is&#xA0;The&#xA0;Current&#xA0;Execution&#xA0;in&#xA0;OpenMP&#xA0;Parallel&#xA0;Mode</a><br/>
45874047 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="ta_parallel_setup.xml#in_parallel" target="_top">Setup&#xA0;thread_alloc&#xA0;For&#xA0;Use&#xA0;in&#xA0;Multi-Threading&#xA0;Environment:&#160;in_parallel</a><br/>
45884048 inactive&#160;<a href="glossary.xml#Tape.Inactive" target="_top">Glossary:&#160;Tape.Inactive</a><br/>
46234083 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="exp_eps.xml#include" target="_top">An&#xA0;Epsilon&#xA0;Accurate&#xA0;Exponential&#xA0;Approximation:&#160;include</a><br/>
46244084 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="exp_2.xml#include" target="_top">Second&#xA0;Order&#xA0;Exponential&#xA0;Approximation:&#160;include</a><br/>
46254085 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="cmake.xml" target="_top">Using&#xA0;CMake&#xA0;to&#xA0;Configure&#xA0;CppAD</a><br/>
4626 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="cppad.xml#Include File" target="_top">cppad-20160000.0:&#xA0;A&#xA0;Package&#xA0;for&#xA0;Differentiation&#xA0;of&#xA0;C++&#xA0;Algorithms:&#160;Include&#xA0;File</a><br/>
4086 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="cppad.xml#Include File" target="_top">cppad-20160000.1:&#xA0;A&#xA0;Package&#xA0;for&#xA0;Differentiation&#xA0;of&#xA0;C++&#xA0;Algorithms:&#160;Include&#xA0;File</a><br/>
46274087 including&#160;<a href="sacado_prefix.xml" target="_top">Including&#xA0;the&#xA0;Sacado&#xA0;Speed&#xA0;Tests</a><br/>
46284088 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="ipopt_prefix.xml" target="_top">Including&#xA0;the&#xA0;cppad_ipopt&#xA0;Library&#xA0;and&#xA0;Tests</a><br/>
46294089 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="fadbad_prefix.xml" target="_top">Including&#xA0;the&#xA0;FADBAD&#xA0;Speed&#xA0;Tests</a><br/>
47824242 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="example.xml#Introduction" target="_top">Examples:&#160;Introduction</a><br/>
47834243 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="exp_apx_main.cpp.xml" target="_top">Correctness&#xA0;Tests&#xA0;For&#xA0;Exponential&#xA0;Approximation&#xA0;in&#xA0;Introduction</a><br/>
47844244 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="introduction.xml" target="_top">An&#xA0;Introduction&#xA0;by&#xA0;Example&#xA0;to&#xA0;Algorithmic&#xA0;Differentiation</a><br/>
4785 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="cppad.xml#Introduction" target="_top">cppad-20160000.0:&#xA0;A&#xA0;Package&#xA0;for&#xA0;Differentiation&#xA0;of&#xA0;C++&#xA0;Algorithms:&#160;Introduction</a><br/>
4245 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="cppad.xml#Introduction" target="_top">cppad-20160000.1:&#xA0;A&#xA0;Package&#xA0;for&#xA0;Differentiation&#xA0;of&#xA0;C++&#xA0;Algorithms:&#160;Introduction</a><br/>
47864246 inuse&#160;<a href="memory_leak.xml#inuse" target="_top">Memory&#xA0;Leak&#xA0;Detection:&#160;inuse</a><br/>
47874247 &#160;&#160;&#160;&#160;&#160;&#160;<a href="omp_inuse.xml" target="_top">Amount&#xA0;of&#xA0;Memory&#xA0;a&#xA0;Thread&#xA0;is&#xA0;Currently&#xA0;Using</a><br/>
47884248 &#160;&#160;&#160;&#160;&#160;&#160;<a href="ta_inuse.xml" target="_top">Amount&#xA0;of&#xA0;Memory&#xA0;a&#xA0;Thread&#xA0;is&#xA0;Currently&#xA0;Using</a><br/>
54564916 NULL&#160;<a href="preprocessor.xml" target="_top">CppAD&#xA0;API&#xA0;Preprocessor&#xA0;Symbols</a><br/>
54574917 NumericType&#160;<a href="check_numeric_type.cpp.xml" target="_top">The&#xA0;CheckNumericType&#xA0;Function:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
54584918 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="numeric_type.cpp.xml" target="_top">The&#xA0;NumericType:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
5459 n&#160;<a href="uniform_01_c.xml#n" target="_top">Simulate&#xA0;a&#xA0;[0,1]&#xA0;Uniform&#xA0;Random&#xA0;Variate:&#160;n</a><br/>
5460 &#160;&#160;<a href="det_of_minor_c.xml#n" target="_top">Determinant&#xA0;of&#xA0;a&#xA0;Minor:&#160;n</a><br/>
5461 &#160;&#160;<a href="old_atomic.xml#n" target="_top">User&#xA0;Defined&#xA0;Atomic&#xA0;AD&#xA0;Functions:&#160;n</a><br/>
5462 &#160;&#160;<a href="cppad_ipopt_nlp.xml#n" target="_top">Nonlinear&#xA0;Programming&#xA0;Using&#xA0;the&#xA0;CppAD&#xA0;Interface&#xA0;to&#xA0;Ipopt:&#160;n</a><br/>
5463 &#160;&#160;<a href="adolc_alloc_mat.xml#n" target="_top">Adolc&#xA0;Test&#xA0;Utility:&#xA0;Allocate&#xA0;and&#xA0;Free&#xA0;Memory&#xA0;For&#xA0;a&#xA0;Matrix:&#160;n</a><br/>
5464 &#160;&#160;<a href="uniform_01.xml#n" target="_top">Simulate&#xA0;a&#xA0;[0,1]&#xA0;Uniform&#xA0;Random&#xA0;Variate:&#160;n</a><br/>
5465 &#160;&#160;<a href="sparse_hes_fun.xml#n" target="_top">Evaluate&#xA0;a&#xA0;Function&#xA0;That&#xA0;Has&#xA0;a&#xA0;Sparse&#xA0;Hessian:&#160;n</a><br/>
5466 &#160;&#160;<a href="sparse_jac_fun.xml#n" target="_top">Evaluate&#xA0;a&#xA0;Function&#xA0;That&#xA0;Has&#xA0;a&#xA0;Sparse&#xA0;Jacobian:&#160;n</a><br/>
5467 &#160;&#160;<a href="mat_sum_sq.xml#n" target="_top">Sum&#xA0;Elements&#xA0;of&#xA0;a&#xA0;Matrix&#xA0;Times&#xA0;Itself:&#160;n</a><br/>
5468 &#160;&#160;<a href="det_by_minor.xml#n" target="_top">Determinant&#xA0;Using&#xA0;Expansion&#xA0;by&#xA0;Minors:&#160;n</a><br/>
5469 &#160;&#160;<a href="det_of_minor.xml#n" target="_top">Determinant&#xA0;of&#xA0;a&#xA0;Minor:&#160;n</a><br/>
5470 &#160;&#160;<a href="det_by_lu.xml#n" target="_top">Determinant&#xA0;Using&#xA0;Expansion&#xA0;by&#xA0;Lu&#xA0;Factorization:&#160;n</a><br/>
5471 &#160;&#160;<a href="link_mat_mul.xml#n" target="_top">Speed&#xA0;Testing&#xA0;Derivative&#xA0;of&#xA0;Matrix&#xA0;Multiply:&#160;n</a><br/>
5472 &#160;&#160;<a href="lu_vec_ad.cpp.xml#n" target="_top">Lu&#xA0;Factor&#xA0;and&#xA0;Solve&#xA0;with&#xA0;Recorded&#xA0;Pivoting:&#160;n</a><br/>
5473 &#160;&#160;<a href="odegear.xml#n" target="_top">An&#xA0;Arbitrary&#xA0;Order&#xA0;Gear&#xA0;Method:&#160;n</a><br/>
5474 &#160;&#160;<a href="rombergmul.xml#n" target="_top">Multi-dimensional&#xA0;Romberg&#xA0;Integration:&#160;n</a><br/>
5475 &#160;&#160;<a href="rombergone.xml#n" target="_top">One&#xA0;DimensionalRomberg&#xA0;Integration:&#160;n</a><br/>
5476 &#160;&#160;<a href="lusolve.xml#n" target="_top">Compute&#xA0;Determinant&#xA0;and&#xA0;Solve&#xA0;Linear&#xA0;Equations:&#160;n</a><br/>
5477 &#160;&#160;<a href="number_skip.xml#n" target="_top">Number&#xA0;of&#xA0;Variables&#xA0;that&#xA0;Can&#xA0;be&#xA0;Skipped:&#160;n</a><br/>
5478 &#160;&#160;<a href="forward_dir.xml#Notation.n" target="_top">Multiple&#xA0;Directions&#xA0;Forward&#xA0;Mode:&#160;Notation.n</a><br/>
5479 &#160;&#160;<a href="forward_order.xml#Notation.n" target="_top">Multiple&#xA0;Order&#xA0;Forward&#xA0;Mode:&#160;Notation.n</a><br/>
5480 &#160;&#160;<a href="vecad.xml#n" target="_top">AD&#xA0;Vectors&#xA0;that&#xA0;Record&#xA0;Index&#xA0;Operations:&#160;n</a><br/>
54814919 n<b>_</b>sweep&#160;<a href="link_sparse_jacobian.xml#n_sweep" target="_top">Speed&#xA0;Testing&#xA0;Sparse&#xA0;Jacobian:&#160;n_sweep</a><br/>
54824920 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="link_sparse_hessian.xml#n_sweep" target="_top">Speed&#xA0;Testing&#xA0;Sparse&#xA0;Hessian:&#160;n_sweep</a><br/>
54834921 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="speed_main.xml#Speed Results.n_sweep" target="_top">Running&#xA0;the&#xA0;Speed&#xA0;Test&#xA0;Program:&#160;Speed&#xA0;Results.n_sweep</a><br/>
54934931 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="cppad_ipopt_nlp.xml#cppad_ipopt namespace" target="_top">Nonlinear&#xA0;Programming&#xA0;Using&#xA0;the&#xA0;CppAD&#xA0;Interface&#xA0;to&#xA0;Ipopt:&#160;cppad_ipopt&#xA0;namespace</a><br/>
54944932 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="faq.xml#Namespace" target="_top">Frequently&#xA0;Asked&#xA0;Questions&#xA0;and&#xA0;Answers:&#160;Namespace</a><br/>
54954933 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="cppad_eigen.hpp.xml#CppAD Namespace" target="_top">Enable&#xA0;Use&#xA0;of&#xA0;Eigen&#xA0;Linear&#xA0;Algebra&#xA0;Package&#xA0;with&#xA0;CppAD:&#160;CppAD&#xA0;Namespace</a><br/>
5496 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="cppad.xml#Namespace" target="_top">cppad-20160000.0:&#xA0;A&#xA0;Package&#xA0;for&#xA0;Differentiation&#xA0;of&#xA0;C++&#xA0;Algorithms:&#160;Namespace</a><br/>
4934 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="cppad.xml#Namespace" target="_top">cppad-20160000.1:&#xA0;A&#xA0;Package&#xA0;for&#xA0;Differentiation&#xA0;of&#xA0;C++&#xA0;Algorithms:&#160;Namespace</a><br/>
54974935 nan&#160;<a href="zdouble.xml#Syntax.Nan" target="_top">zdouble:&#xA0;An&#xA0;AD&#xA0;Base&#xA0;Type&#xA0;With&#xA0;Absolute&#xA0;Zero:&#160;Syntax.Nan</a><br/>
54984936 &#160;&#160;&#160;&#160;<a href="ode_err_control.cpp.xml#Nan" target="_top">OdeErrControl:&#xA0;Example&#xA0;and&#xA0;Test:&#160;Nan</a><br/>
54994937 &#160;&#160;&#160;&#160;<a href="odeerrcontrol.xml#Method.Nan" target="_top">An&#xA0;Error&#xA0;Controller&#xA0;for&#xA0;ODE&#xA0;Solvers:&#160;Method.Nan</a><br/>
56835121 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="ode_err_control.cpp.xml" target="_top">OdeErrControl:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
56845122 odegear<b>:</b>&#160;<a href="ode_gear.cpp.xml" target="_top">OdeGear:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
56855123 odegearcontrol<b>:</b>&#160;<a href="ode_gear_control.cpp.xml" target="_top">OdeGearControl:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
5686 of&#160;<a href="luratio.xml" target="_top">LU&#xA0;Factorization&#xA0;of&#xA0;A&#xA0;Square&#xA0;Matrix&#xA0;and&#xA0;Stability&#xA0;Calculation</a><br/>
5687 &#160;&#160;&#160;<a href="opt_val_hes.xml" target="_top">Jacobian&#xA0;and&#xA0;Hessian&#xA0;of&#xA0;Optimal&#xA0;Values</a><br/>
5688 &#160;&#160;&#160;<a href="benderquad.xml" target="_top">Computing&#xA0;Jacobian&#xA0;and&#xA0;Hessian&#xA0;of&#xA0;Bender's&#xA0;Reduced&#xA0;Objective</a><br/>
5689 &#160;&#160;&#160;<a href="time_det_by_minor_c.xml" target="_top">Determine&#xA0;Amount&#xA0;of&#xA0;Time&#xA0;to&#xA0;Execute&#xA0;det_by_minor</a><br/>
5690 &#160;&#160;&#160;<a href="elapsed_seconds_c.xml" target="_top">Returns&#xA0;Elapsed&#xA0;Number&#xA0;of&#xA0;Seconds</a><br/>
5691 &#160;&#160;&#160;<a href="repeat_det_by_minor_c.xml" target="_top">Repeat&#xA0;det_by_minor&#xA0;Routine&#xA0;A&#xA0;Specified&#xA0;Number&#xA0;of&#xA0;Times</a><br/>
5692 &#160;&#160;&#160;<a href="correct_det_by_minor_c.xml" target="_top">Correctness&#xA0;Test&#xA0;of&#xA0;det_by_minor&#xA0;Routine</a><br/>
5693 &#160;&#160;&#160;<a href="det_of_minor_c.xml#Determinant of A" target="_top">Determinant&#xA0;of&#xA0;a&#xA0;Minor:&#160;Determinant&#xA0;of&#xA0;A</a><br/>
5694 &#160;&#160;&#160;<a href="det_of_minor_c.xml" target="_top">Determinant&#xA0;of&#xA0;a&#xA0;Minor</a><br/>
5695 &#160;&#160;&#160;<a href="compare_c.xml" target="_top">Compare&#xA0;Speed&#xA0;of&#xA0;C&#xA0;and&#xA0;C++</a><br/>
5696 &#160;&#160;&#160;<a href="ipopt_nlp_ode_problem.xml#Black Box Method.Two levels of Iteration" target="_top">An&#xA0;ODE&#xA0;Inverse&#xA0;Problem&#xA0;Example:&#160;Black&#xA0;Box&#xA0;Method.Two&#xA0;levels&#xA0;of&#xA0;Iteration</a><br/>
5697 &#160;&#160;&#160;<a href="ipopt_nlp_ode.xml" target="_top">Example&#xA0;Simultaneous&#xA0;Solution&#xA0;of&#xA0;Forward&#xA0;and&#xA0;Inverse&#xA0;Problem</a><br/>
5698 &#160;&#160;&#160;<a href="old_max_num_threads.xml" target="_top">Set&#xA0;Maximum&#xA0;Number&#xA0;of&#xA0;Threads&#xA0;for&#xA0;omp_alloc&#xA0;Allocator</a><br/>
5699 &#160;&#160;&#160;<a href="omp_available.xml" target="_top">Amount&#xA0;of&#xA0;Memory&#xA0;Available&#xA0;for&#xA0;Quick&#xA0;Use&#xA0;by&#xA0;a&#xA0;Thread</a><br/>
5700 &#160;&#160;&#160;<a href="omp_inuse.xml" target="_top">Amount&#xA0;of&#xA0;Memory&#xA0;a&#xA0;Thread&#xA0;is&#xA0;Currently&#xA0;Using</a><br/>
5701 &#160;&#160;&#160;<a href="omp_get_memory.xml" target="_top">Get&#xA0;At&#xA0;Least&#xA0;A&#xA0;Specified&#xA0;Amount&#xA0;of&#xA0;Memory</a><br/>
5702 &#160;&#160;&#160;<a href="omp_max_num_threads.xml" target="_top">Set&#xA0;and&#xA0;Get&#xA0;Maximum&#xA0;Number&#xA0;of&#xA0;Threads&#xA0;for&#xA0;omp_alloc&#xA0;Allocator</a><br/>
5703 &#160;&#160;&#160;<a href="tracknewdel.cpp.xml" target="_top">Tracking&#xA0;Use&#xA0;of&#xA0;New&#xA0;and&#xA0;Delete:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
5704 &#160;&#160;&#160;<a href="tracknewdel.xml" target="_top">Routines&#xA0;That&#xA0;Track&#xA0;Use&#xA0;of&#xA0;New&#xA0;and&#xA0;Delete</a><br/>
5705 &#160;&#160;&#160;<a href="glossary.xml#Sparsity Pattern.Vector of Sets" target="_top">Glossary:&#160;Sparsity&#xA0;Pattern.Vector&#xA0;of&#xA0;Sets</a><br/>
5706 &#160;&#160;&#160;<a href="glossary.xml#Sparsity Pattern.Vector of Boolean" target="_top">Glossary:&#160;Sparsity&#xA0;Pattern.Vector&#xA0;of&#xA0;Boolean</a><br/>
5707 &#160;&#160;&#160;<a href="glossary.xml#AD of Base" target="_top">Glossary:&#160;AD&#xA0;of&#xA0;Base</a><br/>
5708 &#160;&#160;&#160;<a href="reversetheory.xml" target="_top">The&#xA0;Theory&#xA0;of&#xA0;Reverse&#xA0;Mode</a><br/>
5709 &#160;&#160;&#160;<a href="forwardtheory.xml" target="_top">The&#xA0;Theory&#xA0;of&#xA0;Forward&#xA0;Mode</a><br/>
5710 &#160;&#160;&#160;<a href="theory.xml" target="_top">The&#xA0;Theory&#xA0;of&#xA0;Derivative&#xA0;Calculations</a><br/>
5711 &#160;&#160;&#160;<a href="sacado_poly.cpp.xml" target="_top">Sacado&#xA0;Speed:&#xA0;Second&#xA0;Derivative&#xA0;of&#xA0;a&#xA0;Polynomial</a><br/>
5712 &#160;&#160;&#160;<a href="sacado_ode.cpp.xml" target="_top">Sacado&#xA0;Speed:&#xA0;Gradient&#xA0;of&#xA0;Ode&#xA0;Solution</a><br/>
5713 &#160;&#160;&#160;<a href="sacado_det_lu.cpp.xml" target="_top">Sacado&#xA0;Speed:&#xA0;Gradient&#xA0;of&#xA0;Determinant&#xA0;Using&#xA0;Lu&#xA0;Factorization</a><br/>
5714 &#160;&#160;&#160;<a href="sacado_det_minor.cpp.xml" target="_top">Sacado&#xA0;Speed:&#xA0;Gradient&#xA0;of&#xA0;Determinant&#xA0;by&#xA0;Minor&#xA0;Expansion</a><br/>
5715 &#160;&#160;&#160;<a href="fadbad_poly.cpp.xml" target="_top">Fadbad&#xA0;Speed:&#xA0;Second&#xA0;Derivative&#xA0;of&#xA0;a&#xA0;Polynomial</a><br/>
5716 &#160;&#160;&#160;<a href="fadbad_det_lu.cpp.xml" target="_top">Fadbad&#xA0;Speed:&#xA0;Gradient&#xA0;of&#xA0;Determinant&#xA0;Using&#xA0;Lu&#xA0;Factorization</a><br/>
5717 &#160;&#160;&#160;<a href="fadbad_det_minor.cpp.xml" target="_top">Fadbad&#xA0;Speed:&#xA0;Gradient&#xA0;of&#xA0;Determinant&#xA0;by&#xA0;Minor&#xA0;Expansion</a><br/>
5718 &#160;&#160;&#160;<a href="cppad_poly.cpp.xml" target="_top">CppAD&#xA0;Speed:&#xA0;Second&#xA0;Derivative&#xA0;of&#xA0;a&#xA0;Polynomial</a><br/>
5719 &#160;&#160;&#160;<a href="cppad_ode.cpp.xml" target="_top">CppAD&#xA0;Speed:&#xA0;Gradient&#xA0;of&#xA0;Ode&#xA0;Solution</a><br/>
5720 &#160;&#160;&#160;<a href="cppad_det_lu.cpp.xml" target="_top">CppAD&#xA0;Speed:&#xA0;Gradient&#xA0;of&#xA0;Determinant&#xA0;Using&#xA0;Lu&#xA0;Factorization</a><br/>
5721 &#160;&#160;&#160;<a href="cppad_det_minor.cpp.xml" target="_top">CppAD&#xA0;Speed:&#xA0;Gradient&#xA0;of&#xA0;Determinant&#xA0;by&#xA0;Minor&#xA0;Expansion</a><br/>
5722 &#160;&#160;&#160;<a href="adolc_poly.cpp.xml" target="_top">Adolc&#xA0;Speed:&#xA0;Second&#xA0;Derivative&#xA0;of&#xA0;a&#xA0;Polynomial</a><br/>
5723 &#160;&#160;&#160;<a href="adolc_det_lu.cpp.xml" target="_top">Adolc&#xA0;Speed:&#xA0;Gradient&#xA0;of&#xA0;Determinant&#xA0;Using&#xA0;Lu&#xA0;Factorization</a><br/>
5724 &#160;&#160;&#160;<a href="adolc_det_minor.cpp.xml" target="_top">Adolc&#xA0;Speed:&#xA0;Gradient&#xA0;of&#xA0;Determinant&#xA0;by&#xA0;Minor&#xA0;Expansion</a><br/>
5725 &#160;&#160;&#160;<a href="speed_adolc.xml" target="_top">Speed&#xA0;Test&#xA0;of&#xA0;Derivatives&#xA0;Using&#xA0;Adolc</a><br/>
5726 &#160;&#160;&#160;<a href="speed_double.xml" target="_top">Speed&#xA0;Test&#xA0;of&#xA0;Functions&#xA0;in&#xA0;Double</a><br/>
5727 &#160;&#160;&#160;<a href="ode_evaluate.xml" target="_top">Evaluate&#xA0;a&#xA0;Function&#xA0;Defined&#xA0;in&#xA0;Terms&#xA0;of&#xA0;an&#xA0;ODE</a><br/>
5728 &#160;&#160;&#160;<a href="mat_sum_sq.cpp.xml" target="_top">Sum&#xA0;of&#xA0;the&#xA0;Elements&#xA0;of&#xA0;the&#xA0;Square&#xA0;of&#xA0;a&#xA0;Matrix:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
5729 &#160;&#160;&#160;<a href="mat_sum_sq.cpp.xml" target="_top">Sum&#xA0;of&#xA0;the&#xA0;Elements&#xA0;of&#xA0;the&#xA0;Square&#xA0;of&#xA0;a&#xA0;Matrix:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
5730 &#160;&#160;&#160;<a href="mat_sum_sq.cpp.xml" target="_top">Sum&#xA0;of&#xA0;the&#xA0;Elements&#xA0;of&#xA0;the&#xA0;Square&#xA0;of&#xA0;a&#xA0;Matrix:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
5731 &#160;&#160;&#160;<a href="mat_sum_sq.xml" target="_top">Sum&#xA0;Elements&#xA0;of&#xA0;a&#xA0;Matrix&#xA0;Times&#xA0;Itself</a><br/>
5732 &#160;&#160;&#160;<a href="det_grad_33.xml" target="_top">Check&#xA0;Gradient&#xA0;of&#xA0;Determinant&#xA0;of&#xA0;3&#xA0;by&#xA0;3&#xA0;matrix</a><br/>
5733 &#160;&#160;&#160;<a href="det_grad_33.xml" target="_top">Check&#xA0;Gradient&#xA0;of&#xA0;Determinant&#xA0;of&#xA0;3&#xA0;by&#xA0;3&#xA0;matrix</a><br/>
5734 &#160;&#160;&#160;<a href="det_33.xml" target="_top">Check&#xA0;Determinant&#xA0;of&#xA0;3&#xA0;by&#xA0;3&#xA0;matrix</a><br/>
5735 &#160;&#160;&#160;<a href="det_of_minor.cpp.xml" target="_top">Determinant&#xA0;of&#xA0;a&#xA0;Minor:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
5736 &#160;&#160;&#160;<a href="det_of_minor.xml#Determinant of A" target="_top">Determinant&#xA0;of&#xA0;a&#xA0;Minor:&#160;Determinant&#xA0;of&#xA0;A</a><br/>
5737 &#160;&#160;&#160;<a href="det_of_minor.xml" target="_top">Determinant&#xA0;of&#xA0;a&#xA0;Minor</a><br/>
5738 &#160;&#160;&#160;<a href="microsoft_timer.xml" target="_top">Microsoft&#xA0;Version&#xA0;of&#xA0;Elapsed&#xA0;Number&#xA0;of&#xA0;Seconds</a><br/>
5739 &#160;&#160;&#160;<a href="microsoft_timer.xml" target="_top">Microsoft&#xA0;Version&#xA0;of&#xA0;Elapsed&#xA0;Number&#xA0;of&#xA0;Seconds</a><br/>
5740 &#160;&#160;&#160;<a href="link_poly.xml" target="_top">Speed&#xA0;Testing&#xA0;Second&#xA0;Derivative&#xA0;of&#xA0;a&#xA0;Polynomial</a><br/>
5741 &#160;&#160;&#160;<a href="link_ode.xml" target="_top">Speed&#xA0;Testing&#xA0;the&#xA0;Jacobian&#xA0;of&#xA0;Ode&#xA0;Solution</a><br/>
5742 &#160;&#160;&#160;<a href="link_mat_mul.xml" target="_top">Speed&#xA0;Testing&#xA0;Derivative&#xA0;of&#xA0;Matrix&#xA0;Multiply</a><br/>
5743 &#160;&#160;&#160;<a href="link_det_minor.xml" target="_top">Speed&#xA0;Testing&#xA0;Gradient&#xA0;of&#xA0;Determinant&#xA0;by&#xA0;Minor&#xA0;Expansion</a><br/>
5744 &#160;&#160;&#160;<a href="link_det_lu.xml" target="_top">Speed&#xA0;Testing&#xA0;Gradient&#xA0;of&#xA0;Determinant&#xA0;Using&#xA0;Lu&#xA0;Factorization</a><br/>
5745 &#160;&#160;&#160;<a href="mul_level_adolc_ode.cpp.xml#Derivative of ODE Solution" target="_top">Taylor's&#xA0;Ode&#xA0;Solver:&#xA0;A&#xA0;Multi-Level&#xA0;Adolc&#xA0;Example&#xA0;and&#xA0;Test:&#160;Derivative&#xA0;of&#xA0;ODE&#xA0;Solution</a><br/>
5746 &#160;&#160;&#160;<a href="mul_level_ode.cpp.xml#Derivative of ODE Solution" target="_top">Taylor's&#xA0;Ode&#xA0;Solver:&#xA0;A&#xA0;Multi-Level&#xA0;AD&#xA0;Example&#xA0;and&#xA0;Test:&#160;Derivative&#xA0;of&#xA0;ODE&#xA0;Solution</a><br/>
5747 &#160;&#160;&#160;<a href="mul_level.cpp.xml" target="_top">Multiple&#xA0;Level&#xA0;of&#xA0;AD:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
5748 &#160;&#160;&#160;<a href="mul_level.xml#Procedure.Derivatives of Outer Function" target="_top">Using&#xA0;Multiple&#xA0;Levels&#xA0;of&#xA0;AD:&#160;Procedure.Derivatives&#xA0;of&#xA0;Outer&#xA0;Function</a><br/>
5749 &#160;&#160;&#160;<a href="mul_level.xml" target="_top">Using&#xA0;Multiple&#xA0;Levels&#xA0;of&#xA0;AD</a><br/>
5750 &#160;&#160;&#160;<a href="jac_lu_det.cpp.xml" target="_top">Gradient&#xA0;of&#xA0;Determinant&#xA0;Using&#xA0;Lu&#xA0;Factorization:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
5751 &#160;&#160;&#160;<a href="jac_minor_det.cpp.xml" target="_top">Gradient&#xA0;of&#xA0;Determinant&#xA0;Using&#xA0;Expansion&#xA0;by&#xA0;Minors:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
5752 &#160;&#160;&#160;<a href="hes_lu_det.cpp.xml" target="_top">Gradient&#xA0;of&#xA0;Determinant&#xA0;Using&#xA0;LU&#xA0;Factorization:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
5753 &#160;&#160;&#160;<a href="hes_minor_det.cpp.xml" target="_top">Gradient&#xA0;of&#xA0;Determinant&#xA0;Using&#xA0;Expansion&#xA0;by&#xA0;Minors:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
5754 &#160;&#160;&#160;<a href="cppad_eigen.hpp.xml" target="_top">Enable&#xA0;Use&#xA0;of&#xA0;Eigen&#xA0;Linear&#xA0;Algebra&#xA0;Package&#xA0;with&#xA0;CppAD</a><br/>
5755 &#160;&#160;&#160;<a href="listallexamples.xml" target="_top">List&#xA0;of&#xA0;All&#xA0;the&#xA0;CppAD&#xA0;Examples</a><br/>
5756 &#160;&#160;&#160;<a href="ta_available.xml" target="_top">Amount&#xA0;of&#xA0;Memory&#xA0;Available&#xA0;for&#xA0;Quick&#xA0;Use&#xA0;by&#xA0;a&#xA0;Thread</a><br/>
5757 &#160;&#160;&#160;<a href="ta_inuse.xml" target="_top">Amount&#xA0;of&#xA0;Memory&#xA0;a&#xA0;Thread&#xA0;is&#xA0;Currently&#xA0;Using</a><br/>
5758 &#160;&#160;&#160;<a href="ta_get_memory.xml" target="_top">Get&#xA0;At&#xA0;Least&#xA0;A&#xA0;Specified&#xA0;Amount&#xA0;of&#xA0;Memory</a><br/>
5759 &#160;&#160;&#160;<a href="ta_num_threads.xml" target="_top">Get&#xA0;Number&#xA0;of&#xA0;Threads</a><br/>
5760 &#160;&#160;&#160;<a href="lufactor.xml" target="_top">LU&#xA0;Factorization&#xA0;of&#xA0;A&#xA0;Square&#xA0;Matrix</a><br/>
5761 &#160;&#160;&#160;<a href="simplevector.xml#Elements of Specified Type" target="_top">Definition&#xA0;of&#xA0;a&#xA0;Simple&#xA0;Vector:&#160;Elements&#xA0;of&#xA0;Specified&#xA0;Type</a><br/>
5762 &#160;&#160;&#160;<a href="simplevector.xml" target="_top">Definition&#xA0;of&#xA0;a&#xA0;Simple&#xA0;Vector</a><br/>
5763 &#160;&#160;&#160;<a href="numerictype.xml" target="_top">Definition&#xA0;of&#xA0;a&#xA0;Numeric&#xA0;Type</a><br/>
5764 &#160;&#160;&#160;<a href="elapsed_seconds.xml" target="_top">Returns&#xA0;Elapsed&#xA0;Number&#xA0;of&#xA0;Seconds</a><br/>
5765 &#160;&#160;&#160;<a href="time_test.xml" target="_top">Determine&#xA0;Amount&#xA0;of&#xA0;Time&#xA0;to&#xA0;Execute&#xA0;a&#xA0;Test</a><br/>
5766 &#160;&#160;&#160;<a href="speed_program.cpp.xml" target="_top">Example&#xA0;Use&#xA0;of&#xA0;SpeedTest</a><br/>
5767 &#160;&#160;&#160;<a href="team_pthread.cpp.xml" target="_top">Pthread&#xA0;Implementation&#xA0;of&#xA0;a&#xA0;Team&#xA0;of&#xA0;AD&#xA0;Threads</a><br/>
5768 &#160;&#160;&#160;<a href="team_pthread.cpp.xml" target="_top">Pthread&#xA0;Implementation&#xA0;of&#xA0;a&#xA0;Team&#xA0;of&#xA0;AD&#xA0;Threads</a><br/>
5769 &#160;&#160;&#160;<a href="team_bthread.cpp.xml" target="_top">Boost&#xA0;Thread&#xA0;Implementation&#xA0;of&#xA0;a&#xA0;Team&#xA0;of&#xA0;AD&#xA0;Threads</a><br/>
5770 &#160;&#160;&#160;<a href="team_bthread.cpp.xml" target="_top">Boost&#xA0;Thread&#xA0;Implementation&#xA0;of&#xA0;a&#xA0;Team&#xA0;of&#xA0;AD&#xA0;Threads</a><br/>
5771 &#160;&#160;&#160;<a href="team_openmp.cpp.xml" target="_top">OpenMP&#xA0;Implementation&#xA0;of&#xA0;a&#xA0;Team&#xA0;of&#xA0;AD&#xA0;Threads</a><br/>
5772 &#160;&#160;&#160;<a href="team_openmp.cpp.xml" target="_top">OpenMP&#xA0;Implementation&#xA0;of&#xA0;a&#xA0;Team&#xA0;of&#xA0;AD&#xA0;Threads</a><br/>
5773 &#160;&#160;&#160;<a href="team_thread.hpp.xml#Speed Test of Implementation" target="_top">Specifications&#xA0;for&#xA0;A&#xA0;Team&#xA0;of&#xA0;AD&#xA0;Threads:&#160;Speed&#xA0;Test&#xA0;of&#xA0;Implementation</a><br/>
5774 &#160;&#160;&#160;<a href="team_thread.hpp.xml" target="_top">Specifications&#xA0;for&#xA0;A&#xA0;Team&#xA0;of&#xA0;AD&#xA0;Threads</a><br/>
5775 &#160;&#160;&#160;<a href="multi_newton_time.cpp.xml" target="_top">Timing&#xA0;Test&#xA0;of&#xA0;Multi-Threaded&#xA0;Newton&#xA0;Method</a><br/>
5776 &#160;&#160;&#160;<a href="harmonic_work.cpp.xml" target="_top">Multi-threading&#xA0;Sum&#xA0;of&#xA0;1/i&#xA0;Utility&#xA0;Routines</a><br/>
5777 &#160;&#160;&#160;<a href="harmonic_time.cpp.xml" target="_top">Timing&#xA0;Test&#xA0;of&#xA0;Multi-Threaded&#xA0;Summation&#xA0;of&#xA0;1/i</a><br/>
5778 &#160;&#160;&#160;<a href="harmonic_time.cpp.xml" target="_top">Timing&#xA0;Test&#xA0;of&#xA0;Multi-Threaded&#xA0;Summation&#xA0;of&#xA0;1/i</a><br/>
5779 &#160;&#160;&#160;<a href="harmonic.cpp.xml" target="_top">Multi-Threaded&#xA0;Implementation&#xA0;of&#xA0;Summation&#xA0;of&#xA0;1/i</a><br/>
5780 &#160;&#160;&#160;<a href="harmonic.cpp.xml" target="_top">Multi-Threaded&#xA0;Implementation&#xA0;of&#xA0;Summation&#xA0;of&#xA0;1/i</a><br/>
5781 &#160;&#160;&#160;<a href="team_example.cpp.xml" target="_top">Using&#xA0;a&#xA0;Team&#xA0;of&#xA0;AD&#xA0;Threads:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
5782 &#160;&#160;&#160;<a href="funcheck.xml" target="_top">Check&#xA0;an&#xA0;ADFun&#xA0;Sequence&#xA0;of&#xA0;Operations</a><br/>
5783 &#160;&#160;&#160;<a href="sparse_sub_hes.cpp.xml" target="_top">Sparse&#xA0;Hessian&#xA0;on&#xA0;Subset&#xA0;of&#xA0;Variables:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
5784 &#160;&#160;&#160;<a href="sub_sparse_hes.cpp.xml" target="_top">Computing&#xA0;Sparse&#xA0;Hessian&#xA0;for&#xA0;a&#xA0;Subset&#xA0;of&#xA0;Variables</a><br/>
5785 &#160;&#160;&#160;<a href="for_two.cpp.xml" target="_top">Subset&#xA0;of&#xA0;Second&#xA0;Order&#xA0;Partials:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
5786 &#160;&#160;&#160;<a href="hes_lagrangian.cpp.xml" target="_top">Hessian&#xA0;of&#xA0;Lagrangian&#xA0;and&#xA0;&#xA0;ADFun&#xA0;Default&#xA0;Constructor:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
5787 &#160;&#160;&#160;<a href="sparsity_sub.cpp.xml" target="_top">Sparsity&#xA0;Patterns&#xA0;For&#xA0;a&#xA0;Subset&#xA0;of&#xA0;Variables:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
5788 &#160;&#160;&#160;<a href="number_skip.cpp.xml" target="_top">Number&#xA0;of&#xA0;Variables&#xA0;That&#xA0;Can&#xA0;be&#xA0;Skipped:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
5789 &#160;&#160;&#160;<a href="number_skip.xml" target="_top">Number&#xA0;of&#xA0;Variables&#xA0;that&#xA0;Can&#xA0;be&#xA0;Skipped</a><br/>
5790 &#160;&#160;&#160;<a href="forward_dir.cpp.xml" target="_top">Forward&#xA0;Mode:&#xA0;Example&#xA0;and&#xA0;Test&#xA0;of&#xA0;Multiple&#xA0;Directions</a><br/>
5791 &#160;&#160;&#160;<a href="forward_order.cpp.xml" target="_top">Forward&#xA0;Mode:&#xA0;Example&#xA0;and&#xA0;Test&#xA0;of&#xA0;Multiple&#xA0;Orders</a><br/>
5792 &#160;&#160;&#160;<a href="abort_recording.xml" target="_top">Abort&#xA0;Recording&#xA0;of&#xA0;an&#xA0;Operation&#xA0;Sequence</a><br/>
5793 &#160;&#160;&#160;<a href="base_complex.hpp.xml" target="_top">Enable&#xA0;use&#xA0;of&#xA0;AD&lt;Base&gt;&#xA0;where&#xA0;Base&#xA0;is&#xA0;std::complex&lt;double&gt;</a><br/>
5794 &#160;&#160;&#160;<a href="base_double.hpp.xml" target="_top">Enable&#xA0;use&#xA0;of&#xA0;AD&lt;Base&gt;&#xA0;where&#xA0;Base&#xA0;is&#xA0;double</a><br/>
5795 &#160;&#160;&#160;<a href="base_float.hpp.xml" target="_top">Enable&#xA0;use&#xA0;of&#xA0;AD&lt;Base&gt;&#xA0;where&#xA0;Base&#xA0;is&#xA0;float</a><br/>
5796 &#160;&#160;&#160;<a href="mul_level_adolc.cpp.xml" target="_top">Using&#xA0;Adolc&#xA0;with&#xA0;Multiple&#xA0;Levels&#xA0;of&#xA0;Taping:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
5797 &#160;&#160;&#160;<a href="base_adolc.hpp.xml" target="_top">Enable&#xA0;use&#xA0;of&#xA0;AD&lt;Base&gt;&#xA0;where&#xA0;Base&#xA0;is&#xA0;Adolc's&#xA0;adouble&#xA0;Type</a><br/>
5798 &#160;&#160;&#160;<a href="atomic_afun.xml" target="_top">Using&#xA0;AD&#xA0;Version&#xA0;of&#xA0;Atomic&#xA0;Function</a><br/>
5799 &#160;&#160;&#160;<a href="log1p.xml" target="_top">The&#xA0;Logarithm&#xA0;of&#xA0;One&#xA0;Plus&#xA0;Argument:&#xA0;log1p</a><br/>
5800 &#160;&#160;&#160;<a href="convert.xml" target="_top">Conversion&#xA0;and&#xA0;I/O&#xA0;of&#xA0;AD&#xA0;Objects</a><br/>
5801 &#160;&#160;&#160;<a href="exp_eps.cpp.xml" target="_top">exp_eps:&#xA0;Test&#xA0;of&#xA0;exp_eps</a><br/>
5802 &#160;&#160;&#160;<a href="cppad.xml" target="_top">cppad-20160000.0:&#xA0;A&#xA0;Package&#xA0;for&#xA0;Differentiation&#xA0;of&#xA0;C++&#xA0;Algorithms</a><br/>
58035124 ok&#160;<a href="old_atomic.xml#ok" target="_top">User&#xA0;Defined&#xA0;Atomic&#xA0;AD&#xA0;Functions:&#160;ok</a><br/>
58045125 &#160;&#160;&#160;<a href="det_grad_33.xml#ok" target="_top">Check&#xA0;Gradient&#xA0;of&#xA0;Determinant&#xA0;of&#xA0;3&#xA0;by&#xA0;3&#xA0;matrix:&#160;ok</a><br/>
58055126 &#160;&#160;&#160;<a href="det_33.xml#ok" target="_top">Check&#xA0;Determinant&#xA0;of&#xA0;3&#xA0;by&#xA0;3&#xA0;matrix:&#160;ok</a><br/>
59735294 options&#160;<a href="speed_main.xml#Sparsity Options" target="_top">Running&#xA0;the&#xA0;Speed&#xA0;Test&#xA0;Program:&#160;Sparsity&#xA0;Options</a><br/>
59745295 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="ipopt_solve.xml#options" target="_top">Use&#xA0;Ipopt&#xA0;to&#xA0;Solve&#xA0;a&#xA0;Nonlinear&#xA0;Programming&#xA0;Problem:&#160;options</a><br/>
59755296 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="atomic_option.xml" target="_top">Set&#xA0;Atomic&#xA0;Function&#xA0;Options</a><br/>
5976 or&#160;<a href="faq.xml#Tape Storage: Disk or Memory" target="_top">Frequently&#xA0;Asked&#xA0;Questions&#xA0;and&#xA0;Answers:&#160;Tape&#xA0;Storage:&#xA0;Disk&#xA0;or&#xA0;Memory</a><br/>
5977 &#160;&#160;&#160;<a href="faq.xml#Mode: Forward or Reverse" target="_top">Frequently&#xA0;Asked&#xA0;Questions&#xA0;and&#xA0;Answers:&#160;Mode:&#xA0;Forward&#xA0;or&#xA0;Reverse</a><br/>
5978 &#160;&#160;&#160;<a href="poly.xml" target="_top">Evaluate&#xA0;a&#xA0;Polynomial&#xA0;or&#xA0;its&#xA0;Derivative</a><br/>
5979 &#160;&#160;&#160;<a href="nan.xml" target="_top">Obtain&#xA0;Nan&#xA0;or&#xA0;Determine&#xA0;if&#xA0;a&#xA0;Value&#xA0;is&#xA0;Nan</a><br/>
5980 &#160;&#160;&#160;<a href="jacobian.xml#Forward or Reverse" target="_top">Jacobian:&#xA0;Driver&#xA0;Routine:&#160;Forward&#xA0;or&#xA0;Reverse</a><br/>
5981 &#160;&#160;&#160;<a href="parvar.xml" target="_top">Is&#xA0;an&#xA0;AD&#xA0;Object&#xA0;a&#xA0;Parameter&#xA0;or&#xA0;Variable</a><br/>
5982 &#160;&#160;&#160;<a href="ad_to_string.xml" target="_top">Convert&#xA0;An&#xA0;AD&#xA0;or&#xA0;Base&#xA0;Type&#xA0;to&#xA0;String</a><br/>
59835297 order&#160;<a href="old_mat_mul.hpp.xml#Reverse Partials One Order" target="_top">Define&#xA0;Matrix&#xA0;Multiply&#xA0;as&#xA0;a&#xA0;User&#xA0;Atomic&#xA0;Operation:&#160;Reverse&#xA0;Partials&#xA0;One&#xA0;Order</a><br/>
59845298 &#160;&#160;&#160;&#160;&#160;&#160;<a href="comparechange.xml" target="_top">Comparison&#xA0;Changes&#xA0;During&#xA0;Zero&#xA0;Order&#xA0;Forward&#xA0;Mode</a><br/>
59855299 &#160;&#160;&#160;&#160;&#160;&#160;<a href="fundeprecated.xml#Order" target="_top">ADFun&#xA0;Object&#xA0;Deprecated&#xA0;Member&#xA0;Functions:&#160;Order</a><br/>
61215435 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="speed.xml" target="_top">Speed&#xA0;Test&#xA0;an&#xA0;Operator&#xA0;Overloading&#xA0;AD&#xA0;Package</a><br/>
61225436 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="cppad_eigen.hpp.xml" target="_top">Enable&#xA0;Use&#xA0;of&#xA0;Eigen&#xA0;Linear&#xA0;Algebra&#xA0;Package&#xA0;with&#xA0;CppAD</a><br/>
61235437 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="cmake.xml" target="_top">Using&#xA0;CMake&#xA0;to&#xA0;Configure&#xA0;CppAD</a><br/>
6124 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="cppad.xml" target="_top">cppad-20160000.0:&#xA0;A&#xA0;Package&#xA0;for&#xA0;Differentiation&#xA0;of&#xA0;C++&#xA0;Algorithms</a><br/>
5438 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="cppad.xml" target="_top">cppad-20160000.1:&#xA0;A&#xA0;Package&#xA0;for&#xA0;Differentiation&#xA0;of&#xA0;C++&#xA0;Algorithms</a><br/>
61255439 package<b>_</b>prefix&#160;<a href="cmake.xml#package_prefix" target="_top">Using&#xA0;CMake&#xA0;to&#xA0;Configure&#xA0;CppAD:&#160;package_prefix</a><br/>
61265440 parallel&#160;<a href="old_atomic.xml#afun.Parallel Mode" target="_top">User&#xA0;Defined&#xA0;Atomic&#xA0;AD&#xA0;Functions:&#160;afun.Parallel&#xA0;Mode</a><br/>
61275441 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="omp_in_parallel.xml" target="_top">Is&#xA0;The&#xA0;Current&#xA0;Execution&#xA0;in&#xA0;OpenMP&#xA0;Parallel&#xA0;Mode</a><br/>
62525566 preprocessor&#160;<a href="addon.xml#Preprocessor Symbols" target="_top">CppAD&#xA0;Addons:&#160;Preprocessor&#xA0;Symbols</a><br/>
62535567 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="faq.xml#Namespace.Test Vector Preprocessor Symbol" target="_top">Frequently&#xA0;Asked&#xA0;Questions&#xA0;and&#xA0;Answers:&#160;Namespace.Test&#xA0;Vector&#xA0;Preprocessor&#xA0;Symbol</a><br/>
62545568 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="preprocessor.xml" target="_top">CppAD&#xA0;API&#xA0;Preprocessor&#xA0;Symbols</a><br/>
6255 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="cppad.xml#Preprocessor Symbols" target="_top">cppad-20160000.0:&#xA0;A&#xA0;Package&#xA0;for&#xA0;Differentiation&#xA0;of&#xA0;C++&#xA0;Algorithms:&#160;Preprocessor&#xA0;Symbols</a><br/>
5569 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="cppad.xml#Preprocessor Symbols" target="_top">cppad-20160000.1:&#xA0;A&#xA0;Package&#xA0;for&#xA0;Differentiation&#xA0;of&#xA0;C++&#xA0;Algorithms:&#160;Preprocessor&#xA0;Symbols</a><br/>
62565570 previous&#160;<a href="whats_new.xml#Previous Years" target="_top">Changes&#xA0;and&#xA0;Additions&#xA0;to&#xA0;CppAD:&#160;Previous&#xA0;Years</a><br/>
62575571 previously&#160;<a href="tracknewdel.xml#TrackCount.Previously Deprecated" target="_top">Routines&#xA0;That&#xA0;Track&#xA0;Use&#xA0;of&#xA0;New&#xA0;and&#xA0;Delete:&#160;TrackCount.Previously&#xA0;Deprecated</a><br/>
62585572 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="tracknewdel.xml#TrackExtend.Previously Deprecated" target="_top">Routines&#xA0;That&#xA0;Track&#xA0;Use&#xA0;of&#xA0;New&#xA0;and&#xA0;Delete:&#160;TrackExtend.Previously&#xA0;Deprecated</a><br/>
65845898 Runge45&#160;<a href="runge45_2.cpp.xml" target="_top">Runge45:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
65855899 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="runge45_1.cpp.xml" target="_top">Runge45:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
65865900 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="runge45.xml" target="_top">An&#xA0;Embedded&#xA0;4th&#xA0;and&#xA0;5th&#xA0;Order&#xA0;Runge-Kutta&#xA0;ODE&#xA0;Solver</a><br/>
6587 r&#160;<a href="det_of_minor_c.xml#r" target="_top">Determinant&#xA0;of&#xA0;a&#xA0;Minor:&#160;r</a><br/>
6588 &#160;&#160;<a href="old_atomic.xml#rev_hes_sparse.r" target="_top">User&#xA0;Defined&#xA0;Atomic&#xA0;AD&#xA0;Functions:&#160;rev_hes_sparse.r</a><br/>
6589 &#160;&#160;<a href="old_atomic.xml#rev_jac_sparse.r" target="_top">User&#xA0;Defined&#xA0;Atomic&#xA0;AD&#xA0;Functions:&#160;rev_jac_sparse.r</a><br/>
6590 &#160;&#160;<a href="old_atomic.xml#for_jac_sparse.r" target="_top">User&#xA0;Defined&#xA0;Atomic&#xA0;AD&#xA0;Functions:&#160;for_jac_sparse.r</a><br/>
6591 &#160;&#160;<a href="det_of_minor.xml#r" target="_top">Determinant&#xA0;of&#xA0;a&#xA0;Minor:&#160;r</a><br/>
6592 &#160;&#160;<a href="rombergmul.xml#r" target="_top">Multi-dimensional&#xA0;Romberg&#xA0;Integration:&#160;r</a><br/>
6593 &#160;&#160;<a href="rombergone.xml#r" target="_top">One&#xA0;DimensionalRomberg&#xA0;Integration:&#160;r</a><br/>
6594 &#160;&#160;<a href="nearequal.xml#r" target="_top">Determine&#xA0;if&#xA0;Two&#xA0;Values&#xA0;Are&#xA0;Nearly&#xA0;Equal:&#160;r</a><br/>
6595 &#160;&#160;<a href="funcheck.xml#r" target="_top">Check&#xA0;an&#xA0;ADFun&#xA0;Sequence&#xA0;of&#xA0;Operations:&#160;r</a><br/>
6596 &#160;&#160;<a href="revsparsehes.xml#r" target="_top">Hessian&#xA0;Sparsity&#xA0;Pattern:&#xA0;Reverse&#xA0;Mode:&#160;r</a><br/>
6597 &#160;&#160;<a href="revsparsejac.xml#r" target="_top">Jacobian&#xA0;Sparsity&#xA0;Pattern:&#xA0;Reverse&#xA0;Mode:&#160;r</a><br/>
6598 &#160;&#160;<a href="forsparsejac.xml#r" target="_top">Jacobian&#xA0;Sparsity&#xA0;Pattern:&#xA0;Forward&#xA0;Mode:&#160;r</a><br/>
6599 &#160;&#160;<a href="forward_dir.xml#r" target="_top">Multiple&#xA0;Directions&#xA0;Forward&#xA0;Mode:&#160;r</a><br/>
6600 &#160;&#160;<a href="vecad.xml#AD Indexing.r" target="_top">AD&#xA0;Vectors&#xA0;that&#xA0;Record&#xA0;Index&#xA0;Operations:&#160;AD&#xA0;Indexing.r</a><br/>
6601 &#160;&#160;<a href="nearequalext.xml#r" target="_top">Compare&#xA0;AD&#xA0;and&#xA0;Base&#xA0;Objects&#xA0;for&#xA0;Nearly&#xA0;Equal:&#160;r</a><br/>
6602 &#160;&#160;<a href="atomic_rev_sparse_hes.xml#Implementation.r" target="_top">Atomic&#xA0;Reverse&#xA0;Hessian&#xA0;Sparsity&#xA0;Patterns:&#160;Implementation.r</a><br/>
6603 &#160;&#160;<a href="atomic_for_sparse_jac.xml#Implementation.r" target="_top">Atomic&#xA0;Forward&#xA0;Jacobian&#xA0;Sparsity&#xA0;Patterns:&#160;Implementation.r</a><br/>
66045901 random&#160;<a href="uniform_01_c.xml" target="_top">Simulate&#xA0;a&#xA0;[0,1]&#xA0;Uniform&#xA0;Random&#xA0;Variate</a><br/>
66055902 &#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="uniform_01.xml" target="_top">Simulate&#xA0;a&#xA0;[0,1]&#xA0;Uniform&#xA0;Random&#xA0;Variate</a><br/>
66065903 range&#160;<a href="ipopt_nlp_ode_fast.xml#Trapezoidal Approximation.Range Indices I(k,0)" target="_top">ODE&#xA0;Fitting&#xA0;Using&#xA0;Fast&#xA0;Representation:&#160;Trapezoidal&#xA0;Approximation.Range&#xA0;Indices&#xA0;I(k,0)</a><br/>
69276224 SparseHessian&#160;<a href="sparse_hessian.xml" target="_top">Sparse&#xA0;Hessian:&#xA0;Easy&#xA0;Driver</a><br/>
69286225 SparseJacobian&#160;<a href="sparse_jacobian.xml" target="_top">Sparse&#xA0;Jacobian:&#xA0;Easy&#xA0;Driver</a><br/>
69296226 SpeedTest&#160;<a href="speedtest.xml" target="_top">Run&#xA0;One&#xA0;Speed&#xA0;Test&#xA0;and&#xA0;Print&#xA0;Results</a><br/>
6930 s&#160;<a href="elapsed_seconds_c.xml#s" target="_top">Returns&#xA0;Elapsed&#xA0;Number&#xA0;of&#xA0;Seconds:&#160;s</a><br/>
6931 &#160;&#160;<a href="old_atomic.xml#rev_hes_sparse.s" target="_top">User&#xA0;Defined&#xA0;Atomic&#xA0;AD&#xA0;Functions:&#160;rev_hes_sparse.s</a><br/>
6932 &#160;&#160;<a href="old_atomic.xml#rev_jac_sparse.s" target="_top">User&#xA0;Defined&#xA0;Atomic&#xA0;AD&#xA0;Functions:&#160;rev_jac_sparse.s</a><br/>
6933 &#160;&#160;<a href="old_atomic.xml#for_jac_sparse.s" target="_top">User&#xA0;Defined&#xA0;Atomic&#xA0;AD&#xA0;Functions:&#160;for_jac_sparse.s</a><br/>
6934 &#160;&#160;<a href="microsoft_timer.xml#s" target="_top">Microsoft&#xA0;Version&#xA0;of&#xA0;Elapsed&#xA0;Number&#xA0;of&#xA0;Seconds:&#160;s</a><br/>
6935 &#160;&#160;<a href="to_string.xml#s" target="_top">Convert&#xA0;Certain&#xA0;Types&#xA0;to&#xA0;a&#xA0;String:&#160;s</a><br/>
6936 &#160;&#160;<a href="nan.xml#nan(zero).s" target="_top">Obtain&#xA0;Nan&#xA0;or&#xA0;Determine&#xA0;if&#xA0;a&#xA0;Value&#xA0;is&#xA0;Nan:&#160;nan(zero).s</a><br/>
6937 &#160;&#160;<a href="nan.xml#isnan.s" target="_top">Obtain&#xA0;Nan&#xA0;or&#xA0;Determine&#xA0;if&#xA0;a&#xA0;Value&#xA0;is&#xA0;Nan:&#160;isnan.s</a><br/>
6938 &#160;&#160;<a href="elapsed_seconds.xml#s" target="_top">Returns&#xA0;Elapsed&#xA0;Number&#xA0;of&#xA0;Seconds:&#160;s</a><br/>
6939 &#160;&#160;<a href="revsparsehes.xml#s" target="_top">Hessian&#xA0;Sparsity&#xA0;Pattern:&#xA0;Reverse&#xA0;Mode:&#160;s</a><br/>
6940 &#160;&#160;<a href="revsparsejac.xml#s" target="_top">Jacobian&#xA0;Sparsity&#xA0;Pattern:&#xA0;Reverse&#xA0;Mode:&#160;s</a><br/>
6941 &#160;&#160;<a href="forsparsejac.xml#s" target="_top">Jacobian&#xA0;Sparsity&#xA0;Pattern:&#xA0;Forward&#xA0;Mode:&#160;s</a><br/>
6942 &#160;&#160;<a href="size_order.xml#s" target="_top">Number&#xA0;Taylor&#xA0;Coefficient&#xA0;Orders&#xA0;Currently&#xA0;Stored:&#160;s</a><br/>
6943 &#160;&#160;<a href="forward_order.xml#s" target="_top">Multiple&#xA0;Order&#xA0;Forward&#xA0;Mode:&#160;s</a><br/>
6944 &#160;&#160;<a href="forward_zero.xml#s" target="_top">Zero&#xA0;Order&#xA0;Forward&#xA0;Mode:&#xA0;Function&#xA0;Values:&#160;s</a><br/>
6945 &#160;&#160;<a href="atomic_rev_sparse_hes.xml#Implementation.s" target="_top">Atomic&#xA0;Reverse&#xA0;Hessian&#xA0;Sparsity&#xA0;Patterns:&#160;Implementation.s</a><br/>
6946 &#160;&#160;<a href="atomic_for_sparse_jac.xml#Implementation.s" target="_top">Atomic&#xA0;Forward&#xA0;Jacobian&#xA0;Sparsity&#xA0;Patterns:&#160;Implementation.s</a><br/>
6947 &#160;&#160;<a href="ad_to_string.xml#s" target="_top">Convert&#xA0;An&#xA0;AD&#xA0;or&#xA0;Base&#xA0;Type&#xA0;to&#xA0;String:&#160;s</a><br/>
69486227 sacado&#160;<a href="sacado_sparse_jacobian.cpp.xml" target="_top">sacado&#xA0;Speed:&#xA0;sparse_jacobian</a><br/>
69496228 &#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="sacado_sparse_hessian.cpp.xml" target="_top">Sacado&#xA0;Speed:&#xA0;Sparse&#xA0;Hessian</a><br/>
69506229 &#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="sacado_poly.cpp.xml" target="_top">Sacado&#xA0;Speed:&#xA0;Second&#xA0;Derivative&#xA0;of&#xA0;a&#xA0;Polynomial</a><br/>
76786957 symbol&#160;<a href="faq.xml#Namespace.Test Vector Preprocessor Symbol" target="_top">Frequently&#xA0;Asked&#xA0;Questions&#xA0;and&#xA0;Answers:&#160;Namespace.Test&#xA0;Vector&#xA0;Preprocessor&#xA0;Symbol</a><br/>
76796958 symbols&#160;<a href="addon.xml#Preprocessor Symbols" target="_top">CppAD&#xA0;Addons:&#160;Preprocessor&#xA0;Symbols</a><br/>
76806959 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="preprocessor.xml" target="_top">CppAD&#xA0;API&#xA0;Preprocessor&#xA0;Symbols</a><br/>
7681 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="cppad.xml#Preprocessor Symbols" target="_top">cppad-20160000.0:&#xA0;A&#xA0;Package&#xA0;for&#xA0;Differentiation&#xA0;of&#xA0;C++&#xA0;Algorithms:&#160;Preprocessor&#xA0;Symbols</a><br/>
6960 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="cppad.xml#Preprocessor Symbols" target="_top">cppad-20160000.1:&#xA0;A&#xA0;Package&#xA0;for&#xA0;Differentiation&#xA0;of&#xA0;C++&#xA0;Algorithms:&#160;Preprocessor&#xA0;Symbols</a><br/>
76826961 syntax&#160;<a href="luratio.xml#Syntax" target="_top">LU&#xA0;Factorization&#xA0;of&#xA0;A&#xA0;Square&#xA0;Matrix&#xA0;and&#xA0;Stability&#xA0;Calculation:&#160;Syntax</a><br/>
76836962 &#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="opt_val_hes.xml#Syntax" target="_top">Jacobian&#xA0;and&#xA0;Hessian&#xA0;of&#xA0;Optimal&#xA0;Values:&#160;Syntax</a><br/>
76846963 &#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="benderquad.xml#Syntax" target="_top">Computing&#xA0;Jacobian&#xA0;and&#xA0;Hessian&#xA0;of&#xA0;Bender's&#xA0;Reduced&#xA0;Objective:&#160;Syntax</a><br/>
78797158 &#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="get_eigen.sh.xml#Syntax" target="_top">Download&#xA0;and&#xA0;Install&#xA0;Eigen&#xA0;in&#xA0;Build&#xA0;Directory:&#160;Syntax</a><br/>
78807159 &#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="get_colpack.sh.xml#Syntax" target="_top">Download&#xA0;and&#xA0;Install&#xA0;ColPack&#xA0;in&#xA0;Build&#xA0;Directory:&#160;Syntax</a><br/>
78817160 &#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="get_adolc.sh.xml#Syntax" target="_top">Download&#xA0;and&#xA0;Install&#xA0;Adolc&#xA0;in&#xA0;Build&#xA0;Directory:&#160;Syntax</a><br/>
7882 &#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="cppad.xml#Syntax" target="_top">cppad-20160000.0:&#xA0;A&#xA0;Package&#xA0;for&#xA0;Differentiation&#xA0;of&#xA0;C++&#xA0;Algorithms:&#160;Syntax</a><br/>
7161 &#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="cppad.xml#Syntax" target="_top">cppad-20160000.1:&#xA0;A&#xA0;Package&#xA0;for&#xA0;Differentiation&#xA0;of&#xA0;C++&#xA0;Algorithms:&#160;Syntax</a><br/>
78837162 systems&#160;<a href="elapsed_seconds.xml#Microsoft Systems" target="_top">Returns&#xA0;Elapsed&#xA0;Number&#xA0;of&#xA0;Seconds:&#160;Microsoft&#xA0;Systems</a><br/>
78847163
78857164 <b><big><a name="T">T</a></big></b>
78867165 <br/>
78877166 Taylor&#160;<a href="ode_taylor.cpp.xml" target="_top">Taylor's&#xA0;Ode&#xA0;Solver:&#xA0;An&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
7888 t&#160;<a href="old_atomic.xml#rev_hes_sparse.t" target="_top">User&#xA0;Defined&#xA0;Atomic&#xA0;AD&#xA0;Functions:&#160;rev_hes_sparse.t</a><br/>
7889 &#160;&#160;<a href="odegearcontrol.xml#Fun.t" target="_top">An&#xA0;Error&#xA0;Controller&#xA0;for&#xA0;Gear's&#xA0;Ode&#xA0;Solvers:&#160;Fun.t</a><br/>
7890 &#160;&#160;<a href="odegear.xml#T" target="_top">An&#xA0;Arbitrary&#xA0;Order&#xA0;Gear&#xA0;Method:&#160;T</a><br/>
7891 &#160;&#160;<a href="odegear.xml#Fun.t" target="_top">An&#xA0;Arbitrary&#xA0;Order&#xA0;Gear&#xA0;Method:&#160;Fun.t</a><br/>
7892 &#160;&#160;<a href="rosen34.xml#Fun.t" target="_top">A&#xA0;3rd&#xA0;and&#xA0;4th&#xA0;Order&#xA0;Rosenbrock&#xA0;ODE&#xA0;Solver:&#160;Fun.t</a><br/>
7893 &#160;&#160;<a href="runge45.xml#Fun.t" target="_top">An&#xA0;Embedded&#xA0;4th&#xA0;and&#xA0;5th&#xA0;Order&#xA0;Runge-Kutta&#xA0;ODE&#xA0;Solver:&#160;Fun.t</a><br/>
7894 &#160;&#160;<a href="atomic_rev_sparse_hes.xml#Implementation.t" target="_top">Atomic&#xA0;Reverse&#xA0;Hessian&#xA0;Sparsity&#xA0;Patterns:&#160;Implementation.t</a><br/>
78957167 tan&#160;<a href="old_tan.cpp.xml" target="_top">Old&#xA0;Tan&#xA0;and&#xA0;Tanh&#xA0;as&#xA0;User&#xA0;Atomic&#xA0;Operations:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
78967168 &#160;&#160;&#160;&#160;<a href="tan_reverse.xml" target="_top">Tangent&#xA0;and&#xA0;Hyperbolic&#xA0;Tangent&#xA0;Reverse&#xA0;Mode&#xA0;Theory</a><br/>
78977169 &#160;&#160;&#160;&#160;<a href="tan_forward.xml" target="_top">Tangent&#xA0;and&#xA0;Hyperbolic&#xA0;Tangent&#xA0;Forward&#xA0;Taylor&#xA0;Polynomial&#xA0;Theory</a><br/>
84597731 &#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="speed_test.xml#Timing" target="_top">Run&#xA0;One&#xA0;Speed&#xA0;Test&#xA0;and&#xA0;Return&#xA0;Results:&#160;Timing</a><br/>
84607732 &#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="multi_newton_time.cpp.xml" target="_top">Timing&#xA0;Test&#xA0;of&#xA0;Multi-Threaded&#xA0;Newton&#xA0;Method</a><br/>
84617733 &#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="harmonic_time.cpp.xml" target="_top">Timing&#xA0;Test&#xA0;of&#xA0;Multi-Threaded&#xA0;Summation&#xA0;of&#xA0;1/i</a><br/>
8462 to&#160;<a href="time_det_by_minor_c.xml" target="_top">Determine&#xA0;Amount&#xA0;of&#xA0;Time&#xA0;to&#xA0;Execute&#xA0;det_by_minor</a><br/>
8463 &#160;&#160;&#160;<a href="old_usead_2.cpp.xml" target="_top">Using&#xA0;AD&#xA0;to&#xA0;Compute&#xA0;Atomic&#xA0;Function&#xA0;Derivatives</a><br/>
8464 &#160;&#160;&#160;<a href="old_usead_1.cpp.xml" target="_top">Using&#xA0;AD&#xA0;to&#xA0;Compute&#xA0;Atomic&#xA0;Function&#xA0;Derivatives</a><br/>
8465 &#160;&#160;&#160;<a href="cppad_ipopt_nlp.xml" target="_top">Nonlinear&#xA0;Programming&#xA0;Using&#xA0;the&#xA0;CppAD&#xA0;Interface&#xA0;to&#xA0;Ipopt</a><br/>
8466 &#160;&#160;&#160;<a href="omp_delete_array.xml" target="_top">Return&#xA0;A&#xA0;Raw&#xA0;Array&#xA0;to&#xA0;The&#xA0;Available&#xA0;Memory&#xA0;for&#xA0;a&#xA0;Thread</a><br/>
8467 &#160;&#160;&#160;<a href="omp_return_memory.xml" target="_top">Return&#xA0;Memory&#xA0;to&#xA0;omp_alloc</a><br/>
8468 &#160;&#160;&#160;<a href="include_deprecated.xml#Linking New Files to Deprecated Commands" target="_top">Deprecated&#xA0;Include&#xA0;Files:&#160;Linking&#xA0;New&#xA0;Files&#xA0;to&#xA0;Deprecated&#xA0;Commands</a><br/>
8469 &#160;&#160;&#160;<a href="whats_new_03.xml" target="_top">Changes&#xA0;and&#xA0;Additions&#xA0;to&#xA0;CppAD&#xA0;During&#xA0;2003</a><br/>
8470 &#160;&#160;&#160;<a href="whats_new_04.xml" target="_top">Changes&#xA0;and&#xA0;Additions&#xA0;to&#xA0;CppAD&#xA0;During&#xA0;2004</a><br/>
8471 &#160;&#160;&#160;<a href="whats_new_05.xml" target="_top">Changes&#xA0;and&#xA0;Additions&#xA0;to&#xA0;CppAD&#xA0;During&#xA0;2005</a><br/>
8472 &#160;&#160;&#160;<a href="whats_new_06.xml" target="_top">Changes&#xA0;and&#xA0;Additions&#xA0;to&#xA0;CppAD&#xA0;During&#xA0;2006</a><br/>
8473 &#160;&#160;&#160;<a href="whats_new_07.xml" target="_top">Changes&#xA0;and&#xA0;Additions&#xA0;to&#xA0;CppAD&#xA0;During&#xA0;2007</a><br/>
8474 &#160;&#160;&#160;<a href="whats_new_08.xml" target="_top">Changes&#xA0;and&#xA0;Additions&#xA0;to&#xA0;CppAD&#xA0;During&#xA0;2008</a><br/>
8475 &#160;&#160;&#160;<a href="whats_new_09.xml" target="_top">Changes&#xA0;and&#xA0;Additions&#xA0;to&#xA0;CppAD&#xA0;During&#xA0;2009</a><br/>
8476 &#160;&#160;&#160;<a href="whats_new_10.xml" target="_top">Changes&#xA0;and&#xA0;Additions&#xA0;to&#xA0;CppAD&#xA0;During&#xA0;2010</a><br/>
8477 &#160;&#160;&#160;<a href="whats_new_11.xml" target="_top">Changes&#xA0;and&#xA0;Additions&#xA0;to&#xA0;CppAD&#xA0;During&#xA0;2011</a><br/>
8478 &#160;&#160;&#160;<a href="whats_new.xml" target="_top">Changes&#xA0;and&#xA0;Additions&#xA0;to&#xA0;CppAD</a><br/>
8479 &#160;&#160;&#160;<a href="interface2c.cpp.xml" target="_top">Interfacing&#xA0;to&#xA0;C:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
8480 &#160;&#160;&#160;<a href="eigen_det.cpp.xml" target="_top">Using&#xA0;Eigen&#xA0;To&#xA0;Compute&#xA0;Determinant:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
8481 &#160;&#160;&#160;<a href="ad_in_c.cpp.xml" target="_top">Example&#xA0;and&#xA0;Test&#xA0;Linking&#xA0;CppAD&#xA0;to&#xA0;Languages&#xA0;Other&#xA0;than&#xA0;C++</a><br/>
8482 &#160;&#160;&#160;<a href="ad_fun.cpp.xml" target="_top">Creating&#xA0;Your&#xA0;Own&#xA0;Interface&#xA0;to&#xA0;an&#xA0;ADFun&#xA0;Object</a><br/>
8483 &#160;&#160;&#160;<a href="ipopt_solve.xml" target="_top">Use&#xA0;Ipopt&#xA0;to&#xA0;Solve&#xA0;a&#xA0;Nonlinear&#xA0;Programming&#xA0;Problem</a><br/>
8484 &#160;&#160;&#160;<a href="to_string.xml" target="_top">Convert&#xA0;Certain&#xA0;Types&#xA0;to&#xA0;a&#xA0;String</a><br/>
8485 &#160;&#160;&#160;<a href="ta_return_memory.xml" target="_top">Return&#xA0;Memory&#xA0;to&#xA0;thread_alloc</a><br/>
8486 &#160;&#160;&#160;<a href="time_test.xml" target="_top">Determine&#xA0;Amount&#xA0;of&#xA0;Time&#xA0;to&#xA0;Execute&#xA0;a&#xA0;Test</a><br/>
8487 &#160;&#160;&#160;<a href="bool_sparsity.cpp.xml" target="_top">Using&#xA0;vectorBool&#xA0;Sparsity&#xA0;To&#xA0;Conserve&#xA0;Memory:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
8488 &#160;&#160;&#160;<a href="base_to_string.xml" target="_top">Extending&#xA0;to_string&#xA0;To&#xA0;Another&#xA0;Floating&#xA0;Point&#xA0;Type</a><br/>
8489 &#160;&#160;&#160;<a href="var2par.cpp.xml" target="_top">Convert&#xA0;an&#xA0;AD&#xA0;Variable&#xA0;to&#xA0;a&#xA0;Parameter:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
8490 &#160;&#160;&#160;<a href="var2par.xml" target="_top">Convert&#xA0;an&#xA0;AD&#xA0;Variable&#xA0;to&#xA0;a&#xA0;Parameter</a><br/>
8491 &#160;&#160;&#160;<a href="ad_to_string.xml" target="_top">Convert&#xA0;An&#xA0;AD&#xA0;or&#xA0;Base&#xA0;Type&#xA0;to&#xA0;String</a><br/>
8492 &#160;&#160;&#160;<a href="integer.cpp.xml" target="_top">Convert&#xA0;From&#xA0;AD&#xA0;to&#xA0;Integer:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
8493 &#160;&#160;&#160;<a href="integer.xml" target="_top">Convert&#xA0;From&#xA0;AD&#xA0;to&#xA0;Integer</a><br/>
8494 &#160;&#160;&#160;<a href="value.cpp.xml" target="_top">Convert&#xA0;From&#xA0;AD&#xA0;to&#xA0;its&#xA0;Base&#xA0;Type:&#xA0;Example&#xA0;and&#xA0;Test</a><br/>
8495 &#160;&#160;&#160;<a href="value.xml" target="_top">Convert&#xA0;From&#xA0;an&#xA0;AD&#xA0;Type&#xA0;to&#xA0;its&#xA0;Base&#xA0;Type</a><br/>
8496 &#160;&#160;&#160;<a href="get_started.cpp.xml" target="_top">Getting&#xA0;Started&#xA0;Using&#xA0;CppAD&#xA0;to&#xA0;Compute&#xA0;Derivatives</a><br/>
8497 &#160;&#160;&#160;<a href="introduction.xml" target="_top">An&#xA0;Introduction&#xA0;by&#xA0;Example&#xA0;to&#xA0;Algorithmic&#xA0;Differentiation</a><br/>
8498 &#160;&#160;&#160;<a href="cmake.xml" target="_top">Using&#xA0;CMake&#xA0;to&#xA0;Configure&#xA0;CppAD</a><br/>
84997734 to<b>_</b>string&#160;<a href="utility.xml#Miscellaneous.to_string" target="_top">Some&#xA0;General&#xA0;Purpose&#xA0;Utilities:&#160;Miscellaneous.to_string</a><br/>
85007735 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="base_complex.hpp.xml#to_string" target="_top">Enable&#xA0;use&#xA0;of&#xA0;AD&lt;Base&gt;&#xA0;where&#xA0;Base&#xA0;is&#xA0;std::complex&lt;double&gt;:&#160;to_string</a><br/>
85017736 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="base_double.hpp.xml#to_string" target="_top">Enable&#xA0;use&#xA0;of&#xA0;AD&lt;Base&gt;&#xA0;where&#xA0;Base&#xA0;is&#xA0;double:&#160;to_string</a><br/>
89458180 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="discrete.xml#Create AD Version" target="_top">Discrete&#xA0;AD&#xA0;Functions:&#160;Create&#xA0;AD&#xA0;Version</a><br/>
89468181 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="download.xml#Subversion.Current Version" target="_top">Download&#xA0;The&#xA0;CppAD&#xA0;Source&#xA0;Code:&#160;Subversion.Current&#xA0;Version</a><br/>
89478182 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="download.xml#Compressed Archives.Current Version" target="_top">Download&#xA0;The&#xA0;CppAD&#xA0;Source&#xA0;Code:&#160;Compressed&#xA0;Archives.Current&#xA0;Version</a><br/>
8948 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="cppad.xml" target="_top">cppad-20160000.0:&#xA0;A&#xA0;Package&#xA0;for&#xA0;Differentiation&#xA0;of&#xA0;C++&#xA0;Algorithms</a><br/>
8183 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="cppad.xml" target="_top">cppad-20160000.1:&#xA0;A&#xA0;Package&#xA0;for&#xA0;Differentiation&#xA0;of&#xA0;C++&#xA0;Algorithms</a><br/>
89498184 version<b>)</b>&#160;<a href="double_mat_mul.cpp.xml" target="_top">CppAD&#xA0;Speed:&#xA0;Matrix&#xA0;Multiplication&#xA0;(Double&#xA0;Version)</a><br/>
89508185 versions&#160;<a href="download.xml#Subversion.Release Versions" target="_top">Download&#xA0;The&#xA0;CppAD&#xA0;Source&#xA0;Code:&#160;Subversion.Release&#xA0;Versions</a><br/>
89518186 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="download.xml#Subversion.Stable Versions" target="_top">Download&#xA0;The&#xA0;CppAD&#xA0;Source&#xA0;Code:&#160;Subversion.Stable&#xA0;Versions</a><br/>
91338368
91348369 <b><big><a name="Y">Y</a></big></b>
91358370 <br/>
9136 y&#160;<a href="opt_val_hes.xml#y" target="_top">Jacobian&#xA0;and&#xA0;Hessian&#xA0;of&#xA0;Optimal&#xA0;Values:&#160;y</a><br/>
9137 &#160;&#160;<a href="benderquad.xml#y" target="_top">Computing&#xA0;Jacobian&#xA0;and&#xA0;Hessian&#xA0;of&#xA0;Bender's&#xA0;Reduced&#xA0;Objective:&#160;y</a><br/>
9138 &#160;&#160;<a href="mat_sum_sq.xml#y" target="_top">Sum&#xA0;Elements&#xA0;of&#xA0;a&#xA0;Matrix&#xA0;Times&#xA0;Itself:&#160;y</a><br/>
9139 &#160;&#160;<a href="pow_int.xml#y" target="_top">The&#xA0;Integer&#xA0;Power&#xA0;Function:&#160;y</a><br/>
9140 &#160;&#160;<a href="checksimplevector.xml#x, y" target="_top">Check&#xA0;Simple&#xA0;Vector&#xA0;Concept:&#160;x,&#xA0;y</a><br/>
9141 &#160;&#160;<a href="nearequal.xml#y" target="_top">Determine&#xA0;if&#xA0;Two&#xA0;Values&#xA0;Are&#xA0;Nearly&#xA0;Equal:&#160;y</a><br/>
9142 &#160;&#160;<a href="funcheck.xml#y" target="_top">Check&#xA0;an&#xA0;ADFun&#xA0;Sequence&#xA0;of&#xA0;Operations:&#160;y</a><br/>
9143 &#160;&#160;<a href="dependent.xml#y" target="_top">Stop&#xA0;Recording&#xA0;and&#xA0;Store&#xA0;Operation&#xA0;Sequence:&#160;y</a><br/>
9144 &#160;&#160;<a href="funconstruct.xml#y" target="_top">Construct&#xA0;an&#xA0;ADFun&#xA0;Object&#xA0;and&#xA0;Stop&#xA0;Recording:&#160;y</a><br/>
9145 &#160;&#160;<a href="equalopseq.xml#y" target="_top">Check&#xA0;if&#xA0;Two&#xA0;Value&#xA0;are&#xA0;Identically&#xA0;Equal:&#160;y</a><br/>
9146 &#160;&#160;<a href="boolfun.xml#y" target="_top">AD&#xA0;Boolean&#xA0;Functions:&#160;y</a><br/>
9147 &#160;&#160;<a href="nearequalext.xml#y" target="_top">Compare&#xA0;AD&#xA0;and&#xA0;Base&#xA0;Objects&#xA0;for&#xA0;Nearly&#xA0;Equal:&#160;y</a><br/>
9148 &#160;&#160;<a href="compare.xml#y" target="_top">AD&#xA0;Binary&#xA0;Comparison&#xA0;Operators:&#160;y</a><br/>
9149 &#160;&#160;<a href="discrete.xml#y" target="_top">Discrete&#xA0;AD&#xA0;Functions:&#160;y</a><br/>
9150 &#160;&#160;<a href="pow.xml#y" target="_top">The&#xA0;AD&#xA0;Power&#xA0;Function:&#160;y</a><br/>
9151 &#160;&#160;<a href="atan2.xml#y" target="_top">AD&#xA0;Two&#xA0;Argument&#xA0;Inverse&#xA0;Tangent&#xA0;Function:&#160;y</a><br/>
9152 &#160;&#160;<a href="sign.xml#x, y" target="_top">The&#xA0;Sign:&#xA0;sign:&#160;x,&#xA0;y</a><br/>
9153 &#160;&#160;<a href="log1p.xml#x, y" target="_top">The&#xA0;Logarithm&#xA0;of&#xA0;One&#xA0;Plus&#xA0;Argument:&#xA0;log1p:&#160;x,&#xA0;y</a><br/>
9154 &#160;&#160;<a href="expm1.xml#x, y" target="_top">The&#xA0;Exponential&#xA0;Function&#xA0;Minus&#xA0;One:&#xA0;expm1:&#160;x,&#xA0;y</a><br/>
9155 &#160;&#160;<a href="erf.xml#x, y" target="_top">The&#xA0;Error&#xA0;Function:&#160;x,&#xA0;y</a><br/>
9156 &#160;&#160;<a href="atanh.xml#x, y" target="_top">The&#xA0;Inverse&#xA0;Hyperbolic&#xA0;Tangent&#xA0;Function:&#xA0;atanh:&#160;x,&#xA0;y</a><br/>
9157 &#160;&#160;<a href="asinh.xml#x, y" target="_top">The&#xA0;Inverse&#xA0;Hyperbolic&#xA0;Sine&#xA0;Function:&#xA0;asinh:&#160;x,&#xA0;y</a><br/>
9158 &#160;&#160;<a href="acosh.xml#x, y" target="_top">The&#xA0;Inverse&#xA0;Hyperbolic&#xA0;Cosine&#xA0;Function:&#xA0;acosh:&#160;x,&#xA0;y</a><br/>
9159 &#160;&#160;<a href="abs.xml#x, y" target="_top">AD&#xA0;Absolute&#xA0;Value&#xA0;Functions:&#xA0;abs,&#xA0;fabs:&#160;x,&#xA0;y</a><br/>
9160 &#160;&#160;<a href="tanh.xml#x, y" target="_top">The&#xA0;Hyperbolic&#xA0;Tangent&#xA0;Function:&#xA0;tanh:&#160;x,&#xA0;y</a><br/>
9161 &#160;&#160;<a href="tan.xml#x, y" target="_top">The&#xA0;Tangent&#xA0;Function:&#xA0;tan:&#160;x,&#xA0;y</a><br/>
9162 &#160;&#160;<a href="sqrt.xml#x, y" target="_top">The&#xA0;Square&#xA0;Root&#xA0;Function:&#xA0;sqrt:&#160;x,&#xA0;y</a><br/>
9163 &#160;&#160;<a href="sinh.xml#x, y" target="_top">The&#xA0;Hyperbolic&#xA0;Sine&#xA0;Function:&#xA0;sinh:&#160;x,&#xA0;y</a><br/>
9164 &#160;&#160;<a href="sin.xml#x, y" target="_top">The&#xA0;Sine&#xA0;Function:&#xA0;sin:&#160;x,&#xA0;y</a><br/>
9165 &#160;&#160;<a href="log10.xml#x, y" target="_top">The&#xA0;Base&#xA0;10&#xA0;Logarithm&#xA0;Function:&#xA0;log10:&#160;x,&#xA0;y</a><br/>
9166 &#160;&#160;<a href="log.xml#x, y" target="_top">The&#xA0;Exponential&#xA0;Function:&#xA0;log:&#160;x,&#xA0;y</a><br/>
9167 &#160;&#160;<a href="exp.xml#x, y" target="_top">The&#xA0;Exponential&#xA0;Function:&#xA0;exp:&#160;x,&#xA0;y</a><br/>
9168 &#160;&#160;<a href="cosh.xml#x, y" target="_top">The&#xA0;Hyperbolic&#xA0;Cosine&#xA0;Function:&#xA0;cosh:&#160;x,&#xA0;y</a><br/>
9169 &#160;&#160;<a href="cos.xml#x, y" target="_top">The&#xA0;Cosine&#xA0;Function:&#xA0;cos:&#160;x,&#xA0;y</a><br/>
9170 &#160;&#160;<a href="atan.xml#x, y" target="_top">Inverse&#xA0;Tangent&#xA0;Function:&#xA0;atan:&#160;x,&#xA0;y</a><br/>
9171 &#160;&#160;<a href="asin.xml#x, y" target="_top">Inverse&#xA0;Sine&#xA0;Function:&#xA0;asin:&#160;x,&#xA0;y</a><br/>
9172 &#160;&#160;<a href="acos.xml#x, y" target="_top">Inverse&#xA0;Sine&#xA0;Function:&#xA0;acos:&#160;x,&#xA0;y</a><br/>
9173 &#160;&#160;<a href="compute_assign.xml#y" target="_top">AD&#xA0;Computed&#xA0;Assignment&#xA0;Operators:&#160;y</a><br/>
9174 &#160;&#160;<a href="ad_binary.xml#y" target="_top">AD&#xA0;Binary&#xA0;Arithmetic&#xA0;Operators:&#160;y</a><br/>
9175 &#160;&#160;<a href="unaryminus.xml#y" target="_top">AD&#xA0;Unary&#xA0;Minus&#xA0;Operator:&#160;y</a><br/>
9176 &#160;&#160;<a href="unaryplus.xml#y" target="_top">AD&#xA0;Unary&#xA0;Plus&#xA0;Operator:&#160;y</a><br/>
9177 &#160;&#160;<a href="var2par.xml#y" target="_top">Convert&#xA0;an&#xA0;AD&#xA0;Variable&#xA0;to&#xA0;a&#xA0;Parameter:&#160;y</a><br/>
9178 &#160;&#160;<a href="ad_assign.xml#y" target="_top">AD&#xA0;Assignment&#xA0;Operator:&#160;y</a><br/>
9179 &#160;&#160;<a href="ad_ctor.xml#y" target="_top">AD&#xA0;Constructors:&#160;y</a><br/>
9180 &#160;&#160;<a href="exp_eps.xml#y" target="_top">An&#xA0;Epsilon&#xA0;Accurate&#xA0;Exponential&#xA0;Approximation:&#160;y</a><br/>
9181 &#160;&#160;<a href="exp_2.xml#y" target="_top">Second&#xA0;Order&#xA0;Exponential&#xA0;Approximation:&#160;y</a><br/>
91828371 y<b>(</b>t&#160;<a href="reverse_any.xml#Notation.Y(t, u)" target="_top">Any&#xA0;Order&#xA0;Reverse&#xA0;Mode:&#160;Notation.Y(t,&#xA0;u)</a><br/>
91838372 y<b>(</b>t<b>)</b>&#160;<a href="tan_reverse.xml#Eliminating Y(t)" target="_top">Tangent&#xA0;and&#xA0;Hyperbolic&#xA0;Tangent&#xA0;Reverse&#xA0;Mode&#xA0;Theory:&#160;Eliminating&#xA0;Y(t)</a><br/>
91848373 &#160;&#160;&#160;&#160;&#160;<a href="forward_dir.xml#Y(t)" target="_top">Multiple&#xA0;Directions&#xA0;Forward&#xA0;Mode:&#160;Y(t)</a><br/>
227227 <a href="cos.cpp.xml" target="_top">cos.cpp</a><br/> </td><td> The AD cos Function: Example and Test </td></tr><tr valign="top"><td>
228228 <a href="cosh.xml" target="_top">cosh</a><br/> </td><td> The Hyperbolic Cosine Function: cosh </td></tr><tr valign="top"><td>
229229 <a href="cosh.cpp.xml" target="_top">cosh.cpp</a><br/> </td><td> The AD cosh Function: Example and Test </td></tr><tr valign="top"><td>
230 <a href="cppad.xml" target="_top">CppAD</a><br/> </td><td> cppad-20160000.0: A Package for Differentiation of C++ Algorithms </td></tr><tr valign="top"><td>
230 <a href="cppad.xml" target="_top">CppAD</a><br/> </td><td> cppad-20160000.1: A Package for Differentiation of C++ Algorithms </td></tr><tr valign="top"><td>
231231 <a href="cppad_assert.xml" target="_top">cppad_assert</a><br/> </td><td> CppAD Assertions During Execution </td></tr><tr valign="top"><td>
232232 <a href="cppad_det_lu.cpp.xml" target="_top">cppad_det_lu.cpp</a><br/> </td><td> CppAD Speed: Gradient of Determinant Using Lu Factorization </td></tr><tr valign="top"><td>
233233 <a href="cppad_det_minor.cpp.xml" target="_top">cppad_det_minor.cpp</a><br/> </td><td> CppAD Speed: Gradient of Determinant by Minor Expansion </td></tr><tr valign="top"><td>
0 // -------------------------------------------------------
1 // Copyright (C) Bradley M. Bell 2003, All rights reserved
2 // -------------------------------------------------------
0 // ------------------------------------------------------------
1 // Copyright (C) Bradley M. Bell 1998-2015, All rights reserved
2 // ------------------------------------------------------------
33 Keyword =
44 [
5 'CppAD cppad-20160000.0: A Package for Differentiation of C++ Algorithms ',' algorithmic automatic derivative version cppad.hpp syntax introduction example include file preprocessor symbols namespace ',
5 'CppAD cppad-20160000.1: A Package for Differentiation of C++ Algorithms ',' algorithmic automatic derivative version cppad.hpp syntax introduction example include file preprocessor symbols namespace ',
66 'Install CppAD Download, Test, and Install Instructions ',' step 1: 2: cmake 3: check 4: installation ',
7 'download Download The CppAD Source Code ',' purpose distribution directory compressed archives current version release versions monthly unix file extraction windows and testing install instructions subversion limitations stable ',
7 'download Download The CppAD Source Code ',' purpose distribution directory compressed archives current version release versions monthly unix file extraction windows testing install instructions subversion limitations stable ',
88 'cmake Using CMake to Configure CppAD ',' makefile install prefix postfix include directories lib datadir documentation package compile flags profile maximum number threads sparsity internal structure vector sets memory usage tape implicit explicit the program command build directory cmake_verbose_makefile generator cppad_prefix cppad_postfix cmake_install_includedirs cmake_install_libdirs cmake_install_datadir cmake_install_docdir package_prefix cppad_cxx_flags c++11 cppad_profile_flag eigen fadbad cppad_testvector cppad_max_num_threads cppad_sparse_list cppad_tape_id_type cstdint cppad_tape_addr_type cppad_deprecated ',
99 'adolc_prefix Including the ADOL-C Examples and Tests ',' get purpose speed unix cygwin get_adolc ',
1010 'get_adolc.sh Download and Install Adolc in Build Directory ',' syntax purpose requirements distribution external prefix reuse ',
181181 'par_var.cpp AD Parameter and Variable Functions: Example and Test ',' ',
182182 'EqualOpSeq Check if Two Value are Identically Equal ',' operation sequence syntax purpose motivation b example ',
183183 'equal_op_seq.cpp EqualOpSeq: Example and Test ',' ',
184 'VecAD AD Vectors that Record Index Operations ',' tape reference vecad<base> syntax purpose alternatives vecad<base>::reference exceptions constructor size size_t indexing example speed and memory ',
184 'VecAD AD Vectors that Record Index Operations ',' tape reference vecad<base> syntax purpose alternatives vecad<base>::reference exceptions constructor size size_t indexing example speed memory ',
185185 'vec_ad.cpp AD Vectors that Record Index Operations: Example and Test ',' vecad ',
186186 'base_require AD<Base> Requirements for a CppAD Base Type ',' syntax purpose api warning standard types include order numeric output operator integer suggestion absolute zero azmul ',
187187 'base_member Required Base Class Member Functions ',' notation default constructor double copy unary operators assignment binary bool example ',
292292 'team_thread.hpp Specifications for A Team of AD Threads ',' syntax purpose restrictions team_create team_work team_destroy team_name ok example use implementation speed test source ',
293293 'team_openmp.cpp OpenMP Implementation of a Team of AD Threads ',' ',
294294 'team_bthread.cpp Boost Thread Implementation of a Team of AD Threads ',' ',
295 'team_pthread.cpp Pthread Implementation of a Team of AD Threads ',' pthread_exit bug in cygwin ',
295 'team_pthread.cpp Pthread Implementation of a Team of AD Threads ',' pthread_exit bug cygwin ',
296296 'utility Some General Purpose Utilities ',' testing c++ concepts numerical routines miscellaneous error handler simple vector template class multi-threading memory allocation sorting indices to_string ',
297297 'ErrorHandler Replacing the CppAD Error Handler ',' replace assert exception syntax constructor parallel mode call info known line file exp msg example ',
298298 'error_handler.cpp Replacing The CppAD Error Handler: Example and Test ',' ',
311311 'numeric_type.cpp The NumericType: Example and Test ',' ',
312312 'CheckNumericType Check NumericType Class Concept ',' syntax purpose include parallel mode example ',
313313 'check_numeric_type.cpp The CheckNumericType Function: Example and Test ',' ',
314 'SimpleVector Definition of a Simple Vector ',' value_type [] ndebug template class requirements elements specified default constructor sizing copy and destructor assignment size resize access using example exercise ',
314 'SimpleVector Definition of a Simple Vector ',' value_type [] ndebug template class requirements elements specified default constructor sizing copy destructor assignment size resize access using example exercise ',
315315 'simple_vector.cpp Simple Vector Template Class: Example and Test ',' ',
316316 'CheckSimpleVector Check Simple Vector Concept ',' syntax purpose restrictions include parallel mode example ',
317317 'check_simple_vector.cpp The CheckSimpleVector Function: Example and Test ',' ',
348348 'ode_gear.cpp OdeGear: Example and Test ',' ',
349349 'OdeGearControl An Error Controller for Gear\'s Ode Solvers ',' differential equation syntax purpose include notation xf fun f_x warning m tf xi smin smax sini eabs erel ef maxabs nstep criteria discussion scalar vector example theory source code ',
350350 'ode_gear_control.cpp OdeGearControl: Example and Test ',' ',
351 'CppAD_vector The CppAD::vector Template Class ',' [] push thread_alloc syntax description include capacity assignment check size return reference move semantics element access push_back push_vector output resize clear data vectorbool memory bit_per_unit type and parallel mode example exercise ',
351 'CppAD_vector The CppAD::vector Template Class ',' [] push thread_alloc syntax description include capacity assignment check size return reference move semantics element access push_back push_vector output resize clear data vectorbool memory bit_per_unit type parallel mode example exercise ',
352352 'cppad_vector.cpp CppAD::vector Template Class: Example and Test ',' ',
353353 'vector_bool.cpp CppAD::vectorBool Class: Example and Test ',' ',
354354 'thread_alloc A Fast Multi-Threading Memory Allocator ',' allocation syntax purpose include ',
394394 'mul_level.cpp Multiple Level of AD: Example and Test ',' purpose source ',
395395 'change_param.cpp Computing a Jacobian With Constants that Change ',' multiple ad level purpose ',
396396 'ode_stiff.cpp A Stiff Ode: Example and Test ',' ',
397 'mul_level_ode.cpp Taylor\'s Ode Solver: A Multi-Level AD Example and Test ',' purpose solution derivative of method using source ',
398 'mul_level_adolc_ode.cpp Taylor\'s Ode Solver: A Multi-Level Adolc Example and Test ',' purpose solution derivative of method using base_adolc.hpp memory management configuration requirement source ',
397 'mul_level_ode.cpp Taylor\'s Ode Solver: A Multi-Level AD Example and Test ',' purpose solution derivative method using source ',
398 'mul_level_adolc_ode.cpp Taylor\'s Ode Solver: A Multi-Level Adolc Example and Test ',' purpose solution derivative method using base_adolc.hpp memory management configuration requirement source ',
399399 'ode_taylor.cpp Taylor\'s Ode Solver: An Example and Test ',' purpose solution forward mode ',
400400 'stack_machine.cpp Example Differentiating a Stack Machine Interpreter ',' test ',
401401 'example.cpp CppAD Examples and Tests ',' running ',
506506 'tan_reverse Tangent and Hyperbolic Tangent Reverse Mode Theory ',' notation eliminating y(t) positive orders z(t) zero ',
507507 'erf_reverse Error Function Reverse Mode Theory ',' notation positive orders z(t) zero ',
508508 'reverse_identity An Important Reverse Mode Identity ',' notation sweep theorem proof ',
509 'glossary Glossary ',' efficient ad function of base type above elementary vector operation atomic sequence dependent independent parameter sparsity pattern boolean sets tape active inactive variable variables taylor coefficient ',
510 'Bib Bibliography ',' abramowitz and stegun the c++ programming language evaluating derivatives numerical recipes shampine l.f. ',
511 'wish_list The CppAD Wish List ',' base requirements printfor optimization checkpoint machine epsilon examples adolc optimizing nested conditional expressions forward mode recomputation iterator interface compilation speed operation sequence comparison changes and software guidelines tracing atan2 benderquad ',
509 'glossary Glossary ',' efficient ad function base type above elementary vector operation atomic sequence dependent independent parameter sparsity pattern boolean sets tape active inactive variable variables taylor coefficient ',
510 'Bib Bibliography ',' abramowitz stegun the c++ programming language evaluating derivatives numerical recipes shampine l.f. ',
511 'wish_list The CppAD Wish List ',' base requirements printfor optimization checkpoint machine epsilon examples adolc optimizing nested conditional expressions forward mode recomputation iterator interface compilation speed operation sequence comparison changes software guidelines tracing atan2 benderquad ',
512512 'whats_new Changes and Additions to CppAD ',' introduction this year previous years ',
513513 'whats_new_15 CppAD Changes and Additions During 2015 ',' introduction 12-29 12-28 12-08 12-01 11-30 11-25 11-24 11-14 11-08 11-06 10-21 10-16 10-06 10-04 10-03 10-02 09-28 09-27 09-25 09-24 09-23 09-21 09-20 09-19 09-16 09-03 09-02 08-31 08-30 08-29 08-28 08-26 08-25 08-20 08-17 08-16 08-09 08-06 07-31 06-16 06-11 06-09 06-07 05-26 cond_exp_1 cond_exp_2 05-11 05-10 05-09 05-08 05-07 05-05 04-18 03-13 03-06 02-28 02-18 02-16 02-14 02-11 02-10 02-09 02-07 02-06 02-04 02-03 02-02 01-30 01-29 01-26 01-23 01-21 01-20 01-09 01-07 01-02 ',
514514 'whats_new_14 CppAD Changes and Additions During 2014 ',' introduction 12-30 12-29 12-28 12-27 12-26 12-25 12-23 12-22 12-17 12-16 12-15 11-28 11-27 09-28 09-27 09-25 09-21 05-28 05-27 05-23 05-22 05-20 05-19 05-16 05-14 03-18 03-17 03-09 03-05 03-02 03-01 02-28 02-27 02-26 02-23 02-22 02-17 02-15 01-26 01-21 01-10 ',
550550 'cppad_ipopt_nlp Nonlinear Programming Using the CppAD Interface to Ipopt ',' deprecated 2012-11-28 syntax purpose namespace ipopt_library_paths fg(x) index vector projection injection representation simple sizevector numbervector adnumber advector x_i x_l x_u g_l g_u fg_info fg_info.number_functions fg_info.eval_r fg_info.retape fg_info.domain_size fg_info.range_size fg_info.number_terms fg_info.index solution status z_l z_u lambda obj_value example wish list ',
551551 'ipopt_nlp_get_started.cpp Nonlinear Programming Using CppAD and Ipopt: Example and Test ',' purpose configuration requirement ',
552552 'ipopt_nlp_ode Example Simultaneous Solution of Forward and Inverse Problem ',' ',
553 'ipopt_nlp_ode_problem An ODE Inverse Problem Example ',' notation forward measurements simulation analytic solution parameter values simulated trapezoidal approximation time grid black box method two levels of iteration derivatives simultaneous source ',
553 'ipopt_nlp_ode_problem An ODE Inverse Problem Example ',' notation forward measurements simulation analytic solution parameter values simulated trapezoidal approximation time grid black box method two levels iteration derivatives simultaneous source ',
554554 'ipopt_nlp_ode_simple ODE Fitting Using Simple Representation ',' cppad_ipopt_nlp purpose argument vector objective function initial condition constraint trapezoidal approximation source ',
555555 'ipopt_nlp_ode_fast ODE Fitting Using Fast Representation ',' purpose objective function range indices i(k0) domain j(k0) initial condition trapezoidal approximation source ',
556556 'ipopt_nlp_ode_problem.hpp ODE Inverse Problem Definitions: Source Code ',' example ',
566566 'old_tan.cpp Old Tan and Tanh as User Atomic Operations: Example and Test ',' deprecated 2013-05-27 theory ',
567567 'old_mat_mul.cpp Old Matrix Multiply as a User Atomic Operation: Example and Test ',' deprecated 2013-05-27 include file ',
568568 'old_mat_mul.hpp Define Matrix Multiply as a User Atomic Operation ',' old_atomic test syntax example begin source extra call information indexing one reverse partials order set union cppad callback functions declare ',
569 'zdouble zdouble: An AD Base Type With Absolute Zero ',' deprecated 2015-09-26 syntax constructor and assignment comparison operators arithmetic standard math nan motivation general cppad requirements example ',
569 'zdouble zdouble: An AD Base Type With Absolute Zero ',' deprecated 2015-09-26 syntax constructor assignment comparison operators arithmetic standard math nan motivation general cppad requirements example ',
570570 'zdouble.cpp zdouble: Example and Test ',' ',
571571 'compare_c Compare Speed of C and C++ ',' with syntax purpose ',
572572 'det_of_minor_c Determinant of a Minor ',' syntax purpose source code ',
55 <title>A Simple Boost Thread Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="A Simple Boost Thread Example and Test"/>
8 <meta name="keywords" id="keywords" content=" a simple boost thread example and test A.1.1c purpose source code "/>
8 <meta name="keywords" id="keywords" content=" simple boost thread example test A.1.1c purpose source code "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>A Simple OpenMP Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="A Simple OpenMP Example and Test"/>
8 <meta name="keywords" id="keywords" content=" a simple openmp example and test A.1.1c thread purpose source code "/>
8 <meta name="keywords" id="keywords" content=" simple openmp example test A.1.1c thread purpose source code "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>A Simple Parallel Pthread Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="A Simple Parallel Pthread Example and Test"/>
8 <meta name="keywords" id="keywords" content=" a simple parallel pthread example and test Openmp A.1.1c thread purpose source code "/>
8 <meta name="keywords" id="keywords" content=" simple parallel pthread example test Openmp A.1.1c thread purpose source code "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Abort Current Recording: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Abort Current Recording: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" abort current recording: example and test recording "/>
8 <meta name="keywords" id="keywords" content=" abort current recording: example test recording "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Abort Recording of an Operation Sequence</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Abort Recording of an Operation Sequence"/>
8 <meta name="keywords" id="keywords" content=" abort recording of an operation sequence tape syntax purpose example "/>
8 <meta name="keywords" id="keywords" content=" abort recording operation sequence tape syntax purpose example "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>AD Absolute Value Function: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="AD Absolute Value Function: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" ad absolute value function: example and test abs fabs "/>
8 <meta name="keywords" id="keywords" content=" ad absolute value function: example test abs fabs "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>The AD acos Function: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="The AD acos Function: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" the ad acos function: example and test "/>
8 <meta name="keywords" id="keywords" content=" the ad acos function: example test "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Inverse Cosine and Hyperbolic Cosine Forward Mode Theory</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Inverse Cosine and Hyperbolic Cosine Forward Mode Theory"/>
8 <meta name="keywords" id="keywords" content=" inverse cosine and hyperbolic forward mode theory acos acosh derivatives taylor coefficients recursion "/>
8 <meta name="keywords" id="keywords" content=" inverse cosine hyperbolic forward mode theory acos acosh derivatives taylor coefficients recursion "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Inverse Cosine and Hyperbolic Cosine Reverse Mode Theory</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Inverse Cosine and Hyperbolic Cosine Reverse Mode Theory"/>
8 <meta name="keywords" id="keywords" content=" inverse cosine and hyperbolic reverse mode theory acos acosh "/>
8 <meta name="keywords" id="keywords" content=" inverse cosine hyperbolic reverse mode theory acos acosh "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>The AD acosh Function: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="The AD acosh Function: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" the ad acosh function: example and test "/>
8 <meta name="keywords" id="keywords" content=" the ad acosh function: example test "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>AD Assignment: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="AD Assignment: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" ad assignment: example and test assign object "/>
8 <meta name="keywords" id="keywords" content=" ad assignment: example test assign object "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>AD Constructors: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="AD Constructors: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" ad constructors: example and test constructor object "/>
8 <meta name="keywords" id="keywords" content=" ad constructors: example test constructor object "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Creating Your Own Interface to an ADFun Object</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Creating Your Own Interface to an ADFun Object"/>
8 <meta name="keywords" id="keywords" content=" creating your own interface to an adfun object example test "/>
8 <meta name="keywords" id="keywords" content=" creating your own interface to adfun object example test "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Example and Test Linking CppAD to Languages Other than C++</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Example and Test Linking CppAD to Languages Other than C++"/>
8 <meta name="keywords" id="keywords" content=" example and test linking cppad to languages other than c++ C Ad algorithmic differentiation automatic link "/>
8 <meta name="keywords" id="keywords" content=" example test linking cppad to languages other than c++ C Ad algorithmic differentiation automatic link "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>AD Output Operator: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="AD Output Operator: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" ad output operator: example and test &lt;&lt; input "/>
8 <meta name="keywords" id="keywords" content=" ad output operator: example test &lt;&lt; input "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>AD Output Operator: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="AD Output Operator: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" ad output operator: example and test &lt;&lt; "/>
8 <meta name="keywords" id="keywords" content=" ad output operator: example test &lt;&lt; "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Convert An AD or Base Type to String</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Convert An AD or Base Type to String"/>
8 <meta name="keywords" id="keywords" content=" convert an ad or base type to string syntax see also value s example "/>
8 <meta name="keywords" id="keywords" content=" convert ad base type to string syntax see also value s example "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>AD Binary Addition: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="AD Binary Addition: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" ad binary addition: example and test + add plus "/>
8 <meta name="keywords" id="keywords" content=" ad binary addition: example test + add plus "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>AD Computed Assignment Addition: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="AD Computed Assignment Addition: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" ad computed assignment addition: example and test += add assign plus "/>
8 <meta name="keywords" id="keywords" content=" ad computed assignment addition: example test += add assign plus "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Adolc Test Utility: Allocate and Free Memory For a Matrix</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Adolc Test Utility: Allocate and Free Memory For a Matrix"/>
8 <meta name="keywords" id="keywords" content=" adolc test utility: allocate and free memory for a matrix adolc_alloc_mat alloc syntax purpose m n mat "/>
8 <meta name="keywords" id="keywords" content=" adolc test utility: allocate free memory matrix adolc_alloc_mat alloc syntax purpose m n mat "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
9595 </select>
9696 </td>
9797 </tr></table><br/>
98
99
100
10198 <center><b><big><big>Adolc Test Utility: Allocate and Free Memory For a Matrix</big></big></b></center>
10299 <br/>
103100 <b><big><a name="Syntax" id="Syntax">Syntax</a></big></b>
55 <title>Adolc Speed: Gradient of Determinant Using Lu Factorization</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Adolc Speed: Gradient of Determinant Using Lu Factorization"/>
8 <meta name="keywords" id="keywords" content=" adolc speed: gradient of determinant using lu factorization link_det_lu speed matrix factor specifications implementation "/>
8 <meta name="keywords" id="keywords" content=" adolc speed: gradient determinant using lu factorization link_det_lu speed matrix factor specifications implementation "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
9292 </select>
9393 </td>
9494 </tr></table><br/>
95
96
97
9895 <center><b><big><big>Adolc Speed: Gradient of Determinant Using Lu Factorization</big></big></b></center>
9996 <br/>
10097 <b><big><a name="Specifications" id="Specifications">Specifications</a></big></b>
117114 extern bool global_memory, global_onetape, global_atomic, global_optimize;
118115
119116 bool link_det_lu(
120 size_t size ,
121 size_t repeat ,
122 CppAD::vector&lt;double&gt; &amp;matrix ,
123 CppAD::vector&lt;double&gt; &amp;gradient )
117 size_t size ,
118 size_t repeat ,
119 CppAD::vector&lt;double&gt; &amp;matrix ,
120 CppAD::vector&lt;double&gt; &amp;gradient )
124121 {
125 // speed test global option values
126 if( global_onetape || global_atomic )
127 return false;
128 if( global_memory || global_optimize )
129 return false;
130 // -----------------------------------------------------
131 // setup
132 int tag = 0; // tape identifier
133 int keep = 1; // keep forward mode results in buffer
134 int m = 1; // number of dependent variables
135 int n = size*size; // number of independent variables
136 double f; // function value
137 int j; // temporary index
138
139 // set up for thread_alloc memory allocator (fast and checks for leaks)
140 using CppAD::thread_alloc; // the allocator
141 size_t size_min; // requested number of elements
142 size_t size_out; // capacity of an allocation
143
144 // object for computing determinant
145 typedef adouble ADScalar;
146 typedef ADScalar* ADVector;
147 CppAD::det_by_lu&lt;ADScalar&gt; Det(size);
148
149 // AD value of determinant
150 ADScalar detA;
151
152 // AD version of matrix
153 size_min = n;
154 ADVector A = thread_alloc::create_array&lt;ADScalar&gt;(size_min, size_out);
155
156 // vectors of reverse mode weights
157 size_min = m;
158 double* u = thread_alloc::create_array&lt;double&gt;(size_min, size_out);
159 u[0] = 1.;
160
161 // vector with matrix value
162 size_min = n;
163 double* mat = thread_alloc::create_array&lt;double&gt;(size_min, size_out);
164
165 // vector to receive gradient result
166 size_min = n;
167 double* grad = thread_alloc::create_array&lt;double&gt;(size_min, size_out);
168 // ------------------------------------------------------
169 while(repeat--)
170 { // get the next matrix
171 CppAD::uniform_01(n, mat);
172
173 // declare independent variables
174 trace_on(tag, keep);
175 for(j = 0; j &lt; n; j++)
176 A[j] &lt;&lt;= mat[j];
177
178 // AD computation of the determinant
179 detA = Det(A);
180
181 // create function object f : A -&gt; detA
182 detA &gt;&gt;= f;
183 trace_off();
184
185 // evaluate and return gradient using reverse mode
186 fos_reverse(tag, m, n, u, grad);
187 }
188 // ------------------------------------------------------
189
190 // return matrix and gradient
191 for(j = 0; j &lt; n; j++)
192 { matrix[j] = mat[j];
193 gradient[j] = grad[j];
194 }
195 // tear down
196 thread_alloc::delete_array(grad);
197 thread_alloc::delete_array(mat);
198 thread_alloc::delete_array(u);
199 thread_alloc::delete_array(A);
200
201 return true;
122 // speed test global option values
123 if( global_onetape || global_atomic )
124 return false;
125 if( global_memory || global_optimize )
126 return false;
127 // -----------------------------------------------------
128 // setup
129 int tag = 0; // tape identifier
130 int keep = 1; // keep forward mode results in buffer
131 int m = 1; // number of dependent variables
132 int n = size*size; // number of independent variables
133 double f; // function value
134 int j; // temporary index
135
136 // set up for thread_alloc memory allocator (fast and checks for leaks)
137 using CppAD::thread_alloc; // the allocator
138 size_t size_min; // requested number of elements
139 size_t size_out; // capacity of an allocation
140
141 // object for computing determinant
142 typedef adouble ADScalar;
143 typedef ADScalar* ADVector;
144 CppAD::det_by_lu&lt;ADScalar&gt; Det(size);
145
146 // AD value of determinant
147 ADScalar detA;
148
149 // AD version of matrix
150 size_min = n;
151 ADVector A = thread_alloc::create_array&lt;ADScalar&gt;(size_min, size_out);
152
153 // vectors of reverse mode weights
154 size_min = m;
155 double* u = thread_alloc::create_array&lt;double&gt;(size_min, size_out);
156 u[0] = 1.;
157
158 // vector with matrix value
159 size_min = n;
160 double* mat = thread_alloc::create_array&lt;double&gt;(size_min, size_out);
161
162 // vector to receive gradient result
163 size_min = n;
164 double* grad = thread_alloc::create_array&lt;double&gt;(size_min, size_out);
165 // ------------------------------------------------------
166 while(repeat--)
167 { // get the next matrix
168 CppAD::uniform_01(n, mat);
169
170 // declare independent variables
171 trace_on(tag, keep);
172 for(j = 0; j &lt; n; j++)
173 A[j] &lt;&lt;= mat[j];
174
175 // AD computation of the determinant
176 detA = Det(A);
177
178 // create function object f : A -&gt; detA
179 detA &gt;&gt;= f;
180 trace_off();
181
182 // evaluate and return gradient using reverse mode
183 fos_reverse(tag, m, n, u, grad);
184 }
185 // ------------------------------------------------------
186
187 // return matrix and gradient
188 for(j = 0; j &lt; n; j++)
189 { matrix[j] = mat[j];
190 gradient[j] = grad[j];
191 }
192 // tear down
193 thread_alloc::delete_array(grad);
194 thread_alloc::delete_array(mat);
195 thread_alloc::delete_array(u);
196 thread_alloc::delete_array(A);
197
198 return true;
202199 }
203200 </pre></font></code>
204201
205
206202 <hr/>Input File: speed/adolc/det_lu.cpp
207203
208204 </body>
55 <title>Adolc Speed: Gradient of Determinant by Minor Expansion</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Adolc Speed: Gradient of Determinant by Minor Expansion"/>
8 <meta name="keywords" id="keywords" content=" adolc speed: gradient of determinant by minor expansion link_det_minor speed specifications implementation "/>
8 <meta name="keywords" id="keywords" content=" adolc speed: gradient determinant minor expansion link_det_minor speed specifications implementation "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
113113 extern bool global_memory, global_onetape, global_atomic, global_optimize;
114114
115115 bool link_det_minor(
116 size_t size ,
117 size_t repeat ,
118 CppAD::vector&lt;double&gt; &amp;matrix ,
119 CppAD::vector&lt;double&gt; &amp;gradient )
116 size_t size ,
117 size_t repeat ,
118 CppAD::vector&lt;double&gt; &amp;matrix ,
119 CppAD::vector&lt;double&gt; &amp;gradient )
120120 {
121 // speed test global option values
122 if( global_atomic )
123 return false;
124 if( global_memory || global_optimize )
125 return false;
126 // -----------------------------------------------------
127 // setup
128 typedef adouble ADScalar;
129 typedef ADScalar* ADVector;
130
131 int tag = 0; // tape identifier
132 int m = 1; // number of dependent variables
133 int n = size*size; // number of independent variables
134 double f; // function value
135 int j; // temporary index
136
137 // set up for thread_alloc memory allocator (fast and checks for leaks)
138 using CppAD::thread_alloc; // the allocator
139 size_t capacity; // capacity of an allocation
140
141 // object for computing determinant
142 CppAD::det_by_minor&lt;ADScalar&gt; Det(size);
143
144 // AD value of determinant
145 ADScalar detA;
146
147 // AD version of matrix
148 ADVector A = thread_alloc::create_array&lt;ADScalar&gt;(size_t(n), capacity);
149
150 // vectors of reverse mode weights
151 double* u = thread_alloc::create_array&lt;double&gt;(size_t(m), capacity);
152 u[0] = 1.;
153
154 // vector with matrix value
155 double* mat = thread_alloc::create_array&lt;double&gt;(size_t(n), capacity);
156
157 // vector to receive gradient result
158 double* grad = thread_alloc::create_array&lt;double&gt;(size_t(n), capacity);
159
160 // ----------------------------------------------------------------------
161 if( ! global_onetape ) while(repeat--)
162 { // choose a matrix
163 CppAD::uniform_01(n, mat);
164
165 // declare independent variables
166 int keep = 1; // keep forward mode results
167 trace_on(tag, keep);
168 for(j = 0; j &lt; n; j++)
169 A[j] &lt;&lt;= mat[j];
170
171 // AD computation of the determinant
172 detA = Det(A);
173
174 // create function object f : A -&gt; detA
175 detA &gt;&gt;= f;
176 trace_off();
177
178 // evaluate and return gradient using reverse mode
179 fos_reverse(tag, m, n, u, grad);
180 }
181 else
182 {
183 // choose a matrix
184 CppAD::uniform_01(n, mat);
185
186 // declare independent variables
187 int keep = 0; // do not keep forward mode results in buffer
188 trace_on(tag, keep);
189 for(j = 0; j &lt; n; j++)
190 A[j] &lt;&lt;= mat[j];
191
192 // AD computation of the determinant
193 detA = Det(A);
194
195 // create function object f : A -&gt; detA
196 detA &gt;&gt;= f;
197 trace_off();
198
199 while(repeat--)
200 { // get the next matrix
201 CppAD::uniform_01(n, mat);
202
203 // evaluate the determinant at the new matrix value
204 keep = 1; // keep this forward mode result
205 zos_forward(tag, m, n, keep, mat, &amp;f);
206
207 // evaluate and return gradient using reverse mode
208 fos_reverse(tag, m, n, u, grad);
209 }
210 }
211 // --------------------------------------------------------------------
212
213 // return matrix and gradient
214 for(j = 0; j &lt; n; j++)
215 { matrix[j] = mat[j];
216 gradient[j] = grad[j];
217 }
218
219 // tear down
220 thread_alloc::delete_array(grad);
221 thread_alloc::delete_array(mat);
222 thread_alloc::delete_array(u);
223 thread_alloc::delete_array(A);
224 return true;
121 // speed test global option values
122 if( global_atomic )
123 return false;
124 if( global_memory || global_optimize )
125 return false;
126 // -----------------------------------------------------
127 // setup
128 typedef adouble ADScalar;
129 typedef ADScalar* ADVector;
130
131 int tag = 0; // tape identifier
132 int m = 1; // number of dependent variables
133 int n = size*size; // number of independent variables
134 double f; // function value
135 int j; // temporary index
136
137 // set up for thread_alloc memory allocator (fast and checks for leaks)
138 using CppAD::thread_alloc; // the allocator
139 size_t capacity; // capacity of an allocation
140
141 // object for computing determinant
142 CppAD::det_by_minor&lt;ADScalar&gt; Det(size);
143
144 // AD value of determinant
145 ADScalar detA;
146
147 // AD version of matrix
148 ADVector A = thread_alloc::create_array&lt;ADScalar&gt;(size_t(n), capacity);
149
150 // vectors of reverse mode weights
151 double* u = thread_alloc::create_array&lt;double&gt;(size_t(m), capacity);
152 u[0] = 1.;
153
154 // vector with matrix value
155 double* mat = thread_alloc::create_array&lt;double&gt;(size_t(n), capacity);
156
157 // vector to receive gradient result
158 double* grad = thread_alloc::create_array&lt;double&gt;(size_t(n), capacity);
159
160 // ----------------------------------------------------------------------
161 if( ! global_onetape ) while(repeat--)
162 { // choose a matrix
163 CppAD::uniform_01(n, mat);
164
165 // declare independent variables
166 int keep = 1; // keep forward mode results
167 trace_on(tag, keep);
168 for(j = 0; j &lt; n; j++)
169 A[j] &lt;&lt;= mat[j];
170
171 // AD computation of the determinant
172 detA = Det(A);
173
174 // create function object f : A -&gt; detA
175 detA &gt;&gt;= f;
176 trace_off();
177
178 // evaluate and return gradient using reverse mode
179 fos_reverse(tag, m, n, u, grad);
180 }
181 else
182 {
183 // choose a matrix
184 CppAD::uniform_01(n, mat);
185
186 // declare independent variables
187 int keep = 0; // do not keep forward mode results in buffer
188 trace_on(tag, keep);
189 for(j = 0; j &lt; n; j++)
190 A[j] &lt;&lt;= mat[j];
191
192 // AD computation of the determinant
193 detA = Det(A);
194
195 // create function object f : A -&gt; detA
196 detA &gt;&gt;= f;
197 trace_off();
198
199 while(repeat--)
200 { // get the next matrix
201 CppAD::uniform_01(n, mat);
202
203 // evaluate the determinant at the new matrix value
204 keep = 1; // keep this forward mode result
205 zos_forward(tag, m, n, keep, mat, &amp;f);
206
207 // evaluate and return gradient using reverse mode
208 fos_reverse(tag, m, n, u, grad);
209 }
210 }
211 // --------------------------------------------------------------------
212
213 // return matrix and gradient
214 for(j = 0; j &lt; n; j++)
215 { matrix[j] = mat[j];
216 gradient[j] = grad[j];
217 }
218
219 // tear down
220 thread_alloc::delete_array(grad);
221 thread_alloc::delete_array(mat);
222 thread_alloc::delete_array(u);
223 thread_alloc::delete_array(A);
224 return true;
225225 }
226226 </pre></font></code>
227227
228
229228 <hr/>Input File: speed/adolc/det_minor.cpp
230229
231230 </body>
9292 </select>
9393 </td>
9494 </tr></table><br/>
95
96
97
9895 <center><b><big><big>Adolc Speed: Matrix Multiplication</big></big></b></center>
9996 <br/>
10097 <b><big><a name="Specifications" id="Specifications">Specifications</a></big></b>
118115 extern bool global_memory, global_onetape, global_atomic, global_optimize;
119116
120117 bool link_mat_mul(
121 size_t size ,
122 size_t repeat ,
123 CppAD::vector&lt;double&gt;&amp; x ,
124 CppAD::vector&lt;double&gt;&amp; z ,
125 CppAD::vector&lt;double&gt;&amp; dz )
118 size_t size ,
119 size_t repeat ,
120 CppAD::vector&lt;double&gt;&amp; x ,
121 CppAD::vector&lt;double&gt;&amp; z ,
122 CppAD::vector&lt;double&gt;&amp; dz )
126123 {
127 // speed test global option values
128 if( global_memory || global_atomic || global_optimize )
129 return false;
130 // -----------------------------------------------------
131 // setup
132 typedef adouble ADScalar;
133 typedef ADScalar* ADVector;
134
135 int tag = 0; // tape identifier
136 int m = 1; // number of dependent variables
137 int n = size*size; // number of independent variables
138 double f; // function value
139 int j; // temporary index
140
141 // set up for thread_alloc memory allocator (fast and checks for leaks)
142 using CppAD::thread_alloc; // the allocator
143 size_t capacity; // capacity of an allocation
144
145 // AD domain space vector
146 ADVector X = thread_alloc::create_array&lt;ADScalar&gt;(size_t(n), capacity);
147
148 // Product matrix
149 ADVector Y = thread_alloc::create_array&lt;ADScalar&gt;(size_t(n), capacity);
150
151 // AD range space vector
152 ADVector Z = thread_alloc::create_array&lt;ADScalar&gt;(size_t(m), capacity);
153
154 // vector with matrix value
155 double* mat = thread_alloc::create_array&lt;double&gt;(size_t(n), capacity);
156
157 // vector of reverse mode weights
158 double* u = thread_alloc::create_array&lt;double&gt;(size_t(m), capacity);
159 u[0] = 1.;
160
161 // gradient
162 double* grad = thread_alloc::create_array&lt;double&gt;(size_t(n), capacity);
163
164 // ----------------------------------------------------------------------
165 if( ! global_onetape ) while(repeat--)
166 { // choose a matrix
167 CppAD::uniform_01(n, mat);
168
169 // declare independent variables
170 int keep = 1; // keep forward mode results
171 trace_on(tag, keep);
172 for(j = 0; j &lt; n; j++)
173 X[j] &lt;&lt;= mat[j];
174
175 // do computations
176 CppAD::mat_sum_sq(size, X, Y, Z);
177
178 // create function object f : X -&gt; Z
179 Z[0] &gt;&gt;= f;
180 trace_off();
181
182 // evaluate and return gradient using reverse mode
183 fos_reverse(tag, m, n, u, grad);
184 }
185 else
186 { // choose a matrix
187 CppAD::uniform_01(n, mat);
188
189 // declare independent variables
190 int keep = 0; // do not keep forward mode results
191 trace_on(tag, keep);
192 for(j = 0; j &lt; n; j++)
193 X[j] &lt;&lt;= mat[j];
194
195 // do computations
196 CppAD::mat_sum_sq(size, X, Y, Z);
197
198 // create function object f : X -&gt; Z
199 Z[0] &gt;&gt;= f;
200 trace_off();
201
202 while(repeat--)
203 { // choose a matrix
204 CppAD::uniform_01(n, mat);
205
206 // evaluate the determinant at the new matrix value
207 keep = 1; // keep this forward mode result
208 zos_forward(tag, m, n, keep, mat, &amp;f);
209
210 // evaluate and return gradient using reverse mode
211 fos_reverse(tag, m, n, u, grad);
212 }
213 }
214 // return function, matrix, and gradient
215 z[0] = f;
216 for(j = 0; j &lt; n; j++)
217 { x[j] = mat[j];
218 dz[j] = grad[j];
219 }
220
221 // tear down
222 thread_alloc::delete_array(X);
223 thread_alloc::delete_array(Y);
224 thread_alloc::delete_array(Z);
225 thread_alloc::delete_array(mat);
226 thread_alloc::delete_array(u);
227 thread_alloc::delete_array(grad);
228
229 return true;
124 // speed test global option values
125 if( global_memory || global_atomic || global_optimize )
126 return false;
127 // -----------------------------------------------------
128 // setup
129 typedef adouble ADScalar;
130 typedef ADScalar* ADVector;
131
132 int tag = 0; // tape identifier
133 int m = 1; // number of dependent variables
134 int n = size*size; // number of independent variables
135 double f; // function value
136 int j; // temporary index
137
138 // set up for thread_alloc memory allocator (fast and checks for leaks)
139 using CppAD::thread_alloc; // the allocator
140 size_t capacity; // capacity of an allocation
141
142 // AD domain space vector
143 ADVector X = thread_alloc::create_array&lt;ADScalar&gt;(size_t(n), capacity);
144
145 // Product matrix
146 ADVector Y = thread_alloc::create_array&lt;ADScalar&gt;(size_t(n), capacity);
147
148 // AD range space vector
149 ADVector Z = thread_alloc::create_array&lt;ADScalar&gt;(size_t(m), capacity);
150
151 // vector with matrix value
152 double* mat = thread_alloc::create_array&lt;double&gt;(size_t(n), capacity);
153
154 // vector of reverse mode weights
155 double* u = thread_alloc::create_array&lt;double&gt;(size_t(m), capacity);
156 u[0] = 1.;
157
158 // gradient
159 double* grad = thread_alloc::create_array&lt;double&gt;(size_t(n), capacity);
160
161 // ----------------------------------------------------------------------
162 if( ! global_onetape ) while(repeat--)
163 { // choose a matrix
164 CppAD::uniform_01(n, mat);
165
166 // declare independent variables
167 int keep = 1; // keep forward mode results
168 trace_on(tag, keep);
169 for(j = 0; j &lt; n; j++)
170 X[j] &lt;&lt;= mat[j];
171
172 // do computations
173 CppAD::mat_sum_sq(size, X, Y, Z);
174
175 // create function object f : X -&gt; Z
176 Z[0] &gt;&gt;= f;
177 trace_off();
178
179 // evaluate and return gradient using reverse mode
180 fos_reverse(tag, m, n, u, grad);
181 }
182 else
183 { // choose a matrix
184 CppAD::uniform_01(n, mat);
185
186 // declare independent variables
187 int keep = 0; // do not keep forward mode results
188 trace_on(tag, keep);
189 for(j = 0; j &lt; n; j++)
190 X[j] &lt;&lt;= mat[j];
191
192 // do computations
193 CppAD::mat_sum_sq(size, X, Y, Z);
194
195 // create function object f : X -&gt; Z
196 Z[0] &gt;&gt;= f;
197 trace_off();
198
199 while(repeat--)
200 { // choose a matrix
201 CppAD::uniform_01(n, mat);
202
203 // evaluate the determinant at the new matrix value
204 keep = 1; // keep this forward mode result
205 zos_forward(tag, m, n, keep, mat, &amp;f);
206
207 // evaluate and return gradient using reverse mode
208 fos_reverse(tag, m, n, u, grad);
209 }
210 }
211 // return function, matrix, and gradient
212 z[0] = f;
213 for(j = 0; j &lt; n; j++)
214 { x[j] = mat[j];
215 dz[j] = grad[j];
216 }
217
218 // tear down
219 thread_alloc::delete_array(X);
220 thread_alloc::delete_array(Y);
221 thread_alloc::delete_array(Z);
222 thread_alloc::delete_array(mat);
223 thread_alloc::delete_array(u);
224 thread_alloc::delete_array(grad);
225
226 return true;
230227 }
231228
232229
233230 </pre></font></code>
234
235231
236232 <hr/>Input File: speed/adolc/mat_mul.cpp
237233
9292 </select>
9393 </td>
9494 </tr></table><br/>
95
96
97
9895 <center><b><big><big>Adolc Speed: Ode</big></big></b></center>
9996 <br/>
10097 <b><big><a name="Specifications" id="Specifications">Specifications</a></big></b>
118115 extern bool global_memory, global_onetape, global_atomic, global_optimize;
119116
120117 bool link_ode(
121 size_t size ,
122 size_t repeat ,
123 CppAD::vector&lt;double&gt; &amp;x ,
124 CppAD::vector&lt;double&gt; &amp;jac
118 size_t size ,
119 size_t repeat ,
120 CppAD::vector&lt;double&gt; &amp;x ,
121 CppAD::vector&lt;double&gt; &amp;jac
125122 )
126123 {
127 // speed test global option values
128 if( global_atomic )
129 return false;
130 if( global_memory || global_optimize )
131 return false;
132 // -------------------------------------------------------------
133 // setup
134 assert( x.size() == size );
135 assert( jac.size() == size * size );
136
137 typedef CppAD::vector&lt;adouble&gt; ADVector;
138 typedef CppAD::vector&lt;double&gt; DblVector;
139
140 size_t i, j;
141 int tag = 0; // tape identifier
142 int keep = 0; // do not keep forward mode results
143 size_t p = 0; // use ode to calculate function values
144 size_t n = size; // number of independent variables
145 size_t m = n; // number of dependent variables
146 ADVector X(n), Y(m); // independent and dependent variables
147 DblVector f(m); // function value
148
149 // set up for thread_alloc memory allocator (fast and checks for leaks)
150 using CppAD::thread_alloc; // the allocator
151 size_t size_min; // requested number of elements
152 size_t size_out; // capacity of an allocation
153
154 // raw memory for use with adolc
155 size_min = n;
156 double *x_raw = thread_alloc::create_array&lt;double&gt;(size_min, size_out);
157 size_min = m * n;
158 double *jac_raw = thread_alloc::create_array&lt;double&gt;(size_min, size_out);
159 size_min = m;
160 double **jac_ptr = thread_alloc::create_array&lt;double*&gt;(size_min, size_out);
161 for(i = 0; i &lt; m; i++)
162 jac_ptr[i] = jac_raw + i * n;
163
164 // -------------------------------------------------------------
165 if( ! global_onetape ) while(repeat--)
166 { // choose next x value
167 uniform_01(n, x);
168
169 // declare independent variables
170 trace_on(tag, keep);
171 for(j = 0; j &lt; n; j++)
172 X[j] &lt;&lt;= x[j];
173
174 // evaluate function
175 CppAD::ode_evaluate(X, p, Y);
176
177 // create function object f : X -&gt; Y
178 for(i = 0; i &lt; m; i++)
179 Y[i] &gt;&gt;= f[i];
180 trace_off();
181
182 // evaluate the Jacobian
183 for(j = 0; j &lt; n; j++)
184 x_raw[j] = x[j];
185 jacobian(tag, m, n, x_raw, jac_ptr);
186 }
187 else
188 { // choose next x value
189 uniform_01(n, x);
190
191 // declare independent variables
192 trace_on(tag, keep);
193 for(j = 0; j &lt; n; j++)
194 X[j] &lt;&lt;= x[j];
195
196 // evaluate function
197 CppAD::ode_evaluate(X, p, Y);
198
199 // create function object f : X -&gt; Y
200 for(i = 0; i &lt; m; i++)
201 Y[i] &gt;&gt;= f[i];
202 trace_off();
203
204 while(repeat--)
205 { // get next argument value
206 uniform_01(n, x);
207 for(j = 0; j &lt; n; j++)
208 x_raw[j] = x[j];
209
210 // evaluate jacobian
211 jacobian(tag, m, n, x_raw, jac_ptr);
212 }
213 }
214 // convert return value to a simple vector
215 for(i = 0; i &lt; m; i++)
216 { for(j = 0; j &lt; n; j++)
217 jac[i * n + j] = jac_ptr[i][j];
218 }
219 // ----------------------------------------------------------------------
220 // tear down
221 thread_alloc::delete_array(x_raw);
222 thread_alloc::delete_array(jac_raw);
223 thread_alloc::delete_array(jac_ptr);
224
225 return true;
124 // speed test global option values
125 if( global_atomic )
126 return false;
127 if( global_memory || global_optimize )
128 return false;
129 // -------------------------------------------------------------
130 // setup
131 assert( x.size() == size );
132 assert( jac.size() == size * size );
133
134 typedef CppAD::vector&lt;adouble&gt; ADVector;
135 typedef CppAD::vector&lt;double&gt; DblVector;
136
137 size_t i, j;
138 int tag = 0; // tape identifier
139 int keep = 0; // do not keep forward mode results
140 size_t p = 0; // use ode to calculate function values
141 size_t n = size; // number of independent variables
142 size_t m = n; // number of dependent variables
143 ADVector X(n), Y(m); // independent and dependent variables
144 DblVector f(m); // function value
145
146 // set up for thread_alloc memory allocator (fast and checks for leaks)
147 using CppAD::thread_alloc; // the allocator
148 size_t size_min; // requested number of elements
149 size_t size_out; // capacity of an allocation
150
151 // raw memory for use with adolc
152 size_min = n;
153 double *x_raw = thread_alloc::create_array&lt;double&gt;(size_min, size_out);
154 size_min = m * n;
155 double *jac_raw = thread_alloc::create_array&lt;double&gt;(size_min, size_out);
156 size_min = m;
157 double **jac_ptr = thread_alloc::create_array&lt;double*&gt;(size_min, size_out);
158 for(i = 0; i &lt; m; i++)
159 jac_ptr[i] = jac_raw + i * n;
160
161 // -------------------------------------------------------------
162 if( ! global_onetape ) while(repeat--)
163 { // choose next x value
164 uniform_01(n, x);
165
166 // declare independent variables
167 trace_on(tag, keep);
168 for(j = 0; j &lt; n; j++)
169 X[j] &lt;&lt;= x[j];
170
171 // evaluate function
172 CppAD::ode_evaluate(X, p, Y);
173
174 // create function object f : X -&gt; Y
175 for(i = 0; i &lt; m; i++)
176 Y[i] &gt;&gt;= f[i];
177 trace_off();
178
179 // evaluate the Jacobian
180 for(j = 0; j &lt; n; j++)
181 x_raw[j] = x[j];
182 jacobian(tag, m, n, x_raw, jac_ptr);
183 }
184 else
185 { // choose next x value
186 uniform_01(n, x);
187
188 // declare independent variables
189 trace_on(tag, keep);
190 for(j = 0; j &lt; n; j++)
191 X[j] &lt;&lt;= x[j];
192
193 // evaluate function
194 CppAD::ode_evaluate(X, p, Y);
195
196 // create function object f : X -&gt; Y
197 for(i = 0; i &lt; m; i++)
198 Y[i] &gt;&gt;= f[i];
199 trace_off();
200
201 while(repeat--)
202 { // get next argument value
203 uniform_01(n, x);
204 for(j = 0; j &lt; n; j++)
205 x_raw[j] = x[j];
206
207 // evaluate jacobian
208 jacobian(tag, m, n, x_raw, jac_ptr);
209 }
210 }
211 // convert return value to a simple vector
212 for(i = 0; i &lt; m; i++)
213 { for(j = 0; j &lt; n; j++)
214 jac[i * n + j] = jac_ptr[i][j];
215 }
216 // ----------------------------------------------------------------------
217 // tear down
218 thread_alloc::delete_array(x_raw);
219 thread_alloc::delete_array(jac_raw);
220 thread_alloc::delete_array(jac_ptr);
221
222 return true;
226223 }
227224 </pre></font></code>
228225
229
230226 <hr/>Input File: speed/adolc/ode.cpp
231227
232228 </body>
55 <title>Adolc Speed: Second Derivative of a Polynomial</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Adolc Speed: Second Derivative of a Polynomial"/>
8 <meta name="keywords" id="keywords" content=" adolc speed: second derivative of a polynomial link_poly speed specifications implementation "/>
8 <meta name="keywords" id="keywords" content=" adolc speed: second derivative polynomial link_poly speed specifications implementation "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
9292 </select>
9393 </td>
9494 </tr></table><br/>
95
96
97
9895 <center><b><big><big>Adolc Speed: Second Derivative of a Polynomial</big></big></b></center>
9996 <br/>
10097 <b><big><a name="Specifications" id="Specifications">Specifications</a></big></b>
121118 extern bool global_memory, global_onetape, global_atomic, global_optimize;
122119
123120 bool link_poly(
124 size_t size ,
125 size_t repeat ,
126 CppAD::vector&lt;double&gt; &amp;a , // coefficients of polynomial
127 CppAD::vector&lt;double&gt; &amp;z , // polynomial argument value
128 CppAD::vector&lt;double&gt; &amp;ddp ) // second derivative w.r.t z
121 size_t size ,
122 size_t repeat ,
123 CppAD::vector&lt;double&gt; &amp;a , // coefficients of polynomial
124 CppAD::vector&lt;double&gt; &amp;z , // polynomial argument value
125 CppAD::vector&lt;double&gt; &amp;ddp ) // second derivative w.r.t z
129126 {
130 if( global_atomic )
131 return false;
132 if( global_memory || global_optimize )
133 return false;
134 // -----------------------------------------------------
135 // setup
136 size_t i;
137 int tag = 0; // tape identifier
138 int keep = 0; // do not keep forward mode results in buffer
139 int m = 1; // number of dependent variables
140 int n = 1; // number of independent variables
141 int d = 2; // highest derivative degree
142 double f; // function value
143
144 // set up for thread_alloc memory allocator (fast and checks for leaks)
145 using CppAD::thread_alloc; // the allocator
146 size_t capacity; // capacity of an allocation
147
148 // choose a vector of polynomial coefficients
149 CppAD::uniform_01(size, a);
150
151 // AD copy of the polynomial coefficients
152 std::vector&lt;adouble&gt; A(size);
153 for(i = 0; i &lt; size; i++)
154 A[i] = a[i];
155
156 // domain and range space AD values
157 adouble Z, P;
158
159 // allocate arguments to hos_forward
160 double* x0 = thread_alloc::create_array&lt;double&gt;(size_t(n), capacity);
161 double* y0 = thread_alloc::create_array&lt;double&gt;(size_t(m), capacity);
162 double** x = adolc_alloc_mat(size_t(n), size_t(d));
163 double** y = adolc_alloc_mat(size_t(m), size_t(d));
164
165 // Taylor coefficient for argument
166 x[0][0] = 1.; // first order
167 x[0][1] = 0.; // second order
168
169 // ----------------------------------------------------------------------
170 if( ! global_onetape ) while(repeat--)
171 { // choose an argument value
172 CppAD::uniform_01(1, z);
173
174 // declare independent variables
175 trace_on(tag, keep);
176 Z &lt;&lt;= z[0];
177
178 // AD computation of the function value
179 P = CppAD::Poly(0, A, Z);
180
181 // create function object f : Z -&gt; P
182 P &gt;&gt;= f;
183 trace_off();
184
185 // set the argument value
186 x0[0] = z[0];
187
188 // evaluate the polynomial at the new argument value
189 hos_forward(tag, m, n, d, keep, x0, x, y0, y);
190
191 // second derivative is twice second order Taylor coef
192 ddp[0] = 2. * y[0][1];
193 }
194 else
195 {
196 // choose an argument value
197 CppAD::uniform_01(1, z);
198
199 // declare independent variables
200 trace_on(tag, keep);
201 Z &lt;&lt;= z[0];
202
203 // AD computation of the function value
204 P = CppAD::Poly(0, A, Z);
205
206 // create function object f : Z -&gt; P
207 P &gt;&gt;= f;
208 trace_off();
209
210 while(repeat--)
211 { // get the next argument value
212 CppAD::uniform_01(1, z);
213 x0[0] = z[0];
214
215 // evaluate the polynomial at the new argument value
216 hos_forward(tag, m, n, d, keep, x0, x, y0, y);
217
218 // second derivative is twice second order Taylor coef
219 ddp[0] = 2. * y[0][1];
220 }
221 }
222 // ------------------------------------------------------
223 // tear down
224 adolc_free_mat(x);
225 adolc_free_mat(y);
226 thread_alloc::delete_array(x0);
227 thread_alloc::delete_array(y0);
228
229 return true;
127 if( global_atomic )
128 return false;
129 if( global_memory || global_optimize )
130 return false;
131 // -----------------------------------------------------
132 // setup
133 size_t i;
134 int tag = 0; // tape identifier
135 int keep = 0; // do not keep forward mode results in buffer
136 int m = 1; // number of dependent variables
137 int n = 1; // number of independent variables
138 int d = 2; // highest derivative degree
139 double f; // function value
140
141 // set up for thread_alloc memory allocator (fast and checks for leaks)
142 using CppAD::thread_alloc; // the allocator
143 size_t capacity; // capacity of an allocation
144
145 // choose a vector of polynomial coefficients
146 CppAD::uniform_01(size, a);
147
148 // AD copy of the polynomial coefficients
149 std::vector&lt;adouble&gt; A(size);
150 for(i = 0; i &lt; size; i++)
151 A[i] = a[i];
152
153 // domain and range space AD values
154 adouble Z, P;
155
156 // allocate arguments to hos_forward
157 double* x0 = thread_alloc::create_array&lt;double&gt;(size_t(n), capacity);
158 double* y0 = thread_alloc::create_array&lt;double&gt;(size_t(m), capacity);
159 double** x = adolc_alloc_mat(size_t(n), size_t(d));
160 double** y = adolc_alloc_mat(size_t(m), size_t(d));
161
162 // Taylor coefficient for argument
163 x[0][0] = 1.; // first order
164 x[0][1] = 0.; // second order
165
166 // ----------------------------------------------------------------------
167 if( ! global_onetape ) while(repeat--)
168 { // choose an argument value
169 CppAD::uniform_01(1, z);
170
171 // declare independent variables
172 trace_on(tag, keep);
173 Z &lt;&lt;= z[0];
174
175 // AD computation of the function value
176 P = CppAD::Poly(0, A, Z);
177
178 // create function object f : Z -&gt; P
179 P &gt;&gt;= f;
180 trace_off();
181
182 // set the argument value
183 x0[0] = z[0];
184
185 // evaluate the polynomial at the new argument value
186 hos_forward(tag, m, n, d, keep, x0, x, y0, y);
187
188 // second derivative is twice second order Taylor coef
189 ddp[0] = 2. * y[0][1];
190 }
191 else
192 {
193 // choose an argument value
194 CppAD::uniform_01(1, z);
195
196 // declare independent variables
197 trace_on(tag, keep);
198 Z &lt;&lt;= z[0];
199
200 // AD computation of the function value
201 P = CppAD::Poly(0, A, Z);
202
203 // create function object f : Z -&gt; P
204 P &gt;&gt;= f;
205 trace_off();
206
207 while(repeat--)
208 { // get the next argument value
209 CppAD::uniform_01(1, z);
210 x0[0] = z[0];
211
212 // evaluate the polynomial at the new argument value
213 hos_forward(tag, m, n, d, keep, x0, x, y0, y);
214
215 // second derivative is twice second order Taylor coef
216 ddp[0] = 2. * y[0][1];
217 }
218 }
219 // ------------------------------------------------------
220 // tear down
221 adolc_free_mat(x);
222 adolc_free_mat(y);
223 thread_alloc::delete_array(x0);
224 thread_alloc::delete_array(y0);
225
226 return true;
230227 }
231228 </pre></font></code>
232229
233
234230 <hr/>Input File: speed/adolc/poly.cpp
235231
236232 </body>
55 <title>Including the ADOL-C Examples and Tests</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Including the ADOL-C Examples and Tests"/>
8 <meta name="keywords" id="keywords" content=" including the adol-c examples and tests adolc prefix get purpose adolc_prefix speed unix cygwin get_adolc "/>
8 <meta name="keywords" id="keywords" content=" including the adol-c examples tests adolc prefix get purpose adolc_prefix speed unix cygwin get_adolc "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
9292 </select>
9393 </td>
9494 </tr></table><br/>
95
96
97
9895 <center><b><big><big>Adolc Speed: Sparse Hessian</big></big></b></center>
9996 <br/>
10097 <b><big><a name="Specifications" id="Specifications">Specifications</a></big></b>
120117 extern bool global_colpack, global_boolsparsity;
121118
122119 bool link_sparse_hessian(
123 size_t size ,
124 size_t repeat ,
125 const CppAD::vector&lt;size_t&gt;&amp; row ,
126 const CppAD::vector&lt;size_t&gt;&amp; col ,
127 CppAD::vector&lt;double&gt;&amp; x_return ,
128 CppAD::vector&lt;double&gt;&amp; hessian ,
129 size_t&amp; n_sweep )
120 size_t size ,
121 size_t repeat ,
122 const CppAD::vector&lt;size_t&gt;&amp; row ,
123 const CppAD::vector&lt;size_t&gt;&amp; col ,
124 CppAD::vector&lt;double&gt;&amp; x_return ,
125 CppAD::vector&lt;double&gt;&amp; hessian ,
126 size_t&amp; n_sweep )
130127 {
131 if( global_atomic || (! global_colpack) )
132 return false;
133 if( global_memory || global_optimize || global_boolsparsity )
134 return false;
135 // -----------------------------------------------------
136 // setup
137 typedef unsigned int* SizeVector;
138 typedef double* DblVector;
139 typedef adouble ADScalar;
140 typedef ADScalar* ADVector;
141
142
143 size_t i, j, k; // temporary indices
144 size_t order = 0; // derivative order corresponding to function
145 size_t m = 1; // number of dependent variables
146 size_t n = size; // number of independent variables
147
148 // setup for thread_alloc memory allocator (fast and checks for leaks)
149 using CppAD::thread_alloc; // the allocator
150 size_t capacity; // capacity of an allocation
151
152 // tape identifier
153 int tag = 0;
154 // AD domain space vector
155 ADVector a_x = thread_alloc::create_array&lt;ADScalar&gt;(n, capacity);
156 // AD range space vector
157 ADVector a_y = thread_alloc::create_array&lt;ADScalar&gt;(m, capacity);
158 // double argument value
159 DblVector x = thread_alloc::create_array&lt;double&gt;(n, capacity);
160 // double function value
161 double f;
162
163 // options that control sparse_hess
164 int options[2];
165 options[0] = 0; // safe mode
166 options[1] = 0; // indirect recovery
167
168 // structure that holds some of the work done by sparse_hess
169 int nnz; // number of non-zero values
170 SizeVector rind = CPPAD_NULL; // row indices
171 SizeVector cind = CPPAD_NULL; // column indices
172 DblVector values = CPPAD_NULL; // Hessian values
173
174 // ----------------------------------------------------------------------
175 if( ! global_onetape ) while(repeat--)
176 { // choose a value for x
177 CppAD::uniform_01(n, x);
178
179 // declare independent variables
180 int keep = 0; // keep forward mode results
181 trace_on(tag, keep);
182 for(j = 0; j &lt; n; j++)
183 a_x[j] &lt;&lt;= x[j];
184
185 // AD computation of f (x)
186 CppAD::sparse_hes_fun&lt;ADScalar&gt;(n, a_x, row, col, order, a_y);
187
188 // create function object f : x -&gt; y
189 a_y[0] &gt;&gt;= f;
190 trace_off();
191
192 // is this a repeat call with the same sparsity pattern
193 int same_pattern = 0;
194
195 // calculate the hessian at this x
196 rind = CPPAD_NULL;
197 cind = CPPAD_NULL;
198 values = CPPAD_NULL;
199 sparse_hess(tag, int(n),
200 same_pattern, x, &amp;nnz, &amp;rind, &amp;cind, &amp;values, options
201 );
202 // only needed last time through loop
203 if( repeat == 0 )
204 { size_t K = row.size();
205 for(int ell = 0; ell &lt; nnz; ell++)
206 { i = size_t(rind[ell]);
207 j = size_t(cind[ell]);
208 for(k = 0; k &lt; K; k++)
209 { if( (row[k]==i &amp;&amp; col[k]==j) || (row[k]==j &amp;&amp; col[k]==i) )
210 hessian[k] = values[ell];
211 }
212 }
213 }
214
215 // free raw memory allocated by sparse_hess
216 free(rind);
217 free(cind);
218 free(values);
219 }
220 else
221 { // choose a value for x
222 CppAD::uniform_01(n, x);
223
224 // declare independent variables
225 int keep = 0; // keep forward mode results
226 trace_on(tag, keep);
227 for(j = 0; j &lt; n; j++)
228 a_x[j] &lt;&lt;= x[j];
229
230 // AD computation of f (x)
231 CppAD::sparse_hes_fun&lt;ADScalar&gt;(n, a_x, row, col, order, a_y);
232
233 // create function object f : x -&gt; y
234 a_y[0] &gt;&gt;= f;
235 trace_off();
236
237 // is this a repeat call at the same argument
238 int same_pattern = 0;
239
240 while(repeat--)
241 { // choose a value for x
242 CppAD::uniform_01(n, x);
243
244 // calculate the hessian at this x
245 sparse_hess(tag, int(n),
246 same_pattern, x, &amp;nnz, &amp;rind, &amp;cind, &amp;values, options
247 );
248 same_pattern = 1;
249 }
250 size_t K = row.size();
251 for(int ell = 0; ell &lt; nnz; ell++)
252 { i = size_t(rind[ell]);
253 j = size_t(cind[ell]);
254 for(k = 0; k &lt; K; k++)
255 { if( (row[k]==i &amp;&amp; col[k]==j) || (row[k]==j &amp;&amp; col[k]==i) )
256 hessian[k] = values[ell];
257 }
258 }
259 // free raw memory allocated by sparse_hessian
260 free(rind);
261 free(cind);
262 free(values);
263 }
264 // --------------------------------------------------------------------
265 // return argument
266 for(j = 0; j &lt; n; j++)
267 x_return[j] = x[j];
268
269 // do not know how to return number of sweeps used
270 n_sweep = 0;
271
272 // tear down
273 thread_alloc::delete_array(a_x);
274 thread_alloc::delete_array(a_y);
275 thread_alloc::delete_array(x);
276 return true;
128 if( global_atomic || (! global_colpack) )
129 return false;
130 if( global_memory || global_optimize || global_boolsparsity )
131 return false;
132 // -----------------------------------------------------
133 // setup
134 typedef unsigned int* SizeVector;
135 typedef double* DblVector;
136 typedef adouble ADScalar;
137 typedef ADScalar* ADVector;
138
139
140 size_t i, j, k; // temporary indices
141 size_t order = 0; // derivative order corresponding to function
142 size_t m = 1; // number of dependent variables
143 size_t n = size; // number of independent variables
144
145 // setup for thread_alloc memory allocator (fast and checks for leaks)
146 using CppAD::thread_alloc; // the allocator
147 size_t capacity; // capacity of an allocation
148
149 // tape identifier
150 int tag = 0;
151 // AD domain space vector
152 ADVector a_x = thread_alloc::create_array&lt;ADScalar&gt;(n, capacity);
153 // AD range space vector
154 ADVector a_y = thread_alloc::create_array&lt;ADScalar&gt;(m, capacity);
155 // double argument value
156 DblVector x = thread_alloc::create_array&lt;double&gt;(n, capacity);
157 // double function value
158 double f;
159
160 // options that control sparse_hess
161 int options[2];
162 options[0] = 0; // safe mode
163 options[1] = 0; // indirect recovery
164
165 // structure that holds some of the work done by sparse_hess
166 int nnz; // number of non-zero values
167 SizeVector rind = CPPAD_NULL; // row indices
168 SizeVector cind = CPPAD_NULL; // column indices
169 DblVector values = CPPAD_NULL; // Hessian values
170
171 // ----------------------------------------------------------------------
172 if( ! global_onetape ) while(repeat--)
173 { // choose a value for x
174 CppAD::uniform_01(n, x);
175
176 // declare independent variables
177 int keep = 0; // keep forward mode results
178 trace_on(tag, keep);
179 for(j = 0; j &lt; n; j++)
180 a_x[j] &lt;&lt;= x[j];
181
182 // AD computation of f (x)
183 CppAD::sparse_hes_fun&lt;ADScalar&gt;(n, a_x, row, col, order, a_y);
184
185 // create function object f : x -&gt; y
186 a_y[0] &gt;&gt;= f;
187 trace_off();
188
189 // is this a repeat call with the same sparsity pattern
190 int same_pattern = 0;
191
192 // calculate the hessian at this x
193 rind = CPPAD_NULL;
194 cind = CPPAD_NULL;
195 values = CPPAD_NULL;
196 sparse_hess(tag, int(n),
197 same_pattern, x, &amp;nnz, &amp;rind, &amp;cind, &amp;values, options
198 );
199 // only needed last time through loop
200 if( repeat == 0 )
201 { size_t K = row.size();
202 for(int ell = 0; ell &lt; nnz; ell++)
203 { i = size_t(rind[ell]);
204 j = size_t(cind[ell]);
205 for(k = 0; k &lt; K; k++)
206 { if( (row[k]==i &amp;&amp; col[k]==j) || (row[k]==j &amp;&amp; col[k]==i) )
207 hessian[k] = values[ell];
208 }
209 }
210 }
211
212 // free raw memory allocated by sparse_hess
213 free(rind);
214 free(cind);
215 free(values);
216 }
217 else
218 { // choose a value for x
219 CppAD::uniform_01(n, x);
220
221 // declare independent variables
222 int keep = 0; // keep forward mode results
223 trace_on(tag, keep);
224 for(j = 0; j &lt; n; j++)
225 a_x[j] &lt;&lt;= x[j];
226
227 // AD computation of f (x)
228 CppAD::sparse_hes_fun&lt;ADScalar&gt;(n, a_x, row, col, order, a_y);
229
230 // create function object f : x -&gt; y
231 a_y[0] &gt;&gt;= f;
232 trace_off();
233
234 // is this a repeat call at the same argument
235 int same_pattern = 0;
236
237 while(repeat--)
238 { // choose a value for x
239 CppAD::uniform_01(n, x);
240
241 // calculate the hessian at this x
242 sparse_hess(tag, int(n),
243 same_pattern, x, &amp;nnz, &amp;rind, &amp;cind, &amp;values, options
244 );
245 same_pattern = 1;
246 }
247 size_t K = row.size();
248 for(int ell = 0; ell &lt; nnz; ell++)
249 { i = size_t(rind[ell]);
250 j = size_t(cind[ell]);
251 for(k = 0; k &lt; K; k++)
252 { if( (row[k]==i &amp;&amp; col[k]==j) || (row[k]==j &amp;&amp; col[k]==i) )
253 hessian[k] = values[ell];
254 }
255 }
256 // free raw memory allocated by sparse_hessian
257 free(rind);
258 free(cind);
259 free(values);
260 }
261 // --------------------------------------------------------------------
262 // return argument
263 for(j = 0; j &lt; n; j++)
264 x_return[j] = x[j];
265
266 // do not know how to return number of sweeps used
267 n_sweep = 0;
268
269 // tear down
270 thread_alloc::delete_array(a_x);
271 thread_alloc::delete_array(a_y);
272 thread_alloc::delete_array(x);
273 return true;
277274
278275 }
279276 </pre></font></code>
280277
281
282278 <hr/>Input File: speed/adolc/sparse_hessian.cpp
283279
284280 </body>
9292 </select>
9393 </td>
9494 </tr></table><br/>
95
96
97
9895 <center><b><big><big>adolc Speed: Sparse Jacobian</big></big></b></center>
9996 <br/>
10097 <b><big><a name="Specifications" id="Specifications">Specifications</a></big></b>
119116 extern bool global_colpack, global_boolsparsity;
120117
121118 bool link_sparse_jacobian(
122 size_t size ,
123 size_t repeat ,
124 size_t m ,
125 const CppAD::vector&lt;size_t&gt;&amp; row ,
126 const CppAD::vector&lt;size_t&gt;&amp; col ,
127 CppAD::vector&lt;double&gt;&amp; x_return ,
128 CppAD::vector&lt;double&gt;&amp; jacobian ,
129 size_t&amp; n_sweep )
119 size_t size ,
120 size_t repeat ,
121 size_t m ,
122 const CppAD::vector&lt;size_t&gt;&amp; row ,
123 const CppAD::vector&lt;size_t&gt;&amp; col ,
124 CppAD::vector&lt;double&gt;&amp; x_return ,
125 CppAD::vector&lt;double&gt;&amp; jacobian ,
126 size_t&amp; n_sweep )
130127 {
131 if( global_atomic || (! global_colpack) )
132 return false;
133 if( global_memory || global_optimize )
134 return false;
135 // -----------------------------------------------------
136 // setup
137 typedef unsigned int* SizeVector;
138 typedef double* DblVector;
139 typedef adouble ADScalar;
140 typedef ADScalar* ADVector;
141
142 size_t i, j, k; // temporary indices
143 size_t n = size; // number of independent variables
144 size_t order = 0; // derivative order corresponding to function
145
146 // set up for thread_alloc memory allocator (fast and checks for leaks)
147 using CppAD::thread_alloc; // the allocator
148 size_t capacity; // capacity of an allocation
149
150 // tape identifier
151 int tag = 0;
152 // AD domain space vector
153 ADVector a_x = thread_alloc::create_array&lt;ADScalar&gt;(n, capacity);
154 // AD range space vector
155 ADVector a_y = thread_alloc::create_array&lt;ADScalar&gt;(m, capacity);
156 // argument value in double
157 DblVector x = thread_alloc::create_array&lt;double&gt;(n, capacity);
158 // function value in double
159 DblVector y = thread_alloc::create_array&lt;double&gt;(m, capacity);
160
161
162 // options that control sparse_jac
163 int options[4];
164 extern bool global_boolsparsity;
165 if( global_boolsparsity )
166 options[0] = 1; // sparsity by propagation of bit pattern
167 else
168 options[0] = 0; // sparsity pattern by index domains
169 options[1] = 0; // (0 = safe mode, 1 = tight mode)
170 options[2] = 0; // see changing to -1 and back to 0 below
171 options[3] = 0; // (0 = column compression, 1 = row compression)
172
173 // structure that holds some of the work done by sparse_jac
174 int nnz; // number of non-zero values
175 SizeVector rind = CPPAD_NULL; // row indices
176 SizeVector cind = CPPAD_NULL; // column indices
177 DblVector values = CPPAD_NULL; // Jacobian values
178
179 // choose a value for x
180 CppAD::uniform_01(n, x);
181
182 // declare independent variables
183 int keep = 0; // keep forward mode results
184 trace_on(tag, keep);
185 for(j = 0; j &lt; n; j++)
186 a_x[j] &lt;&lt;= x[j];
187
188 // AD computation of f (x)
189 CppAD::sparse_jac_fun&lt;ADScalar&gt;(m, n, a_x, row, col, order, a_y);
190
191 // create function object f : x -&gt; y
192 for(i = 0; i &lt; m; i++)
193 a_y[i] &gt;&gt;= y[i];
194 trace_off();
195
196 // Retrieve n_sweep using undocumented feature of sparsedrivers.cpp
197 int same_pattern = 0;
198 options[2] = -1;
199 n_sweep = sparse_jac(tag, int(m), int(n),
200 same_pattern, x, &amp;nnz, &amp;rind, &amp;cind, &amp;values, options
201 );
202 options[2] = 0;
203 // ----------------------------------------------------------------------
204 if( ! global_onetape ) while(repeat--)
205 { // choose a value for x
206 CppAD::uniform_01(n, x);
207
208 // declare independent variables
209 trace_on(tag, keep);
210 for(j = 0; j &lt; n; j++)
211 a_x[j] &lt;&lt;= x[j];
212
213 // AD computation of f (x)
214 CppAD::sparse_jac_fun&lt;ADScalar&gt;(m, n, a_x, row, col, order, a_y);
215
216 // create function object f : x -&gt; y
217 for(i = 0; i &lt; m; i++)
218 a_y[i] &gt;&gt;= y[i];
219 trace_off();
220
221 // is this a repeat call with the same sparsity pattern
222 same_pattern = 0;
223
224 // calculate the jacobian at this x
225 rind = CPPAD_NULL;
226 cind = CPPAD_NULL;
227 values = CPPAD_NULL;
228 sparse_jac(tag, int(m), int(n),
229 same_pattern, x, &amp;nnz, &amp;rind, &amp;cind, &amp;values, options
230 );
231 // only needed last time through loop
232 if( repeat == 0 )
233 { size_t K = row.size();
234 for(int ell = 0; ell &lt; nnz; ell++)
235 { i = size_t(rind[ell]);
236 j = size_t(cind[ell]);
237 for(k = 0; k &lt; K; k++)
238 { if( row[k]==i &amp;&amp; col[k]==j )
239 jacobian[k] = values[ell];
240 }
241 }
242 }
243
244 // free raw memory allocated by sparse_jac
245 free(rind);
246 free(cind);
247 free(values);
248 }
249 else
250 { while(repeat--)
251 { // choose a value for x
252 CppAD::uniform_01(n, x);
253
254 // calculate the jacobian at this x
255 sparse_jac(tag, int(m), int(n),
256 same_pattern, x, &amp;nnz, &amp;rind, &amp;cind, &amp;values, options
257 );
258 same_pattern = 1;
259 }
260 size_t K = row.size();
261 for(int ell = 0; ell &lt; nnz; ell++)
262 { i = size_t(rind[ell]);
263 j = size_t(cind[ell]);
264 for(k = 0; k &lt; K; k++)
265 { if( row[k]==i &amp;&amp; col[k]==j )
266 jacobian[k] = values[ell];
267 }
268 }
269
270 // free raw memory allocated by sparse_jac
271 free(rind);
272 free(cind);
273 free(values);
274 }
275 // --------------------------------------------------------------------
276 // return argument
277 for(j = 0; j &lt; n; j++)
278 x_return[j] = x[j];
279
280 // tear down
281 thread_alloc::delete_array(a_x);
282 thread_alloc::delete_array(a_y);
283 thread_alloc::delete_array(x);
284 thread_alloc::delete_array(y);
285 return true;
128 if( global_atomic || (! global_colpack) )
129 return false;
130 if( global_memory || global_optimize )
131 return false;
132 // -----------------------------------------------------
133 // setup
134 typedef unsigned int* SizeVector;
135 typedef double* DblVector;
136 typedef adouble ADScalar;
137 typedef ADScalar* ADVector;
138
139 size_t i, j, k; // temporary indices
140 size_t n = size; // number of independent variables
141 size_t order = 0; // derivative order corresponding to function
142
143 // set up for thread_alloc memory allocator (fast and checks for leaks)
144 using CppAD::thread_alloc; // the allocator
145 size_t capacity; // capacity of an allocation
146
147 // tape identifier
148 int tag = 0;
149 // AD domain space vector
150 ADVector a_x = thread_alloc::create_array&lt;ADScalar&gt;(n, capacity);
151 // AD range space vector
152 ADVector a_y = thread_alloc::create_array&lt;ADScalar&gt;(m, capacity);
153 // argument value in double
154 DblVector x = thread_alloc::create_array&lt;double&gt;(n, capacity);
155 // function value in double
156 DblVector y = thread_alloc::create_array&lt;double&gt;(m, capacity);
157
158
159 // options that control sparse_jac
160 int options[4];
161 extern bool global_boolsparsity;
162 if( global_boolsparsity )
163 options[0] = 1; // sparsity by propagation of bit pattern
164 else
165 options[0] = 0; // sparsity pattern by index domains
166 options[1] = 0; // (0 = safe mode, 1 = tight mode)
167 options[2] = 0; // see changing to -1 and back to 0 below
168 options[3] = 0; // (0 = column compression, 1 = row compression)
169
170 // structure that holds some of the work done by sparse_jac
171 int nnz; // number of non-zero values
172 SizeVector rind = CPPAD_NULL; // row indices
173 SizeVector cind = CPPAD_NULL; // column indices
174 DblVector values = CPPAD_NULL; // Jacobian values
175
176 // choose a value for x
177 CppAD::uniform_01(n, x);
178
179 // declare independent variables
180 int keep = 0; // keep forward mode results
181 trace_on(tag, keep);
182 for(j = 0; j &lt; n; j++)
183 a_x[j] &lt;&lt;= x[j];
184
185 // AD computation of f (x)
186 CppAD::sparse_jac_fun&lt;ADScalar&gt;(m, n, a_x, row, col, order, a_y);
187
188 // create function object f : x -&gt; y
189 for(i = 0; i &lt; m; i++)
190 a_y[i] &gt;&gt;= y[i];
191 trace_off();
192
193 // Retrieve n_sweep using undocumented feature of sparsedrivers.cpp
194 int same_pattern = 0;
195 options[2] = -1;
196 n_sweep = sparse_jac(tag, int(m), int(n),
197 same_pattern, x, &amp;nnz, &amp;rind, &amp;cind, &amp;values, options
198 );
199 options[2] = 0;
200 // ----------------------------------------------------------------------
201 if( ! global_onetape ) while(repeat--)
202 { // choose a value for x
203 CppAD::uniform_01(n, x);
204
205 // declare independent variables
206 trace_on(tag, keep);
207 for(j = 0; j &lt; n; j++)
208 a_x[j] &lt;&lt;= x[j];
209
210 // AD computation of f (x)
211 CppAD::sparse_jac_fun&lt;ADScalar&gt;(m, n, a_x, row, col, order, a_y);
212
213 // create function object f : x -&gt; y
214 for(i = 0; i &lt; m; i++)
215 a_y[i] &gt;&gt;= y[i];
216 trace_off();
217
218 // is this a repeat call with the same sparsity pattern
219 same_pattern = 0;
220
221 // calculate the jacobian at this x
222 rind = CPPAD_NULL;
223 cind = CPPAD_NULL;
224 values = CPPAD_NULL;
225 sparse_jac(tag, int(m), int(n),
226 same_pattern, x, &amp;nnz, &amp;rind, &amp;cind, &amp;values, options
227 );
228 // only needed last time through loop
229 if( repeat == 0 )
230 { size_t K = row.size();
231 for(int ell = 0; ell &lt; nnz; ell++)
232 { i = size_t(rind[ell]);
233 j = size_t(cind[ell]);
234 for(k = 0; k &lt; K; k++)
235 { if( row[k]==i &amp;&amp; col[k]==j )
236 jacobian[k] = values[ell];
237 }
238 }
239 }
240
241 // free raw memory allocated by sparse_jac
242 free(rind);
243 free(cind);
244 free(values);
245 }
246 else
247 { while(repeat--)
248 { // choose a value for x
249 CppAD::uniform_01(n, x);
250
251 // calculate the jacobian at this x
252 sparse_jac(tag, int(m), int(n),
253 same_pattern, x, &amp;nnz, &amp;rind, &amp;cind, &amp;values, options
254 );
255 same_pattern = 1;
256 }
257 size_t K = row.size();
258 for(int ell = 0; ell &lt; nnz; ell++)
259 { i = size_t(rind[ell]);
260 j = size_t(cind[ell]);
261 for(k = 0; k &lt; K; k++)
262 { if( row[k]==i &amp;&amp; col[k]==j )
263 jacobian[k] = values[ell];
264 }
265 }
266
267 // free raw memory allocated by sparse_jac
268 free(rind);
269 free(cind);
270 free(values);
271 }
272 // --------------------------------------------------------------------
273 // return argument
274 for(j = 0; j &lt; n; j++)
275 x_return[j] = x[j];
276
277 // tear down
278 thread_alloc::delete_array(a_x);
279 thread_alloc::delete_array(a_y);
280 thread_alloc::delete_array(x);
281 thread_alloc::delete_array(y);
282 return true;
286283 }
287284 </pre></font></code>
288285
289
290286 <hr/>Input File: speed/adolc/sparse_jacobian.cpp
291287
292288 </body>
55 <title>AD Valued Operations and Functions</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="AD Valued Operations and Functions"/>
8 <meta name="keywords" id="keywords" content=" ad valued operations and functions "/>
8 <meta name="keywords" id="keywords" content=" ad valued operations functions "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
7979 </select>
8080 </td>
8181 </tr></table><br/>
82
83
84
8582 <center><b><big><big>Appendix</big></big></b></center>
8683 <br/>
8784 <b><big><a name="Contents" id="Contents">Contents</a></big></b>
55 <title>AD Arithmetic Operators and Computed Assignments</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="AD Arithmetic Operators and Computed Assignments"/>
8 <meta name="keywords" id="keywords" content=" ad arithmetic operators and computed assignments "/>
8 <meta name="keywords" id="keywords" content=" ad arithmetic operators computed assignments "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>The AD asin Function: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="The AD asin Function: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" the ad asin function: example and test "/>
8 <meta name="keywords" id="keywords" content=" the ad asin function: example test "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Inverse Sine and Hyperbolic Sine Forward Mode Theory</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Inverse Sine and Hyperbolic Sine Forward Mode Theory"/>
8 <meta name="keywords" id="keywords" content=" inverse sine and hyperbolic forward mode theory asin asinh derivatives taylor coefficients recursion "/>
8 <meta name="keywords" id="keywords" content=" inverse sine hyperbolic forward mode theory asin asinh derivatives taylor coefficients recursion "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Inverse Sine and Hyperbolic Sine Reverse Mode Theory</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Inverse Sine and Hyperbolic Sine Reverse Mode Theory"/>
8 <meta name="keywords" id="keywords" content=" inverse sine and hyperbolic reverse mode theory asin asinh "/>
8 <meta name="keywords" id="keywords" content=" inverse sine hyperbolic reverse mode theory asin asinh "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>The AD asinh Function: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="The AD asinh Function: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" the ad asinh function: example and test "/>
8 <meta name="keywords" id="keywords" content=" the ad asinh function: example test "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>The AD atan Function: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="The AD atan Function: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" the ad atan function: example and test "/>
8 <meta name="keywords" id="keywords" content=" the ad atan function: example test "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>The AD atan2 Function: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="The AD atan2 Function: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" the ad atan2 function: example and test "/>
8 <meta name="keywords" id="keywords" content=" the ad atan2 function: example test "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Inverse Tangent and Hyperbolic Tangent Forward Mode Theory</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Inverse Tangent and Hyperbolic Tangent Forward Mode Theory"/>
8 <meta name="keywords" id="keywords" content=" inverse tangent and hyperbolic forward mode theory atan atanh derivatives taylor coefficients recursion "/>
8 <meta name="keywords" id="keywords" content=" inverse tangent hyperbolic forward mode theory atan atanh derivatives taylor coefficients recursion "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Inverse Tangent and Hyperbolic Tangent Reverse Mode Theory</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Inverse Tangent and Hyperbolic Tangent Reverse Mode Theory"/>
8 <meta name="keywords" id="keywords" content=" inverse tangent and hyperbolic reverse mode theory "/>
8 <meta name="keywords" id="keywords" content=" inverse tangent hyperbolic reverse mode theory "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>The AD atanh Function: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="The AD atanh Function: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" the ad atanh function: example and test "/>
8 <meta name="keywords" id="keywords" content=" the ad atanh function: example test "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Using AD Version of Atomic Function</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Using AD Version of Atomic Function"/>
8 <meta name="keywords" id="keywords" content=" using ad version of atomic function syntax purpose advector afun ax ay examples "/>
8 <meta name="keywords" id="keywords" content=" using ad version atomic function syntax purpose advector afun ax ay examples "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Getting Started with Atomic Operations: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Getting Started with Atomic Operations: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" getting started with atomic operations: example and test purpose start class definition constructor forward end use function recording "/>
8 <meta name="keywords" id="keywords" content=" getting started with atomic operations: example test purpose start class definition constructor forward end use function recording "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
122122 using CppAD::vector; // abbreviate as vector
123123 class atomic_get_started : public CppAD::atomic_base&lt;double&gt; {
124124 </pre></font></code>
125
126
127 <br/>
128125 <br/>
129126 <b><big><a name="Constructor" id="Constructor">Constructor</a></big></b>
130127
131128 <code><font color='blue'><pre style='display:inline'>
132 public:
133 // constructor (could use const char* for name)
134 atomic_get_started(const std::string&amp; name) :
135 // this example does not use any sparsity patterns
136 CppAD::atomic_base&lt;double&gt;(name)
137 { }
138 private:
139 </pre></font></code>
140
141 <br/>
129 public:
130 // constructor (could use const char* for name)
131 atomic_get_started(const std::string&amp; name) :
132 // this example does not use any sparsity patterns
133 CppAD::atomic_base&lt;double&gt;(name)
134 { }
135 private:
136 </pre></font></code>
142137 <br/>
143138 <b><big><a name="forward" id="forward">forward</a></big></b>
144139
145140 <code><font color='blue'><pre style='display:inline'>
146 // forward mode routine called by CppAD
147 virtual bool forward(
148 size_t p ,
149 size_t q ,
150 const vector&lt;bool&gt;&amp; vx ,
151 vector&lt;bool&gt;&amp; vy ,
152 const vector&lt;double&gt;&amp; tx ,
153 vector&lt;double&gt;&amp; ty
154 )
155 { size_t n = tx.size() / (q + 1);
156 size_t m = ty.size() / (q + 1);
157 assert( n == 1 );
158 assert( m == 1 );
159
160 // return flag
161 bool ok = q == 0;
162 if( ! ok )
163 return ok;
164
165 // check for defining variable information
166 // This case must always be implemented
167 if( vx.size() &gt; 0 )
168 vy[0] = vx[0];
169
170 // Order zero forward mode.
171 // This case must always be implemented
172 // y^0 = f( x^0 ) = 1 / x^0
173 double f = 1. / tx[0];
174 if( p &lt;= 0 )
175 ty[0] = f;
176 return ok;
177 }
178 </pre></font></code>
179
180 <br/>
141 // forward mode routine called by CppAD
142 virtual bool forward(
143 size_t p ,
144 size_t q ,
145 const vector&lt;bool&gt;&amp; vx ,
146 vector&lt;bool&gt;&amp; vy ,
147 const vector&lt;double&gt;&amp; tx ,
148 vector&lt;double&gt;&amp; ty
149 )
150 { size_t n = tx.size() / (q + 1);
151 size_t m = ty.size() / (q + 1);
152 assert( n == 1 );
153 assert( m == 1 );
154
155 // return flag
156 bool ok = q == 0;
157 if( ! ok )
158 return ok;
159
160 // check for defining variable information
161 // This case must always be implemented
162 if( vx.size() &gt; 0 )
163 vy[0] = vx[0];
164
165 // Order zero forward mode.
166 // This case must always be implemented
167 // y^0 = f( x^0 ) = 1 / x^0
168 double f = 1. / tx[0];
169 if( p &lt;= 0 )
170 ty[0] = f;
171 return ok;
172 }
173 </pre></font></code>
181174 <br/>
182175 <b><big><a name="End Class Definition" id="End Class Definition">End Class Definition</a></big></b>
183176
186179 } // End empty namespace
187180
188181 </pre></font></code>
189
190 <br/>
191 <br/>
192182 <b><big><a name="Use Atomic Function" id="Use Atomic Function">Use Atomic Function</a></big></b>
193183
194184 <code><font color='blue'><pre style='display:inline'>
195185 bool get_started(void)
196 { bool ok = true;
197 using CppAD::AD;
198 using CppAD::NearEqual;
199 double eps = 10. * CppAD::numeric_limits&lt;double&gt;::epsilon();
200 </pre></font></code>
201
202 <br/>
186 { bool ok = true;
187 using CppAD::AD;
188 using CppAD::NearEqual;
189 double eps = 10. * CppAD::numeric_limits&lt;double&gt;::epsilon();
190 </pre></font></code>
203191 <br/>
204192 <b><a name="Use Atomic Function.Constructor" id="Use Atomic Function.Constructor">Constructor</a></b>
205193
206194 <code><font color='blue'><pre style='display:inline'>
207 // Create the atomic get_started object
208 atomic_get_started afun(&quot;atomic_get_started&quot;);
209 </pre></font></code>
210
211 <br/>
195 // Create the atomic get_started object
196 atomic_get_started afun(&quot;atomic_get_started&quot;);
197 </pre></font></code>
212198 <br/>
213199 <b><a name="Use Atomic Function.Recording" id="Use Atomic Function.Recording">Recording</a></b>
214200
215201 <code><font color='blue'><pre style='display:inline'>
216 // Create the function f(x)
217 //
218 // domain space vector
219 size_t n = 1;
220 double x0 = 0.5;
221 vector&lt; <a href="ad.xml" target="_top">AD</a>&lt;double&gt; &gt; ax(n);
222 ax[0] = x0;
223
224 // declare independent variables and start tape recording
225 CppAD::<a href="independent.xml" target="_top">Independent</a>(ax);
226
227 // range space vector
228 size_t m = 1;
229 vector&lt; <a href="ad.xml" target="_top">AD</a>&lt;double&gt; &gt; ay(m);
230
231 // call user function and store get_started(x) in au[0]
232 vector&lt; <a href="ad.xml" target="_top">AD</a>&lt;double&gt; &gt; au(m);
233 afun(ax, au); // u = 1 / x
234
235 // now use AD division to invert to invert the operation
236 ay[0] = 1.0 / au[0]; // y = 1 / u = x
237
238 // create f: x -&gt; y and stop tape recording
239 CppAD::<a href="funconstruct.xml" target="_top">ADFun</a>&lt;double&gt; f;
240 f.Dependent (ax, ay); // f(x) = x
241 </pre></font></code>
242
243 <br/>
202 // Create the function f(x)
203 //
204 // domain space vector
205 size_t n = 1;
206 double x0 = 0.5;
207 vector&lt; <a href="ad.xml" target="_top">AD</a>&lt;double&gt; &gt; ax(n);
208 ax[0] = x0;
209
210 // declare independent variables and start tape recording
211 CppAD::<a href="independent.xml" target="_top">Independent</a>(ax);
212
213 // range space vector
214 size_t m = 1;
215 vector&lt; <a href="ad.xml" target="_top">AD</a>&lt;double&gt; &gt; ay(m);
216
217 // call user function and store get_started(x) in au[0]
218 vector&lt; <a href="ad.xml" target="_top">AD</a>&lt;double&gt; &gt; au(m);
219 afun(ax, au); // u = 1 / x
220
221 // now use AD division to invert to invert the operation
222 ay[0] = 1.0 / au[0]; // y = 1 / u = x
223
224 // create f: x -&gt; y and stop tape recording
225 CppAD::<a href="funconstruct.xml" target="_top">ADFun</a>&lt;double&gt; f;
226 f.Dependent (ax, ay); // f(x) = x
227 </pre></font></code>
244228 <br/>
245229 <b><a name="Use Atomic Function.forward" id="Use Atomic Function.forward">forward</a></b>
246230
247231 <code><font color='blue'><pre style='display:inline'>
248 // check function value
249 double check = x0;
250 ok &amp;= <a href="nearequal.xml" target="_top">NearEqual</a>( Value(ay[0]) , check, eps, eps);
251
252 // check zero order forward mode
253 size_t q;
254 vector&lt;double&gt; x_q(n), y_q(m);
255 q = 0;
256 x_q[0] = x0;
257 y_q = f.<a href="forward.xml" target="_top">Forward</a>(q, x_q);
258 ok &amp;= <a href="nearequal.xml" target="_top">NearEqual</a>(y_q[0] , check, eps, eps);
259
260 return ok;
232 // check function value
233 double check = x0;
234 ok &amp;= <a href="nearequal.xml" target="_top">NearEqual</a>( Value(ay[0]) , check, eps, eps);
235
236 // check zero order forward mode
237 size_t q;
238 vector&lt;double&gt; x_q(n), y_q(m);
239 q = 0;
240 x_q[0] = x0;
241 y_q = f.<a href="forward.xml" target="_top">Forward</a>(q, x_q);
242 ok &amp;= <a href="nearequal.xml" target="_top">NearEqual</a>(y_q[0] , check, eps, eps);
243
244 return ok;
261245 }
262246 </pre></font></code>
263
264
265247
266248 <hr/>Input File: example/atomic/get_started.cpp
267249
55 <title>Atomic Operation Hessian Sparsity: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Atomic Operation Hessian Sparsity: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" atomic operation hessian sparsity: example and test sparsity purpose start class definition constructor forward for_sparse_jac rev_sparse_hes use function with x_1 both a variable parameter "/>
8 <meta name="keywords" id="keywords" content=" atomic operation hessian sparsity: example test sparsity purpose start class definition constructor forward for_sparse_jac rev_sparse_hes use function with x_1 both variable parameter "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
9999 </select>
100100 </td>
101101 </tr></table><br/>
102
103
104102 <center><b><big><big>Atomic Operation Hessian Sparsity: Example and Test</big></big></b></center>
105103 <br/>
106104 <b><big><a name="Purpose" id="Purpose">Purpose</a></big></b>
121119 //
122120 // a utility to compute the union of two sets.
123121 void my_union(
124 std::set&lt;size_t&gt;&amp; result ,
125 const std::set&lt;size_t&gt;&amp; left ,
126 const std::set&lt;size_t&gt;&amp; right )
127 { std::set&lt;size_t&gt; temp;
128 std::set_union(
129 left.begin() ,
130 left.end() ,
131 right.begin() ,
132 right.end() ,
133 std::inserter(temp, temp.begin())
134 );
135 result.swap(temp);
122 std::set&lt;size_t&gt;&amp; result ,
123 const std::set&lt;size_t&gt;&amp; left ,
124 const std::set&lt;size_t&gt;&amp; right )
125 { std::set&lt;size_t&gt; temp;
126 std::set_union(
127 left.begin() ,
128 left.end() ,
129 right.begin() ,
130 right.end() ,
131 std::inserter(temp, temp.begin())
132 );
133 result.swap(temp);
136134 }
137135 //
138136 class atomic_hes_sparse : public CppAD::atomic_base&lt;double&gt; {
139137 </pre></font></code>
140
141 <br/>
142138 <br/>
143139 <b><big><a name="Constructor" id="Constructor">Constructor</a></big></b>
144140
145141 <code><font color='blue'><pre style='display:inline'>
146 public:
147 // constructor (could use const char* for name)
148 atomic_hes_sparse(const std::string&amp; name) :
149 CppAD::atomic_base&lt;double&gt;(name)
150 { }
151 private:
152 </pre></font></code>
153
154 <br/>
142 public:
143 // constructor (could use const char* for name)
144 atomic_hes_sparse(const std::string&amp; name) :
145 CppAD::atomic_base&lt;double&gt;(name)
146 { }
147 private:
148 </pre></font></code>
155149 <br/>
156150 <b><big><a name="forward" id="forward">forward</a></big></b>
157151
158152 <code><font color='blue'><pre style='display:inline'>
159 // forward mode routine called by CppAD
160 virtual bool forward(
161 size_t p ,
162 size_t q ,
163 const vector&lt;bool&gt;&amp; vx ,
164 vector&lt;bool&gt;&amp; vy ,
165 const vector&lt;double&gt;&amp; tx ,
166 vector&lt;double&gt;&amp; ty
167 )
168 { size_t n = tx.size() / (q + 1);
169 size_t m = ty.size() / (q + 1);
170 assert( n == 2 );
171 assert( m == 2 );
172
173 // return flag
174 bool ok = q == 0;
175 if( ! ok )
176 return ok;
177
178 // check for defining variable information
179 // This case must always be implemented
180 if( vx.size() &gt; 0 )
181 { vy[0] = vx[0];
182 vy[1] = vx[0] || vy[0];
183 }
184
185 // Order zero forward mode.
186 // This case must always be implemented
187 // y^0 = f( x^0 ) = [ x0_0 * x0_0 , x0_0 * x0_1 ]^T
188 assert( p &lt;= 0 );
189 if( p &lt;= 0 )
190 { ty[0] = tx[0] * tx[0];
191 ty[1] = tx[0] * tx[1];
192 }
193 return ok;
194 }
195 </pre></font></code>
196
197 <br/>
153 // forward mode routine called by CppAD
154 virtual bool forward(
155 size_t p ,
156 size_t q ,
157 const vector&lt;bool&gt;&amp; vx ,
158 vector&lt;bool&gt;&amp; vy ,
159 const vector&lt;double&gt;&amp; tx ,
160 vector&lt;double&gt;&amp; ty
161 )
162 { size_t n = tx.size() / (q + 1);
163 size_t m = ty.size() / (q + 1);
164 assert( n == 2 );
165 assert( m == 2 );
166
167 // return flag
168 bool ok = q == 0;
169 if( ! ok )
170 return ok;
171
172 // check for defining variable information
173 // This case must always be implemented
174 if( vx.size() &gt; 0 )
175 { vy[0] = vx[0];
176 vy[1] = vx[0] || vy[0];
177 }
178
179 // Order zero forward mode.
180 // This case must always be implemented
181 // y^0 = f( x^0 ) = [ x0_0 * x0_0 , x0_0 * x0_1 ]^T
182 assert( p &lt;= 0 );
183 if( p &lt;= 0 )
184 { ty[0] = tx[0] * tx[0];
185 ty[1] = tx[0] * tx[1];
186 }
187 return ok;
188 }
189 </pre></font></code>
198190 <br/>
199191 <b><big><a name="for_sparse_jac" id="for_sparse_jac">for_sparse_jac</a></big></b>
200192
201193 <code><font color='blue'><pre style='display:inline'>
202 // forward Jacobian set sparsity routine called by CppAD
203 virtual bool for_sparse_jac(
204 size_t p ,
205 const vector&lt; std::set&lt;size_t&gt; &gt;&amp; r ,
206 vector&lt; std::set&lt;size_t&gt; &gt;&amp; s )
207 { // This function needed if using f.ForSparseJac
208 // with afun.option( CppAD::atomic_base&lt;double&gt;::set_sparsity_enum )
209 size_t n = r.size();
210 size_t m = s.size();
211 assert( n == 2 );
212 assert( m == 2 );
213
214 // sparsity for S(x) = f'(x) * R is union of rows of R
215 s[0] = r[0];
216 my_union(s[1], r[0], r[1]);
217
218 return true;
219 }
220 </pre></font></code>
221
222 <br/>
194 // forward Jacobian set sparsity routine called by CppAD
195 virtual bool for_sparse_jac(
196 size_t p ,
197 const vector&lt; std::set&lt;size_t&gt; &gt;&amp; r ,
198 vector&lt; std::set&lt;size_t&gt; &gt;&amp; s )
199 { // This function needed if using f.ForSparseJac
200 // with afun.option( CppAD::atomic_base&lt;double&gt;::set_sparsity_enum )
201 size_t n = r.size();
202 size_t m = s.size();
203 assert( n == 2 );
204 assert( m == 2 );
205
206 // sparsity for S(x) = f'(x) * R is union of rows of R
207 s[0] = r[0];
208 my_union(s[1], r[0], r[1]);
209
210 return true;
211 }
212 </pre></font></code>
223213 <br/>
224214 <b><big><a name="rev_sparse_hes" id="rev_sparse_hes">rev_sparse_hes</a></big></b>
225215
226216 <code><font color='blue'><pre style='display:inline'>
227 // reverse Hessian set sparsity routine called by CppAD
228 virtual bool rev_sparse_hes(
229 const vector&lt;bool&gt;&amp; vx,
230 const vector&lt;bool&gt;&amp; s ,
231 vector&lt;bool&gt;&amp; t ,
232 size_t p ,
233 const vector&lt; std::set&lt;size_t&gt; &gt;&amp; r ,
234 const vector&lt; std::set&lt;size_t&gt; &gt;&amp; u ,
235 vector&lt; std::set&lt;size_t&gt; &gt;&amp; v )
236 { // This function needed if using RevSparseHes
237 // with afun.option( CppAD::atomic_base&lt;double&gt;::set_sparsity_enum )
238 size_t n = vx.size();
239 size_t m = s.size();
240 assert( t.size() == n );
241 assert( r.size() == n );
242 assert( u.size() == m );
243 assert( v.size() == n );
244 assert( n == 2 );
245 assert( m == 2 );
246
247 // There are no cross term second derivatives for this case,
248 // so it is not necessary to vx.
249
250 // sparsity for T(x) = S(x) * f'(x)
251 t[0] = s[0];
252 t[1] = s[0] || s[1];
253
254 // V(x) = f'(x)^T * g''(y) * f'(x) * R + g'(y) * f''(x) * R
255 // U(x) = g''(y) * f'(x) * R
256 // S(x) = g'(y)
257
258 // back propagate the sparsity for U,
259 // note both components of f'(x) may be non-zero;
260 v[0] = u[0];
261 my_union(v[1], u[0], u[1]);
262
263 // include forward Jacobian sparsity in Hessian sparsity
264 // f_0''(x) * R
265 if( s[0] )
266 my_union(v[0], v[0], r[0] );
267 // f_1''(x) * R
268 if( s[1] )
269 { my_union(v[1], v[1], r[0] );
270 my_union(v[0], v[0], r[1] );
271 }
272 return true;
273 }
217 // reverse Hessian set sparsity routine called by CppAD
218 virtual bool rev_sparse_hes(
219 const vector&lt;bool&gt;&amp; vx,
220 const vector&lt;bool&gt;&amp; s ,
221 vector&lt;bool&gt;&amp; t ,
222 size_t p ,
223 const vector&lt; std::set&lt;size_t&gt; &gt;&amp; r ,
224 const vector&lt; std::set&lt;size_t&gt; &gt;&amp; u ,
225 vector&lt; std::set&lt;size_t&gt; &gt;&amp; v )
226 { // This function needed if using RevSparseHes
227 // with afun.option( CppAD::atomic_base&lt;double&gt;::set_sparsity_enum )
228 size_t n = vx.size();
229 size_t m = s.size();
230 assert( t.size() == n );
231 assert( r.size() == n );
232 assert( u.size() == m );
233 assert( v.size() == n );
234 assert( n == 2 );
235 assert( m == 2 );
236
237 // There are no cross term second derivatives for this case,
238 // so it is not necessary to vx.
239
240 // sparsity for T(x) = S(x) * f'(x)
241 t[0] = s[0];
242 t[1] = s[0] || s[1];
243
244 // V(x) = f'(x)^T * g''(y) * f'(x) * R + g'(y) * f''(x) * R
245 // U(x) = g''(y) * f'(x) * R
246 // S(x) = g'(y)
247
248 // back propagate the sparsity for U,
249 // note both components of f'(x) may be non-zero;
250 v[0] = u[0];
251 my_union(v[1], u[0], u[1]);
252
253 // include forward Jacobian sparsity in Hessian sparsity
254 // f_0''(x) * R
255 if( s[0] )
256 my_union(v[0], v[0], r[0] );
257 // f_1''(x) * R
258 if( s[1] )
259 { my_union(v[1], v[1], r[0] );
260 my_union(v[0], v[0], r[1] );
261 }
262 return true;
263 }
274264 }; // End of atomic_hes_sparse class
275265
276266 </pre></font></code>
277
278 <br/>
279 <br/>
280267 <b><big><a name="Use Atomic Function" id="Use Atomic Function">Use Atomic Function</a></big></b>
281268
282269 <code><font color='blue'><pre style='display:inline'>
283270 bool use_atomic_hes_sparse(bool x_1_variable)
284 { bool ok = true;
285 using CppAD::AD;
286 using CppAD::NearEqual;
287 double eps = 10. * CppAD::numeric_limits&lt;double&gt;::epsilon();
288 //
289 // Create the atomic hes_sparse object
290 atomic_hes_sparse afun(&quot;atomic_hes_sparse&quot;);
291 //
292 // Create the function f(u)
293 //
294 // domain space vector
295 size_t n = 2;
296 double x0_0 = 0.75, x0_1 = 2.00;
297 vector&lt; <a href="ad.xml" target="_top">AD</a>&lt;double&gt; &gt; au(n);
298 au[0] = x0_0;
299 au[1] = x0_1;
300
301 // declare independent variables and start tape recording
302 CppAD::<a href="independent.xml" target="_top">Independent</a>(au);
303
304 // range space vector
305 size_t m = 2;
306 vector&lt; <a href="ad.xml" target="_top">AD</a>&lt;double&gt; &gt; ay(m);
307
308 // call user function
309 vector&lt; <a href="ad.xml" target="_top">AD</a>&lt;double&gt; &gt; ax(n);
310 ax[0] = au[0];
311 if( x_1_variable )
312 ax[1] = au[1];
313 else
314 ax[1] = x0_1;
315 afun(ax, ay); // y = [ x[0] * x[0] , x[0] * x[1] ] ^T
316
317 // create f: u -&gt; y and stop tape recording
318 CppAD::<a href="funconstruct.xml" target="_top">ADFun</a>&lt;double&gt; f;
319 f.Dependent (au, ay); // f(u) = y
320 //
321 // check function value
322 double check_y0_0 = x0_0 * x0_0;
323 double check_y0_1 = x0_0 * x0_1;
324 ok &amp;= <a href="nearequal.xml" target="_top">NearEqual</a>( Value(ay[0]) , check_y0_0, eps, eps);
325 ok &amp;= <a href="nearequal.xml" target="_top">NearEqual</a>( Value(ay[1]) , check_y0_1, eps, eps);
326
327 // check zero order forward mode
328 size_t q;
329 vector&lt;double&gt; uq(n), yq(m);
330 q = 0;
331 uq[0] = x0_0;
332 uq[1] = x0_1;
333 yq = f.<a href="forward.xml" target="_top">Forward</a>(q, uq);
334 ok &amp;= <a href="nearequal.xml" target="_top">NearEqual</a>(yq[0] , check_y0_0, eps, eps);
335 ok &amp;= <a href="nearequal.xml" target="_top">NearEqual</a>(yq[1] , check_y0_1, eps, eps);
336
337 // forward sparse jacobian
338 afun.option( CppAD::atomic_base&lt;double&gt;::set_sparsity_enum );
339 vector&lt; std::set&lt;size_t&gt; &gt; r(2), jac_s(2), check_s(2);
340 r[0].insert(0);
341 r[1].insert(1);
342 jac_s = f.ForSparseJac(n, r);
343 check_s[0].insert(0);
344 ok &amp;= jac_s[0] == check_s[0];
345 check_s[1].insert(0);
346 if( x_1_variable )
347 check_s[1].insert(1);
348 ok &amp;= jac_s[1] == check_s[1];
349
350 // reverse sparse Hessian
351 vector&lt; std::set&lt;size_t&gt; &gt; h(2), check_h(2), hes_s(1);
352 hes_s[0].insert(0);
353 hes_s[0].insert(1);
354 h = f.RevSparseHes(n, hes_s);
355 check_h[0].insert(0);
356 if( x_1_variable )
357 check_h[0].insert(1);
358 ok &amp;= h[0] == check_h[0];
359 if( x_1_variable )
360 check_h[1].insert(0);
361 ok &amp;= h[1] == check_h[1];
362
363 return ok;
271 { bool ok = true;
272 using CppAD::AD;
273 using CppAD::NearEqual;
274 double eps = 10. * CppAD::numeric_limits&lt;double&gt;::epsilon();
275 //
276 // Create the atomic hes_sparse object
277 atomic_hes_sparse afun(&quot;atomic_hes_sparse&quot;);
278 //
279 // Create the function f(u)
280 //
281 // domain space vector
282 size_t n = 2;
283 double x0_0 = 0.75, x0_1 = 2.00;
284 vector&lt; <a href="ad.xml" target="_top">AD</a>&lt;double&gt; &gt; au(n);
285 au[0] = x0_0;
286 au[1] = x0_1;
287
288 // declare independent variables and start tape recording
289 CppAD::<a href="independent.xml" target="_top">Independent</a>(au);
290
291 // range space vector
292 size_t m = 2;
293 vector&lt; <a href="ad.xml" target="_top">AD</a>&lt;double&gt; &gt; ay(m);
294
295 // call user function
296 vector&lt; <a href="ad.xml" target="_top">AD</a>&lt;double&gt; &gt; ax(n);
297 ax[0] = au[0];
298 if( x_1_variable )
299 ax[1] = au[1];
300 else
301 ax[1] = x0_1;
302 afun(ax, ay); // y = [ x[0] * x[0] , x[0] * x[1] ] ^T
303
304 // create f: u -&gt; y and stop tape recording
305 CppAD::<a href="funconstruct.xml" target="_top">ADFun</a>&lt;double&gt; f;
306 f.Dependent (au, ay); // f(u) = y
307 //
308 // check function value
309 double check_y0_0 = x0_0 * x0_0;
310 double check_y0_1 = x0_0 * x0_1;
311 ok &amp;= <a href="nearequal.xml" target="_top">NearEqual</a>( Value(ay[0]) , check_y0_0, eps, eps);
312 ok &amp;= <a href="nearequal.xml" target="_top">NearEqual</a>( Value(ay[1]) , check_y0_1, eps, eps);
313
314 // check zero order forward mode
315 size_t q;
316 vector&lt;double&gt; uq(n), yq(m);
317 q = 0;
318 uq[0] = x0_0;
319 uq[1] = x0_1;
320 yq = f.<a href="forward.xml" target="_top">Forward</a>(q, uq);
321 ok &amp;= <a href="nearequal.xml" target="_top">NearEqual</a>(yq[0] , check_y0_0, eps, eps);
322 ok &amp;= <a href="nearequal.xml" target="_top">NearEqual</a>(yq[1] , check_y0_1, eps, eps);
323
324 // forward sparse jacobian
325 afun.option( CppAD::atomic_base&lt;double&gt;::set_sparsity_enum );
326 vector&lt; std::set&lt;size_t&gt; &gt; r(2), jac_s(2), check_s(2);
327 r[0].insert(0);
328 r[1].insert(1);
329 jac_s = f.ForSparseJac(n, r);
330 check_s[0].insert(0);
331 ok &amp;= jac_s[0] == check_s[0];
332 check_s[1].insert(0);
333 if( x_1_variable )
334 check_s[1].insert(1);
335 ok &amp;= jac_s[1] == check_s[1];
336
337 // reverse sparse Hessian
338 vector&lt; std::set&lt;size_t&gt; &gt; h(2), check_h(2), hes_s(1);
339 hes_s[0].insert(0);
340 hes_s[0].insert(1);
341 h = f.RevSparseHes(n, hes_s);
342 check_h[0].insert(0);
343 if( x_1_variable )
344 check_h[0].insert(1);
345 ok &amp;= h[0] == check_h[0];
346 if( x_1_variable )
347 check_h[1].insert(0);
348 ok &amp;= h[1] == check_h[1];
349
350 return ok;
364351 }
365352 } // End empty namespace
366353 </pre></font></code>
367
368 <br/>
369354 <br/>
370355 <b><big><a name="Test with x_1 Both a Variable and a Parameter" id="Test with x_1 Both a Variable and a Parameter">Test with x_1 Both a Variable and a Parameter</a></big></b>
371356
372357 <code><font color='blue'><pre style='display:inline'>
373358 bool hes_sparse(void)
374 { bool ok = true;
375 // test with x_1 a variable
376 ok &amp;= use_atomic_hes_sparse(true);
377 // test with x_1 a parameter
378 ok &amp;= use_atomic_hes_sparse(false);
379 return ok;
359 { bool ok = true;
360 // test with x_1 a variable
361 ok &amp;= use_atomic_hes_sparse(true);
362 // test with x_1 a parameter
363 ok &amp;= use_atomic_hes_sparse(false);
364 return ok;
380365 }
381366 </pre></font></code>
382
383
384367
385368 <hr/>Input File: example/atomic/hes_sparse.cpp
386369
55 <title>User Atomic Matrix Multiply: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="User Atomic Matrix Multiply: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" user atomic matrix multiply: example and test multiply class definition use function constructor recording forward reverse option for_sparse_jac rev_sparse_jac rev_sparse_hes "/>
8 <meta name="keywords" id="keywords" content=" user atomic matrix multiply: example test multiply class definition use function constructor recording forward reverse option for_sparse_jac rev_sparse_jac rev_sparse_hes "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
106106 </select>
107107 </td>
108108 </tr></table><br/>
109
110
111
112109 <center><b><big><big>User Atomic Matrix Multiply: Example and Test</big></big></b></center>
113110 <br/>
114111 <b><big><a name="Class Definition" id="Class Definition">Class Definition</a></big></b>
129126 # include &lt;cppad/example/matrix_mul.hpp&gt;
130127
131128 bool mat_mul(void)
132 { bool ok = true;
133 using CppAD::AD;
134 using CppAD::vector;
135 size_t i, j;
136 </pre></font></code>
137
138 <br/>
129 { bool ok = true;
130 using CppAD::AD;
131 using CppAD::vector;
132 size_t i, j;
133 </pre></font></code>
139134 <br/>
140135 <b><a name="Use Atomic Function.Constructor" id="Use Atomic Function.Constructor">Constructor</a></b>
141136
142137 <code><font color='blue'><pre style='display:inline'>
143 // -------------------------------------------------------------------
144 // object that multiplies 2 x 2 matrices
145 size_t nr_result = 2;
146 size_t n_middle = 2;
147 size_t nc_result = 2;
148 matrix_mul afun(nr_result, n_middle, nc_result);
149 </pre></font></code>
150
151 <br/>
138 // -------------------------------------------------------------------
139 // object that multiplies 2 x 2 matrices
140 size_t nr_result = 2;
141 size_t n_middle = 2;
142 size_t nc_result = 2;
143 matrix_mul afun(nr_result, n_middle, nc_result);
144 </pre></font></code>
152145 <br/>
153146 <b><a name="Use Atomic Function.Recording" id="Use Atomic Function.Recording">Recording</a></b>
154147
155148 <code><font color='blue'><pre style='display:inline'>
156 // start recording with four independent varables
157 size_t n = 4;
158 vector&lt;double&gt; x(n);
159 vector&lt; <a href="ad.xml" target="_top">AD</a>&lt;double&gt; &gt; ax(n);
160 for(j = 0; j &lt; n; j++)
161 ax[j] = x[j] = j + 1;
162 CppAD::<a href="independent.xml" target="_top">Independent</a>(ax);
163
164 // ------------------------------------------------------------------
165 vector&lt; <a href="ad.xml" target="_top">AD</a>&lt;double&gt; &gt; atom_x(nr_result * n_middle + n_middle * nc_result);
166
167 // left matrix
168 atom_x[0] = ax[0]; // left[0, 0] = x0
169 atom_x[1] = ax[1]; // left[0, 1] = x1
170 atom_x[2] = 5.; // left[1, 0] = 5
171 atom_x[3] = 6.; // left[1, 1] = 6
172
173 // right matix
174 atom_x[4] = ax[2]; // right[0, 0] = x2
175 atom_x[5] = 7.; // right[0, 1] = 7
176 atom_x[6] = ax[3]; // right[1, 0] = x3
177 atom_x[7] = 8.; // right[1, 1] = 8
178 // ------------------------------------------------------------------
179 /*
180 [ x0 , x1 ] * [ x2 , 7 ] = [ x0*x2 + x1*x3 , x0*7 + x1*8 ]
181 [ 5 , 6 ] [ x3 , 8 ] [ 5*x2 + 6*x3 , 5*7 + 6*8 ]
182 */
183 vector&lt; <a href="ad.xml" target="_top">AD</a>&lt;double&gt; &gt; atom_y(nr_result * nc_result);
184 afun(atom_x, atom_y);
185
186 ok &amp;= (atom_y[0] == x[0]*x[2] + x[1]*x[3]) &amp; Variable(atom_y[0]);
187 ok &amp;= (atom_y[1] == x[0]*7. + x[1]*8. ) &amp; Variable(atom_y[1]);
188 ok &amp;= (atom_y[2] == 5.*x[2] + 6.*x[3]) &amp; Variable(atom_y[2]);
189 ok &amp;= (atom_y[3] == 5.*7. + 6.*8. ) &amp; Parameter(atom_y[3]);
190
191 // ------------------------------------------------------------------
192 // define the function g : x -&gt; atom_y
193 // g(x) = [ x0*x2 + x1*x3 , x0*7 + x1*8 , 5*x2 + 6*x3 , 5*7 + 6*8 ]^T
194 CppAD::<a href="funconstruct.xml" target="_top">ADFun</a>&lt;double&gt; g(ax, atom_y);
195 </pre></font></code>
196
197 <br/>
149 // start recording with four independent varables
150 size_t n = 4;
151 vector&lt;double&gt; x(n);
152 vector&lt; <a href="ad.xml" target="_top">AD</a>&lt;double&gt; &gt; ax(n);
153 for(j = 0; j &lt; n; j++)
154 ax[j] = x[j] = j + 1;
155 CppAD::<a href="independent.xml" target="_top">Independent</a>(ax);
156
157 // ------------------------------------------------------------------
158 vector&lt; <a href="ad.xml" target="_top">AD</a>&lt;double&gt; &gt; atom_x(nr_result * n_middle + n_middle * nc_result);
159
160 // left matrix
161 atom_x[0] = ax[0]; // left[0, 0] = x0
162 atom_x[1] = ax[1]; // left[0, 1] = x1
163 atom_x[2] = 5.; // left[1, 0] = 5
164 atom_x[3] = 6.; // left[1, 1] = 6
165
166 // right matix
167 atom_x[4] = ax[2]; // right[0, 0] = x2
168 atom_x[5] = 7.; // right[0, 1] = 7
169 atom_x[6] = ax[3]; // right[1, 0] = x3
170 atom_x[7] = 8.; // right[1, 1] = 8
171 // ------------------------------------------------------------------
172 /*
173 [ x0 , x1 ] * [ x2 , 7 ] = [ x0*x2 + x1*x3 , x0*7 + x1*8 ]
174 [ 5 , 6 ] [ x3 , 8 ] [ 5*x2 + 6*x3 , 5*7 + 6*8 ]
175 */
176 vector&lt; <a href="ad.xml" target="_top">AD</a>&lt;double&gt; &gt; atom_y(nr_result * nc_result);
177 afun(atom_x, atom_y);
178
179 ok &amp;= (atom_y[0] == x[0]*x[2] + x[1]*x[3]) &amp; Variable(atom_y[0]);
180 ok &amp;= (atom_y[1] == x[0]*7. + x[1]*8. ) &amp; Variable(atom_y[1]);
181 ok &amp;= (atom_y[2] == 5.*x[2] + 6.*x[3]) &amp; Variable(atom_y[2]);
182 ok &amp;= (atom_y[3] == 5.*7. + 6.*8. ) &amp; Parameter(atom_y[3]);
183
184 // ------------------------------------------------------------------
185 // define the function g : x -&gt; atom_y
186 // g(x) = [ x0*x2 + x1*x3 , x0*7 + x1*8 , 5*x2 + 6*x3 , 5*7 + 6*8 ]^T
187 CppAD::<a href="funconstruct.xml" target="_top">ADFun</a>&lt;double&gt; g(ax, atom_y);
188 </pre></font></code>
198189 <br/>
199190 <b><a name="Use Atomic Function.forward" id="Use Atomic Function.forward">forward</a></b>
200191
201192 <code><font color='blue'><pre style='display:inline'>
202 // Test zero order forward mode evaluation of g(x)
203 size_t m = atom_y.size();
204 vector&lt;double&gt; y(m);
205 for(j = 0; j &lt; n; j++)
206 x[j] = j + 2;
207 y = g.<a href="forward.xml" target="_top">Forward</a>(0, x);
208 ok &amp;= y[0] == x[0] * x[2] + x[1] * x[3];
209 ok &amp;= y[1] == x[0] * 7. + x[1] * 8.;
210 ok &amp;= y[2] == 5. * x[2] + 6. * x[3];
211 ok &amp;= y[3] == 5. * 7. + 6. * 8.;
212
213 //----------------------------------------------------------------------
214 // Test first order forward mode evaluation of g'(x) * [1, 2, 3, 4]^T
215 // g'(x) = [ x2, x3, x0, x1 ]
216 // [ 7 , 8, 0, 0 ]
217 // [ 0 , 0, 5, 6 ]
218 // [ 0 , 0, 0, 0 ]
219 CppAD::vector&lt;double&gt; dx(n), dy(m);
220 for(j = 0; j &lt; n; j++)
221 dx[j] = j + 1;
222 dy = g.<a href="forward.xml" target="_top">Forward</a>(1, dx);
223 ok &amp;= dy[0] == 1. * x[2] + 2. * x[3] + 3. * x[0] + 4. * x[1];
224 ok &amp;= dy[1] == 1. * 7. + 2. * 8. + 3. * 0. + 4. * 0.;
225 ok &amp;= dy[2] == 1. * 0. + 2. * 0. + 3. * 5. + 4. * 6.;
226 ok &amp;= dy[3] == 1. * 0. + 2. * 0. + 3. * 0. + 4. * 0.;
227
228 //----------------------------------------------------------------------
229 // Test second order forward mode
230 // g_0^2 (x) = [ 0, 0, 1, 0 ], g_0^2 (x) * [1] = [3]
231 // [ 0, 0, 0, 1 ] [2] [4]
232 // [ 1, 0, 0, 0 ] [3] [1]
233 // [ 0, 1, 0, 0 ] [4] [2]
234 CppAD::vector&lt;double&gt; ddx(n), ddy(m);
235 for(j = 0; j &lt; n; j++)
236 ddx[j] = 0.;
237 ddy = g.<a href="forward.xml" target="_top">Forward</a>(2, ddx);
238
239 // [1, 2, 3, 4] * g_0^2 (x) * [1, 2, 3, 4]^T = 1*3 + 2*4 + 3*1 + 4*2
240 ok &amp;= 2. * ddy[0] == 1. * 3. + 2. * 4. + 3. * 1. + 4. * 2.;
241
242 // for i &gt; 0, [1, 2, 3, 4] * g_i^2 (x) * [1, 2, 3, 4]^T = 0
243 ok &amp;= ddy[1] == 0.;
244 ok &amp;= ddy[2] == 0.;
245 ok &amp;= ddy[3] == 0.;
246 </pre></font></code>
247
248 <br/>
193 // Test zero order forward mode evaluation of g(x)
194 size_t m = atom_y.size();
195 vector&lt;double&gt; y(m);
196 for(j = 0; j &lt; n; j++)
197 x[j] = j + 2;
198 y = g.<a href="forward.xml" target="_top">Forward</a>(0, x);
199 ok &amp;= y[0] == x[0] * x[2] + x[1] * x[3];
200 ok &amp;= y[1] == x[0] * 7. + x[1] * 8.;
201 ok &amp;= y[2] == 5. * x[2] + 6. * x[3];
202 ok &amp;= y[3] == 5. * 7. + 6. * 8.;
203
204 //----------------------------------------------------------------------
205 // Test first order forward mode evaluation of g'(x) * [1, 2, 3, 4]^T
206 // g'(x) = [ x2, x3, x0, x1 ]
207 // [ 7 , 8, 0, 0 ]
208 // [ 0 , 0, 5, 6 ]
209 // [ 0 , 0, 0, 0 ]
210 CppAD::vector&lt;double&gt; dx(n), dy(m);
211 for(j = 0; j &lt; n; j++)
212 dx[j] = j + 1;
213 dy = g.<a href="forward.xml" target="_top">Forward</a>(1, dx);
214 ok &amp;= dy[0] == 1. * x[2] + 2. * x[3] + 3. * x[0] + 4. * x[1];
215 ok &amp;= dy[1] == 1. * 7. + 2. * 8. + 3. * 0. + 4. * 0.;
216 ok &amp;= dy[2] == 1. * 0. + 2. * 0. + 3. * 5. + 4. * 6.;
217 ok &amp;= dy[3] == 1. * 0. + 2. * 0. + 3. * 0. + 4. * 0.;
218
219 //----------------------------------------------------------------------
220 // Test second order forward mode
221 // g_0^2 (x) = [ 0, 0, 1, 0 ], g_0^2 (x) * [1] = [3]
222 // [ 0, 0, 0, 1 ] [2] [4]
223 // [ 1, 0, 0, 0 ] [3] [1]
224 // [ 0, 1, 0, 0 ] [4] [2]
225 CppAD::vector&lt;double&gt; ddx(n), ddy(m);
226 for(j = 0; j &lt; n; j++)
227 ddx[j] = 0.;
228 ddy = g.<a href="forward.xml" target="_top">Forward</a>(2, ddx);
229
230 // [1, 2, 3, 4] * g_0^2 (x) * [1, 2, 3, 4]^T = 1*3 + 2*4 + 3*1 + 4*2
231 ok &amp;= 2. * ddy[0] == 1. * 3. + 2. * 4. + 3. * 1. + 4. * 2.;
232
233 // for i &gt; 0, [1, 2, 3, 4] * g_i^2 (x) * [1, 2, 3, 4]^T = 0
234 ok &amp;= ddy[1] == 0.;
235 ok &amp;= ddy[2] == 0.;
236 ok &amp;= ddy[3] == 0.;
237 </pre></font></code>
249238 <br/>
250239 <b><a name="Use Atomic Function.reverse" id="Use Atomic Function.reverse">reverse</a></b>
251240
252241 <code><font color='blue'><pre style='display:inline'>
253 // Test second order reverse mode
254 CppAD::vector&lt;double&gt; w(m), dw(2 * n);
255 for(i = 0; i &lt; m; i++)
256 w[i] = 0.;
257 w[0] = 1.;
258 dw = g.<a href="reverse.xml" target="_top">Reverse</a>(2, w);
259
260 // g_0'(x) = [ x2, x3, x0, x1 ]
261 ok &amp;= dw[0*2 + 0] == x[2];
262 ok &amp;= dw[1*2 + 0] == x[3];
263 ok &amp;= dw[2*2 + 0] == x[0];
264 ok &amp;= dw[3*2 + 0] == x[1];
265
266 // g_0'(x) * [1, 2, 3, 4] = 1 * x2 + 2 * x3 + 3 * x0 + 4 * x1
267 // g_0^2 (x) * [1, 2, 3, 4] = [3, 4, 1, 2]
268 ok &amp;= dw[0*2 + 1] == 3.;
269 ok &amp;= dw[1*2 + 1] == 4.;
270 ok &amp;= dw[2*2 + 1] == 1.;
271 ok &amp;= dw[3*2 + 1] == 2.;
272 </pre></font></code>
273
274 <br/>
242 // Test second order reverse mode
243 CppAD::vector&lt;double&gt; w(m), dw(2 * n);
244 for(i = 0; i &lt; m; i++)
245 w[i] = 0.;
246 w[0] = 1.;
247 dw = g.<a href="reverse.xml" target="_top">Reverse</a>(2, w);
248
249 // g_0'(x) = [ x2, x3, x0, x1 ]
250 ok &amp;= dw[0*2 + 0] == x[2];
251 ok &amp;= dw[1*2 + 0] == x[3];
252 ok &amp;= dw[2*2 + 0] == x[0];
253 ok &amp;= dw[3*2 + 0] == x[1];
254
255 // g_0'(x) * [1, 2, 3, 4] = 1 * x2 + 2 * x3 + 3 * x0 + 4 * x1
256 // g_0^2 (x) * [1, 2, 3, 4] = [3, 4, 1, 2]
257 ok &amp;= dw[0*2 + 1] == 3.;
258 ok &amp;= dw[1*2 + 1] == 4.;
259 ok &amp;= dw[2*2 + 1] == 1.;
260 ok &amp;= dw[3*2 + 1] == 2.;
261 </pre></font></code>
275262 <br/>
276263 <b><a name="Use Atomic Function.option" id="Use Atomic Function.option">option</a></b>
277264
278265 <code><font color='blue'><pre style='display:inline'>
279 //----------------------------------------------------------------------
280 // Test both the boolean and set sparsity at the atomic level
281 for(size_t sparse_index = 0; sparse_index &lt; 2; sparse_index++)
282 { if( sparse_index == 0 )
283 afun.option( CppAD::atomic_base&lt;double&gt;::bool_sparsity_enum );
284 else afun.option( CppAD::atomic_base&lt;double&gt;::set_sparsity_enum );
285 </pre></font></code>
286
287 <br/>
266 //----------------------------------------------------------------------
267 // Test both the boolean and set sparsity at the atomic level
268 for(size_t sparse_index = 0; sparse_index &lt; 2; sparse_index++)
269 { if( sparse_index == 0 )
270 afun.option( CppAD::atomic_base&lt;double&gt;::bool_sparsity_enum );
271 else afun.option( CppAD::atomic_base&lt;double&gt;::set_sparsity_enum );
272 </pre></font></code>
288273 <br/>
289274 <b><a name="Use Atomic Function.for_sparse_jac" id="Use Atomic Function.for_sparse_jac">for_sparse_jac</a></b>
290275
291276 <code><font color='blue'><pre style='display:inline'>
292 // Test forward Jacobian sparsity pattern
293 /*
294 g(x) = [ x0*x2 + x1*x3 , x0*7 + x1*8 , 5*x2 + 6*x3 , 5*7 + 6*8 ]^T
295 so the sparsity pattern should be
296 s[0] = {0, 1, 2, 3}
297 s[1] = {0, 1}
298 s[2] = {2, 3}
299 s[3] = {}
300 */
301 CppAD::vector&lt; std::set&lt;size_t&gt; &gt; r(n), s(m);
302 for(j = 0; j &lt; n; j++)
303 { assert( r[j].empty() );
304 r[j].insert(j);
305 }
306 s = g.ForSparseJac(n, r);
307 for(j = 0; j &lt; n; j++)
308 { // s[0] = {0, 1, 2, 3}
309 ok &amp;= s[0].find(j) != s[0].end();
310 // s[1] = {0, 1}
311 if( j == 0 || j == 1 )
312 ok &amp;= s[1].find(j) != s[1].end();
313 else ok &amp;= s[1].find(j) == s[1].end();
314 // s[2] = {2, 3}
315 if( j == 2 || j == 3 )
316 ok &amp;= s[2].find(j) != s[2].end();
317 else ok &amp;= s[2].find(j) == s[2].end();
318 }
319 // s[3] == {}
320 ok &amp;= s[3].empty();
321 </pre></font></code>
322
323 <br/>
277 // Test forward Jacobian sparsity pattern
278 /*
279 g(x) = [ x0*x2 + x1*x3 , x0*7 + x1*8 , 5*x2 + 6*x3 , 5*7 + 6*8 ]^T
280 so the sparsity pattern should be
281 s[0] = {0, 1, 2, 3}
282 s[1] = {0, 1}
283 s[2] = {2, 3}
284 s[3] = {}
285 */
286 CppAD::vector&lt; std::set&lt;size_t&gt; &gt; r(n), s(m);
287 for(j = 0; j &lt; n; j++)
288 { assert( r[j].empty() );
289 r[j].insert(j);
290 }
291 s = g.ForSparseJac(n, r);
292 for(j = 0; j &lt; n; j++)
293 { // s[0] = {0, 1, 2, 3}
294 ok &amp;= s[0].find(j) != s[0].end();
295 // s[1] = {0, 1}
296 if( j == 0 || j == 1 )
297 ok &amp;= s[1].find(j) != s[1].end();
298 else ok &amp;= s[1].find(j) == s[1].end();
299 // s[2] = {2, 3}
300 if( j == 2 || j == 3 )
301 ok &amp;= s[2].find(j) != s[2].end();
302 else ok &amp;= s[2].find(j) == s[2].end();
303 }
304 // s[3] == {}
305 ok &amp;= s[3].empty();
306 </pre></font></code>
324307 <br/>
325308 <b><a name="Use Atomic Function.rev_sparse_jac" id="Use Atomic Function.rev_sparse_jac">rev_sparse_jac</a></b>
326309
327310 <code><font color='blue'><pre style='display:inline'>
328 // Test reverse Jacobian sparsity pattern
329 for(i = 0; i &lt; m; i++)
330 { s[i].clear();
331 s[i].insert(i);
332 }
333 r = g.RevSparseJac(m, s);
334 for(j = 0; j &lt; n ; j++)
335 { // r[0] = {0, 1, 2, 3}
336 ok &amp;= r[0].find(j) != r[0].end();
337 // r[1] = {0, 1}
338 if( j == 0 || j == 1 )
339 ok &amp;= r[1].find(j) != r[1].end();
340 else ok &amp;= r[1].find(j) == r[1].end();
341 // r[2] = {2, 3}
342 if( j == 2 || j == 3 )
343 ok &amp;= r[2].find(j) != r[2].end();
344 else ok &amp;= r[2].find(j) == r[2].end();
345 }
346 // r[3] == {}
347 ok &amp;= r[3].empty();
348 </pre></font></code>
349
350 <br/>
311 // Test reverse Jacobian sparsity pattern
312 for(i = 0; i &lt; m; i++)
313 { s[i].clear();
314 s[i].insert(i);
315 }
316 r = g.RevSparseJac(m, s);
317 for(j = 0; j &lt; n ; j++)
318 { // r[0] = {0, 1, 2, 3}
319 ok &amp;= r[0].find(j) != r[0].end();
320 // r[1] = {0, 1}
321 if( j == 0 || j == 1 )
322 ok &amp;= r[1].find(j) != r[1].end();
323 else ok &amp;= r[1].find(j) == r[1].end();
324 // r[2] = {2, 3}
325 if( j == 2 || j == 3 )
326 ok &amp;= r[2].find(j) != r[2].end();
327 else ok &amp;= r[2].find(j) == r[2].end();
328 }
329 // r[3] == {}
330 ok &amp;= r[3].empty();
331 </pre></font></code>
351332 <br/>
352333 <b><a name="Use Atomic Function.rev_sparse_hes" id="Use Atomic Function.rev_sparse_hes">rev_sparse_hes</a></b>
353334
354335 <code><font color='blue'><pre style='display:inline'>
355 /* Test reverse Hessian sparsity pattern
356 g_0^2 (x) = [ 0, 0, 1, 0 ] and for i &gt; 0, g_i^2 = 0
357 [ 0, 0, 0, 1 ]
358 [ 1, 0, 0, 0 ]
359 [ 0, 1, 0, 0 ]
360 so for the sparsity pattern for the first component of g is
361 h[0] = {2}
362 h[1] = {3}
363 h[2] = {0}
364 h[3] = {1}
365 */
366 CppAD::vector&lt; std::set&lt;size_t&gt; &gt; h(n), t(1);
367 t[0].clear();
368 t[0].insert(0);
369 h = g.RevSparseHes(n, t);
370 size_t check[] = {2, 3, 0, 1};
371 for(j = 0; j &lt; n; j++)
372 { // h[j] = { check[j] }
373 for(i = 0; i &lt; n; i++)
374 { if( i == check[j] )
375 ok &amp;= h[j].find(i) != h[j].end();
376 else ok &amp;= h[j].find(i) == h[j].end();
377 }
378 }
379 t[0].clear();
380 for( j = 1; j &lt; n; j++)
381 t[0].insert(j);
382 h = g.RevSparseHes(n, t);
383 for(j = 0; j &lt; n; j++)
384 { // h[j] = { }
385 for(i = 0; i &lt; n; i++)
386 ok &amp;= h[j].find(i) == h[j].end();
387 }
388
389 //-----------------------------------------------------------------
390 } // end for(size_t sparse_index ...
391 //-----------------------------------------------------------------
392
393 return ok;
336 /* Test reverse Hessian sparsity pattern
337 g_0^2 (x) = [ 0, 0, 1, 0 ] and for i &gt; 0, g_i^2 = 0
338 [ 0, 0, 0, 1 ]
339 [ 1, 0, 0, 0 ]
340 [ 0, 1, 0, 0 ]
341 so for the sparsity pattern for the first component of g is
342 h[0] = {2}
343 h[1] = {3}
344 h[2] = {0}
345 h[3] = {1}
346 */
347 CppAD::vector&lt; std::set&lt;size_t&gt; &gt; h(n), t(1);
348 t[0].clear();
349 t[0].insert(0);
350 h = g.RevSparseHes(n, t);
351 size_t check[] = {2, 3, 0, 1};
352 for(j = 0; j &lt; n; j++)
353 { // h[j] = { check[j] }
354 for(i = 0; i &lt; n; i++)
355 { if( i == check[j] )
356 ok &amp;= h[j].find(i) != h[j].end();
357 else ok &amp;= h[j].find(i) == h[j].end();
358 }
359 }
360 t[0].clear();
361 for( j = 1; j &lt; n; j++)
362 t[0].insert(j);
363 h = g.RevSparseHes(n, t);
364 for(j = 0; j &lt; n; j++)
365 { // h[j] = { }
366 for(i = 0; i &lt; n; i++)
367 ok &amp;= h[j].find(i) == h[j].end();
368 }
369
370 //-----------------------------------------------------------------
371 } // end for(size_t sparse_index ...
372 //-----------------------------------------------------------------
373
374 return ok;
394375 }
395376 </pre></font></code>
396
397
398377
399378 <hr/>Input File: example/atomic/mat_mul.cpp
400379
55 <title>Matrix Multiply as an Atomic Operation</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Matrix Multiply as an Atomic Operation"/>
8 <meta name="keywords" id="keywords" content=" matrix multiply as an atomic operation start class definition constructor left operand element index right result forward multipliy reverse for_sparse_jac rev_sparse_jac rev_sparse_hes end "/>
8 <meta name="keywords" id="keywords" content=" matrix multiply atomic operation start class definition constructor left operand element index right result forward multipliy reverse for_sparse_jac rev_sparse_jac rev_sparse_hes end "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
9999 </select>
100100 </td>
101101 </tr></table><br/>
102
103
104
105102 <center><b><big><big>Matrix Multiply as an Atomic Operation</big></big></b></center>
106103 <br/>
107104 <b><big><a name="Start Class Definition" id="Start Class Definition">Start Class Definition</a></big></b>
112109 using CppAD::vector;
113110 //
114111 void my_union(
115 std::set&lt;size_t&gt;&amp; result ,
116 const std::set&lt;size_t&gt;&amp; left ,
117 const std::set&lt;size_t&gt;&amp; right )
118 { std::set&lt;size_t&gt; temp;
119 std::set_union(
120 left.begin() ,
121 left.end() ,
122 right.begin() ,
123 right.end() ,
124 std::inserter(temp, temp.begin())
125 );
126 result.swap(temp);
112 std::set&lt;size_t&gt;&amp; result ,
113 const std::set&lt;size_t&gt;&amp; left ,
114 const std::set&lt;size_t&gt;&amp; right )
115 { std::set&lt;size_t&gt; temp;
116 std::set_union(
117 left.begin() ,
118 left.end() ,
119 right.begin() ,
120 right.end() ,
121 std::inserter(temp, temp.begin())
122 );
123 result.swap(temp);
127124 }
128125 //
129126 // matrix result = left * right
130127 class matrix_mul : public CppAD::atomic_base&lt;double&gt; {
131128 </pre></font></code>
132
133 <br/>
134129 <br/>
135130 <b><big><a name="Constructor" id="Constructor">Constructor</a></big></b>
136131
137132 <code><font color='blue'><pre style='display:inline'>
138 private:
139 // number of rows in left operand and in the result
140 const size_t nr_result_;
141 // number of columns in left operand and rows in right operand
142 const size_t n_middle_;
143 // number of columns in right operand and in the result
144 const size_t nc_result_;
145 // dimension of the domain space
146 const size_t n_;
147 // dimension of the range space
133 private:
134 // number of rows in left operand and in the result
135 const size_t nr_result_;
136 // number of columns in left operand and rows in right operand
137 const size_t n_middle_;
138 // number of columns in right operand and in the result
139 const size_t nc_result_;
140 // dimension of the domain space
141 const size_t n_;
142 // dimension of the range space
148143 # ifndef NDEBUG
149 const size_t m_;
144 const size_t m_;
150145 # endif
151 public:
152 // ---------------------------------------------------------------------
153 // constructor
154 matrix_mul(size_t nr_result, size_t n_middle, size_t nc_result)
155 : CppAD::atomic_base&lt;double&gt;(&quot;matrix_mul&quot;),
156 nr_result_(nr_result) ,
157 n_middle_(n_middle) ,
158 nc_result_(nc_result) ,
159 n_( nr_result * n_middle + n_middle * nc_result )
146 public:
147 // ---------------------------------------------------------------------
148 // constructor
149 matrix_mul(size_t nr_result, size_t n_middle, size_t nc_result)
150 : CppAD::atomic_base&lt;double&gt;(&quot;matrix_mul&quot;),
151 nr_result_(nr_result) ,
152 n_middle_(n_middle) ,
153 nc_result_(nc_result) ,
154 n_( nr_result * n_middle + n_middle * nc_result )
160155 # ifndef NDEBUG
161 , m_( n_middle * nc_result )
156 , m_( n_middle * nc_result )
162157 # endif
163 { }
164 private:
165 </pre></font></code>
166
167 <br/>
158 { }
159 private:
160 </pre></font></code>
168161 <br/>
169162 <b><big><a name="Left Operand Element Index" id="Left Operand Element Index">Left Operand Element Index</a></big></b>
170163
171164 <code><font color='blue'><pre style='display:inline'>
172 // left matrix element index in the taylor coefficient vector tx.
173 size_t left(
174 size_t i , // left matrix row index
175 size_t j , // left matrix column index
176 size_t k , // Taylor coeffocient order
177 size_t nk ) // number of Taylor coefficients in tx
178 { assert( i &lt; nr_result_ );
179 assert( j &lt; n_middle_ );
180 return (i * n_middle_ + j) * nk + k;
181 }
182 </pre></font></code>
183
184 <br/>
165 // left matrix element index in the taylor coefficient vector tx.
166 size_t left(
167 size_t i , // left matrix row index
168 size_t j , // left matrix column index
169 size_t k , // Taylor coeffocient order
170 size_t nk ) // number of Taylor coefficients in tx
171 { assert( i &lt; nr_result_ );
172 assert( j &lt; n_middle_ );
173 return (i * n_middle_ + j) * nk + k;
174 }
175 </pre></font></code>
185176 <br/>
186177 <b><big><a name="Right Operand Element Index" id="Right Operand Element Index">Right Operand Element Index</a></big></b>
187178
188179 <code><font color='blue'><pre style='display:inline'>
189 // right matrix element index in the taylor coefficient vector tx.
190 size_t right(
191 size_t i , // right matrix row index
192 size_t j , // right matrix column index
193 size_t k , // Taylor coeffocient order
194 size_t nk ) // number of Taylor coefficients in tx
195 { assert( i &lt; n_middle_ );
196 assert( j &lt; nc_result_ );
197 size_t offset = nr_result_ * n_middle_;
198 return (offset + i * nc_result_ + j) * nk + k;
199 }
200 </pre></font></code>
201
202 <br/>
180 // right matrix element index in the taylor coefficient vector tx.
181 size_t right(
182 size_t i , // right matrix row index
183 size_t j , // right matrix column index
184 size_t k , // Taylor coeffocient order
185 size_t nk ) // number of Taylor coefficients in tx
186 { assert( i &lt; n_middle_ );
187 assert( j &lt; nc_result_ );
188 size_t offset = nr_result_ * n_middle_;
189 return (offset + i * nc_result_ + j) * nk + k;
190 }
191 </pre></font></code>
203192 <br/>
204193 <b><big><a name="Result Element Index" id="Result Element Index">Result Element Index</a></big></b>
205194
206195 <code><font color='blue'><pre style='display:inline'>
207 // result matrix element index in the taylor coefficient vector ty.
208 size_t result(
209 size_t i , // result matrix row index
210 size_t j , // result matrix column index
211 size_t k , // Taylor coeffocient order
212 size_t nk ) // number of Taylor coefficients in ty
213 { assert( i &lt; nr_result_ );
214 assert( j &lt; nc_result_ );
215 return (i * nc_result_ + j) * nk + k;
216 }
217 </pre></font></code>
218
219 <br/>
196 // result matrix element index in the taylor coefficient vector ty.
197 size_t result(
198 size_t i , // result matrix row index
199 size_t j , // result matrix column index
200 size_t k , // Taylor coeffocient order
201 size_t nk ) // number of Taylor coefficients in ty
202 { assert( i &lt; nr_result_ );
203 assert( j &lt; nc_result_ );
204 return (i * nc_result_ + j) * nk + k;
205 }
206 </pre></font></code>
220207 <br/>
221208 <b><big><a name="Forward Matrix Multipliy" id="Forward Matrix Multipliy">Forward Matrix Multipliy</a></big></b>
222209
223210 <code><font color='blue'><pre style='display:inline'>
224 // Forward mode multiply Taylor coefficients in tx and sum into ty
225 // (for one pair of left and right orders)
226 void forward_multiply(
227 size_t k_left , // order for left coefficients
228 size_t k_right , // order for right coefficients
229 const vector&lt;double&gt;&amp; tx , // domain space Taylor coefficients
230 vector&lt;double&gt;&amp; ty ) // range space Taylor coefficients
231 { size_t nk = tx.size() / n_;
232 assert( nk == ty.size() / m_ );
233 //
234 size_t k_result = k_left + k_right;
235 assert( k_result &lt; nk );
236 //
237 for(size_t i = 0; i &lt; nr_result_; i++)
238 { for(size_t j = 0; j &lt; nc_result_; j++)
239 { double sum = 0.0;
240 for(size_t ell = 0; ell &lt; n_middle_; ell++)
241 { size_t i_left = left(i, ell, k_left, nk);
242 size_t i_right = right(ell, j, k_right, nk);
243 sum += tx[i_left] * tx[i_right];
244 }
245 size_t i_result = result(i, j, k_result, nk);
246 ty[i_result] += sum;
247 }
248 }
249 }
250 </pre></font></code>
251
252 <br/>
211 // Forward mode multiply Taylor coefficients in tx and sum into ty
212 // (for one pair of left and right orders)
213 void forward_multiply(
214 size_t k_left , // order for left coefficients
215 size_t k_right , // order for right coefficients
216 const vector&lt;double&gt;&amp; tx , // domain space Taylor coefficients
217 vector&lt;double&gt;&amp; ty ) // range space Taylor coefficients
218 { size_t nk = tx.size() / n_;
219 assert( nk == ty.size() / m_ );
220 //
221 size_t k_result = k_left + k_right;
222 assert( k_result &lt; nk );
223 //
224 for(size_t i = 0; i &lt; nr_result_; i++)
225 { for(size_t j = 0; j &lt; nc_result_; j++)
226 { double sum = 0.0;
227 for(size_t ell = 0; ell &lt; n_middle_; ell++)
228 { size_t i_left = left(i, ell, k_left, nk);
229 size_t i_right = right(ell, j, k_right, nk);
230 sum += tx[i_left] * tx[i_right];
231 }
232 size_t i_result = result(i, j, k_result, nk);
233 ty[i_result] += sum;
234 }
235 }
236 }
237 </pre></font></code>
253238 <br/>
254239 <b><big><a name="Reverse Matrix Multipliy" id="Reverse Matrix Multipliy">Reverse Matrix Multipliy</a></big></b>
255240
256241 <code><font color='blue'><pre style='display:inline'>
257 // Reverse mode partials of Taylor coefficients and sum into px
258 // (for one pair of left and right orders)
259 void reverse_multiply(
260 size_t k_left , // order for left coefficients
261 size_t k_right , // order for right coefficients
262 const vector&lt;double&gt;&amp; tx , // domain space Taylor coefficients
263 const vector&lt;double&gt;&amp; ty , // range space Taylor coefficients
264 vector&lt;double&gt;&amp; px , // partials w.r.t. tx
265 const vector&lt;double&gt;&amp; py ) // partials w.r.t. ty
266 { size_t nk = tx.size() / n_;
267 assert( nk == ty.size() / m_ );
268 assert( tx.size() == px.size() );
269 assert( ty.size() == py.size() );
270 //
271 size_t k_result = k_left + k_right;
272 assert( k_result &lt; nk );
273 //
274 for(size_t i = 0; i &lt; nr_result_; i++)
275 { for(size_t j = 0; j &lt; nc_result_; j++)
276 { size_t i_result = result(i, j, k_result, nk);
277 for(size_t ell = 0; ell &lt; n_middle_; ell++)
278 { size_t i_left = left(i, ell, k_left, nk);
279 size_t i_right = right(ell, j, k_right, nk);
280 // sum += tx[i_left] * tx[i_right];
281 px[i_left] += tx[i_right] * py[i_result];
282 px[i_right] += tx[i_left] * py[i_result];
283 }
284 }
285 }
286 return;
287 }
288 </pre></font></code>
289
290 <br/>
242 // Reverse mode partials of Taylor coefficients and sum into px
243 // (for one pair of left and right orders)
244 void reverse_multiply(
245 size_t k_left , // order for left coefficients
246 size_t k_right , // order for right coefficients
247 const vector&lt;double&gt;&amp; tx , // domain space Taylor coefficients
248 const vector&lt;double&gt;&amp; ty , // range space Taylor coefficients
249 vector&lt;double&gt;&amp; px , // partials w.r.t. tx
250 const vector&lt;double&gt;&amp; py ) // partials w.r.t. ty
251 { size_t nk = tx.size() / n_;
252 assert( nk == ty.size() / m_ );
253 assert( tx.size() == px.size() );
254 assert( ty.size() == py.size() );
255 //
256 size_t k_result = k_left + k_right;
257 assert( k_result &lt; nk );
258 //
259 for(size_t i = 0; i &lt; nr_result_; i++)
260 { for(size_t j = 0; j &lt; nc_result_; j++)
261 { size_t i_result = result(i, j, k_result, nk);
262 for(size_t ell = 0; ell &lt; n_middle_; ell++)
263 { size_t i_left = left(i, ell, k_left, nk);
264 size_t i_right = right(ell, j, k_right, nk);
265 // sum += tx[i_left] * tx[i_right];
266 px[i_left] += tx[i_right] * py[i_result];
267 px[i_right] += tx[i_left] * py[i_result];
268 }
269 }
270 }
271 return;
272 }
273 </pre></font></code>
291274 <br/>
292275 <b><big><a name="forward" id="forward">forward</a></big></b>
293276
294277 <code><font color='blue'><pre style='display:inline'>
295 // forward mode routine called by CppAD
296 bool forward(
297 size_t q ,
298 size_t p ,
299 const vector&lt;bool&gt;&amp; vx ,
300 vector&lt;bool&gt;&amp; vy ,
301 const vector&lt;double&gt;&amp; tx ,
302 vector&lt;double&gt;&amp; ty
303 )
304 { size_t p1 = p + 1;
305 assert( vx.size() == 0 || n_ == vx.size() );
306 assert( vx.size() == 0 || m_ == vy.size() );
307 assert( n_ * p1 == tx.size() );
308 assert( m_ * p1 == ty.size() );
309 size_t i, j, ell;
310
311 // check if we are computing vy information
312 if( vx.size() &gt; 0 )
313 { size_t nk = 1;
314 size_t k = 0;
315 for(i = 0; i &lt; nr_result_; i++)
316 { for(j = 0; j &lt; nc_result_; j++)
317 { bool var = false;
318 for(ell = 0; ell &lt; n_middle_; ell++)
319 { size_t i_left = left(i, ell, k, nk);
320 size_t i_right = right(ell, j, k, nk);
321 bool nz_left = vx[i_left] |(tx[i_left] != 0.);
322 bool nz_right = vx[i_right]|(tx[i_right] != 0.);
323 // if not multiplying by the constant zero
324 if( nz_left &amp; nz_right )
325 var |= bool(vx[i_left]) | bool(vx[i_right]);
326 }
327 size_t i_result = result(i, j, k, nk);
328 vy[i_result] = var;
329 }
330 }
331 }
332
333 // initialize result as zero
334 size_t k;
335 for(i = 0; i &lt; nr_result_; i++)
336 { for(j = 0; j &lt; nc_result_; j++)
337 { for(k = q; k &lt;= p; k++)
338 ty[ result(i, j, k, p1) ] = 0.0;
339 }
340 }
341 for(k = q; k &lt;= p; k++)
342 { // sum the produces that result in order k
343 for(ell = 0; ell &lt;= k; ell++)
344 forward_multiply(ell, k - ell, tx, ty);
345 }
346
347 // all orders are implented, so always return true
348 return true;
349 }
350 </pre></font></code>
351
352 <br/>
278 // forward mode routine called by CppAD
279 bool forward(
280 size_t q ,
281 size_t p ,
282 const vector&lt;bool&gt;&amp; vx ,
283 vector&lt;bool&gt;&amp; vy ,
284 const vector&lt;double&gt;&amp; tx ,
285 vector&lt;double&gt;&amp; ty
286 )
287 { size_t p1 = p + 1;
288 assert( vx.size() == 0 || n_ == vx.size() );
289 assert( vx.size() == 0 || m_ == vy.size() );
290 assert( n_ * p1 == tx.size() );
291 assert( m_ * p1 == ty.size() );
292 size_t i, j, ell;
293
294 // check if we are computing vy information
295 if( vx.size() &gt; 0 )
296 { size_t nk = 1;
297 size_t k = 0;
298 for(i = 0; i &lt; nr_result_; i++)
299 { for(j = 0; j &lt; nc_result_; j++)
300 { bool var = false;
301 for(ell = 0; ell &lt; n_middle_; ell++)
302 { size_t i_left = left(i, ell, k, nk);
303 size_t i_right = right(ell, j, k, nk);
304 bool nz_left = vx[i_left] |(tx[i_left] != 0.);
305 bool nz_right = vx[i_right]|(tx[i_right] != 0.);
306 // if not multiplying by the constant zero
307 if( nz_left &amp; nz_right )
308 var |= bool(vx[i_left]) | bool(vx[i_right]);
309 }
310 size_t i_result = result(i, j, k, nk);
311 vy[i_result] = var;
312 }
313 }
314 }
315
316 // initialize result as zero
317 size_t k;
318 for(i = 0; i &lt; nr_result_; i++)
319 { for(j = 0; j &lt; nc_result_; j++)
320 { for(k = q; k &lt;= p; k++)
321 ty[ result(i, j, k, p1) ] = 0.0;
322 }
323 }
324 for(k = q; k &lt;= p; k++)
325 { // sum the produces that result in order k
326 for(ell = 0; ell &lt;= k; ell++)
327 forward_multiply(ell, k - ell, tx, ty);
328 }
329
330 // all orders are implented, so always return true
331 return true;
332 }
333 </pre></font></code>
353334 <br/>
354335 <b><big><a name="reverse" id="reverse">reverse</a></big></b>
355336
356337 <code><font color='blue'><pre style='display:inline'>
357 // reverse mode routine called by CppAD
358 virtual bool reverse(
359 size_t p ,
360 const vector&lt;double&gt;&amp; tx ,
361 const vector&lt;double&gt;&amp; ty ,
362 vector&lt;double&gt;&amp; px ,
363 const vector&lt;double&gt;&amp; py
364 )
365 { size_t p1 = p + 1;
366 assert( n_ * p1 == tx.size() );
367 assert( m_ * p1 == ty.size() );
368 assert( px.size() == tx.size() );
369 assert( py.size() == ty.size() );
370
371 // initialize summation
372 for(size_t i = 0; i &lt; px.size(); i++)
373 px[i] = 0.0;
374
375 // number of orders to differentiate
376 size_t k = p1;
377 while(k--)
378 { // differentiate the produces that result in order k
379 for(size_t ell = 0; ell &lt;= k; ell++)
380 reverse_multiply(ell, k - ell, tx, ty, px, py);
381 }
382
383 // all orders are implented, so always return true
384 return true;
385 }
386 </pre></font></code>
387
388 <br/>
338 // reverse mode routine called by CppAD
339 virtual bool reverse(
340 size_t p ,
341 const vector&lt;double&gt;&amp; tx ,
342 const vector&lt;double&gt;&amp; ty ,
343 vector&lt;double&gt;&amp; px ,
344 const vector&lt;double&gt;&amp; py
345 )
346 { size_t p1 = p + 1;
347 assert( n_ * p1 == tx.size() );
348 assert( m_ * p1 == ty.size() );
349 assert( px.size() == tx.size() );
350 assert( py.size() == ty.size() );
351
352 // initialize summation
353 for(size_t i = 0; i &lt; px.size(); i++)
354 px[i] = 0.0;
355
356 // number of orders to differentiate
357 size_t k = p1;
358 while(k--)
359 { // differentiate the produces that result in order k
360 for(size_t ell = 0; ell &lt;= k; ell++)
361 reverse_multiply(ell, k - ell, tx, ty, px, py);
362 }
363
364 // all orders are implented, so always return true
365 return true;
366 }
367 </pre></font></code>
389368 <br/>
390369 <b><big><a name="for_sparse_jac" id="for_sparse_jac">for_sparse_jac</a></big></b>
391370
392371 <code><font color='blue'><pre style='display:inline'>
393 // forward Jacobian sparsity routine called by CppAD
394 virtual bool for_sparse_jac(
395 size_t q ,
396 const vector&lt;bool&gt;&amp; r ,
397 vector&lt;bool&gt;&amp; s )
398 { assert( n_ * q == r.size() );
399 assert( m_ * q == s.size() );
400 size_t p;
401
402 // sparsity for S(x) = f'(x) * R
403 size_t nk = 1;
404 size_t k = 0;
405 for(size_t i = 0; i &lt; nr_result_; i++)
406 { for(size_t j = 0; j &lt; nc_result_; j++)
407 { size_t i_result = result(i, j, k, nk);
408 for(p = 0; p &lt; q; p++)
409 s[i_result * q + p] = false;
410 for(size_t ell = 0; ell &lt; n_middle_; ell++)
411 { size_t i_left = left(i, ell, k, nk);
412 size_t i_right = right(ell, j, k, nk);
413 for(p = 0; p &lt; q; p++)
414 { // cast avoids Microsoft warning (should not be needed)
415 s[i_result * q + p] |= bool( r[i_left * q + p ] );
416 s[i_result * q + p] |= bool( r[i_right * q + p ] );
417 }
418 }
419 }
420 }
421 return true;
422 }
423 virtual bool for_sparse_jac(
424 size_t q ,
425 const vector&lt; std::set&lt;size_t&gt; &gt;&amp; r ,
426 vector&lt; std::set&lt;size_t&gt; &gt;&amp; s )
427 { assert( n_ == r.size() );
428 assert( m_ == s.size() );
429
430 // sparsity for S(x) = f'(x) * R
431 size_t nk = 1;
432 size_t k = 0;
433 for(size_t i = 0; i &lt; nr_result_; i++)
434 { for(size_t j = 0; j &lt; nc_result_; j++)
435 { size_t i_result = result(i, j, k, nk);
436 s[i_result].clear();
437 for(size_t ell = 0; ell &lt; n_middle_; ell++)
438 { size_t i_left = left(i, ell, k, nk);
439 size_t i_right = right(ell, j, k, nk);
440 //
441 my_union( s[i_result], s[i_result], r[i_left] );
442 my_union( s[i_result], s[i_result], r[i_right] );
443 }
444 }
445 }
446 return true;
447 }
448 </pre></font></code>
449
450 <br/>
372 // forward Jacobian sparsity routine called by CppAD
373 virtual bool for_sparse_jac(
374 size_t q ,
375 const vector&lt;bool&gt;&amp; r ,
376 vector&lt;bool&gt;&amp; s )
377 { assert( n_ * q == r.size() );
378 assert( m_ * q == s.size() );
379 size_t p;
380
381 // sparsity for S(x) = f'(x) * R
382 size_t nk = 1;
383 size_t k = 0;
384 for(size_t i = 0; i &lt; nr_result_; i++)
385 { for(size_t j = 0; j &lt; nc_result_; j++)
386 { size_t i_result = result(i, j, k, nk);
387 for(p = 0; p &lt; q; p++)
388 s[i_result * q + p] = false;
389 for(size_t ell = 0; ell &lt; n_middle_; ell++)
390 { size_t i_left = left(i, ell, k, nk);
391 size_t i_right = right(ell, j, k, nk);
392 for(p = 0; p &lt; q; p++)
393 { // cast avoids Microsoft warning (should not be needed)
394 s[i_result * q + p] |= bool( r[i_left * q + p ] );
395 s[i_result * q + p] |= bool( r[i_right * q + p ] );
396 }
397 }
398 }
399 }
400 return true;
401 }
402 virtual bool for_sparse_jac(
403 size_t q ,
404 const vector&lt; std::set&lt;size_t&gt; &gt;&amp; r ,
405 vector&lt; std::set&lt;size_t&gt; &gt;&amp; s )
406 { assert( n_ == r.size() );
407 assert( m_ == s.size() );
408
409 // sparsity for S(x) = f'(x) * R
410 size_t nk = 1;
411 size_t k = 0;
412 for(size_t i = 0; i &lt; nr_result_; i++)
413 { for(size_t j = 0; j &lt; nc_result_; j++)
414 { size_t i_result = result(i, j, k, nk);
415 s[i_result].clear();
416 for(size_t ell = 0; ell &lt; n_middle_; ell++)
417 { size_t i_left = left(i, ell, k, nk);
418 size_t i_right = right(ell, j, k, nk);
419 //
420 my_union( s[i_result], s[i_result], r[i_left] );
421 my_union( s[i_result], s[i_result], r[i_right] );
422 }
423 }
424 }
425 return true;
426 }
427 </pre></font></code>
451428 <br/>
452429 <b><big><a name="rev_sparse_jac" id="rev_sparse_jac">rev_sparse_jac</a></big></b>
453430
454431 <code><font color='blue'><pre style='display:inline'>
455 // reverse Jacobian sparsity routine called by CppAD
456 virtual bool rev_sparse_jac(
457 size_t q ,
458 const vector&lt;bool&gt;&amp; rt ,
459 vector&lt;bool&gt;&amp; st )
460 { assert( n_ * q == st.size() );
461 assert( m_ * q == rt.size() );
462 size_t i, j, p;
463
464 // initialize
465 for(i = 0; i &lt; n_; i++)
466 { for(p = 0; p &lt; q; p++)
467 st[ i * q + p ] = false;
468 }
469
470 // sparsity for S(x)^T = f'(x)^T * R^T
471 size_t nk = 1;
472 size_t k = 0;
473 for(i = 0; i &lt; nr_result_; i++)
474 { for(j = 0; j &lt; nc_result_; j++)
475 { size_t i_result = result(i, j, k, nk);
476 for(size_t ell = 0; ell &lt; n_middle_; ell++)
477 { size_t i_left = left(i, ell, k, nk);
478 size_t i_right = right(ell, j, k, nk);
479 for(p = 0; p &lt; q; p++)
480 { st[i_left * q + p] |= bool( rt[i_result * q + p] );
481 st[i_right* q + p] |= bool( rt[i_result * q + p] );
482 }
483 }
484 }
485 }
486 return true;
487 }
488 virtual bool rev_sparse_jac(
489 size_t q ,
490 const vector&lt; std::set&lt;size_t&gt; &gt;&amp; rt ,
491 vector&lt; std::set&lt;size_t&gt; &gt;&amp; st )
492 { assert( n_ == st.size() );
493 assert( m_ == rt.size() );
494 size_t i, j;
495
496 // initialize
497 for(i = 0; i &lt; n_; i++)
498 st[i].clear();
499
500 // sparsity for S(x)^T = f'(x)^T * R^T
501 size_t nk = 1;
502 size_t k = 0;
503 for(i = 0; i &lt; nr_result_; i++)
504 { for(j = 0; j &lt; nc_result_; j++)
505 { size_t i_result = result(i, j, k, nk);
506 for(size_t ell = 0; ell &lt; n_middle_; ell++)
507 { size_t i_left = left(i, ell, k, nk);
508 size_t i_right = right(ell, j, k, nk);
509 //
510 my_union(st[i_left], st[i_left], rt[i_result]);
511 my_union(st[i_right], st[i_right], rt[i_result]);
512 }
513 }
514 }
515 return true;
516 }
517 </pre></font></code>
518
519 <br/>
432 // reverse Jacobian sparsity routine called by CppAD
433 virtual bool rev_sparse_jac(
434 size_t q ,
435 const vector&lt;bool&gt;&amp; rt ,
436 vector&lt;bool&gt;&amp; st )
437 { assert( n_ * q == st.size() );
438 assert( m_ * q == rt.size() );
439 size_t i, j, p;
440
441 // initialize
442 for(i = 0; i &lt; n_; i++)
443 { for(p = 0; p &lt; q; p++)
444 st[ i * q + p ] = false;
445 }
446
447 // sparsity for S(x)^T = f'(x)^T * R^T
448 size_t nk = 1;
449 size_t k = 0;
450 for(i = 0; i &lt; nr_result_; i++)
451 { for(j = 0; j &lt; nc_result_; j++)
452 { size_t i_result = result(i, j, k, nk);
453 for(size_t ell = 0; ell &lt; n_middle_; ell++)
454 { size_t i_left = left(i, ell, k, nk);
455 size_t i_right = right(ell, j, k, nk);
456 for(p = 0; p &lt; q; p++)
457 { st[i_left * q + p] |= bool( rt[i_result * q + p] );
458 st[i_right* q + p] |= bool( rt[i_result * q + p] );
459 }
460 }
461 }
462 }
463 return true;
464 }
465 virtual bool rev_sparse_jac(
466 size_t q ,
467 const vector&lt; std::set&lt;size_t&gt; &gt;&amp; rt ,
468 vector&lt; std::set&lt;size_t&gt; &gt;&amp; st )
469 { assert( n_ == st.size() );
470 assert( m_ == rt.size() );
471 size_t i, j;
472
473 // initialize
474 for(i = 0; i &lt; n_; i++)
475 st[i].clear();
476
477 // sparsity for S(x)^T = f'(x)^T * R^T
478 size_t nk = 1;
479 size_t k = 0;
480 for(i = 0; i &lt; nr_result_; i++)
481 { for(j = 0; j &lt; nc_result_; j++)
482 { size_t i_result = result(i, j, k, nk);
483 for(size_t ell = 0; ell &lt; n_middle_; ell++)
484 { size_t i_left = left(i, ell, k, nk);
485 size_t i_right = right(ell, j, k, nk);
486 //
487 my_union(st[i_left], st[i_left], rt[i_result]);
488 my_union(st[i_right], st[i_right], rt[i_result]);
489 }
490 }
491 }
492 return true;
493 }
494 </pre></font></code>
520495 <br/>
521496 <b><big><a name="rev_sparse_hes" id="rev_sparse_hes">rev_sparse_hes</a></big></b>
522497
523498 <code><font color='blue'><pre style='display:inline'>
524 // reverse Hessian sparsity routine called by CppAD
525 virtual bool rev_sparse_hes(
526 const vector&lt;bool&gt;&amp; vx,
527 const vector&lt;bool&gt;&amp; s ,
528 vector&lt;bool&gt;&amp; t ,
529 size_t q ,
530 const vector&lt; std::set&lt;size_t&gt; &gt;&amp; r ,
531 const vector&lt; std::set&lt;size_t&gt; &gt;&amp; u ,
532 vector&lt; std::set&lt;size_t&gt; &gt;&amp; v )
533 { size_t n = vx.size();
534 assert( t.size() == n );
535 assert( r.size() == n );
536 assert( v.size() == n );
499 // reverse Hessian sparsity routine called by CppAD
500 virtual bool rev_sparse_hes(
501 const vector&lt;bool&gt;&amp; vx,
502 const vector&lt;bool&gt;&amp; s ,
503 vector&lt;bool&gt;&amp; t ,
504 size_t q ,
505 const vector&lt; std::set&lt;size_t&gt; &gt;&amp; r ,
506 const vector&lt; std::set&lt;size_t&gt; &gt;&amp; u ,
507 vector&lt; std::set&lt;size_t&gt; &gt;&amp; v )
508 { size_t n = vx.size();
509 assert( t.size() == n );
510 assert( r.size() == n );
511 assert( v.size() == n );
537512 # ifndef NDEBUG
538 size_t m = s.size();
539 assert( u.size() == m );
513 size_t m = s.size();
514 assert( u.size() == m );
540515 # endif
541 size_t i, j;
542 //
543 // initilaize sparsity patterns as false
544 for(j = 0; j &lt; n; j++)
545 { t[j] = false;
546 v[j].clear();
547 }
548 size_t nk = 1;
549 size_t k = 0;
550 for(i = 0; i &lt; nr_result_; i++)
551 { for(j = 0; j &lt; nc_result_; j++)
552 { size_t i_result = result(i, j, k, nk);
553 for(size_t ell = 0; ell &lt; n_middle_; ell++)
554 { size_t i_left = left(i, ell, k, nk);
555 size_t i_right = right(ell, j, k, nk);
556 //
557 // Compute sparsity for T(x) = S(x) * f'(x).
558 // We need not use vx with f'(x) back propagation.
559 t[i_left] |= bool( s[i_result] );
560 t[i_right] |= bool( s[i_result] );
561
562 // V(x) = f'(x)^T * U(x) + S(x) * f''(x) * R
563 // U(x) = g''(y) * f'(x) * R
564 // S(x) = g'(y)
565
566 // back propagate f'(x)^T * U(x)
567 // (no need to use vx with f'(x) propogation)
568 my_union(v[i_left], v[i_left], u[i_result] );
569 my_union(v[i_right], v[i_right], u[i_result] );
570
571 // back propagate S(x) * f''(x) * R
572 // (here is where we must check for cross terms)
573 if( s[i_result] &amp; vx[i_left] &amp; vx[i_right] )
574 { my_union(v[i_left], v[i_left], r[i_right] );
575 my_union(v[i_right], v[i_right], r[i_left] );
576 }
577 }
578 }
579 }
580 return true;
581 }
582 virtual bool rev_sparse_hes(
583 const vector&lt;bool&gt;&amp; vx,
584 const vector&lt;bool&gt;&amp; s ,
585 vector&lt;bool&gt;&amp; t ,
586 size_t q ,
587 const vector&lt;bool&gt;&amp; r ,
588 const vector&lt;bool&gt;&amp; u ,
589 vector&lt;bool&gt;&amp; v )
590 { size_t n = vx.size();
591 assert( t.size() == n );
592 assert( r.size() == n * q );
593 assert( v.size() == n * q );
516 size_t i, j;
517 //
518 // initilaize sparsity patterns as false
519 for(j = 0; j &lt; n; j++)
520 { t[j] = false;
521 v[j].clear();
522 }
523 size_t nk = 1;
524 size_t k = 0;
525 for(i = 0; i &lt; nr_result_; i++)
526 { for(j = 0; j &lt; nc_result_; j++)
527 { size_t i_result = result(i, j, k, nk);
528 for(size_t ell = 0; ell &lt; n_middle_; ell++)
529 { size_t i_left = left(i, ell, k, nk);
530 size_t i_right = right(ell, j, k, nk);
531 //
532 // Compute sparsity for T(x) = S(x) * f'(x).
533 // We need not use vx with f'(x) back propagation.
534 t[i_left] |= bool( s[i_result] );
535 t[i_right] |= bool( s[i_result] );
536
537 // V(x) = f'(x)^T * U(x) + S(x) * f''(x) * R
538 // U(x) = g''(y) * f'(x) * R
539 // S(x) = g'(y)
540
541 // back propagate f'(x)^T * U(x)
542 // (no need to use vx with f'(x) propogation)
543 my_union(v[i_left], v[i_left], u[i_result] );
544 my_union(v[i_right], v[i_right], u[i_result] );
545
546 // back propagate S(x) * f''(x) * R
547 // (here is where we must check for cross terms)
548 if( s[i_result] &amp; vx[i_left] &amp; vx[i_right] )
549 { my_union(v[i_left], v[i_left], r[i_right] );
550 my_union(v[i_right], v[i_right], r[i_left] );
551 }
552 }
553 }
554 }
555 return true;
556 }
557 virtual bool rev_sparse_hes(
558 const vector&lt;bool&gt;&amp; vx,
559 const vector&lt;bool&gt;&amp; s ,
560 vector&lt;bool&gt;&amp; t ,
561 size_t q ,
562 const vector&lt;bool&gt;&amp; r ,
563 const vector&lt;bool&gt;&amp; u ,
564 vector&lt;bool&gt;&amp; v )
565 { size_t n = vx.size();
566 assert( t.size() == n );
567 assert( r.size() == n * q );
568 assert( v.size() == n * q );
594569 # ifndef NDEBUG
595 size_t m = s.size();
596 assert( u.size() == m * q );
570 size_t m = s.size();
571 assert( u.size() == m * q );
597572 # endif
598 size_t i, j, p;
599 //
600 // initilaize sparsity patterns as false
601 for(j = 0; j &lt; n; j++)
602 { t[j] = false;
603 for(p = 0; p &lt; q; p++)
604 v[j * q + p] = false;
605 }
606 size_t nk = 1;
607 size_t k = 0;
608 for(i = 0; i &lt; nr_result_; i++)
609 { for(j = 0; j &lt; nc_result_; j++)
610 { size_t i_result = result(i, j, k, nk);
611 for(size_t ell = 0; ell &lt; n_middle_; ell++)
612 { size_t i_left = left(i, ell, k, nk);
613 size_t i_right = right(ell, j, k, nk);
614 //
615 // Compute sparsity for T(x) = S(x) * f'(x).
616 // We so not need to use vx with f'(x) propagation.
617 t[i_left] |= bool( s[i_result] );
618 t[i_right] |= bool( s[i_result] );
619
620 // V(x) = f'(x)^T * U(x) + S(x) * f''(x) * R
621 // U(x) = g''(y) * f'(x) * R
622 // S(x) = g'(y)
623
624 // back propagate f'(x)^T * U(x)
625 // (no need to use vx with f'(x) propogation)
626 for(p = 0; p &lt; q; p++)
627 { v[ i_left * q + p] |= bool( u[ i_result * q + p] );
628 v[ i_right * q + p] |= bool( u[ i_result * q + p] );
629 }
630
631 // back propagate S(x) * f''(x) * R
632 // (here is where we must check for cross terms)
633 if( s[i_result] &amp; vx[i_left] &amp; vx[i_right] )
634 { for(p = 0; p &lt; q; p++)
635 { v[i_left * q + p] |= bool( r[i_right * q + p] );
636 v[i_right * q + p] |= bool( r[i_left * q + p] );
637 }
638 }
639 }
640 }
641 }
642 return true;
643 }
644
645 </pre></font></code>
646
647 <br/>
648 <br/>
573 size_t i, j, p;
574 //
575 // initilaize sparsity patterns as false
576 for(j = 0; j &lt; n; j++)
577 { t[j] = false;
578 for(p = 0; p &lt; q; p++)
579 v[j * q + p] = false;
580 }
581 size_t nk = 1;
582 size_t k = 0;
583 for(i = 0; i &lt; nr_result_; i++)
584 { for(j = 0; j &lt; nc_result_; j++)
585 { size_t i_result = result(i, j, k, nk);
586 for(size_t ell = 0; ell &lt; n_middle_; ell++)
587 { size_t i_left = left(i, ell, k, nk);
588 size_t i_right = right(ell, j, k, nk);
589 //
590 // Compute sparsity for T(x) = S(x) * f'(x).
591 // We so not need to use vx with f'(x) propagation.
592 t[i_left] |= bool( s[i_result] );
593 t[i_right] |= bool( s[i_result] );
594
595 // V(x) = f'(x)^T * U(x) + S(x) * f''(x) * R
596 // U(x) = g''(y) * f'(x) * R
597 // S(x) = g'(y)
598
599 // back propagate f'(x)^T * U(x)
600 // (no need to use vx with f'(x) propogation)
601 for(p = 0; p &lt; q; p++)
602 { v[ i_left * q + p] |= bool( u[ i_result * q + p] );
603 v[ i_right * q + p] |= bool( u[ i_result * q + p] );
604 }
605
606 // back propagate S(x) * f''(x) * R
607 // (here is where we must check for cross terms)
608 if( s[i_result] &amp; vx[i_left] &amp; vx[i_right] )
609 { for(p = 0; p &lt; q; p++)
610 { v[i_left * q + p] |= bool( r[i_right * q + p] );
611 v[i_right * q + p] |= bool( r[i_left * q + p] );
612 }
613 }
614 }
615 }
616 }
617 return true;
618 }
619
620 </pre></font></code>
649621 <b><big><a name="End Class Definition" id="End Class Definition">End Class Definition</a></big></b>
650622
651623 <code><font color='blue'><pre style='display:inline'>
653625 } // End empty namespace
654626 </pre></font></code>
655627
656
657
658628 <hr/>Input File: cppad/example/matrix_mul.hpp
659629
660630 </body>
55 <title>Atomic Euclidean Norm Squared: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Atomic Euclidean Norm Squared: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" atomic euclidean norm squared: example and test bool_sparsity_enum theory sparsity start class definition constructor forward reverse for_sparse_jac rev_sparse_jac rev_sparse_hes end use function recording "/>
8 <meta name="keywords" id="keywords" content=" atomic euclidean norm squared: example test bool_sparsity_enum theory sparsity start class definition constructor forward reverse for_sparse_jac rev_sparse_jac rev_sparse_hes end use function recording "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
109109 </select>
110110 </td>
111111 </tr></table><br/>
112
113
114
115112 <center><b><big><big>Atomic Euclidean Norm Squared: Example and Test</big></big></b></center>
116113 <br/>
117114 <b><big><a name="Theory" id="Theory">Theory</a></big></b>
186183 //
187184 class atomic_norm_sq : public CppAD::atomic_base&lt;double&gt; {
188185 </pre></font></code>
189
190 <br/>
191186 <br/>
192187 <b><big><a name="Constructor" id="Constructor">Constructor</a></big></b>
193188
194189 <code><font color='blue'><pre style='display:inline'>
195 public:
196 // constructor (could use const char* for name)
197 atomic_norm_sq(const std::string&amp; name) :
198 // this example only uses boolean sparsity patterns
199 CppAD::atomic_base&lt;double&gt;(name, atomic_base&lt;double&gt;::bool_sparsity_enum)
200 { }
201 private:
202 </pre></font></code>
203
204 <br/>
190 public:
191 // constructor (could use const char* for name)
192 atomic_norm_sq(const std::string&amp; name) :
193 // this example only uses boolean sparsity patterns
194 CppAD::atomic_base&lt;double&gt;(name, atomic_base&lt;double&gt;::bool_sparsity_enum)
195 { }
196 private:
197 </pre></font></code>
205198 <br/>
206199 <b><big><a name="forward" id="forward">forward</a></big></b>
207200
208201 <code><font color='blue'><pre style='display:inline'>
209 // forward mode routine called by CppAD
210 virtual bool forward(
211 size_t p ,
212 size_t q ,
213 const vector&lt;bool&gt;&amp; vx ,
214 vector&lt;bool&gt;&amp; vy ,
215 const vector&lt;double&gt;&amp; tx ,
216 vector&lt;double&gt;&amp; ty
217 )
218 { size_t n = tx.size() / (q+1);
219 size_t m = ty.size() / (q+1);
220 assert( n == 2 );
221 assert( m == 1 );
222 assert( p &lt;= q );
223
224 // return flag
225 bool ok = q &lt;= 1;
226
227 // Variable information must always be implemented.
228 // y_0 is a variable if and only if x_0 or x_1 is a variable.
229 if( vx.size() &gt; 0 )
230 vy[0] = vx[0] | vx[1];
231
232 // Order zero forward mode must always be implemented.
233 // y^0 = f( x^0 )
234 double x_00 = tx[ 0*(q+1) + 0]; // x_0^0
235 double x_10 = tx[ 1*(q+1) + 0]; // x_10
236 double f = x_00 * x_00 + x_10 * x_10; // f( x^0 )
237 if( p &lt;= 0 )
238 ty[0] = f; // y_0^0
239 if( q &lt;= 0 )
240 return ok;
241 assert( vx.size() == 0 );
242
243 // Order one forward mode.
244 // This case needed if first order forward mode is used.
245 // y^1 = f'( x^0 ) x^1
246 double x_01 = tx[ 0*(q+1) + 1]; // x_0^1
247 double x_11 = tx[ 1*(q+1) + 1]; // x_1^1
248 double fp_0 = 2.0 * x_00; // partial f w.r.t x_0^0
249 double fp_1 = 2.0 * x_10; // partial f w.r.t x_1^0
250 if( p &lt;= 1 )
251 ty[1] = fp_0 * x_01 + fp_1 * x_11; // f'( x^0 ) * x^1
252 if( q &lt;= 1 )
253 return ok;
254
255 // Assume we are not using forward mode with order &gt; 1
256 assert( ! ok );
257 return ok;
258 }
259 </pre></font></code>
260
261 <br/>
202 // forward mode routine called by CppAD
203 virtual bool forward(
204 size_t p ,
205 size_t q ,
206 const vector&lt;bool&gt;&amp; vx ,
207 vector&lt;bool&gt;&amp; vy ,
208 const vector&lt;double&gt;&amp; tx ,
209 vector&lt;double&gt;&amp; ty
210 )
211 { size_t n = tx.size() / (q+1);
212 size_t m = ty.size() / (q+1);
213 assert( n == 2 );
214 assert( m == 1 );
215 assert( p &lt;= q );
216
217 // return flag
218 bool ok = q &lt;= 1;
219
220 // Variable information must always be implemented.
221 // y_0 is a variable if and only if x_0 or x_1 is a variable.
222 if( vx.size() &gt; 0 )
223 vy[0] = vx[0] | vx[1];
224
225 // Order zero forward mode must always be implemented.
226 // y^0 = f( x^0 )
227 double x_00 = tx[ 0*(q+1) + 0]; // x_0^0
228 double x_10 = tx[ 1*(q+1) + 0]; // x_10
229 double f = x_00 * x_00 + x_10 * x_10; // f( x^0 )
230 if( p &lt;= 0 )
231 ty[0] = f; // y_0^0
232 if( q &lt;= 0 )
233 return ok;
234 assert( vx.size() == 0 );
235
236 // Order one forward mode.
237 // This case needed if first order forward mode is used.
238 // y^1 = f'( x^0 ) x^1
239 double x_01 = tx[ 0*(q+1) + 1]; // x_0^1
240 double x_11 = tx[ 1*(q+1) + 1]; // x_1^1
241 double fp_0 = 2.0 * x_00; // partial f w.r.t x_0^0
242 double fp_1 = 2.0 * x_10; // partial f w.r.t x_1^0
243 if( p &lt;= 1 )
244 ty[1] = fp_0 * x_01 + fp_1 * x_11; // f'( x^0 ) * x^1
245 if( q &lt;= 1 )
246 return ok;
247
248 // Assume we are not using forward mode with order &gt; 1
249 assert( ! ok );
250 return ok;
251 }
252 </pre></font></code>
262253 <br/>
263254 <b><big><a name="reverse" id="reverse">reverse</a></big></b>
264255
265256 <code><font color='blue'><pre style='display:inline'>
266 // reverse mode routine called by CppAD
267 virtual bool reverse(
268 size_t q ,
269 const vector&lt;double&gt;&amp; tx ,
270 const vector&lt;double&gt;&amp; ty ,
271 vector&lt;double&gt;&amp; px ,
272 const vector&lt;double&gt;&amp; py
273 )
274 { size_t n = tx.size() / (q+1);
275 size_t m = ty.size() / (q+1);
276 assert( px.size() == n * (q+1) );
277 assert( py.size() == m * (q+1) );
278 assert( n == 2 );
279 assert( m == 1 );
280 bool ok = q &lt;= 1;
281
282 double fp_0, fp_1;
283 switch(q)
284 { case 0:
285 // This case needed if first order reverse mode is used
286 // F ( {x} ) = f( x^0 ) = y^0
287 fp_0 = 2.0 * tx[0]; // partial F w.r.t. x_0^0
288 fp_1 = 2.0 * tx[1]; // partial F w.r.t. x_0^1
289 px[0] = py[0] * fp_0;; // partial G w.r.t. x_0^0
290 px[1] = py[0] * fp_1;; // partial G w.r.t. x_0^1
291 assert(ok);
292 break;
293
294 default:
295 // Assume we are not using reverse with order &gt; 1 (q &gt; 0)
296 assert(!ok);
297 }
298 return ok;
299 }
300 </pre></font></code>
301
302 <br/>
257 // reverse mode routine called by CppAD
258 virtual bool reverse(
259 size_t q ,
260 const vector&lt;double&gt;&amp; tx ,
261 const vector&lt;double&gt;&amp; ty ,
262 vector&lt;double&gt;&amp; px ,
263 const vector&lt;double&gt;&amp; py
264 )
265 { size_t n = tx.size() / (q+1);
266 size_t m = ty.size() / (q+1);
267 assert( px.size() == n * (q+1) );
268 assert( py.size() == m * (q+1) );
269 assert( n == 2 );
270 assert( m == 1 );
271 bool ok = q &lt;= 1;
272
273 double fp_0, fp_1;
274 switch(q)
275 { case 0:
276 // This case needed if first order reverse mode is used
277 // F ( {x} ) = f( x^0 ) = y^0
278 fp_0 = 2.0 * tx[0]; // partial F w.r.t. x_0^0
279 fp_1 = 2.0 * tx[1]; // partial F w.r.t. x_0^1
280 px[0] = py[0] * fp_0;; // partial G w.r.t. x_0^0
281 px[1] = py[0] * fp_1;; // partial G w.r.t. x_0^1
282 assert(ok);
283 break;
284
285 default:
286 // Assume we are not using reverse with order &gt; 1 (q &gt; 0)
287 assert(!ok);
288 }
289 return ok;
290 }
291 </pre></font></code>
303292 <br/>
304293 <b><big><a name="for_sparse_jac" id="for_sparse_jac">for_sparse_jac</a></big></b>
305294
306295 <code><font color='blue'><pre style='display:inline'>
307 // forward Jacobian bool sparsity routine called by CppAD
308 virtual bool for_sparse_jac(
309 size_t p ,
310 const vector&lt;bool&gt;&amp; r ,
311 vector&lt;bool&gt;&amp; s )
312 { // This function needed if using f.ForSparseJac
313 size_t n = r.size() / p;
314 size_t m = s.size() / p;
315 assert( n == 2 );
316 assert( m == 1 );
317
318 // sparsity for S(x) = f'(x) * R
319 // where f'(x) = 2 * [ x_0, x_1 ]
320 for(size_t j = 0; j &lt; p; j++)
321 { s[j] = false;
322 for(size_t i = 0; i &lt; n; i++)
323 { // Visual Studio 2013 generates warning without bool below
324 s[j] |= bool( r[i * p + j] );
325 }
326 }
327 return true;
328 }
329 </pre></font></code>
330
331 <br/>
296 // forward Jacobian bool sparsity routine called by CppAD
297 virtual bool for_sparse_jac(
298 size_t p ,
299 const vector&lt;bool&gt;&amp; r ,
300 vector&lt;bool&gt;&amp; s )
301 { // This function needed if using f.ForSparseJac
302 size_t n = r.size() / p;
303 size_t m = s.size() / p;
304 assert( n == 2 );
305 assert( m == 1 );
306
307 // sparsity for S(x) = f'(x) * R
308 // where f'(x) = 2 * [ x_0, x_1 ]
309 for(size_t j = 0; j &lt; p; j++)
310 { s[j] = false;
311 for(size_t i = 0; i &lt; n; i++)
312 { // Visual Studio 2013 generates warning without bool below
313 s[j] |= bool( r[i * p + j] );
314 }
315 }
316 return true;
317 }
318 </pre></font></code>
332319 <br/>
333320 <b><big><a name="rev_sparse_jac" id="rev_sparse_jac">rev_sparse_jac</a></big></b>
334321
335322 <code><font color='blue'><pre style='display:inline'>
336 // reverse Jacobian bool sparsity routine called by CppAD
337 virtual bool rev_sparse_jac(
338 size_t p ,
339 const vector&lt;bool&gt;&amp; rt ,
340 vector&lt;bool&gt;&amp; st )
341 { // This function needed if using RevSparseJac or optimize
342 size_t n = st.size() / p;
343 size_t m = rt.size() / p;
344 assert( n == 2 );
345 assert( m == 1 );
346
347 // sparsity for S(x)^T = f'(x)^T * R^T
348 // where f'(x)^T = 2 * [ x_0, x_1]^T
349 for(size_t j = 0; j &lt; p; j++)
350 for(size_t i = 0; i &lt; n; i++)
351 st[i * p + j] = rt[j];
352
353 return true;
354 }
355 </pre></font></code>
356
357 <br/>
323 // reverse Jacobian bool sparsity routine called by CppAD
324 virtual bool rev_sparse_jac(
325 size_t p ,
326 const vector&lt;bool&gt;&amp; rt ,
327 vector&lt;bool&gt;&amp; st )
328 { // This function needed if using RevSparseJac or optimize
329 size_t n = st.size() / p;
330 size_t m = rt.size() / p;
331 assert( n == 2 );
332 assert( m == 1 );
333
334 // sparsity for S(x)^T = f'(x)^T * R^T
335 // where f'(x)^T = 2 * [ x_0, x_1]^T
336 for(size_t j = 0; j &lt; p; j++)
337 for(size_t i = 0; i &lt; n; i++)
338 st[i * p + j] = rt[j];
339
340 return true;
341 }
342 </pre></font></code>
358343 <br/>
359344 <b><big><a name="rev_sparse_hes" id="rev_sparse_hes">rev_sparse_hes</a></big></b>
360345
361346 <code><font color='blue'><pre style='display:inline'>
362 // reverse Hessian bool sparsity routine called by CppAD
363 virtual bool rev_sparse_hes(
364 const vector&lt;bool&gt;&amp; vx,
365 const vector&lt;bool&gt;&amp; s ,
366 vector&lt;bool&gt;&amp; t ,
367 size_t p ,
368 const vector&lt;bool&gt;&amp; r ,
369 const vector&lt;bool&gt;&amp; u ,
370 vector&lt;bool&gt;&amp; v )
371 { // This function needed if using RevSparseHes
372 size_t m = s.size();
373 size_t n = t.size();
374 assert( r.size() == n * p );
375 assert( u.size() == m * p );
376 assert( v.size() == n * p );
377 assert( n == 2 );
378 assert( m == 1 );
379
380 // There are no cross term second derivatives for this case,
381 // so it is not necessary to use vx.
382
383 // sparsity for T(x) = S(x) * f'(x)
384 t[0] = s[0];
385 t[1] = s[0];
386
387 // V(x) = f'(x)^T * g''(y) * f'(x) * R + g'(y) * f''(x) * R
388 // U(x) = g''(y) * f'(x) * R
389 // S(x) = g'(y)
390
391 // back propagate the sparsity for U
392 size_t j;
393 for(j = 0; j &lt; p; j++)
394 for(size_t i = 0; i &lt; n; i++)
395 v[ i * p + j] = u[j];
396
397 // include forward Jacobian sparsity in Hessian sparsity
398 // sparsity for g'(y) * f''(x) * R (Note f''(x) has same sparsity
399 // as the identity matrix)
400 if( s[0] )
401 { for(j = 0; j &lt; p; j++)
402 for(size_t i = 0; i &lt; n; i++)
403 { // Visual Studio 2013 generates warning without bool below
404 v[ i * p + j] |= bool( r[ i * p + j] );
405 }
406 }
407
408 return true;
409 }
410 </pre></font></code>
411
412 <br/>
347 // reverse Hessian bool sparsity routine called by CppAD
348 virtual bool rev_sparse_hes(
349 const vector&lt;bool&gt;&amp; vx,
350 const vector&lt;bool&gt;&amp; s ,
351 vector&lt;bool&gt;&amp; t ,
352 size_t p ,
353 const vector&lt;bool&gt;&amp; r ,
354 const vector&lt;bool&gt;&amp; u ,
355 vector&lt;bool&gt;&amp; v )
356 { // This function needed if using RevSparseHes
357 size_t m = s.size();
358 size_t n = t.size();
359 assert( r.size() == n * p );
360 assert( u.size() == m * p );
361 assert( v.size() == n * p );
362 assert( n == 2 );
363 assert( m == 1 );
364
365 // There are no cross term second derivatives for this case,
366 // so it is not necessary to use vx.
367
368 // sparsity for T(x) = S(x) * f'(x)
369 t[0] = s[0];
370 t[1] = s[0];
371
372 // V(x) = f'(x)^T * g''(y) * f'(x) * R + g'(y) * f''(x) * R
373 // U(x) = g''(y) * f'(x) * R
374 // S(x) = g'(y)
375
376 // back propagate the sparsity for U
377 size_t j;
378 for(j = 0; j &lt; p; j++)
379 for(size_t i = 0; i &lt; n; i++)
380 v[ i * p + j] = u[j];
381
382 // include forward Jacobian sparsity in Hessian sparsity
383 // sparsity for g'(y) * f''(x) * R (Note f''(x) has same sparsity
384 // as the identity matrix)
385 if( s[0] )
386 { for(j = 0; j &lt; p; j++)
387 for(size_t i = 0; i &lt; n; i++)
388 { // Visual Studio 2013 generates warning without bool below
389 v[ i * p + j] |= bool( r[ i * p + j] );
390 }
391 }
392
393 return true;
394 }
395 </pre></font></code>
413396 <br/>
414397 <b><big><a name="End Class Definition" id="End Class Definition">End Class Definition</a></big></b>
415398
418401 } // End empty namespace
419402
420403 </pre></font></code>
421
422 <br/>
423 <br/>
424404 <b><big><a name="Use Atomic Function" id="Use Atomic Function">Use Atomic Function</a></big></b>
425405
426406 <code><font color='blue'><pre style='display:inline'>
427407 bool norm_sq(void)
428 { bool ok = true;
429 using CppAD::AD;
430 using CppAD::NearEqual;
431 double eps = 10. * CppAD::numeric_limits&lt;double&gt;::epsilon();
432 </pre></font></code>
433
434 <br/>
408 { bool ok = true;
409 using CppAD::AD;
410 using CppAD::NearEqual;
411 double eps = 10. * CppAD::numeric_limits&lt;double&gt;::epsilon();
412 </pre></font></code>
435413 <br/>
436414 <b><a name="Use Atomic Function.Constructor" id="Use Atomic Function.Constructor">Constructor</a></b>
437415
438416 <code><font color='blue'><pre style='display:inline'>
439 // --------------------------------------------------------------------
440 // Create the atomic reciprocal object
441 atomic_norm_sq afun(&quot;atomic_norm_sq&quot;);
442 </pre></font></code>
443
444 <br/>
417 // --------------------------------------------------------------------
418 // Create the atomic reciprocal object
419 atomic_norm_sq afun(&quot;atomic_norm_sq&quot;);
420 </pre></font></code>
445421 <br/>
446422 <b><a name="Use Atomic Function.Recording" id="Use Atomic Function.Recording">Recording</a></b>
447423
448424 <code><font color='blue'><pre style='display:inline'>
449 // Create the function f(x)
450 //
451 // domain space vector
452 size_t n = 2;
453 double x0 = 0.25;
454 double x1 = 0.75;
455 vector&lt; <a href="ad.xml" target="_top">AD</a>&lt;double&gt; &gt; ax(n);
456 ax[0] = x0;
457 ax[1] = x1;
458
459 // declare independent variables and start tape recording
460 CppAD::<a href="independent.xml" target="_top">Independent</a>(ax);
461
462 // range space vector
463 size_t m = 1;
464 vector&lt; <a href="ad.xml" target="_top">AD</a>&lt;double&gt; &gt; ay(m);
465
466 // call user function and store norm_sq(x) in au[0]
467 afun(ax, ay); // y_0 = x_0 * x_0 + x_1 * x_1
468
469 // create f: x -&gt; y and stop tape recording
470 CppAD::<a href="funconstruct.xml" target="_top">ADFun</a>&lt;double&gt; f;
471 f.Dependent (ax, ay);
472 </pre></font></code>
473
474 <br/>
425 // Create the function f(x)
426 //
427 // domain space vector
428 size_t n = 2;
429 double x0 = 0.25;
430 double x1 = 0.75;
431 vector&lt; <a href="ad.xml" target="_top">AD</a>&lt;double&gt; &gt; ax(n);
432 ax[0] = x0;
433 ax[1] = x1;
434
435 // declare independent variables and start tape recording
436 CppAD::<a href="independent.xml" target="_top">Independent</a>(ax);
437
438 // range space vector
439 size_t m = 1;
440 vector&lt; <a href="ad.xml" target="_top">AD</a>&lt;double&gt; &gt; ay(m);
441
442 // call user function and store norm_sq(x) in au[0]
443 afun(ax, ay); // y_0 = x_0 * x_0 + x_1 * x_1
444
445 // create f: x -&gt; y and stop tape recording
446 CppAD::<a href="funconstruct.xml" target="_top">ADFun</a>&lt;double&gt; f;
447 f.Dependent (ax, ay);
448 </pre></font></code>
475449 <br/>
476450 <b><a name="Use Atomic Function.forward" id="Use Atomic Function.forward">forward</a></b>
477451
478452 <code><font color='blue'><pre style='display:inline'>
479 // check function value
480 double check = x0 * x0 + x1 * x1;
481 ok &amp;= <a href="nearequal.xml" target="_top">NearEqual</a>( Value(ay[0]) , check, eps, eps);
482
483 // check zero order forward mode
484 size_t q;
485 vector&lt;double&gt; x_q(n), y_q(m);
486 q = 0;
487 x_q[0] = x0;
488 x_q[1] = x1;
489 y_q = f.<a href="forward.xml" target="_top">Forward</a>(q, x_q);
490 ok &amp;= <a href="nearequal.xml" target="_top">NearEqual</a>(y_q[0] , check, eps, eps);
491
492 // check first order forward mode
493 q = 1;
494 x_q[0] = 0.3;
495 x_q[1] = 0.7;
496 y_q = f.<a href="forward.xml" target="_top">Forward</a>(q, x_q);
497 check = 2.0 * x0 * x_q[0] + 2.0 * x1 * x_q[1];
498 ok &amp;= <a href="nearequal.xml" target="_top">NearEqual</a>(y_q[0] , check, eps, eps);
499
500 </pre></font></code>
501
502 <br/>
503 <br/>
453 // check function value
454 double check = x0 * x0 + x1 * x1;
455 ok &amp;= <a href="nearequal.xml" target="_top">NearEqual</a>( Value(ay[0]) , check, eps, eps);
456
457 // check zero order forward mode
458 size_t q;
459 vector&lt;double&gt; x_q(n), y_q(m);
460 q = 0;
461 x_q[0] = x0;
462 x_q[1] = x1;
463 y_q = f.<a href="forward.xml" target="_top">Forward</a>(q, x_q);
464 ok &amp;= <a href="nearequal.xml" target="_top">NearEqual</a>(y_q[0] , check, eps, eps);
465
466 // check first order forward mode
467 q = 1;
468 x_q[0] = 0.3;
469 x_q[1] = 0.7;
470 y_q = f.<a href="forward.xml" target="_top">Forward</a>(q, x_q);
471 check = 2.0 * x0 * x_q[0] + 2.0 * x1 * x_q[1];
472 ok &amp;= <a href="nearequal.xml" target="_top">NearEqual</a>(y_q[0] , check, eps, eps);
473
474 </pre></font></code>
504475 <b><a name="Use Atomic Function.reverse" id="Use Atomic Function.reverse">reverse</a></b>
505476
506477 <code><font color='blue'><pre style='display:inline'>
507 // first order reverse mode
508 q = 1;
509 vector&lt;double&gt; w(m), dw(n * q);
510 w[0] = 1.;
511 dw = f.<a href="reverse.xml" target="_top">Reverse</a>(q, w);
512 check = 2.0 * x0;
513 ok &amp;= <a href="nearequal.xml" target="_top">NearEqual</a>(dw[0] , check, eps, eps);
514 check = 2.0 * x1;
515 ok &amp;= <a href="nearequal.xml" target="_top">NearEqual</a>(dw[1] , check, eps, eps);
516 </pre></font></code>
517
518 <br/>
478 // first order reverse mode
479 q = 1;
480 vector&lt;double&gt; w(m), dw(n * q);
481 w[0] = 1.;
482 dw = f.<a href="reverse.xml" target="_top">Reverse</a>(q, w);
483 check = 2.0 * x0;
484 ok &amp;= <a href="nearequal.xml" target="_top">NearEqual</a>(dw[0] , check, eps, eps);
485 check = 2.0 * x1;
486 ok &amp;= <a href="nearequal.xml" target="_top">NearEqual</a>(dw[1] , check, eps, eps);
487 </pre></font></code>
519488 <br/>
520489 <b><a name="Use Atomic Function.for_sparse_jac" id="Use Atomic Function.for_sparse_jac">for_sparse_jac</a></b>
521490
522491 <code><font color='blue'><pre style='display:inline'>
523 // forward mode sparstiy pattern
524 size_t p = n;
525 CppAD::vectorBool r1(n * p), s1(m * p);
526 r1[0] = true; r1[1] = false; // sparsity pattern identity
527 r1[2] = false; r1[3] = true;
528 //
529 s1 = f.ForSparseJac(p, r1);
530 ok &amp;= s1[0] == true; // f[0] depends on x[0]
531 ok &amp;= s1[1] == true; // f[0] depends on x[1]
532 </pre></font></code>
533
534 <br/>
492 // forward mode sparstiy pattern
493 size_t p = n;
494 CppAD::vectorBool r1(n * p), s1(m * p);
495 r1[0] = true; r1[1] = false; // sparsity pattern identity
496 r1[2] = false; r1[3] = true;
497 //
498 s1 = f.ForSparseJac(p, r1);
499 ok &amp;= s1[0] == true; // f[0] depends on x[0]
500 ok &amp;= s1[1] == true; // f[0] depends on x[1]
501 </pre></font></code>
535502 <br/>
536503 <b><a name="Use Atomic Function.rev_sparse_jac" id="Use Atomic Function.rev_sparse_jac">rev_sparse_jac</a></b>
537504
538505 <code><font color='blue'><pre style='display:inline'>
539 // reverse mode sparstiy pattern
540 q = m;
541 CppAD::vectorBool s2(q * m), r2(q * n);
542 s2[0] = true; // compute sparsity pattern for f[0]
543 //
544 r2 = f.RevSparseJac(q, s2);
545 ok &amp;= r2[0] == true; // f[0] depends on x[0]
546 ok &amp;= r2[1] == true; // f[0] depends on x[1]
547 </pre></font></code>
548
549 <br/>
506 // reverse mode sparstiy pattern
507 q = m;
508 CppAD::vectorBool s2(q * m), r2(q * n);
509 s2[0] = true; // compute sparsity pattern for f[0]
510 //
511 r2 = f.RevSparseJac(q, s2);
512 ok &amp;= r2[0] == true; // f[0] depends on x[0]
513 ok &amp;= r2[1] == true; // f[0] depends on x[1]
514 </pre></font></code>
550515 <br/>
551516 <b><a name="Use Atomic Function.rev_sparse_hes" id="Use Atomic Function.rev_sparse_hes">rev_sparse_hes</a></b>
552517
553518 <code><font color='blue'><pre style='display:inline'>
554 // Hessian sparsity (using previous ForSparseJac call)
555 CppAD::vectorBool s3(m), h(p * n);
556 s3[0] = true; // compute sparsity pattern for f[0]
557 //
558 h = f.RevSparseHes(p, s3);
559 ok &amp;= h[0] == true; // partial of f[0] w.r.t. x[0],x[0] is non-zero
560 ok &amp;= h[1] == false; // partial of f[0] w.r.t. x[0],x[1] is zero
561 ok &amp;= h[2] == false; // partial of f[0] w.r.t. x[1],x[0] is zero
562 ok &amp;= h[3] == true; // partial of f[0] w.r.t. x[1],x[1] is non-zero
563 //
564 return ok;
519 // Hessian sparsity (using previous ForSparseJac call)
520 CppAD::vectorBool s3(m), h(p * n);
521 s3[0] = true; // compute sparsity pattern for f[0]
522 //
523 h = f.RevSparseHes(p, s3);
524 ok &amp;= h[0] == true; // partial of f[0] w.r.t. x[0],x[0] is non-zero
525 ok &amp;= h[1] == false; // partial of f[0] w.r.t. x[0],x[1] is zero
526 ok &amp;= h[2] == false; // partial of f[0] w.r.t. x[1],x[0] is zero
527 ok &amp;= h[3] == true; // partial of f[0] w.r.t. x[1],x[1] is non-zero
528 //
529 return ok;
565530 }
566531 </pre></font></code>
567
568
569532
570533 <hr/>Input File: example/atomic/norm_sq.cpp
571534
55 <title>Reciprocal as an Atomic Operation: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Reciprocal as an Atomic Operation: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" reciprocal as an atomic operation: example and test set_sparsity_enum theory sparsity start class definition constructor forward reverse for_sparse_jac rev_sparse_jac rev_sparse_hes end use function recording "/>
8 <meta name="keywords" id="keywords" content=" reciprocal atomic operation: example test set_sparsity_enum theory sparsity start class definition constructor forward reverse for_sparse_jac rev_sparse_jac rev_sparse_hes end use function recording "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
109109 </select>
110110 </td>
111111 </tr></table><br/>
112
113
114
115112 <center><b><big><big>Reciprocal as an Atomic Operation: Example and Test</big></big></b></center>
116113 <br/>
117114 <b><big><a name="Theory" id="Theory">Theory</a></big></b>
182179 //
183180 // a utility to compute the union of two sets.
184181 void my_union(
185 std::set&lt;size_t&gt;&amp; result ,
186 const std::set&lt;size_t&gt;&amp; left ,
187 const std::set&lt;size_t&gt;&amp; right )
188 { std::set&lt;size_t&gt; temp;
189 std::set_union(
190 left.begin() ,
191 left.end() ,
192 right.begin() ,
193 right.end() ,
194 std::inserter(temp, temp.begin())
195 );
196 result.swap(temp);
182 std::set&lt;size_t&gt;&amp; result ,
183 const std::set&lt;size_t&gt;&amp; left ,
184 const std::set&lt;size_t&gt;&amp; right )
185 { std::set&lt;size_t&gt; temp;
186 std::set_union(
187 left.begin() ,
188 left.end() ,
189 right.begin() ,
190 right.end() ,
191 std::inserter(temp, temp.begin())
192 );
193 result.swap(temp);
197194 }
198195 //
199196 class atomic_reciprocal : public CppAD::atomic_base&lt;double&gt; {
200197 </pre></font></code>
201
202 <br/>
203198 <br/>
204199 <b><big><a name="Constructor" id="Constructor">Constructor</a></big></b>
205200
206201 <code><font color='blue'><pre style='display:inline'>
207 public:
208 // constructor (could use const char* for name)
209 atomic_reciprocal(const std::string&amp; name) :
210 // this exmaple only uses set sparsity patterns
211 CppAD::atomic_base&lt;double&gt;(name, atomic_base&lt;double&gt;::set_sparsity_enum)
212 { }
213 private:
214 </pre></font></code>
215
216 <br/>
202 public:
203 // constructor (could use const char* for name)
204 atomic_reciprocal(const std::string&amp; name) :
205 // this exmaple only uses set sparsity patterns
206 CppAD::atomic_base&lt;double&gt;(name, atomic_base&lt;double&gt;::set_sparsity_enum)
207 { }
208 private:
209 </pre></font></code>
217210 <br/>
218211 <b><big><a name="forward" id="forward">forward</a></big></b>
219212
220213 <code><font color='blue'><pre style='display:inline'>
221 // forward mode routine called by CppAD
222 virtual bool forward(
223 size_t p ,
224 size_t q ,
225 const vector&lt;bool&gt;&amp; vx ,
226 vector&lt;bool&gt;&amp; vy ,
227 const vector&lt;double&gt;&amp; tx ,
228 vector&lt;double&gt;&amp; ty
229 )
230 { size_t n = tx.size() / (q + 1);
231 size_t m = ty.size() / (q + 1);
232 assert( n == 1 );
233 assert( m == 1 );
234 assert( p &lt;= q );
235
236 // return flag
237 bool ok = q &lt;= 2;
238
239 // check for defining variable information
240 // This case must always be implemented
241 if( vx.size() &gt; 0 )
242 vy[0] = vx[0];
243
244 // Order zero forward mode.
245 // This case must always be implemented
246 // y^0 = f( x^0 ) = 1 / x^0
247 double f = 1. / tx[0];
248 if( p &lt;= 0 )
249 ty[0] = f;
250 if( q &lt;= 0 )
251 return ok;
252 assert( vx.size() == 0 );
253
254 // Order one forward mode.
255 // This case needed if first order forward mode is used.
256 // y^1 = f'( x^0 ) x^1
257 double fp = - f / tx[0];
258 if( p &lt;= 1 )
259 ty[1] = fp * tx[1];
260 if( q &lt;= 1 )
261 return ok;
262
263 // Order two forward mode.
264 // This case needed if second order forward mode is used.
265 // Y''(t) = X'(t)^\R{T} f''[X(t)] X'(t) + f'[X(t)] X''(t)
266 // 2 y^2 = x^1 * f''( x^0 ) x^1 + 2 f'( x^0 ) x^2
267 double fpp = - 2.0 * fp / tx[0];
268 ty[2] = tx[1] * fpp * tx[1] / 2.0 + fp * tx[2];
269 if( q &lt;= 2 )
270 return ok;
271
272 // Assume we are not using forward mode with order &gt; 2
273 assert( ! ok );
274 return ok;
275 }
276 </pre></font></code>
277
278 <br/>
214 // forward mode routine called by CppAD
215 virtual bool forward(
216 size_t p ,
217 size_t q ,
218 const vector&lt;bool&gt;&amp; vx ,
219 vector&lt;bool&gt;&amp; vy ,
220 const vector&lt;double&gt;&amp; tx ,
221 vector&lt;double&gt;&amp; ty
222 )
223 { size_t n = tx.size() / (q + 1);
224 size_t m = ty.size() / (q + 1);
225 assert( n == 1 );
226 assert( m == 1 );
227 assert( p &lt;= q );
228
229 // return flag
230 bool ok = q &lt;= 2;
231
232 // check for defining variable information
233 // This case must always be implemented
234 if( vx.size() &gt; 0 )
235 vy[0] = vx[0];
236
237 // Order zero forward mode.
238 // This case must always be implemented
239 // y^0 = f( x^0 ) = 1 / x^0
240 double f = 1. / tx[0];
241 if( p &lt;= 0 )
242 ty[0] = f;
243 if( q &lt;= 0 )
244 return ok;
245 assert( vx.size() == 0 );
246
247 // Order one forward mode.
248 // This case needed if first order forward mode is used.
249 // y^1 = f'( x^0 ) x^1
250 double fp = - f / tx[0];
251 if( p &lt;= 1 )
252 ty[1] = fp * tx[1];
253 if( q &lt;= 1 )
254 return ok;
255
256 // Order two forward mode.
257 // This case needed if second order forward mode is used.
258 // Y''(t) = X'(t)^\R{T} f''[X(t)] X'(t) + f'[X(t)] X''(t)
259 // 2 y^2 = x^1 * f''( x^0 ) x^1 + 2 f'( x^0 ) x^2
260 double fpp = - 2.0 * fp / tx[0];
261 ty[2] = tx[1] * fpp * tx[1] / 2.0 + fp * tx[2];
262 if( q &lt;= 2 )
263 return ok;
264
265 // Assume we are not using forward mode with order &gt; 2
266 assert( ! ok );
267 return ok;
268 }
269 </pre></font></code>
279270 <br/>
280271 <b><big><a name="reverse" id="reverse">reverse</a></big></b>
281272
282273 <code><font color='blue'><pre style='display:inline'>
283 // reverse mode routine called by CppAD
284 virtual bool reverse(
285 size_t q ,
286 const vector&lt;double&gt;&amp; tx ,
287 const vector&lt;double&gt;&amp; ty ,
288 vector&lt;double&gt;&amp; px ,
289 const vector&lt;double&gt;&amp; py
290 )
291 { size_t n = tx.size() / (q + 1);
292 size_t m = ty.size() / (q + 1);
293 assert( px.size() == n * (q + 1) );
294 assert( py.size() == m * (q + 1) );
295 assert( n == 1 );
296 assert( m == 1 );
297 bool ok = q &lt;= 2;
298
299 double f, fp, fpp, fppp;
300 switch(q)
301 { case 0:
302 // This case needed if first order reverse mode is used
303 // reverse: F^0 ( tx ) = y^0 = f( x^0 )
304 f = ty[0];
305 fp = - f / tx[0];
306 px[0] = py[0] * fp;;
307 assert(ok);
308 break;
309
310 case 1:
311 // This case needed if second order reverse mode is used
312 // reverse: F^1 ( tx ) = y^1 = f'( x^0 ) x^1
313 f = ty[0];
314 fp = - f / tx[0];
315 fpp = - 2.0 * fp / tx[0];
316 px[1] = py[1] * fp;
317 px[0] = py[1] * fpp * tx[1];
318 // reverse: F^0 ( tx ) = y^0 = f( x^0 );
319 px[0] += py[0] * fp;
320 assert(ok);
321 break;
322
323 case 2:
324 // This needed if third order reverse mode is used
325 // reverse: F^2 ( tx ) = y^2 =
326 // = x^1 * f''( x^0 ) x^1 / 2 + f'( x^0 ) x^2
327 f = ty[0];
328 fp = - f / tx[0];
329 fpp = - 2.0 * fp / tx[0];
330 fppp = - 3.0 * fpp / tx[0];
331 px[2] = py[2] * fp;
332 px[1] = py[2] * fpp * tx[1];
333 px[0] = py[2] * tx[1] * fppp * tx[1] / 2.0 + fpp * tx[2];
334 // reverse: F^1 ( tx ) = y^1 = f'( x^0 ) x^1
335 px[1] += py[1] * fp;
336 px[0] += py[1] * fpp * tx[1];
337 // reverse: F^0 ( tx ) = y^0 = f( x^0 );
338 px[0] += py[0] * fp;
339 assert(ok);
340 break;
341
342 default:
343 assert(!ok);
344 }
345 return ok;
346 }
347 </pre></font></code>
348
349 <br/>
274 // reverse mode routine called by CppAD
275 virtual bool reverse(
276 size_t q ,
277 const vector&lt;double&gt;&amp; tx ,
278 const vector&lt;double&gt;&amp; ty ,
279 vector&lt;double&gt;&amp; px ,
280 const vector&lt;double&gt;&amp; py
281 )
282 { size_t n = tx.size() / (q + 1);
283 size_t m = ty.size() / (q + 1);
284 assert( px.size() == n * (q + 1) );
285 assert( py.size() == m * (q + 1) );
286 assert( n == 1 );
287 assert( m == 1 );
288 bool ok = q &lt;= 2;
289
290 double f, fp, fpp, fppp;
291 switch(q)
292 { case 0:
293 // This case needed if first order reverse mode is used
294 // reverse: F^0 ( tx ) = y^0 = f( x^0 )
295 f = ty[0];
296 fp = - f / tx[0];
297 px[0] = py[0] * fp;;
298 assert(ok);
299 break;
300
301 case 1:
302 // This case needed if second order reverse mode is used
303 // reverse: F^1 ( tx ) = y^1 = f'( x^0 ) x^1
304 f = ty[0];
305 fp = - f / tx[0];
306 fpp = - 2.0 * fp / tx[0];
307 px[1] = py[1] * fp;
308 px[0] = py[1] * fpp * tx[1];
309 // reverse: F^0 ( tx ) = y^0 = f( x^0 );
310 px[0] += py[0] * fp;
311 assert(ok);
312 break;
313
314 case 2:
315 // This needed if third order reverse mode is used
316 // reverse: F^2 ( tx ) = y^2 =
317 // = x^1 * f''( x^0 ) x^1 / 2 + f'( x^0 ) x^2
318 f = ty[0];
319 fp = - f / tx[0];
320 fpp = - 2.0 * fp / tx[0];
321 fppp = - 3.0 * fpp / tx[0];
322 px[2] = py[2] * fp;
323 px[1] = py[2] * fpp * tx[1];
324 px[0] = py[2] * tx[1] * fppp * tx[1] / 2.0 + fpp * tx[2];
325 // reverse: F^1 ( tx ) = y^1 = f'( x^0 ) x^1
326 px[1] += py[1] * fp;
327 px[0] += py[1] * fpp * tx[1];
328 // reverse: F^0 ( tx ) = y^0 = f( x^0 );
329 px[0] += py[0] * fp;
330 assert(ok);
331 break;
332
333 default:
334 assert(!ok);
335 }
336 return ok;
337 }
338 </pre></font></code>
350339 <br/>
351340 <b><big><a name="for_sparse_jac" id="for_sparse_jac">for_sparse_jac</a></big></b>
352341
353342 <code><font color='blue'><pre style='display:inline'>
354 // forward Jacobian set sparsity routine called by CppAD
355 virtual bool for_sparse_jac(
356 size_t p ,
357 const vector&lt; std::set&lt;size_t&gt; &gt;&amp; r ,
358 vector&lt; std::set&lt;size_t&gt; &gt;&amp; s )
359 { // This function needed if using f.ForSparseJac
360 size_t n = r.size();
361 size_t m = s.size();
362 assert( n == 1 );
363 assert( m == 1 );
364
365 // sparsity for S(x) = f'(x) * R is same as sparsity for R
366 s[0] = r[0];
367
368 return true;
369 }
370 </pre></font></code>
371
372 <br/>
343 // forward Jacobian set sparsity routine called by CppAD
344 virtual bool for_sparse_jac(
345 size_t p ,
346 const vector&lt; std::set&lt;size_t&gt; &gt;&amp; r ,
347 vector&lt; std::set&lt;size_t&gt; &gt;&amp; s )
348 { // This function needed if using f.ForSparseJac
349 size_t n = r.size();
350 size_t m = s.size();
351 assert( n == 1 );
352 assert( m == 1 );
353
354 // sparsity for S(x) = f'(x) * R is same as sparsity for R
355 s[0] = r[0];
356
357 return true;
358 }
359 </pre></font></code>
373360 <br/>
374361 <b><big><a name="rev_sparse_jac" id="rev_sparse_jac">rev_sparse_jac</a></big></b>
375362
376363 <code><font color='blue'><pre style='display:inline'>
377 // reverse Jacobian set sparsity routine called by CppAD
378 virtual bool rev_sparse_jac(
379 size_t p ,
380 const vector&lt; std::set&lt;size_t&gt; &gt;&amp; rt ,
381 vector&lt; std::set&lt;size_t&gt; &gt;&amp; st )
382 { // This function needed if using RevSparseJac or optimize
383 size_t n = st.size();
384 size_t m = rt.size();
385 assert( n == 1 );
386 assert( m == 1 );
387
388 // sparsity for S(x)^T = f'(x)^T * R^T is same as sparsity for R^T
389 st[0] = rt[0];
390
391 return true;
392 }
393 </pre></font></code>
394
395 <br/>
364 // reverse Jacobian set sparsity routine called by CppAD
365 virtual bool rev_sparse_jac(
366 size_t p ,
367 const vector&lt; std::set&lt;size_t&gt; &gt;&amp; rt ,
368 vector&lt; std::set&lt;size_t&gt; &gt;&amp; st )
369 { // This function needed if using RevSparseJac or optimize
370 size_t n = st.size();
371 size_t m = rt.size();
372 assert( n == 1 );
373 assert( m == 1 );
374
375 // sparsity for S(x)^T = f'(x)^T * R^T is same as sparsity for R^T
376 st[0] = rt[0];
377
378 return true;
379 }
380 </pre></font></code>
396381 <br/>
397382 <b><big><a name="rev_sparse_hes" id="rev_sparse_hes">rev_sparse_hes</a></big></b>
398383
399384 <code><font color='blue'><pre style='display:inline'>
400 // reverse Hessian set sparsity routine called by CppAD
401 virtual bool rev_sparse_hes(
402 const vector&lt;bool&gt;&amp; vx,
403 const vector&lt;bool&gt;&amp; s ,
404 vector&lt;bool&gt;&amp; t ,
405 size_t p ,
406 const vector&lt; std::set&lt;size_t&gt; &gt;&amp; r ,
407 const vector&lt; std::set&lt;size_t&gt; &gt;&amp; u ,
408 vector&lt; std::set&lt;size_t&gt; &gt;&amp; v )
409 { // This function needed if using RevSparseHes
410 size_t n = vx.size();
411 size_t m = s.size();
412 assert( t.size() == n );
413 assert( r.size() == n );
414 assert( u.size() == m );
415 assert( v.size() == n );
416 assert( n == 1 );
417 assert( m == 1 );
418
419 // There are no cross term second derivatives for this case,
420 // so it is not necessary to vx.
421
422 // sparsity for T(x) = S(x) * f'(x) is same as sparsity for S
423 t[0] = s[0];
424
425 // V(x) = f'(x)^T * g''(y) * f'(x) * R + g'(y) * f''(x) * R
426 // U(x) = g''(y) * f'(x) * R
427 // S(x) = g'(y)
428
429 // back propagate the sparsity for U, note f'(x) may be non-zero;
430 v[0] = u[0];
431
432 // include forward Jacobian sparsity in Hessian sparsity
433 // (note sparsty for f''(x) * R same as for R)
434 if( s[0] )
435 my_union(v[0], v[0], r[0] );
436
437 return true;
438 }
439 </pre></font></code>
440
441 <br/>
385 // reverse Hessian set sparsity routine called by CppAD
386 virtual bool rev_sparse_hes(
387 const vector&lt;bool&gt;&amp; vx,
388 const vector&lt;bool&gt;&amp; s ,
389 vector&lt;bool&gt;&amp; t ,
390 size_t p ,
391 const vector&lt; std::set&lt;size_t&gt; &gt;&amp; r ,
392 const vector&lt; std::set&lt;size_t&gt; &gt;&amp; u ,
393 vector&lt; std::set&lt;size_t&gt; &gt;&amp; v )
394 { // This function needed if using RevSparseHes
395 size_t n = vx.size();
396 size_t m = s.size();
397 assert( t.size() == n );
398 assert( r.size() == n );
399 assert( u.size() == m );
400 assert( v.size() == n );
401 assert( n == 1 );
402 assert( m == 1 );
403
404 // There are no cross term second derivatives for this case,
405 // so it is not necessary to vx.
406
407 // sparsity for T(x) = S(x) * f'(x) is same as sparsity for S
408 t[0] = s[0];
409
410 // V(x) = f'(x)^T * g''(y) * f'(x) * R + g'(y) * f''(x) * R
411 // U(x) = g''(y) * f'(x) * R
412 // S(x) = g'(y)
413
414 // back propagate the sparsity for U, note f'(x) may be non-zero;
415 v[0] = u[0];
416
417 // include forward Jacobian sparsity in Hessian sparsity
418 // (note sparsty for f''(x) * R same as for R)
419 if( s[0] )
420 my_union(v[0], v[0], r[0] );
421
422 return true;
423 }
424 </pre></font></code>
442425 <br/>
443426 <b><big><a name="End Class Definition" id="End Class Definition">End Class Definition</a></big></b>
444427
447430 } // End empty namespace
448431
449432 </pre></font></code>
450
451 <br/>
452 <br/>
453433 <b><big><a name="Use Atomic Function" id="Use Atomic Function">Use Atomic Function</a></big></b>
454434
455435 <code><font color='blue'><pre style='display:inline'>
456436 bool reciprocal(void)
457 { bool ok = true;
458 using CppAD::AD;
459 using CppAD::NearEqual;
460 double eps = 10. * CppAD::numeric_limits&lt;double&gt;::epsilon();
461 </pre></font></code>
462
463 <br/>
437 { bool ok = true;
438 using CppAD::AD;
439 using CppAD::NearEqual;
440 double eps = 10. * CppAD::numeric_limits&lt;double&gt;::epsilon();
441 </pre></font></code>
464442 <br/>
465443 <b><a name="Use Atomic Function.Constructor" id="Use Atomic Function.Constructor">Constructor</a></b>
466444
467445 <code><font color='blue'><pre style='display:inline'>
468 // --------------------------------------------------------------------
469 // Create the atomic reciprocal object
470 atomic_reciprocal afun(&quot;atomic_reciprocal&quot;);
471 </pre></font></code>
472
473 <br/>
446 // --------------------------------------------------------------------
447 // Create the atomic reciprocal object
448 atomic_reciprocal afun(&quot;atomic_reciprocal&quot;);
449 </pre></font></code>
474450 <br/>
475451 <b><a name="Use Atomic Function.Recording" id="Use Atomic Function.Recording">Recording</a></b>
476452
477453 <code><font color='blue'><pre style='display:inline'>
478 // Create the function f(x)
479 //
480 // domain space vector
481 size_t n = 1;
482 double x0 = 0.5;
483 vector&lt; <a href="ad.xml" target="_top">AD</a>&lt;double&gt; &gt; ax(n);
484 ax[0] = x0;
485
486 // declare independent variables and start tape recording
487 CppAD::<a href="independent.xml" target="_top">Independent</a>(ax);
488
489 // range space vector
490 size_t m = 1;
491 vector&lt; <a href="ad.xml" target="_top">AD</a>&lt;double&gt; &gt; ay(m);
492
493 // call user function and store reciprocal(x) in au[0]
494 vector&lt; <a href="ad.xml" target="_top">AD</a>&lt;double&gt; &gt; au(m);
495 afun(ax, au); // u = 1 / x
496
497 // now use AD division to invert to invert the operation
498 ay[0] = 1.0 / au[0]; // y = 1 / u = x
499
500 // create f: x -&gt; y and stop tape recording
501 CppAD::<a href="funconstruct.xml" target="_top">ADFun</a>&lt;double&gt; f;
502 f.Dependent (ax, ay); // f(x) = x
503 </pre></font></code>
504
505 <br/>
454 // Create the function f(x)
455 //
456 // domain space vector
457 size_t n = 1;
458 double x0 = 0.5;
459 vector&lt; <a href="ad.xml" target="_top">AD</a>&lt;double&gt; &gt; ax(n);
460 ax[0] = x0;
461
462 // declare independent variables and start tape recording
463 CppAD::<a href="independent.xml" target="_top">Independent</a>(ax);
464
465 // range space vector
466 size_t m = 1;
467 vector&lt; <a href="ad.xml" target="_top">AD</a>&lt;double&gt; &gt; ay(m);
468
469 // call user function and store reciprocal(x) in au[0]
470 vector&lt; <a href="ad.xml" target="_top">AD</a>&lt;double&gt; &gt; au(m);
471 afun(ax, au); // u = 1 / x
472
473 // now use AD division to invert to invert the operation
474 ay[0] = 1.0 / au[0]; // y = 1 / u = x
475
476 // create f: x -&gt; y and stop tape recording
477 CppAD::<a href="funconstruct.xml" target="_top">ADFun</a>&lt;double&gt; f;
478 f.Dependent (ax, ay); // f(x) = x
479 </pre></font></code>
506480 <br/>
507481 <b><a name="Use Atomic Function.forward" id="Use Atomic Function.forward">forward</a></b>
508482
509483 <code><font color='blue'><pre style='display:inline'>
510 // check function value
511 double check = x0;
512 ok &amp;= <a href="nearequal.xml" target="_top">NearEqual</a>( Value(ay[0]) , check, eps, eps);
513
514 // check zero order forward mode
515 size_t q;
516 vector&lt;double&gt; x_q(n), y_q(m);
517 q = 0;
518 x_q[0] = x0;
519 y_q = f.<a href="forward.xml" target="_top">Forward</a>(q, x_q);
520 ok &amp;= <a href="nearequal.xml" target="_top">NearEqual</a>(y_q[0] , check, eps, eps);
521
522 // check first order forward mode
523 q = 1;
524 x_q[0] = 1;
525 y_q = f.<a href="forward.xml" target="_top">Forward</a>(q, x_q);
526 check = 1.;
527 ok &amp;= <a href="nearequal.xml" target="_top">NearEqual</a>(y_q[0] , check, eps, eps);
528
529 // check second order forward mode
530 q = 2;
531 x_q[0] = 0;
532 y_q = f.<a href="forward.xml" target="_top">Forward</a>(q, x_q);
533 check = 0.;
534 ok &amp;= <a href="nearequal.xml" target="_top">NearEqual</a>(y_q[0] , check, eps, eps);
535 </pre></font></code>
536
537 <br/>
484 // check function value
485 double check = x0;
486 ok &amp;= <a href="nearequal.xml" target="_top">NearEqual</a>( Value(ay[0]) , check, eps, eps);
487
488 // check zero order forward mode
489 size_t q;
490 vector&lt;double&gt; x_q(n), y_q(m);
491 q = 0;
492 x_q[0] = x0;
493 y_q = f.<a href="forward.xml" target="_top">Forward</a>(q, x_q);
494 ok &amp;= <a href="nearequal.xml" target="_top">NearEqual</a>(y_q[0] , check, eps, eps);
495
496 // check first order forward mode
497 q = 1;
498 x_q[0] = 1;
499 y_q = f.<a href="forward.xml" target="_top">Forward</a>(q, x_q);
500 check = 1.;
501 ok &amp;= <a href="nearequal.xml" target="_top">NearEqual</a>(y_q[0] , check, eps, eps);
502
503 // check second order forward mode
504 q = 2;
505 x_q[0] = 0;
506 y_q = f.<a href="forward.xml" target="_top">Forward</a>(q, x_q);
507 check = 0.;
508 ok &amp;= <a href="nearequal.xml" target="_top">NearEqual</a>(y_q[0] , check, eps, eps);
509 </pre></font></code>
538510 <br/>
539511 <b><a name="Use Atomic Function.reverse" id="Use Atomic Function.reverse">reverse</a></b>
540512
541513 <code><font color='blue'><pre style='display:inline'>
542 // third order reverse mode
543 q = 3;
544 vector&lt;double&gt; w(m), dw(n * q);
545 w[0] = 1.;
546 dw = f.<a href="reverse.xml" target="_top">Reverse</a>(q, w);
547 check = 1.;
548 ok &amp;= <a href="nearequal.xml" target="_top">NearEqual</a>(dw[0] , check, eps, eps);
549 check = 0.;
550 ok &amp;= <a href="nearequal.xml" target="_top">NearEqual</a>(dw[1] , check, eps, eps);
551 ok &amp;= <a href="nearequal.xml" target="_top">NearEqual</a>(dw[2] , check, eps, eps);
552 </pre></font></code>
553
554 <br/>
514 // third order reverse mode
515 q = 3;
516 vector&lt;double&gt; w(m), dw(n * q);
517 w[0] = 1.;
518 dw = f.<a href="reverse.xml" target="_top">Reverse</a>(q, w);
519 check = 1.;
520 ok &amp;= <a href="nearequal.xml" target="_top">NearEqual</a>(dw[0] , check, eps, eps);
521 check = 0.;
522 ok &amp;= <a href="nearequal.xml" target="_top">NearEqual</a>(dw[1] , check, eps, eps);
523 ok &amp;= <a href="nearequal.xml" target="_top">NearEqual</a>(dw[2] , check, eps, eps);
524 </pre></font></code>
555525 <br/>
556526 <b><a name="Use Atomic Function.for_sparse_jac" id="Use Atomic Function.for_sparse_jac">for_sparse_jac</a></b>
557527
558528 <code><font color='blue'><pre style='display:inline'>
559 // forward mode sparstiy pattern
560 size_t p = n;
561 CppAD::vectorBool r1(n * p), s1(m * p);
562 r1[0] = true; // compute sparsity pattern for x[0]
563 //
564 s1 = f.ForSparseJac(p, r1);
565 ok &amp;= s1[0] == true; // f[0] depends on x[0]
566 </pre></font></code>
567
568 <br/>
529 // forward mode sparstiy pattern
530 size_t p = n;
531 CppAD::vectorBool r1(n * p), s1(m * p);
532 r1[0] = true; // compute sparsity pattern for x[0]
533 //
534 s1 = f.ForSparseJac(p, r1);
535 ok &amp;= s1[0] == true; // f[0] depends on x[0]
536 </pre></font></code>
569537 <br/>
570538 <b><a name="Use Atomic Function.rev_sparse_jac" id="Use Atomic Function.rev_sparse_jac">rev_sparse_jac</a></b>
571539
572540 <code><font color='blue'><pre style='display:inline'>
573 // reverse mode sparstiy pattern
574 q = m;
575 CppAD::vectorBool s2(q * m), r2(q * n);
576 s2[0] = true; // compute sparsity pattern for f[0]
577 //
578 r2 = f.RevSparseJac(q, s2);
579 ok &amp;= r2[0] == true; // f[0] depends on x[0]
580 </pre></font></code>
581
582 <br/>
541 // reverse mode sparstiy pattern
542 q = m;
543 CppAD::vectorBool s2(q * m), r2(q * n);
544 s2[0] = true; // compute sparsity pattern for f[0]
545 //
546 r2 = f.RevSparseJac(q, s2);
547 ok &amp;= r2[0] == true; // f[0] depends on x[0]
548 </pre></font></code>
583549 <br/>
584550 <b><a name="Use Atomic Function.rev_sparse_hes" id="Use Atomic Function.rev_sparse_hes">rev_sparse_hes</a></b>
585551
586552 <code><font color='blue'><pre style='display:inline'>
587 // Hessian sparsity (using previous ForSparseJac call)
588 CppAD::vectorBool s3(m), h(p * n);
589 s3[0] = true; // compute sparsity pattern for f[0]
590 //
591 h = f.RevSparseHes(p, s3);
592 ok &amp;= h[0] == true; // second partial of f[0] w.r.t. x[0] may be non-zero
593 //
594 return ok;
553 // Hessian sparsity (using previous ForSparseJac call)
554 CppAD::vectorBool s3(m), h(p * n);
555 s3[0] = true; // compute sparsity pattern for f[0]
556 //
557 h = f.RevSparseHes(p, s3);
558 ok &amp;= h[0] == true; // second partial of f[0] w.r.t. x[0] may be non-zero
559 //
560 return ok;
595561 }
596562 </pre></font></code>
597
598
599563
600564 <hr/>Input File: example/atomic/reciprocal.cpp
601565
55 <title>Atomic Sparsity Patterns: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Atomic Sparsity Patterns: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" atomic sparsity patterns: example and test function pack_sparsity_enum start class definition constructor forward for_sparse_jac rev_sparse_jac rev_sparse_hes end use recording forsparse_jac "/>
8 <meta name="keywords" id="keywords" content=" atomic sparsity patterns: example test function pack_sparsity_enum start class definition constructor forward for_sparse_jac rev_sparse_jac rev_sparse_hes end use recording forsparse_jac "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
105105 </select>
106106 </td>
107107 </tr></table><br/>
108
109
110
111108 <center><b><big><big>Atomic Sparsity Patterns: Example and Test</big></big></b></center>
112109 <br/>
113110 <b><big><a name="function" id="function">function</a></big></b>
181178 //
182179 class atomic_sparsity : public CppAD::atomic_base&lt;double&gt; {
183180 </pre></font></code>
184
185 <br/>
186181 <br/>
187182 <b><big><a name="Constructor" id="Constructor">Constructor</a></big></b>
188183
189184 <code><font color='blue'><pre style='display:inline'>
190 public:
191 // constructor
192 atomic_sparsity(const std::string&amp; name) :
193 // this exampel only uses pack sparsity patterns
194 CppAD::atomic_base&lt;double&gt;(name, pack_sparsity_enum )
195 { }
196 private:
197 </pre></font></code>
198
199 <br/>
185 public:
186 // constructor
187 atomic_sparsity(const std::string&amp; name) :
188 // this exampel only uses pack sparsity patterns
189 CppAD::atomic_base&lt;double&gt;(name, pack_sparsity_enum )
190 { }
191 private:
192 </pre></font></code>
200193 <br/>
201194 <b><big><a name="forward" id="forward">forward</a></big></b>
202195
203196 <code><font color='blue'><pre style='display:inline'>
204 // forward
205 virtual bool forward(
206 size_t p ,
207 size_t q ,
208 const vector&lt;bool&gt;&amp; vx ,
209 vector&lt;bool&gt;&amp; vy ,
210 const vector&lt;double&gt;&amp; tx ,
211 vector&lt;double&gt;&amp; ty
212 )
213 { size_t n = tx.size() / (q + 1);
214 size_t m = ty.size() / (q + 1);
215 assert( n == 3 );
216 assert( m == 2 );
217
218 // only order zero
219 bool ok = q == 0;
220 if( ! ok )
221 return ok;
222
223 // check for defining variable information
224 if( vx.size() &gt; 0 )
225 { ok &amp;= vx.size() == n;
226 vy[0] = vx[2];
227 vy[1] = vx[0] || vx[1];
228 }
229
230 // Order zero forward mode.
231 // y[0] = x[2], y[1] = x[0] * x[1]
232 if( p &lt;= 0 )
233 { ty[0] = tx[2];
234 ty[1] = tx[0] * tx[1];
235 }
236 return ok;
237 }
238 </pre></font></code>
239
240 <br/>
197 // forward
198 virtual bool forward(
199 size_t p ,
200 size_t q ,
201 const vector&lt;bool&gt;&amp; vx ,
202 vector&lt;bool&gt;&amp; vy ,
203 const vector&lt;double&gt;&amp; tx ,
204 vector&lt;double&gt;&amp; ty
205 )
206 { size_t n = tx.size() / (q + 1);
207 size_t m = ty.size() / (q + 1);
208 assert( n == 3 );
209 assert( m == 2 );
210
211 // only order zero
212 bool ok = q == 0;
213 if( ! ok )
214 return ok;
215
216 // check for defining variable information
217 if( vx.size() &gt; 0 )
218 { ok &amp;= vx.size() == n;
219 vy[0] = vx[2];
220 vy[1] = vx[0] || vx[1];
221 }
222
223 // Order zero forward mode.
224 // y[0] = x[2], y[1] = x[0] * x[1]
225 if( p &lt;= 0 )
226 { ty[0] = tx[2];
227 ty[1] = tx[0] * tx[1];
228 }
229 return ok;
230 }
231 </pre></font></code>
241232 <br/>
242233 <b><big><a name="for_sparse_jac" id="for_sparse_jac">for_sparse_jac</a></big></b>
243234
244235 <code><font color='blue'><pre style='display:inline'>
245 // for_sparse_jac
246 virtual bool for_sparse_jac(
247 size_t p ,
248 const vectorBool&amp; r ,
249 vectorBool&amp; s )
250 { // This function needed if using f.ForSparseJac
251 size_t n = r.size() / p;
252 size_t m = s.size() / p;
253 assert( n == 3 );
254 assert( m == 2 );
255
256 // sparsity for S(x) = f'(x) * R = [ 0, 0, 1 ] * R
257 // [ x1, x0, 0 ]
258 for(size_t j = 0; j &lt; p; j++)
259 { s[ 0 * p + j] = r[ 2 * p + j];
260 s[ 1 * p + j] = r[ 0 * p + j] || r[ 1 * p + j];
261 }
262 return true;
263 }
264 </pre></font></code>
265
266 <br/>
236 // for_sparse_jac
237 virtual bool for_sparse_jac(
238 size_t p ,
239 const vectorBool&amp; r ,
240 vectorBool&amp; s )
241 { // This function needed if using f.ForSparseJac
242 size_t n = r.size() / p;
243 size_t m = s.size() / p;
244 assert( n == 3 );
245 assert( m == 2 );
246
247 // sparsity for S(x) = f'(x) * R = [ 0, 0, 1 ] * R
248 // [ x1, x0, 0 ]
249 for(size_t j = 0; j &lt; p; j++)
250 { s[ 0 * p + j] = r[ 2 * p + j];
251 s[ 1 * p + j] = r[ 0 * p + j] || r[ 1 * p + j];
252 }
253 return true;
254 }
255 </pre></font></code>
267256 <br/>
268257 <b><big><a name="rev_sparse_jac" id="rev_sparse_jac">rev_sparse_jac</a></big></b>
269258
270259 <code><font color='blue'><pre style='display:inline'>
271 virtual bool rev_sparse_jac(
272 size_t p ,
273 const vectorBool&amp; rt ,
274 vectorBool&amp; st )
275 { // This function needed if using RevSparseJac or optimize
276 size_t n = st.size() / p;
277 size_t m = rt.size() / p;
278 assert( n == 3 );
279 assert( m == 2 );
280
281 // [ 0, x1 ]
282 // sparsity for S(x)^T = f'(x)^T * R^T = [ 0, x0 ] * R^T
283 // [ 1, 0 ]
284 for(size_t j = 0; j &lt; p; j++)
285 { st[ 0 * p + j ] = rt[ 1 * m + j ];
286 st[ 1 * p + j ] = rt[ 1 * m + j ];
287 st[ 2 * p + j ] = rt[ 0 * m + j ];
288 }
289 return true;
290 }
291 </pre></font></code>
292
293 <br/>
260 virtual bool rev_sparse_jac(
261 size_t p ,
262 const vectorBool&amp; rt ,
263 vectorBool&amp; st )
264 { // This function needed if using RevSparseJac or optimize
265 size_t n = st.size() / p;
266 size_t m = rt.size() / p;
267 assert( n == 3 );
268 assert( m == 2 );
269
270 // [ 0, x1 ]
271 // sparsity for S(x)^T = f'(x)^T * R^T = [ 0, x0 ] * R^T
272 // [ 1, 0 ]
273 for(size_t j = 0; j &lt; p; j++)
274 { st[ 0 * p + j ] = rt[ 1 * m + j ];
275 st[ 1 * p + j ] = rt[ 1 * m + j ];
276 st[ 2 * p + j ] = rt[ 0 * m + j ];
277 }
278 return true;
279 }
280 </pre></font></code>
294281 <br/>
295282 <b><big><a name="rev_sparse_hes" id="rev_sparse_hes">rev_sparse_hes</a></big></b>
296283
297284 <code><font color='blue'><pre style='display:inline'>
298 virtual bool rev_sparse_hes(
299 const vector&lt;bool&gt;&amp; vx,
300 const vector&lt;bool&gt;&amp; s ,
301 vector&lt;bool&gt;&amp; t ,
302 size_t p ,
303 const vectorBool&amp; r ,
304 const vectorBool&amp; u ,
305 vectorBool&amp; v )
306 { // This function needed if using RevSparseHes
307 size_t m = s.size();
308 size_t n = t.size();
309 assert( r.size() == n * p );
310 assert( u.size() == m * p );
311 assert( v.size() == n * p );
312 assert( n == 3 );
313 assert( m == 2 );
314
315 // sparsity for T(x) = S(x) * f'(x) = S(x) * [ 0, 0, 1 ]
316 // [ x1, x0, 0 ]
317 t[0] = s[1];
318 t[1] = s[1];
319 t[2] = s[0];
320
321 // V(x) = f'(x)^T * g''(y) * f'(x) * R + g'(y) * f''(x) * R
322 // U(x) = g''(y) * f'(x) * R
323 // S(x) = g'(y)
324
325 // [ 0, x1 ]
326 // sparsity for f'(x)^T * U(x) = [ 0, x0 ] * U(x)
327 // [ 1, 0 ]
328 size_t j;
329 for(j = 0; j &lt; p; j++)
330 { v[ 0 * p + j ] = u[ 1 * m + j ];
331 v[ 1 * p + j ] = u[ 1 * m + j ];
332 v[ 2 * p + j ] = u[ 0 * m + j ];
333 }
334
335 // include forward Jacobian sparsity in Hessian sparsity
336 // [ 0, 1, 0 ]
337 // sum_i S_i (x) g'(y) * f_i''(x) * R = S_1 (x) * [ 1, 0, 0 ] * R
338 // [ 0, 0, 0 ]
339 if( s[1] )
340 { for(j = 0; j &lt; p; j++)
341 { v[ 0 * p + j ] = bool(v[0 * p + j]) | bool(r[1 * p + j]);
342 v[ 1 * p + j ] = bool(v[1 * p + j]) | bool(r[0 * p + j]);
343 }
344 }
345 return true;
346 }
347 </pre></font></code>
348
349 <br/>
285 virtual bool rev_sparse_hes(
286 const vector&lt;bool&gt;&amp; vx,
287 const vector&lt;bool&gt;&amp; s ,
288 vector&lt;bool&gt;&amp; t ,
289 size_t p ,
290 const vectorBool&amp; r ,
291 const vectorBool&amp; u ,
292 vectorBool&amp; v )
293 { // This function needed if using RevSparseHes
294 size_t m = s.size();
295 size_t n = t.size();
296 assert( r.size() == n * p );
297 assert( u.size() == m * p );
298 assert( v.size() == n * p );
299 assert( n == 3 );
300 assert( m == 2 );
301
302 // sparsity for T(x) = S(x) * f'(x) = S(x) * [ 0, 0, 1 ]
303 // [ x1, x0, 0 ]
304 t[0] = s[1];
305 t[1] = s[1];
306 t[2] = s[0];
307
308 // V(x) = f'(x)^T * g''(y) * f'(x) * R + g'(y) * f''(x) * R
309 // U(x) = g''(y) * f'(x) * R
310 // S(x) = g'(y)
311
312 // [ 0, x1 ]
313 // sparsity for f'(x)^T * U(x) = [ 0, x0 ] * U(x)
314 // [ 1, 0 ]
315 size_t j;
316 for(j = 0; j &lt; p; j++)
317 { v[ 0 * p + j ] = u[ 1 * m + j ];
318 v[ 1 * p + j ] = u[ 1 * m + j ];
319 v[ 2 * p + j ] = u[ 0 * m + j ];
320 }
321
322 // include forward Jacobian sparsity in Hessian sparsity
323 // [ 0, 1, 0 ]
324 // sum_i S_i (x) g'(y) * f_i''(x) * R = S_1 (x) * [ 1, 0, 0 ] * R
325 // [ 0, 0, 0 ]
326 if( s[1] )
327 { for(j = 0; j &lt; p; j++)
328 { v[ 0 * p + j ] = bool(v[0 * p + j]) | bool(r[1 * p + j]);
329 v[ 1 * p + j ] = bool(v[1 * p + j]) | bool(r[0 * p + j]);
330 }
331 }
332 return true;
333 }
334 </pre></font></code>
350335 <br/>
351336 <b><big><a name="End Class Definition" id="End Class Definition">End Class Definition</a></big></b>
352337
355340 } // End empty namespace
356341
357342 </pre></font></code>
358
359 <br/>
360 <br/>
361343 <b><big><a name="Use Atomic Function" id="Use Atomic Function">Use Atomic Function</a></big></b>
362344
363345 <code><font color='blue'><pre style='display:inline'>
364346 bool sparsity(void)
365 { bool ok = true;
366 using CppAD::AD;
367 using CppAD::NearEqual;
368 double eps = 10. * std::numeric_limits&lt;double&gt;::epsilon();
369 </pre></font></code>
370
371 <br/>
347 { bool ok = true;
348 using CppAD::AD;
349 using CppAD::NearEqual;
350 double eps = 10. * std::numeric_limits&lt;double&gt;::epsilon();
351 </pre></font></code>
372352 <br/>
373353 <b><a name="Use Atomic Function.Constructor" id="Use Atomic Function.Constructor">Constructor</a></b>
374354
375355 <code><font color='blue'><pre style='display:inline'>
376 // Create the atomic get_started object
377 atomic_sparsity afun(&quot;atomic_sparsity&quot;);
378 </pre></font></code>
379
380 <br/>
356 // Create the atomic get_started object
357 atomic_sparsity afun(&quot;atomic_sparsity&quot;);
358 </pre></font></code>
381359 <br/>
382360 <b><a name="Use Atomic Function.Recording" id="Use Atomic Function.Recording">Recording</a></b>
383361
384362 <code><font color='blue'><pre style='display:inline'>
385 size_t n = 3;
386 size_t m = 2;
387 vector&lt; <a href="ad.xml" target="_top">AD</a>&lt;double&gt; &gt; ax(n), ay(m);
388 for(size_t j = 0; j &lt; n; j++)
389 ax[j] = double(j + 1);
390
391 // declare independent variables and start tape recording
392 CppAD::<a href="independent.xml" target="_top">Independent</a>(ax);
393
394 // call user function
395 afun(ax, ay);
396
397 // create f: x -&gt; y and stop tape recording
398 CppAD::<a href="funconstruct.xml" target="_top">ADFun</a>&lt;double&gt; f;
399 f.Dependent (ax, ay); // f(x) = x
400
401 // check function value
402 ok &amp;= <a href="nearequal.xml" target="_top">NearEqual</a>(ay[0] , ax[2], eps, eps);
403 ok &amp;= <a href="nearequal.xml" target="_top">NearEqual</a>(ay[1] , ax[0] * ax[1], eps, eps);
404
405 </pre></font></code>
406
407 <br/>
408 <br/>
363 size_t n = 3;
364 size_t m = 2;
365 vector&lt; <a href="ad.xml" target="_top">AD</a>&lt;double&gt; &gt; ax(n), ay(m);
366 for(size_t j = 0; j &lt; n; j++)
367 ax[j] = double(j + 1);
368
369 // declare independent variables and start tape recording
370 CppAD::<a href="independent.xml" target="_top">Independent</a>(ax);
371
372 // call user function
373 afun(ax, ay);
374
375 // create f: x -&gt; y and stop tape recording
376 CppAD::<a href="funconstruct.xml" target="_top">ADFun</a>&lt;double&gt; f;
377 f.Dependent (ax, ay); // f(x) = x
378
379 // check function value
380 ok &amp;= <a href="nearequal.xml" target="_top">NearEqual</a>(ay[0] , ax[2], eps, eps);
381 ok &amp;= <a href="nearequal.xml" target="_top">NearEqual</a>(ay[1] , ax[0] * ax[1], eps, eps);
382
383 </pre></font></code>
409384 <b><a name="Use Atomic Function.forsparse_jac and rev_sparse_jac" id="Use Atomic Function.forsparse_jac and rev_sparse_jac">forsparse_jac and rev_sparse_jac</a></b>
410385
411386 <code><font color='blue'><pre style='display:inline'>
412 for(size_t dir = 0; dir &lt; 2; dir++)
413 { size_t ell;
414 if( dir == 0 )
415 ell = n;
416 else
417 ell = m;
418
419 // identity martrix
420 vectorBool r(ell * ell);
421 for(size_t i = 0; i &lt; ell; i++)
422 for(size_t j = 0; j &lt; ell; j++)
423 r[i * ell + j] = (i == j);
424
425 vectorBool s;
426 if( dir == 0 )
427 s = f.ForSparseJac(n, r);
428 else
429 s = f.RevSparseJac(m, r);
430
431 // check Jacobian result
432 ok &amp;= s.size() == m * n;
433 ok &amp;= s[0 * n + 0] == false;
434 ok &amp;= s[0 * n + 1] == false;
435 ok &amp;= s[0 * n + 2] == true;
436 ok &amp;= s[1 * n + 0] == true;
437 ok &amp;= s[1 * n + 1] == true;
438 ok &amp;= s[1 * n + 2] == false;
439 }
440 </pre></font></code>
441
442 <br/>
387 for(size_t dir = 0; dir &lt; 2; dir++)
388 { size_t ell;
389 if( dir == 0 )
390 ell = n;
391 else
392 ell = m;
393
394 // identity martrix
395 vectorBool r(ell * ell);
396 for(size_t i = 0; i &lt; ell; i++)
397 for(size_t j = 0; j &lt; ell; j++)
398 r[i * ell + j] = (i == j);
399
400 vectorBool s;
401 if( dir == 0 )
402 s = f.ForSparseJac(n, r);
403 else
404 s = f.RevSparseJac(m, r);
405
406 // check Jacobian result
407 ok &amp;= s.size() == m * n;
408 ok &amp;= s[0 * n + 0] == false;
409 ok &amp;= s[0 * n + 1] == false;
410 ok &amp;= s[0 * n + 2] == true;
411 ok &amp;= s[1 * n + 0] == true;
412 ok &amp;= s[1 * n + 1] == true;
413 ok &amp;= s[1 * n + 2] == false;
414 }
415 </pre></font></code>
443416 <br/>
444417 <b><a name="Use Atomic Function.rev_sparse_hes" id="Use Atomic Function.rev_sparse_hes">rev_sparse_hes</a></b>
445418
446419 <code><font color='blue'><pre style='display:inline'>
447 vectorBool s(m), h(n * n);
448 s[0] = true;
449 s[1] = true;
450 h = f.RevSparseHes(n, s);
451 for(size_t i = 0; i &lt; n; i++)
452 { for(size_t j = 0; j &lt; n; j++)
453 { bool check = false;
454 check |= (i == 0) &amp;&amp; (j == 1);
455 check |= (j == 0) &amp;&amp; (i == 1);
456 ok &amp;= h[ i * n + j] == check;
457 }
458 }
459 //
460 return ok;
420 vectorBool s(m), h(n * n);
421 s[0] = true;
422 s[1] = true;
423 h = f.RevSparseHes(n, s);
424 for(size_t i = 0; i &lt; n; i++)
425 { for(size_t j = 0; j &lt; n; j++)
426 { bool check = false;
427 check |= (i == 0) &amp;&amp; (j == 1);
428 check |= (j == 0) &amp;&amp; (i == 1);
429 ok &amp;= h[ i * n + j] == check;
430 }
431 }
432 //
433 return ok;
461434 }
462435 </pre></font></code>
463
464
465436
466437 <hr/>Input File: example/atomic/sparsity.cpp
467438
55 <title>Tan and Tanh as User Atomic Operations: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Tan and Tanh as User Atomic Operations: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" tan and tanh as user atomic operations: example test tangent operation theory sparsity start class definition constructor forward reverse for_sparse_jac rev_sparse_jac rev_sparse_hes end use function recording large x values "/>
8 <meta name="keywords" id="keywords" content=" tan tanh user atomic operations: example test tangent operation theory sparsity start class definition constructor forward reverse for_sparse_jac rev_sparse_jac rev_sparse_hes end use function recording large x values "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
110110 </select>
111111 </td>
112112 </tr></table><br/>
113
114
115
116113 <center><b><big><big>Tan and Tanh as User Atomic Operations: Example and Test</big></big></b></center>
117114 <br/>
118115 <b><big><a name="Theory" id="Theory">Theory</a></big></b>
142139 //
143140 // a utility to compute the union of two sets.
144141 void my_union(
145 std::set&lt;size_t&gt;&amp; result ,
146 const std::set&lt;size_t&gt;&amp; left ,
147 const std::set&lt;size_t&gt;&amp; right )
148 { std::set&lt;size_t&gt; temp;
149 std::set_union(
150 left.begin() ,
151 left.end() ,
152 right.begin() ,
153 right.end() ,
154 std::inserter(temp, temp.begin())
155 );
156 result.swap(temp);
142 std::set&lt;size_t&gt;&amp; result ,
143 const std::set&lt;size_t&gt;&amp; left ,
144 const std::set&lt;size_t&gt;&amp; right )
145 { std::set&lt;size_t&gt; temp;
146 std::set_union(
147 left.begin() ,
148 left.end() ,
149 right.begin() ,
150 right.end() ,
151 std::inserter(temp, temp.begin())
152 );
153 result.swap(temp);
157154 }
158155 //
159156 class atomic_tangent : public CppAD::atomic_base&lt;float&gt; {
160157 </pre></font></code>
161
162 <br/>
163158 <br/>
164159 <b><big><a name="Constructor" id="Constructor">Constructor</a></big></b>
165160
166161 <code><font color='blue'><pre style='display:inline'>
167 private:
168 const bool hyperbolic_; // is this hyperbolic tangent
169 public:
170 // constructor
171 atomic_tangent(const char* name, bool hyperbolic)
172 : CppAD::atomic_base&lt;float&gt;(name),
173 hyperbolic_(hyperbolic)
174 { }
175 private:
176 </pre></font></code>
177
178 <br/>
162 private:
163 const bool hyperbolic_; // is this hyperbolic tangent
164 public:
165 // constructor
166 atomic_tangent(const char* name, bool hyperbolic)
167 : CppAD::atomic_base&lt;float&gt;(name),
168 hyperbolic_(hyperbolic)
169 { }
170 private:
171 </pre></font></code>
179172 <br/>
180173 <b><big><a name="forward" id="forward">forward</a></big></b>
181174
182175 <code><font color='blue'><pre style='display:inline'>
183 // forward mode routine called by CppAD
184 bool forward(
185 size_t p ,
186 size_t q ,
187 const vector&lt;bool&gt;&amp; vx ,
188 vector&lt;bool&gt;&amp; vzy ,
189 const vector&lt;float&gt;&amp; tx ,
190 vector&lt;float&gt;&amp; tzy
191 )
192 { size_t q1 = q + 1;
193 size_t n = tx.size() / q1;
194 size_t m = tzy.size() / q1;
195 assert( n == 1 );
196 assert( m == 2 );
197 assert( p &lt;= q );
198 size_t j, k;
199
200 // check if this is during the call to old_tan(id, ax, ay)
201 if( vx.size() &gt; 0 )
202 { // set variable flag for both y an z
203 vzy[0] = vx[0];
204 vzy[1] = vx[0];
205 }
206
207 if( p == 0 )
208 { // z^{(0)} = tan( x^{(0)} ) or tanh( x^{(0)} )
209 if( hyperbolic_ )
210 tzy[0] = tanh( tx[0] );
211 else tzy[0] = tan( tx[0] );
212
213 // y^{(0)} = z^{(0)} * z^{(0)}
214 tzy[q1 + 0] = tzy[0] * tzy[0];
215
216 p++;
217 }
218 for(j = p; j &lt;= q; j++)
219 { float j_inv = 1.f / float(j);
220 if( hyperbolic_ )
221 j_inv = - j_inv;
222
223 // z^{(j)} = x^{(j)} +- sum_{k=1}^j k x^{(k)} y^{(j-k)} / j
224 tzy[j] = tx[j];
225 for(k = 1; k &lt;= j; k++)
226 tzy[j] += tx[k] * tzy[q1 + j-k] * k * j_inv;
227
228 // y^{(j)} = sum_{k=0}^j z^{(k)} z^{(j-k)}
229 tzy[q1 + j] = 0.;
230 for(k = 0; k &lt;= j; k++)
231 tzy[q1 + j] += tzy[k] * tzy[j-k];
232 }
233
234 // All orders are implemented and there are no possible errors
235 return true;
236 }
237 </pre></font></code>
238
239 <br/>
176 // forward mode routine called by CppAD
177 bool forward(
178 size_t p ,
179 size_t q ,
180 const vector&lt;bool&gt;&amp; vx ,
181 vector&lt;bool&gt;&amp; vzy ,
182 const vector&lt;float&gt;&amp; tx ,
183 vector&lt;float&gt;&amp; tzy
184 )
185 { size_t q1 = q + 1;
186 size_t n = tx.size() / q1;
187 size_t m = tzy.size() / q1;
188 assert( n == 1 );
189 assert( m == 2 );
190 assert( p &lt;= q );
191 size_t j, k;
192
193 // check if this is during the call to old_tan(id, ax, ay)
194 if( vx.size() &gt; 0 )
195 { // set variable flag for both y an z
196 vzy[0] = vx[0];
197 vzy[1] = vx[0];
198 }
199
200 if( p == 0 )
201 { // z^{(0)} = tan( x^{(0)} ) or tanh( x^{(0)} )
202 if( hyperbolic_ )
203 tzy[0] = tanh( tx[0] );
204 else tzy[0] = tan( tx[0] );
205
206 // y^{(0)} = z^{(0)} * z^{(0)}
207 tzy[q1 + 0] = tzy[0] * tzy[0];
208
209 p++;
210 }
211 for(j = p; j &lt;= q; j++)
212 { float j_inv = 1.f / float(j);
213 if( hyperbolic_ )
214 j_inv = - j_inv;
215
216 // z^{(j)} = x^{(j)} +- sum_{k=1}^j k x^{(k)} y^{(j-k)} / j
217 tzy[j] = tx[j];
218 for(k = 1; k &lt;= j; k++)
219 tzy[j] += tx[k] * tzy[q1 + j-k] * k * j_inv;
220
221 // y^{(j)} = sum_{k=0}^j z^{(k)} z^{(j-k)}
222 tzy[q1 + j] = 0.;
223 for(k = 0; k &lt;= j; k++)
224 tzy[q1 + j] += tzy[k] * tzy[j-k];
225 }
226
227 // All orders are implemented and there are no possible errors
228 return true;
229 }
230 </pre></font></code>
240231 <br/>
241232 <b><big><a name="reverse" id="reverse">reverse</a></big></b>
242233
243234 <code><font color='blue'><pre style='display:inline'>
244 // reverse mode routine called by CppAD
245 virtual bool reverse(
246 size_t q ,
247 const vector&lt;float&gt;&amp; tx ,
248 const vector&lt;float&gt;&amp; tzy ,
249 vector&lt;float&gt;&amp; px ,
250 const vector&lt;float&gt;&amp; pzy
251 )
252 { size_t q1 = q + 1;
253 size_t n = tx.size() / q1;
254 size_t m = tzy.size() / q1;
255 assert( px.size() == n * q1 );
256 assert( pzy.size() == m * q1 );
257 assert( n == 1 );
258 assert( m == 2 );
259
260 size_t j, k;
261
262 // copy because partials w.r.t. y and z need to change
263 vector&lt;float&gt; qzy = pzy;
264
265 // initialize accumultion of reverse mode partials
266 for(k = 0; k &lt; q1; k++)
267 px[k] = 0.;
268
269 // eliminate positive orders
270 for(j = q; j &gt; 0; j--)
271 { float j_inv = 1.f / float(j);
272 if( hyperbolic_ )
273 j_inv = - j_inv;
274
275 // H_{x^{(k)}} += delta(j-k) +- H_{z^{(j)} y^{(j-k)} * k / j
276 px[j] += qzy[j];
277 for(k = 1; k &lt;= j; k++)
278 px[k] += qzy[j] * tzy[q1 + j-k] * k * j_inv;
279
280 // H_{y^{j-k)} += +- H_{z^{(j)} x^{(k)} * k / j
281 for(k = 1; k &lt;= j; k++)
282 qzy[q1 + j-k] += qzy[j] * tx[k] * k * j_inv;
283
284 // H_{z^{(k)}} += H_{y^{(j-1)}} * z^{(j-k-1)} * 2.
285 for(k = 0; k &lt; j; k++)
286 qzy[k] += qzy[q1 + j-1] * tzy[j-k-1] * 2.f;
287 }
288
289 // eliminate order zero
290 if( hyperbolic_ )
291 px[0] += qzy[0] * (1.f - tzy[q1 + 0]);
292 else
293 px[0] += qzy[0] * (1.f + tzy[q1 + 0]);
294
295 return true;
296 }
297 </pre></font></code>
298
299 <br/>
235 // reverse mode routine called by CppAD
236 virtual bool reverse(
237 size_t q ,
238 const vector&lt;float&gt;&amp; tx ,
239 const vector&lt;float&gt;&amp; tzy ,
240 vector&lt;float&gt;&amp; px ,
241 const vector&lt;float&gt;&amp; pzy
242 )
243 { size_t q1 = q + 1;
244 size_t n = tx.size() / q1;
245 size_t m = tzy.size() / q1;
246 assert( px.size() == n * q1 );
247 assert( pzy.size() == m * q1 );
248 assert( n == 1 );
249 assert( m == 2 );
250
251 size_t j, k;
252
253 // copy because partials w.r.t. y and z need to change
254 vector&lt;float&gt; qzy = pzy;
255
256 // initialize accumultion of reverse mode partials
257 for(k = 0; k &lt; q1; k++)
258 px[k] = 0.;
259
260 // eliminate positive orders
261 for(j = q; j &gt; 0; j--)
262 { float j_inv = 1.f / float(j);
263 if( hyperbolic_ )
264 j_inv = - j_inv;
265
266 // H_{x^{(k)}} += delta(j-k) +- H_{z^{(j)} y^{(j-k)} * k / j
267 px[j] += qzy[j];
268 for(k = 1; k &lt;= j; k++)
269 px[k] += qzy[j] * tzy[q1 + j-k] * k * j_inv;
270
271 // H_{y^{j-k)} += +- H_{z^{(j)} x^{(k)} * k / j
272 for(k = 1; k &lt;= j; k++)
273 qzy[q1 + j-k] += qzy[j] * tx[k] * k * j_inv;
274
275 // H_{z^{(k)}} += H_{y^{(j-1)}} * z^{(j-k-1)} * 2.
276 for(k = 0; k &lt; j; k++)
277 qzy[k] += qzy[q1 + j-1] * tzy[j-k-1] * 2.f;
278 }
279
280 // eliminate order zero
281 if( hyperbolic_ )
282 px[0] += qzy[0] * (1.f - tzy[q1 + 0]);
283 else
284 px[0] += qzy[0] * (1.f + tzy[q1 + 0]);
285
286 return true;
287 }
288 </pre></font></code>
300289 <br/>
301290 <b><big><a name="for_sparse_jac" id="for_sparse_jac">for_sparse_jac</a></big></b>
302291
303292 <code><font color='blue'><pre style='display:inline'>
304 // forward Jacobian sparsity routine called by CppAD
305 virtual bool for_sparse_jac(
306 size_t p ,
307 const vector&lt;bool&gt;&amp; r ,
308 vector&lt;bool&gt;&amp; s )
309 { size_t n = r.size() / p;
310 size_t m = s.size() / p;
311 assert( n == 1 );
312 assert( m == 2 );
313
314 // sparsity for S(x) = f'(x) * R
315 for(size_t j = 0; j &lt; p; j++)
316 { s[0 * p + j] = r[j];
317 s[1 * p + j] = r[j];
318 }
319
320 return true;
321 }
322 // forward Jacobian sparsity routine called by CppAD
323 virtual bool for_sparse_jac(
324 size_t p ,
325 const vector&lt; std::set&lt;size_t&gt; &gt;&amp; r ,
326 vector&lt; std::set&lt;size_t&gt; &gt;&amp; s )
327 { size_t n = r.size();
328 size_t m = s.size();
329 assert( n == 1 );
330 assert( m == 2 );
331
332 // sparsity for S(x) = f'(x) * R
333 s[0] = r[0];
334 s[1] = r[0];
335
336 return true;
337 }
338 </pre></font></code>
339
340 <br/>
293 // forward Jacobian sparsity routine called by CppAD
294 virtual bool for_sparse_jac(
295 size_t p ,
296 const vector&lt;bool&gt;&amp; r ,
297 vector&lt;bool&gt;&amp; s )
298 { size_t n = r.size() / p;
299 size_t m = s.size() / p;
300 assert( n == 1 );
301 assert( m == 2 );
302
303 // sparsity for S(x) = f'(x) * R
304 for(size_t j = 0; j &lt; p; j++)
305 { s[0 * p + j] = r[j];
306 s[1 * p + j] = r[j];
307 }
308
309 return true;
310 }
311 // forward Jacobian sparsity routine called by CppAD
312 virtual bool for_sparse_jac(
313 size_t p ,
314 const vector&lt; std::set&lt;size_t&gt; &gt;&amp; r ,
315 vector&lt; std::set&lt;size_t&gt; &gt;&amp; s )
316 { size_t n = r.size();
317 size_t m = s.size();
318 assert( n == 1 );
319 assert( m == 2 );
320
321 // sparsity for S(x) = f'(x) * R
322 s[0] = r[0];
323 s[1] = r[0];
324
325 return true;
326 }
327 </pre></font></code>
341328 <br/>
342329 <b><big><a name="rev_sparse_jac" id="rev_sparse_jac">rev_sparse_jac</a></big></b>
343330
344331 <code><font color='blue'><pre style='display:inline'>
345 // reverse Jacobian sparsity routine called by CppAD
346 virtual bool rev_sparse_jac(
347 size_t p ,
348 const vector&lt;bool&gt;&amp; rt ,
349 vector&lt;bool&gt;&amp; st )
350 { size_t n = st.size() / p;
351 size_t m = rt.size() / p;
352 assert( n == 1 );
353 assert( m == 2 );
354
355 // sparsity for S(x)^T = f'(x)^T * R^T
356 for(size_t j = 0; j &lt; p; j++)
357 st[j] = rt[0 * p + j] | rt[1 * p + j];
358
359 return true;
360 }
361 // reverse Jacobian sparsity routine called by CppAD
362 virtual bool rev_sparse_jac(
363 size_t p ,
364 const vector&lt; std::set&lt;size_t&gt; &gt;&amp; rt ,
365 vector&lt; std::set&lt;size_t&gt; &gt;&amp; st )
366 { size_t n = st.size();
367 size_t m = rt.size();
368 assert( n == 1 );
369 assert( m == 2 );
370
371 // sparsity for S(x)^T = f'(x)^T * R^T
372 my_union(st[0], rt[0], rt[1]);
373 return true;
374 }
375 </pre></font></code>
376
377 <br/>
332 // reverse Jacobian sparsity routine called by CppAD
333 virtual bool rev_sparse_jac(
334 size_t p ,
335 const vector&lt;bool&gt;&amp; rt ,
336 vector&lt;bool&gt;&amp; st )
337 { size_t n = st.size() / p;
338 size_t m = rt.size() / p;
339 assert( n == 1 );
340 assert( m == 2 );
341
342 // sparsity for S(x)^T = f'(x)^T * R^T
343 for(size_t j = 0; j &lt; p; j++)
344 st[j] = rt[0 * p + j] | rt[1 * p + j];
345
346 return true;
347 }
348 // reverse Jacobian sparsity routine called by CppAD
349 virtual bool rev_sparse_jac(
350 size_t p ,
351 const vector&lt; std::set&lt;size_t&gt; &gt;&amp; rt ,
352 vector&lt; std::set&lt;size_t&gt; &gt;&amp; st )
353 { size_t n = st.size();
354 size_t m = rt.size();
355 assert( n == 1 );
356 assert( m == 2 );
357
358 // sparsity for S(x)^T = f'(x)^T * R^T
359 my_union(st[0], rt[0], rt[1]);
360 return true;
361 }
362 </pre></font></code>
378363 <br/>
379364 <b><big><a name="rev_sparse_hes" id="rev_sparse_hes">rev_sparse_hes</a></big></b>
380365
381366 <code><font color='blue'><pre style='display:inline'>
382 // reverse Hessian sparsity routine called by CppAD
383 virtual bool rev_sparse_hes(
384 const vector&lt;bool&gt;&amp; vx,
385 const vector&lt;bool&gt;&amp; s ,
386 vector&lt;bool&gt;&amp; t ,
387 size_t p ,
388 const vector&lt;bool&gt;&amp; r ,
389 const vector&lt;bool&gt;&amp; u ,
390 vector&lt;bool&gt;&amp; v )
391 {
392 size_t m = s.size();
393 size_t n = t.size();
394 assert( r.size() == n * p );
395 assert( u.size() == m * p );
396 assert( v.size() == n * p );
397 assert( n == 1 );
398 assert( m == 2 );
399
400 // There are no cross term second derivatives for this case,
401 // so it is not necessary to vx.
402
403 // sparsity for T(x) = S(x) * f'(x)
404 t[0] = s[0] | s[1];
405
406 // V(x) = f'(x)^T * g''(y) * f'(x) * R + g'(y) * f''(x) * R
407 // U(x) = g''(y) * f'(x) * R
408 // S(x) = g'(y)
409
410 // back propagate the sparsity for U, note both components
411 // of f'(x) may be non-zero;
412 size_t j;
413 for(j = 0; j &lt; p; j++)
414 v[j] = u[ 0 * p + j ] | u[ 1 * p + j ];
415
416 // include forward Jacobian sparsity in Hessian sparsity
417 // (note sparsty for f''(x) * R same as for R)
418 if( s[0] | s[1] )
419 { for(j = 0; j &lt; p; j++)
420 { // Visual Studio 2013 generates warning without bool below
421 v[j] |= bool( r[j] );
422 }
423 }
424
425 return true;
426 }
427 // reverse Hessian sparsity routine called by CppAD
428 virtual bool rev_sparse_hes(
429 const vector&lt;bool&gt;&amp; vx,
430 const vector&lt;bool&gt;&amp; s ,
431 vector&lt;bool&gt;&amp; t ,
432 size_t p ,
433 const vector&lt; std::set&lt;size_t&gt; &gt;&amp; r ,
434 const vector&lt; std::set&lt;size_t&gt; &gt;&amp; u ,
435 vector&lt; std::set&lt;size_t&gt; &gt;&amp; v )
436 { size_t m = s.size();
437 size_t n = t.size();
438 assert( r.size() == n );
439 assert( u.size() == m );
440 assert( v.size() == n );
441 assert( n == 1 );
442 assert( m == 2 );
443
444 // There are no cross term second derivatives for this case,
445 // so it is not necessary to vx.
446
447 // sparsity for T(x) = S(x) * f'(x)
448 t[0] = s[0] | s[1];
449
450 // V(x) = f'(x)^T * g''(y) * f'(x) * R + g'(y) * f''(x) * R
451 // U(x) = g''(y) * f'(x) * R
452 // S(x) = g'(y)
453
454 // back propagate the sparsity for U, note both components
455 // of f'(x) may be non-zero;
456 my_union(v[0], u[0], u[1]);
457
458 // include forward Jacobian sparsity in Hessian sparsity
459 // (note sparsty for f''(x) * R same as for R)
460 if( s[0] | s[1] )
461 my_union(v[0], v[0], r[0]);
462
463 return true;
464 }
465 </pre></font></code>
466
467 <br/>
367 // reverse Hessian sparsity routine called by CppAD
368 virtual bool rev_sparse_hes(
369 const vector&lt;bool&gt;&amp; vx,
370 const vector&lt;bool&gt;&amp; s ,
371 vector&lt;bool&gt;&amp; t ,
372 size_t p ,
373 const vector&lt;bool&gt;&amp; r ,
374 const vector&lt;bool&gt;&amp; u ,
375 vector&lt;bool&gt;&amp; v )
376 {
377 size_t m = s.size();
378 size_t n = t.size();
379 assert( r.size() == n * p );
380 assert( u.size() == m * p );
381 assert( v.size() == n * p );
382 assert( n == 1 );
383 assert( m == 2 );
384
385 // There are no cross term second derivatives for this case,
386 // so it is not necessary to vx.
387
388 // sparsity for T(x) = S(x) * f'(x)
389 t[0] = s[0] | s[1];
390
391 // V(x) = f'(x)^T * g''(y) * f'(x) * R + g'(y) * f''(x) * R
392 // U(x) = g''(y) * f'(x) * R
393 // S(x) = g'(y)
394
395 // back propagate the sparsity for U, note both components
396 // of f'(x) may be non-zero;
397 size_t j;
398 for(j = 0; j &lt; p; j++)
399 v[j] = u[ 0 * p + j ] | u[ 1 * p + j ];
400
401 // include forward Jacobian sparsity in Hessian sparsity
402 // (note sparsty for f''(x) * R same as for R)
403 if( s[0] | s[1] )
404 { for(j = 0; j &lt; p; j++)
405 { // Visual Studio 2013 generates warning without bool below
406 v[j] |= bool( r[j] );
407 }
408 }
409
410 return true;
411 }
412 // reverse Hessian sparsity routine called by CppAD
413 virtual bool rev_sparse_hes(
414 const vector&lt;bool&gt;&amp; vx,
415 const vector&lt;bool&gt;&amp; s ,
416 vector&lt;bool&gt;&amp; t ,
417 size_t p ,
418 const vector&lt; std::set&lt;size_t&gt; &gt;&amp; r ,
419 const vector&lt; std::set&lt;size_t&gt; &gt;&amp; u ,
420 vector&lt; std::set&lt;size_t&gt; &gt;&amp; v )
421 { size_t m = s.size();
422 size_t n = t.size();
423 assert( r.size() == n );
424 assert( u.size() == m );
425 assert( v.size() == n );
426 assert( n == 1 );
427 assert( m == 2 );
428
429 // There are no cross term second derivatives for this case,
430 // so it is not necessary to vx.
431
432 // sparsity for T(x) = S(x) * f'(x)
433 t[0] = s[0] | s[1];
434
435 // V(x) = f'(x)^T * g''(y) * f'(x) * R + g'(y) * f''(x) * R
436 // U(x) = g''(y) * f'(x) * R
437 // S(x) = g'(y)
438
439 // back propagate the sparsity for U, note both components
440 // of f'(x) may be non-zero;
441 my_union(v[0], u[0], u[1]);
442
443 // include forward Jacobian sparsity in Hessian sparsity
444 // (note sparsty for f''(x) * R same as for R)
445 if( s[0] | s[1] )
446 my_union(v[0], v[0], r[0]);
447
448 return true;
449 }
450 </pre></font></code>
468451 <br/>
469452 <b><big><a name="End Class Definition" id="End Class Definition">End Class Definition</a></big></b>
470453
473456 } // End empty namespace
474457
475458 </pre></font></code>
476
477 <br/>
478 <br/>
479459 <b><big><a name="Use Atomic Function" id="Use Atomic Function">Use Atomic Function</a></big></b>
480460
481461 <code><font color='blue'><pre style='display:inline'>
482462 bool tangent(void)
483 { bool ok = true;
484 using CppAD::AD;
485 using CppAD::NearEqual;
486 float eps = 10.f * CppAD::numeric_limits&lt;float&gt;::epsilon();
487 </pre></font></code>
488
489 <br/>
463 { bool ok = true;
464 using CppAD::AD;
465 using CppAD::NearEqual;
466 float eps = 10.f * CppAD::numeric_limits&lt;float&gt;::epsilon();
467 </pre></font></code>
490468 <br/>
491469 <b><a name="Use Atomic Function.Constructor" id="Use Atomic Function.Constructor">Constructor</a></b>
492470
493471 <code><font color='blue'><pre style='display:inline'>
494 // --------------------------------------------------------------------
495 // Creater a tan and tanh object
496 atomic_tangent my_tan(&quot;my_tan&quot;, false), my_tanh(&quot;my_tanh&quot;, true);
497 </pre></font></code>
498
499 <br/>
472 // --------------------------------------------------------------------
473 // Creater a tan and tanh object
474 atomic_tangent my_tan(&quot;my_tan&quot;, false), my_tanh(&quot;my_tanh&quot;, true);
475 </pre></font></code>
500476 <br/>
501477 <b><a name="Use Atomic Function.Recording" id="Use Atomic Function.Recording">Recording</a></b>
502478
503479 <code><font color='blue'><pre style='display:inline'>
504 // domain space vector
505 size_t n = 1;
506 float x0 = 0.5;
507 CppAD::vector&lt; <a href="ad.xml" target="_top">AD</a>&lt;float&gt; &gt; ax(n);
508 ax[0] = x0;
509
510 // declare independent variables and start tape recording
511 CppAD::<a href="independent.xml" target="_top">Independent</a>(ax);
512
513 // range space vector
514 size_t m = 3;
515 CppAD::vector&lt; <a href="ad.xml" target="_top">AD</a>&lt;float&gt; &gt; af(m);
516
517 // temporary vector for computations
518 // (my_tan and my_tanh computes tan or tanh and its square)
519 CppAD::vector&lt; <a href="ad.xml" target="_top">AD</a>&lt;float&gt; &gt; az(2);
520
521 // call atomic tan function and store tan(x) in f[0] (ignore tan(x)^2)
522 my_tan(ax, az);
523 af[0] = az[0];
524
525 // call atomic tanh function and store tanh(x) in f[1] (ignore tanh(x)^2)
526 my_tanh(ax, az);
527 af[1] = az[0];
528
529 // put a constant in f[2] = tanh(1.) (for sparsity pattern testing)
530 CppAD::vector&lt; <a href="ad.xml" target="_top">AD</a>&lt;float&gt; &gt; one(1);
531 one[0] = 1.;
532 my_tanh(one, az);
533 af[2] = az[0];
534
535 // create f: x -&gt; f and stop tape recording
536 CppAD::<a href="funconstruct.xml" target="_top">ADFun</a>&lt;float&gt; F;
537 F.Dependent(ax, af);
538 </pre></font></code>
539
540 <br/>
480 // domain space vector
481 size_t n = 1;
482 float x0 = 0.5;
483 CppAD::vector&lt; <a href="ad.xml" target="_top">AD</a>&lt;float&gt; &gt; ax(n);
484 ax[0] = x0;
485
486 // declare independent variables and start tape recording
487 CppAD::<a href="independent.xml" target="_top">Independent</a>(ax);
488
489 // range space vector
490 size_t m = 3;
491 CppAD::vector&lt; <a href="ad.xml" target="_top">AD</a>&lt;float&gt; &gt; af(m);
492
493 // temporary vector for computations
494 // (my_tan and my_tanh computes tan or tanh and its square)
495 CppAD::vector&lt; <a href="ad.xml" target="_top">AD</a>&lt;float&gt; &gt; az(2);
496
497 // call atomic tan function and store tan(x) in f[0] (ignore tan(x)^2)
498 my_tan(ax, az);
499 af[0] = az[0];
500
501 // call atomic tanh function and store tanh(x) in f[1] (ignore tanh(x)^2)
502 my_tanh(ax, az);
503 af[1] = az[0];
504
505 // put a constant in f[2] = tanh(1.) (for sparsity pattern testing)
506 CppAD::vector&lt; <a href="ad.xml" target="_top">AD</a>&lt;float&gt; &gt; one(1);
507 one[0] = 1.;
508 my_tanh(one, az);
509 af[2] = az[0];
510
511 // create f: x -&gt; f and stop tape recording
512 CppAD::<a href="funconstruct.xml" target="_top">ADFun</a>&lt;float&gt; F;
513 F.Dependent(ax, af);
514 </pre></font></code>
541515 <br/>
542516 <b><a name="Use Atomic Function.forward" id="Use Atomic Function.forward">forward</a></b>
543517
544518 <code><font color='blue'><pre style='display:inline'>
545 // check function value
546 float tan = std::tan(x0);
547 ok &amp;= <a href="nearequal.xml" target="_top">NearEqual</a>(af[0] , tan, eps, eps);
548 float tanh = std::tanh(x0);
549 ok &amp;= <a href="nearequal.xml" target="_top">NearEqual</a>(af[1] , tanh, eps, eps);
550
551 // check zero order forward
552 CppAD::vector&lt;float&gt; x(n), f(m);
553 x[0] = x0;
554 f = F.<a href="forward.xml" target="_top">Forward</a>(0, x);
555 ok &amp;= <a href="nearequal.xml" target="_top">NearEqual</a>(f[0] , tan, eps, eps);
556 ok &amp;= <a href="nearequal.xml" target="_top">NearEqual</a>(f[1] , tanh, eps, eps);
557
558 // compute first partial of f w.r.t. x[0] using forward mode
559 CppAD::vector&lt;float&gt; dx(n), df(m);
560 dx[0] = 1.;
561 df = F.<a href="forward.xml" target="_top">Forward</a>(1, dx);
562 </pre></font></code>
563
564 <br/>
519 // check function value
520 float tan = std::tan(x0);
521 ok &amp;= <a href="nearequal.xml" target="_top">NearEqual</a>(af[0] , tan, eps, eps);
522 float tanh = std::tanh(x0);
523 ok &amp;= <a href="nearequal.xml" target="_top">NearEqual</a>(af[1] , tanh, eps, eps);
524
525 // check zero order forward
526 CppAD::vector&lt;float&gt; x(n), f(m);
527 x[0] = x0;
528 f = F.<a href="forward.xml" target="_top">Forward</a>(0, x);
529 ok &amp;= <a href="nearequal.xml" target="_top">NearEqual</a>(f[0] , tan, eps, eps);
530 ok &amp;= <a href="nearequal.xml" target="_top">NearEqual</a>(f[1] , tanh, eps, eps);
531
532 // compute first partial of f w.r.t. x[0] using forward mode
533 CppAD::vector&lt;float&gt; dx(n), df(m);
534 dx[0] = 1.;
535 df = F.<a href="forward.xml" target="_top">Forward</a>(1, dx);
536 </pre></font></code>
565537 <br/>
566538 <b><a name="Use Atomic Function.reverse" id="Use Atomic Function.reverse">reverse</a></b>
567539
568540 <code><font color='blue'><pre style='display:inline'>
569 // compute derivative of tan - tanh using reverse mode
570 CppAD::vector&lt;float&gt; w(m), dw(n);
571 w[0] = 1.;
572 w[1] = 1.;
573 w[2] = 0.;
574 dw = F.<a href="reverse.xml" target="_top">Reverse</a>(1, w);
575
576 // tan'(x) = 1 + tan(x) * tan(x)
577 // tanh'(x) = 1 - tanh(x) * tanh(x)
578 float tanp = 1.f + tan * tan;
579 float tanhp = 1.f - tanh * tanh;
580 ok &amp;= <a href="nearequal.xml" target="_top">NearEqual</a>(df[0], tanp, eps, eps);
581 ok &amp;= <a href="nearequal.xml" target="_top">NearEqual</a>(df[1], tanhp, eps, eps);
582 ok &amp;= <a href="nearequal.xml" target="_top">NearEqual</a>(dw[0], w[0]*tanp + w[1]*tanhp, eps, eps);
583
584 // compute second partial of f w.r.t. x[0] using forward mode
585 CppAD::vector&lt;float&gt; ddx(n), ddf(m);
586 ddx[0] = 0.;
587 ddf = F.<a href="forward.xml" target="_top">Forward</a>(2, ddx);
588
589 // compute second derivative of tan - tanh using reverse mode
590 CppAD::vector&lt;float&gt; ddw(2);
591 ddw = F.<a href="reverse.xml" target="_top">Reverse</a>(2, w);
592
593 // tan''(x) = 2 * tan(x) * tan'(x)
594 // tanh''(x) = - 2 * tanh(x) * tanh'(x)
595 // Note that second order Taylor coefficient for u half the
596 // corresponding second derivative.
597 float two = 2;
598 float tanpp = two * tan * tanp;
599 float tanhpp = - two * tanh * tanhp;
600 ok &amp;= <a href="nearequal.xml" target="_top">NearEqual</a>(two * ddf[0], tanpp, eps, eps);
601 ok &amp;= <a href="nearequal.xml" target="_top">NearEqual</a>(two * ddf[1], tanhpp, eps, eps);
602 ok &amp;= <a href="nearequal.xml" target="_top">NearEqual</a>(ddw[0], w[0]*tanp + w[1]*tanhp , eps, eps);
603 ok &amp;= <a href="nearequal.xml" target="_top">NearEqual</a>(ddw[1], w[0]*tanpp + w[1]*tanhpp, eps, eps);
604 </pre></font></code>
605
606 <br/>
541 // compute derivative of tan - tanh using reverse mode
542 CppAD::vector&lt;float&gt; w(m), dw(n);
543 w[0] = 1.;
544 w[1] = 1.;
545 w[2] = 0.;
546 dw = F.<a href="reverse.xml" target="_top">Reverse</a>(1, w);
547
548 // tan'(x) = 1 + tan(x) * tan(x)
549 // tanh'(x) = 1 - tanh(x) * tanh(x)
550 float tanp = 1.f + tan * tan;
551 float tanhp = 1.f - tanh * tanh;
552 ok &amp;= <a href="nearequal.xml" target="_top">NearEqual</a>(df[0], tanp, eps, eps);
553 ok &amp;= <a href="nearequal.xml" target="_top">NearEqual</a>(df[1], tanhp, eps, eps);
554 ok &amp;= <a href="nearequal.xml" target="_top">NearEqual</a>(dw[0], w[0]*tanp + w[1]*tanhp, eps, eps);
555
556 // compute second partial of f w.r.t. x[0] using forward mode
557 CppAD::vector&lt;float&gt; ddx(n), ddf(m);
558 ddx[0] = 0.;
559 ddf = F.<a href="forward.xml" target="_top">Forward</a>(2, ddx);
560
561 // compute second derivative of tan - tanh using reverse mode
562 CppAD::vector&lt;float&gt; ddw(2);
563 ddw = F.<a href="reverse.xml" target="_top">Reverse</a>(2, w);
564
565 // tan''(x) = 2 * tan(x) * tan'(x)
566 // tanh''(x) = - 2 * tanh(x) * tanh'(x)
567 // Note that second order Taylor coefficient for u half the
568 // corresponding second derivative.
569 float two = 2;
570 float tanpp = two * tan * tanp;
571 float tanhpp = - two * tanh * tanhp;
572 ok &amp;= <a href="nearequal.xml" target="_top">NearEqual</a>(two * ddf[0], tanpp, eps, eps);
573 ok &amp;= <a href="nearequal.xml" target="_top">NearEqual</a>(two * ddf[1], tanhpp, eps, eps);
574 ok &amp;= <a href="nearequal.xml" target="_top">NearEqual</a>(ddw[0], w[0]*tanp + w[1]*tanhp , eps, eps);
575 ok &amp;= <a href="nearequal.xml" target="_top">NearEqual</a>(ddw[1], w[0]*tanpp + w[1]*tanhpp, eps, eps);
576 </pre></font></code>
607577 <br/>
608578 <b><a name="Use Atomic Function.for_sparse_jac" id="Use Atomic Function.for_sparse_jac">for_sparse_jac</a></b>
609579
610580 <code><font color='blue'><pre style='display:inline'>
611 // Forward mode computation of sparsity pattern for F.
612 size_t p = n;
613 // user vectorBool because m and n are small
614 CppAD::vectorBool r1(p), s1(m * p);
615 r1[0] = true; // propagate sparsity for x[0]
616 s1 = F.ForSparseJac(p, r1);
617 ok &amp;= (s1[0] == true); // f[0] depends on x[0]
618 ok &amp;= (s1[1] == true); // f[1] depends on x[0]
619 ok &amp;= (s1[2] == false); // f[2] does not depend on x[0]
620 </pre></font></code>
621
622 <br/>
581 // Forward mode computation of sparsity pattern for F.
582 size_t p = n;
583 // user vectorBool because m and n are small
584 CppAD::vectorBool r1(p), s1(m * p);
585 r1[0] = true; // propagate sparsity for x[0]
586 s1 = F.ForSparseJac(p, r1);
587 ok &amp;= (s1[0] == true); // f[0] depends on x[0]
588 ok &amp;= (s1[1] == true); // f[1] depends on x[0]
589 ok &amp;= (s1[2] == false); // f[2] does not depend on x[0]
590 </pre></font></code>
623591 <br/>
624592 <b><a name="Use Atomic Function.rev_sparse_jac" id="Use Atomic Function.rev_sparse_jac">rev_sparse_jac</a></b>
625593
626594 <code><font color='blue'><pre style='display:inline'>
627 // Reverse mode computation of sparsity pattern for F.
628 size_t q = m;
629 CppAD::vectorBool s2(q * m), r2(q * n);
630 // Sparsity pattern for identity matrix
631 size_t i, j;
632 for(i = 0; i &lt; q; i++)
633 { for(j = 0; j &lt; m; j++)
634 s2[i * q + j] = (i == j);
635 }
636 r2 = F.RevSparseJac(q, s2);
637 ok &amp;= (r2[0] == true); // f[0] depends on x[0]
638 ok &amp;= (r2[1] == true); // f[1] depends on x[0]
639 ok &amp;= (r2[2] == false); // f[2] does not depend on x[0]
640 </pre></font></code>
641
642 <br/>
595 // Reverse mode computation of sparsity pattern for F.
596 size_t q = m;
597 CppAD::vectorBool s2(q * m), r2(q * n);
598 // Sparsity pattern for identity matrix
599 size_t i, j;
600 for(i = 0; i &lt; q; i++)
601 { for(j = 0; j &lt; m; j++)
602 s2[i * q + j] = (i == j);
603 }
604 r2 = F.RevSparseJac(q, s2);
605 ok &amp;= (r2[0] == true); // f[0] depends on x[0]
606 ok &amp;= (r2[1] == true); // f[1] depends on x[0]
607 ok &amp;= (r2[2] == false); // f[2] does not depend on x[0]
608 </pre></font></code>
643609 <br/>
644610 <b><a name="Use Atomic Function.rev_sparse_hes" id="Use Atomic Function.rev_sparse_hes">rev_sparse_hes</a></b>
645611
646612 <code><font color='blue'><pre style='display:inline'>
647 // Hessian sparsity for f[0]
648 CppAD::vectorBool s3(m), h(p * n);
649 s3[0] = true;
650 s3[1] = false;
651 s3[2] = false;
652 h = F.RevSparseHes(p, s3);
653 ok &amp;= (h[0] == true); // Hessian is non-zero
654
655 // Hessian sparsity for f[2]
656 s3[0] = false;
657 s3[2] = true;
658 h = F.RevSparseHes(p, s3);
659 ok &amp;= (h[0] == false); // Hessian is zero
660 </pre></font></code>
661
662 <br/>
613 // Hessian sparsity for f[0]
614 CppAD::vectorBool s3(m), h(p * n);
615 s3[0] = true;
616 s3[1] = false;
617 s3[2] = false;
618 h = F.RevSparseHes(p, s3);
619 ok &amp;= (h[0] == true); // Hessian is non-zero
620
621 // Hessian sparsity for f[2]
622 s3[0] = false;
623 s3[2] = true;
624 h = F.RevSparseHes(p, s3);
625 ok &amp;= (h[0] == false); // Hessian is zero
626 </pre></font></code>
663627 <br/>
664628 <b><a name="Use Atomic Function.Large x Values" id="Use Atomic Function.Large x Values">Large x Values</a></b>
665629
666630 <code><font color='blue'><pre style='display:inline'>
667 // check tanh results for a large value of x
668 x[0] = std::numeric_limits&lt;float&gt;::max() / two;
669 f = F.<a href="forward.xml" target="_top">Forward</a>(0, x);
670 tanh = 1.;
671 ok &amp;= <a href="nearequal.xml" target="_top">NearEqual</a>(f[1], tanh, eps, eps);
672 df = F.<a href="forward.xml" target="_top">Forward</a>(1, dx);
673 tanhp = 0.;
674 ok &amp;= <a href="nearequal.xml" target="_top">NearEqual</a>(df[1], tanhp, eps, eps);
675
676 return ok;
631 // check tanh results for a large value of x
632 x[0] = std::numeric_limits&lt;float&gt;::max() / two;
633 f = F.<a href="forward.xml" target="_top">Forward</a>(0, x);
634 tanh = 1.;
635 ok &amp;= <a href="nearequal.xml" target="_top">NearEqual</a>(f[1], tanh, eps, eps);
636 df = F.<a href="forward.xml" target="_top">Forward</a>(1, dx);
637 tanhp = 0.;
638 ok &amp;= <a href="nearequal.xml" target="_top">NearEqual</a>(df[1], tanhp, eps, eps);
639
640 return ok;
677641 }
678642 </pre></font></code>
679
680
681643
682644 <hr/>Input File: example/atomic/tangent.cpp
683645
55 <title>Auto Tools Unix Test and Installation</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Auto Tools Unix Test and Installation"/>
8 <meta name="keywords" id="keywords" content=" auto tools unix test and installation speed profile prefix std vector boost eigen sparse internal sets ctor implicit explicit compile flags Openmp postfix Adolc Fadbad Ipopt Sacado memory usage tape deprecated 2012-12-26 distribution directory work configure make examples tests profiling cppad prefix_dir --with-documentation --with-testvector --with-sparse_option --with-deprecated max_num_threads cxx_flags openmp_flags postfix_dir adolc_dir linux cygwin boost_dir eigen_dir fadbad_dir ipopt_dir sacado_dir tape_addr_type tape_id_type install "/>
8 <meta name="keywords" id="keywords" content=" auto tools unix test installation speed profile prefix std vector boost eigen sparse internal sets ctor implicit explicit compile flags Openmp postfix Adolc Fadbad Ipopt Sacado memory usage tape deprecated 2012-12-26 distribution directory work configure make examples tests profiling cppad prefix_dir --with-documentation --with-testvector --with-sparse_option --with-deprecated max_num_threads cxx_flags openmp_flags postfix_dir adolc_dir linux cygwin boost_dir eigen_dir fadbad_dir ipopt_dir sacado_dir tape_addr_type tape_id_type install "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
186186 </span></code>The following command will build all the correctness and speed tests.
187187 In addition, it will run all the correctness tests:
188188 <code><font color='blue'><pre style='display:inline'>
189 make test
189 make test
190190 </pre></font></code>
191
192191 <code><span style='white-space: nowrap'><br/>
193192 <br/>
194193 </span></code>The following links describe how to build and run subsets of these tests:
291290 you may have to replace <code><font color="blue">profile</font></code> by <code><font color="blue">profile.exe</font></code>
292291 in the <code><font color="blue">gprof</font></code> command above; i.e.,
293292 <code><font color='blue'><pre style='display:inline'>
294 gprof -b profile.exe
293 gprof -b profile.exe
295294 </pre></font></code>
296
297295 In C++, template parameters and argument types become part of a
298296 routines's name.
299297 This can make the <code><font color="blue">gprof</font></code> output hard to read
301299 You can remove the template parameters and argument types from the
302300 routine names by executing the following command
303301 <code><font color='blue'><pre style='display:inline'>
304 gprof -b profile | sed -f gprof.sed
302 gprof -b profile | sed -f gprof.sed
305303 </pre></font></code>
306
307304 If you are using a windows operating system with Cygwin or MinGW,
308305 you would need to use
309306 <code><font color='blue'><pre style='display:inline'>
310 gprof -b profile.exe | sed -f gprof.sed
307 gprof -b profile.exe | sed -f gprof.sed
311308 </pre></font></code>
312
313
314 <br/>
315309 <br/>
316310 <b><big><a name="prefix_dir" id="prefix_dir">prefix_dir</a></big></b>
317311 <br/>
325319 option,
326320 if you specify
327321 <code><font color='blue'><pre style='display:inline'>
328 ./configure --prefix=/usr/local
322 ./configure --prefix=/usr/local
329323 </pre></font></code>
330
331324 the CppAD include files will be installed in the directory
332325
333326 <code><font color="blue"><span style='white-space: nowrap'><br/>
374367 .
375368 If one, and only one, of the following command line arguments is specified:
376369 <code><font color='blue'><pre style='display:inline'>
377 --with-stdvector
378 --with-boostvector
379 --with-eigenvector
370 --with-stdvector
371 --with-boostvector
372 --with-eigenvector
380373 </pre></font></code>
381
382374 the corresponding of the following template classes is used
383375
384376 <code><font color="blue"><span style='white-space: nowrap'><br/>
486478 option,
487479 if you specify
488480 <code><font color='blue'><pre style='display:inline'>
489 ./configure --prefix=/usr/local POSTFIX_DIR=coin
481 ./configure --prefix=/usr/local POSTFIX_DIR=coin
490482 </pre></font></code>
491
492483 the CppAD include files will be
493484 <a href="auto_tools.xml#make install" target="_top"><span style='white-space: nowrap'>installed</span></a>
494485 in the directory
789780 Once you are satisfied that the tests are giving correct results,
790781 you can install CppAD into easy to use directories by executing the command
791782 <code><font color='blue'><pre style='display:inline'>
792 make install
783 make install
793784 </pre></font></code>
794
795785 This will install CppAD in the location specified by
796786 <a href="auto_tools.xml#prefix_dir" target="_top"><span style='white-space: nowrap'>prefix_dir</span></a>
797787 .
55 <title>AD Absolute Zero Multiplication: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="AD Absolute Zero Multiplication: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" ad absolute zero multiplication: example and test "/>
8 <meta name="keywords" id="keywords" content=" ad absolute zero multiplication: example test "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Enable use of AD&lt;Base&gt; where Base is Adolc's adouble Type</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Enable use of AD&lt;Base&gt; where Base is Adolc's adouble Type"/>
8 <meta name="keywords" id="keywords" content=" enable use of ad&lt;base&gt; where base is adolc's adouble type syntax example include files condexpop condexprel equalopseq identical integer azmul ordered unary standard math erf asinh acosh atanh expm1 log1p sign abs pow numeric_limits "/>
8 <meta name="keywords" id="keywords" content=" enable use ad&lt;base&gt; where base is adolc's adouble type syntax example include files condexpop condexprel equalopseq identical integer azmul ordered unary standard math erf asinh acosh atanh expm1 log1p sign abs pow numeric_limits "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
144144 # include &lt;adolc/adolc.h&gt;
145145 # include &lt;cppad/base_require.hpp&gt;
146146 </pre></font></code>
147
148
149 <br/>
150147 <br/>
151148 <b><big><a name="CondExpOp" id="CondExpOp">CondExpOp</a></big></b>
152149 <br/>
168165 function).
169166 <code><font color='blue'><pre style='display:inline'>
170167 namespace CppAD {
171 inline adouble CondExpOp(
172 enum CppAD::CompareOp cop ,
173 const adouble &amp;left ,
174 const adouble &amp;right ,
175 const adouble &amp;trueCase ,
176 const adouble &amp;falseCase )
177 { adouble result;
178 switch( cop )
179 {
180 case CompareLt: // left &lt; right
181 condassign(result, right - left, trueCase, falseCase);
182 break;
183
184 case CompareLe: // left &lt;= right
185 condassign(result, left - right, falseCase, trueCase);
186 break;
187
188 case CompareEq: // left == right
189 condassign(result, left - right, falseCase, trueCase);
190 condassign(result, right - left, falseCase, result);
191 break;
192
193 case CompareGe: // left &gt;= right
194 condassign(result, right - left, falseCase, trueCase);
195 break;
196
197 case CompareGt: // left &gt; right
198 condassign(result, left - right, trueCase, falseCase);
199 break;
200 default:
201 CppAD::ErrorHandler::Call(
202 true , __LINE__ , __FILE__ ,
203 &quot;CppAD::CondExp&quot;,
204 &quot;Error: for unknown reason.&quot;
205 );
206 result = trueCase;
207 }
208 return result;
209 }
210 }
211 </pre></font></code>
212
213
214 <br/>
168 inline adouble CondExpOp(
169 enum CppAD::CompareOp cop ,
170 const adouble &amp;left ,
171 const adouble &amp;right ,
172 const adouble &amp;trueCase ,
173 const adouble &amp;falseCase )
174 { adouble result;
175 switch( cop )
176 {
177 case CompareLt: // left &lt; right
178 condassign(result, right - left, trueCase, falseCase);
179 break;
180
181 case CompareLe: // left &lt;= right
182 condassign(result, left - right, falseCase, trueCase);
183 break;
184
185 case CompareEq: // left == right
186 condassign(result, left - right, falseCase, trueCase);
187 condassign(result, right - left, falseCase, result);
188 break;
189
190 case CompareGe: // left &gt;= right
191 condassign(result, right - left, falseCase, trueCase);
192 break;
193
194 case CompareGt: // left &gt; right
195 condassign(result, left - right, trueCase, falseCase);
196 break;
197 default:
198 CppAD::ErrorHandler::Call(
199 true , __LINE__ , __FILE__ ,
200 &quot;CppAD::CondExp&quot;,
201 &quot;Error: for unknown reason.&quot;
202 );
203 result = trueCase;
204 }
205 return result;
206 }
207 }
208 </pre></font></code>
215209 <br/>
216210 <b><big><a name="CondExpRel" id="CondExpRel">CondExpRel</a></big></b>
217211 <br/>
219213 macro invocation
220214 <code><font color='blue'><pre style='display:inline'>
221215 namespace CppAD {
222 CPPAD_COND_EXP_REL(adouble)
223 }
224 </pre></font></code>
225
226
227 <br/>
216 CPPAD_COND_EXP_REL(adouble)
217 }
218 </pre></font></code>
228219 <br/>
229220 <b><big><a name="EqualOpSeq" id="EqualOpSeq">EqualOpSeq</a></big></b>
230221 <br/>
233224 Make <code><font color="blue">EqualOpSeq</font></code> an error if it gets used:
234225 <code><font color='blue'><pre style='display:inline'>
235226 namespace CppAD {
236 inline bool EqualOpSeq(const adouble &amp;x, const adouble &amp;y)
237 { CppAD::ErrorHandler::Call(
238 true , __LINE__ , __FILE__ ,
239 &quot;CppAD::EqualOpSeq(x, y)&quot;,
240 &quot;Error: adouble does not support EqualOpSeq.&quot;
241 );
242 return false;
243 }
244 }
245 </pre></font></code>
246
247
248 <br/>
227 inline bool EqualOpSeq(const adouble &amp;x, const adouble &amp;y)
228 { CppAD::ErrorHandler::Call(
229 true , __LINE__ , __FILE__ ,
230 &quot;CppAD::EqualOpSeq(x, y)&quot;,
231 &quot;Error: adouble does not support EqualOpSeq.&quot;
232 );
233 return false;
234 }
235 }
236 </pre></font></code>
249237 <br/>
250238 <b><big><a name="Identical" id="Identical">Identical</a></big></b>
251239 <br/>
254242 To be safe (but slow) return <code><font color="blue">false</font></code> in all the cases below.
255243 <code><font color='blue'><pre style='display:inline'>
256244 namespace CppAD {
257 inline bool IdenticalPar(const adouble &amp;x)
258 { return false; }
259 inline bool IdenticalZero(const adouble &amp;x)
260 { return false; }
261 inline bool IdenticalOne(const adouble &amp;x)
262 { return false; }
263 inline bool IdenticalEqualPar(const adouble &amp;x, const adouble &amp;y)
264 { return false; }
265 }
266 </pre></font></code>
267
268
269 <br/>
245 inline bool IdenticalPar(const adouble &amp;x)
246 { return false; }
247 inline bool IdenticalZero(const adouble &amp;x)
248 { return false; }
249 inline bool IdenticalOne(const adouble &amp;x)
250 { return false; }
251 inline bool IdenticalEqualPar(const adouble &amp;x, const adouble &amp;y)
252 { return false; }
253 }
254 </pre></font></code>
270255 <br/>
271256 <b><big><a name="Integer" id="Integer">Integer</a></big></b>
272257
273258 <code><font color='blue'><pre style='display:inline'>
274 inline int Integer(const adouble &amp;x)
275 { return static_cast&lt;int&gt;( x.getValue() ); }
276 </pre></font></code>
277
278
279 <br/>
259 inline int Integer(const adouble &amp;x)
260 { return static_cast&lt;int&gt;( x.getValue() ); }
261 </pre></font></code>
280262 <br/>
281263 <b><big><a name="azmul" id="azmul">azmul</a></big></b>
282264
283265 <code><font color='blue'><pre style='display:inline'>
284266 namespace CppAD {
285 CPPAD_AZMUL( adouble )
286 }
287 </pre></font></code>
288
289
290 <br/>
267 CPPAD_AZMUL( adouble )
268 }
269 </pre></font></code>
291270 <br/>
292271 <b><big><a name="Ordered" id="Ordered">Ordered</a></big></b>
293272
294273 <code><font color='blue'><pre style='display:inline'>
295274 namespace CppAD {
296 inline bool GreaterThanZero(const adouble &amp;x)
297 { return (x &gt; 0); }
298 inline bool GreaterThanOrZero(const adouble &amp;x)
299 { return (x &gt;= 0); }
300 inline bool LessThanZero(const adouble &amp;x)
301 { return (x &lt; 0); }
302 inline bool LessThanOrZero(const adouble &amp;x)
303 { return (x &lt;= 0); }
304 inline bool abs_geq(const adouble&amp; x, const adouble&amp; y)
305 { return fabs(x) &gt;= fabs(y); }
306 }
307 </pre></font></code>
308
309
310 <br/>
275 inline bool GreaterThanZero(const adouble &amp;x)
276 { return (x &gt; 0); }
277 inline bool GreaterThanOrZero(const adouble &amp;x)
278 { return (x &gt;= 0); }
279 inline bool LessThanZero(const adouble &amp;x)
280 { return (x &lt; 0); }
281 inline bool LessThanOrZero(const adouble &amp;x)
282 { return (x &lt;= 0); }
283 inline bool abs_geq(const adouble&amp; x, const adouble&amp; y)
284 { return fabs(x) &gt;= fabs(y); }
285 }
286 </pre></font></code>
311287 <br/>
312288 <b><big><a name="Unary Standard Math" id="Unary Standard Math">Unary Standard Math</a></big></b>
313289 <br/>
352328 return 0.0; \
353329 }
354330 # if CPPAD_USE_CPLUSPLUS_2011
355 CPPAD_BASE_ADOLC_NO_SUPPORT(erf)
356 CPPAD_BASE_ADOLC_NO_SUPPORT(asinh)
357 CPPAD_BASE_ADOLC_NO_SUPPORT(acosh)
358 CPPAD_BASE_ADOLC_NO_SUPPORT(atanh)
359 CPPAD_BASE_ADOLC_NO_SUPPORT(expm1)
360 CPPAD_BASE_ADOLC_NO_SUPPORT(log1p)
331 CPPAD_BASE_ADOLC_NO_SUPPORT(erf)
332 CPPAD_BASE_ADOLC_NO_SUPPORT(asinh)
333 CPPAD_BASE_ADOLC_NO_SUPPORT(acosh)
334 CPPAD_BASE_ADOLC_NO_SUPPORT(atanh)
335 CPPAD_BASE_ADOLC_NO_SUPPORT(expm1)
336 CPPAD_BASE_ADOLC_NO_SUPPORT(log1p)
361337 # endif
362338 # undef CPPAD_BASE_ADOLC_NO_SUPPORT
363339 }
364340 </pre></font></code>
365
366
367 <br/>
368341 <br/>
369342 <b><big><a name="sign" id="sign">sign</a></big></b>
370343 <br/>
376349 .
377350 <code><font color='blue'><pre style='display:inline'>
378351 namespace CppAD {
379 inline adouble sign(const adouble&amp; x)
380 { adouble s_plus, s_minus, half(.5);
381 // set s_plus to sign(x)/2, except for case x == 0, s_plus = -.5
382 condassign(s_plus, +x, -half, +half);
383 // set s_minus to -sign(x)/2, except for case x == 0, s_minus = -.5
384 condassign(s_minus, -x, -half, +half);
385 // set s to sign(x)
386 return s_plus - s_minus;
387 }
388 }
389 </pre></font></code>
390
391
392 <br/>
352 inline adouble sign(const adouble&amp; x)
353 { adouble s_plus, s_minus, half(.5);
354 // set s_plus to sign(x)/2, except for case x == 0, s_plus = -.5
355 condassign(s_plus, +x, -half, +half);
356 // set s_minus to -sign(x)/2, except for case x == 0, s_minus = -.5
357 condassign(s_minus, -x, -half, +half);
358 // set s to sign(x)
359 return s_plus - s_minus;
360 }
361 }
362 </pre></font></code>
393363 <br/>
394364 <b><big><a name="abs" id="abs">abs</a></big></b>
395365 <br/>
398368 function:
399369 <code><font color='blue'><pre style='display:inline'>
400370 namespace CppAD {
401 inline adouble abs(const adouble&amp; x)
402 { return fabs(x); }
403 }
404 </pre></font></code>
405
406
407 <br/>
371 inline adouble abs(const adouble&amp; x)
372 { return fabs(x); }
373 }
374 </pre></font></code>
408375 <br/>
409376 <b><big><a name="pow" id="pow">pow</a></big></b>
410377 <br/>
421388 for the type <code><font color="blue">adouble</font></code>:
422389 <code><font color='blue'><pre style='display:inline'>
423390 namespace CppAD {
424 CPPAD_NUMERIC_LIMITS(double, adouble)
425 }
426 </pre></font></code>
427
391 CPPAD_NUMERIC_LIMITS(double, adouble)
392 }
393 </pre></font></code>
428394
429395 <hr/>Input File: cppad/example/base_adolc.hpp
430396
133133 # include &lt;cppad/base_require.hpp&gt;
134134 # include &lt;cppad/utility/thread_alloc.hpp&gt;
135135 </pre></font></code>
136
137
138 <br/>
139136 <br/>
140137 <b><big><a name="Computed Assignment Macro" id="Computed Assignment Macro">Computed Assignment Macro</a></big></b>
141138 <br/>
150147 <code><font color="blue">/=</font></code>.
151148 <code><font color='blue'><pre style='display:inline'>
152149 # define BASE_ALLOC_ASSIGN_OPERATOR(op) \
153 void operator op (const base_alloc&amp; x) \
154 { *ptrdbl_ op *x.ptrdbl_; }
155 </pre></font></code>
156
157
158 <br/>
150 void operator op (const base_alloc&amp; x) \
151 { *ptrdbl_ op *x.ptrdbl_; }
152 </pre></font></code>
159153 <br/>
160154 <b><big><a name="Binary Operator Macro" id="Binary Operator Macro">Binary Operator Macro</a></big></b>
161155 <br/>
170164 <code><font color="blue">/</font></code>.
171165 <code><font color='blue'><pre style='display:inline'>
172166 # define BASE_ALLOC_BINARY_OPERATOR(op) const \
173 base_alloc operator op (const base_alloc&amp; x) const \
174 { base_alloc result; \
175 double dbl = *ptrdbl_; \
176 double x_dbl = *x.ptrdbl_; \
177 *result.ptrdbl_ = dbl op x_dbl; \
178 return result; \
179 }
180 </pre></font></code>
181
182
183 <br/>
167 base_alloc operator op (const base_alloc&amp; x) const \
168 { base_alloc result; \
169 double dbl = *ptrdbl_; \
170 double x_dbl = *x.ptrdbl_; \
171 *result.ptrdbl_ = dbl op x_dbl; \
172 return result; \
173 }
174 </pre></font></code>
184175 <br/>
185176 <b><big><a name="Boolean Operator Macro" id="Boolean Operator Macro">Boolean Operator Macro</a></big></b>
186177 <br/>
198189 <code><font color="blue">&gt;</font></code>,
199190 <code><font color='blue'><pre style='display:inline'>
200191 # define BASE_ALLOC_BOOL_OPERATOR(op) const \
201 bool operator op (const base_alloc&amp; x) const \
202 { double dbl = *ptrdbl_; \
203 double x_dbl = *x.ptrdbl_; \
204 return dbl op x_dbl; \
205 }
206 </pre></font></code>
207
208
209 <br/>
192 bool operator op (const base_alloc&amp; x) const \
193 { double dbl = *ptrdbl_; \
194 double x_dbl = *x.ptrdbl_; \
195 return dbl op x_dbl; \
196 }
197 </pre></font></code>
210198 <br/>
211199 <b><big><a name="Class Definition" id="Class Definition">Class Definition</a></big></b>
212200 <br/>
219207
220208 class base_alloc {
221209 public:
222 double* ptrdbl_;
223
224 base_alloc(void)
225 { size_t cap;
226 void* v = CppAD::thread_alloc::get_memory(sizeof(double), cap);
227 ptrdbl_ = static_cast&lt;double*&gt;(v);
228 }
229 base_alloc(double dbl)
230 { size_t cap;
231 void *v = CppAD::thread_alloc::get_memory(sizeof(double), cap);
232 ptrdbl_ = static_cast&lt;double*&gt;(v);
233 *ptrdbl_ = dbl;
234 }
235 base_alloc(const base_alloc&amp; x)
236 { size_t cap;
237 void *v = CppAD::thread_alloc::get_memory(sizeof(double), cap);
238 ptrdbl_ = static_cast&lt;double*&gt;(v);
239 *ptrdbl_ = *x.ptrdbl_;
240 }
241 ~base_alloc(void)
242 { void* v = static_cast&lt;void*&gt;(ptrdbl_);
243 CppAD::thread_alloc::return_memory(v);
244 }
245 base_alloc operator-(void) const
246 { base_alloc result;
247 *result.ptrdbl_ = - *ptrdbl_;
248 return result;
249 }
250 base_alloc operator+(void) const
251 { return *this; }
252 void operator=(const base_alloc&amp; x)
253 { *ptrdbl_ = *x.ptrdbl_; }
254 BASE_ALLOC_ASSIGN_OPERATOR(+=)
255 BASE_ALLOC_ASSIGN_OPERATOR(-=)
256 BASE_ALLOC_ASSIGN_OPERATOR(*=)
257 BASE_ALLOC_ASSIGN_OPERATOR(/=)
258 BASE_ALLOC_BINARY_OPERATOR(+)
259 BASE_ALLOC_BINARY_OPERATOR(-)
260 BASE_ALLOC_BINARY_OPERATOR(*)
261 BASE_ALLOC_BINARY_OPERATOR(/)
262 BASE_ALLOC_BOOL_OPERATOR(==)
263 BASE_ALLOC_BOOL_OPERATOR(!=)
264 // The &lt;= operator is not necessary for the base type requirements
265 // (needed so we can use NearEqual with base_alloc arguments).
266 BASE_ALLOC_BOOL_OPERATOR(&lt;=)
210 double* ptrdbl_;
211
212 base_alloc(void)
213 { size_t cap;
214 void* v = CppAD::thread_alloc::get_memory(sizeof(double), cap);
215 ptrdbl_ = static_cast&lt;double*&gt;(v);
216 }
217 base_alloc(double dbl)
218 { size_t cap;
219 void *v = CppAD::thread_alloc::get_memory(sizeof(double), cap);
220 ptrdbl_ = static_cast&lt;double*&gt;(v);
221 *ptrdbl_ = dbl;
222 }
223 base_alloc(const base_alloc&amp; x)
224 { size_t cap;
225 void *v = CppAD::thread_alloc::get_memory(sizeof(double), cap);
226 ptrdbl_ = static_cast&lt;double*&gt;(v);
227 *ptrdbl_ = *x.ptrdbl_;
228 }
229 ~base_alloc(void)
230 { void* v = static_cast&lt;void*&gt;(ptrdbl_);
231 CppAD::thread_alloc::return_memory(v);
232 }
233 base_alloc operator-(void) const
234 { base_alloc result;
235 *result.ptrdbl_ = - *ptrdbl_;
236 return result;
237 }
238 base_alloc operator+(void) const
239 { return *this; }
240 void operator=(const base_alloc&amp; x)
241 { *ptrdbl_ = *x.ptrdbl_; }
242 BASE_ALLOC_ASSIGN_OPERATOR(+=)
243 BASE_ALLOC_ASSIGN_OPERATOR(-=)
244 BASE_ALLOC_ASSIGN_OPERATOR(*=)
245 BASE_ALLOC_ASSIGN_OPERATOR(/=)
246 BASE_ALLOC_BINARY_OPERATOR(+)
247 BASE_ALLOC_BINARY_OPERATOR(-)
248 BASE_ALLOC_BINARY_OPERATOR(*)
249 BASE_ALLOC_BINARY_OPERATOR(/)
250 BASE_ALLOC_BOOL_OPERATOR(==)
251 BASE_ALLOC_BOOL_OPERATOR(!=)
252 // The &lt;= operator is not necessary for the base type requirements
253 // (needed so we can use NearEqual with base_alloc arguments).
254 BASE_ALLOC_BOOL_OPERATOR(&lt;=)
267255 };
268256 </pre></font></code>
269
270
271 <br/>
272257 <br/>
273258 <b><big><a name="CondExpOp" id="CondExpOp">CondExpOp</a></big></b>
274259 <br/>
277262 Hence its <code><font color="blue">CondExpOp</font></code> function is defined by
278263 <code><font color='blue'><pre style='display:inline'>
279264 namespace CppAD {
280 inline base_alloc CondExpOp(
281 enum CompareOp cop ,
282 const base_alloc&amp; left ,
283 const base_alloc&amp; right ,
284 const base_alloc&amp; exp_if_true ,
285 const base_alloc&amp; exp_if_false )
286 { // not used
287 assert(false);
288
289 // to void compiler error
290 return base_alloc();
291 }
292 }
293 </pre></font></code>
294
295
296 <br/>
265 inline base_alloc CondExpOp(
266 enum CompareOp cop ,
267 const base_alloc&amp; left ,
268 const base_alloc&amp; right ,
269 const base_alloc&amp; exp_if_true ,
270 const base_alloc&amp; exp_if_false )
271 { // not used
272 assert(false);
273
274 // to void compiler error
275 return base_alloc();
276 }
277 }
278 </pre></font></code>
297279 <br/>
298280 <b><big><a name="CondExpRel" id="CondExpRel">CondExpRel</a></big></b>
299281 <br/>
301283 macro invocation
302284 <code><font color='blue'><pre style='display:inline'>
303285 namespace CppAD {
304 CPPAD_COND_EXP_REL(base_alloc)
305 }
306 </pre></font></code>
307
286 CPPAD_COND_EXP_REL(base_alloc)
287 }
288 </pre></font></code>
308289 uses <code><font color="blue">CondExpOp</font></code> above to
309290 define
310291 <code><font color="blue"><span style='white-space: nowrap'>CondExp</span></font><i><font color="black"><span style='white-space: nowrap'>Rel</span></font></i></code>
321302 The type <code><font color="blue">base_alloc</font></code> is simple (in this respect) and so we define
322303 <code><font color='blue'><pre style='display:inline'>
323304 namespace CppAD {
324 inline bool EqualOpSeq(const base_alloc&amp; x, const base_alloc&amp; y)
325 { return *x.ptrdbl_ == *y.ptrdbl_; }
326 }
327 </pre></font></code>
328
329
330 <br/>
305 inline bool EqualOpSeq(const base_alloc&amp; x, const base_alloc&amp; y)
306 { return *x.ptrdbl_ == *y.ptrdbl_; }
307 }
308 </pre></font></code>
331309 <br/>
332310 <b><big><a name="Identical" id="Identical">Identical</a></big></b>
333311 <br/>
334312 The type <code><font color="blue">base_alloc</font></code> is simple (in this respect) and so we define
335313 <code><font color='blue'><pre style='display:inline'>
336314 namespace CppAD {
337 inline bool IdenticalPar(const base_alloc&amp; x)
338 { return true; }
339 inline bool IdenticalZero(const base_alloc&amp; x)
340 { return (*x.ptrdbl_ == 0.0); }
341 inline bool IdenticalOne(const base_alloc&amp; x)
342 { return (*x.ptrdbl_ == 1.0); }
343 inline bool IdenticalEqualPar(const base_alloc&amp; x, const base_alloc&amp; y)
344 { return (*x.ptrdbl_ == *y.ptrdbl_); }
345 }
346 </pre></font></code>
347
348
349 <br/>
315 inline bool IdenticalPar(const base_alloc&amp; x)
316 { return true; }
317 inline bool IdenticalZero(const base_alloc&amp; x)
318 { return (*x.ptrdbl_ == 0.0); }
319 inline bool IdenticalOne(const base_alloc&amp; x)
320 { return (*x.ptrdbl_ == 1.0); }
321 inline bool IdenticalEqualPar(const base_alloc&amp; x, const base_alloc&amp; y)
322 { return (*x.ptrdbl_ == *y.ptrdbl_); }
323 }
324 </pre></font></code>
350325 <br/>
351326 <b><big><a name="Output Operator" id="Output Operator">Output Operator</a></big></b>
352327
353328 <code><font color='blue'><pre style='display:inline'>
354329 namespace CppAD {
355 std::ostream&amp; operator &lt;&lt; (std::ostream &amp;os, const base_alloc&amp; x)
356 { os &lt;&lt; *x.ptrdbl_;
357 return os;
358 }
359 }
360 </pre></font></code>
361
362
363 <br/>
330 std::ostream&amp; operator &lt;&lt; (std::ostream &amp;os, const base_alloc&amp; x)
331 { os &lt;&lt; *x.ptrdbl_;
332 return os;
333 }
334 }
335 </pre></font></code>
364336 <br/>
365337 <b><big><a name="Integer" id="Integer">Integer</a></big></b>
366338
367339 <code><font color='blue'><pre style='display:inline'>
368340 namespace CppAD {
369 inline int Integer(const base_alloc&amp; x)
370 { return static_cast&lt;int&gt;(*x.ptrdbl_); }
371 }
372 </pre></font></code>
373
374
375 <br/>
341 inline int Integer(const base_alloc&amp; x)
342 { return static_cast&lt;int&gt;(*x.ptrdbl_); }
343 }
344 </pre></font></code>
376345 <br/>
377346 <b><big><a name="azmul" id="azmul">azmul</a></big></b>
378347
379348 <code><font color='blue'><pre style='display:inline'>
380349 namespace CppAD {
381 CPPAD_AZMUL( base_alloc )
382 }
383 </pre></font></code>
384
385
386 <br/>
350 CPPAD_AZMUL( base_alloc )
351 }
352 </pre></font></code>
387353 <br/>
388354 <b><big><a name="Ordered" id="Ordered">Ordered</a></big></b>
389355 <br/>
390356 The <code><font color="blue">base_alloc</font></code> type supports ordered comparisons
391357 <code><font color='blue'><pre style='display:inline'>
392358 namespace CppAD {
393 inline bool GreaterThanZero(const base_alloc&amp; x)
394 { return *x.ptrdbl_ &gt; 0.0; }
395 inline bool GreaterThanOrZero(const base_alloc&amp; x)
396 { return *x.ptrdbl_ &gt;= 0.0; }
397 inline bool LessThanZero(const base_alloc&amp; x)
398 { return *x.ptrdbl_ &lt; 0.0; }
399 inline bool LessThanOrZero(const base_alloc&amp; x)
400 { return *x.ptrdbl_ &lt;= 0.f; }
401 inline bool abs_geq(const base_alloc&amp; x, const base_alloc&amp; y)
402 { return std::fabs(*x.ptrdbl_) &gt;= std::fabs(*y.ptrdbl_); }
403 }
404 </pre></font></code>
405
406
407 <br/>
359 inline bool GreaterThanZero(const base_alloc&amp; x)
360 { return *x.ptrdbl_ &gt; 0.0; }
361 inline bool GreaterThanOrZero(const base_alloc&amp; x)
362 { return *x.ptrdbl_ &gt;= 0.0; }
363 inline bool LessThanZero(const base_alloc&amp; x)
364 { return *x.ptrdbl_ &lt; 0.0; }
365 inline bool LessThanOrZero(const base_alloc&amp; x)
366 { return *x.ptrdbl_ &lt;= 0.f; }
367 inline bool abs_geq(const base_alloc&amp; x, const base_alloc&amp; y)
368 { return std::fabs(*x.ptrdbl_) &gt;= std::fabs(*y.ptrdbl_); }
369 }
370 </pre></font></code>
408371 <br/>
409372 <b><big><a name="Unary Standard Math" id="Unary Standard Math">Unary Standard Math</a></big></b>
410373 <br/>
415378 a special macro for this type:
416379 <code><font color='blue'><pre style='display:inline'>
417380 # define BASE_ALLOC_STD_MATH(fun) \
418 inline base_alloc fun (const base_alloc&amp; x) \
419 { return std::fun(*x.ptrdbl_); }
420 </pre></font></code>
421
381 inline base_alloc fun (const base_alloc&amp; x) \
382 { return std::fun(*x.ptrdbl_); }
383 </pre></font></code>
422384 The following invocations of the macro above define the
423385 <a href="base_std_math.xml#Unary Standard Math" target="_top"><span style='white-space: nowrap'>unary&#xA0;standard&#xA0;math</span></a>
424386 functions
425387 (except for <code><font color="blue">abs</font></code>):
426388 <code><font color='blue'><pre style='display:inline'>
427389 namespace CppAD {
428 BASE_ALLOC_STD_MATH(acos)
429 BASE_ALLOC_STD_MATH(asin)
430 BASE_ALLOC_STD_MATH(atan)
431 BASE_ALLOC_STD_MATH(cos)
432 BASE_ALLOC_STD_MATH(cosh)
433 BASE_ALLOC_STD_MATH(exp)
434 BASE_ALLOC_STD_MATH(log)
435 BASE_ALLOC_STD_MATH(log10)
436 BASE_ALLOC_STD_MATH(sin)
437 BASE_ALLOC_STD_MATH(sinh)
438 BASE_ALLOC_STD_MATH(sqrt)
439 BASE_ALLOC_STD_MATH(tan)
440 BASE_ALLOC_STD_MATH(tanh)
441 }
442 </pre></font></code>
443
390 BASE_ALLOC_STD_MATH(acos)
391 BASE_ALLOC_STD_MATH(asin)
392 BASE_ALLOC_STD_MATH(atan)
393 BASE_ALLOC_STD_MATH(cos)
394 BASE_ALLOC_STD_MATH(cosh)
395 BASE_ALLOC_STD_MATH(exp)
396 BASE_ALLOC_STD_MATH(log)
397 BASE_ALLOC_STD_MATH(log10)
398 BASE_ALLOC_STD_MATH(sin)
399 BASE_ALLOC_STD_MATH(sinh)
400 BASE_ALLOC_STD_MATH(sqrt)
401 BASE_ALLOC_STD_MATH(tan)
402 BASE_ALLOC_STD_MATH(tanh)
403 }
404 </pre></font></code>
444405 The absolute value function is special because its <code><font color="blue">std</font></code> name is
445406 <code><font color="blue">fabs</font></code>
446407 <code><font color='blue'><pre style='display:inline'>
447408 namespace CppAD {
448 inline base_alloc abs(const base_alloc&amp; x)
449 { return std::fabs(*x.ptrdbl_); }
450 }
451 </pre></font></code>
452
453
454 <br/>
409 inline base_alloc abs(const base_alloc&amp; x)
410 { return std::fabs(*x.ptrdbl_); }
411 }
412 </pre></font></code>
455413 <br/>
456414 <b><big><a name="erf, asinh, acosh, atanh, expm1, log1p" id="erf, asinh, acosh, atanh, expm1, log1p">erf, asinh, acosh, atanh, expm1, log1p</a></big></b>
457415 <br/>
461419 required by <code><font color="blue">AD&lt;base_alloc&gt;</font></code>:
462420 <code><font color='blue'><pre style='display:inline'>
463421 # if CPPAD_USE_CPLUSPLUS_2011
464 BASE_ALLOC_STD_MATH(erf)
465 BASE_ALLOC_STD_MATH(asinh)
466 BASE_ALLOC_STD_MATH(acosh)
467 BASE_ALLOC_STD_MATH(atanh)
468 BASE_ALLOC_STD_MATH(expm1)
469 BASE_ALLOC_STD_MATH(log1p)
422 BASE_ALLOC_STD_MATH(erf)
423 BASE_ALLOC_STD_MATH(asinh)
424 BASE_ALLOC_STD_MATH(acosh)
425 BASE_ALLOC_STD_MATH(atanh)
426 BASE_ALLOC_STD_MATH(expm1)
427 BASE_ALLOC_STD_MATH(log1p)
470428 # endif
471429 </pre></font></code>
472
473
474 <br/>
475430 <br/>
476431 <b><big><a name="sign" id="sign">sign</a></big></b>
477432 <br/>
479434 is required to use <code><font color="blue">AD&lt;base_alloc&gt;</font></code>:
480435 <code><font color='blue'><pre style='display:inline'>
481436 namespace CppAD {
482 inline base_alloc sign(const base_alloc&amp; x)
483 { if( *x.ptrdbl_ &gt; 0.0 )
484 return 1.0;
485 if( *x.ptrdbl_ == 0.0 )
486 return 0.0;
487 return -1.0;
488 }
489 }
490 </pre></font></code>
491
492
493 <br/>
437 inline base_alloc sign(const base_alloc&amp; x)
438 { if( *x.ptrdbl_ &gt; 0.0 )
439 return 1.0;
440 if( *x.ptrdbl_ == 0.0 )
441 return 0.0;
442 return -1.0;
443 }
444 }
445 </pre></font></code>
494446 <br/>
495447 <b><big><a name="pow" id="pow">pow</a></big></b>
496448 <br/>
498450 is required to use <code><font color="blue">AD&lt;base_alloc&gt;</font></code>:
499451 <code><font color='blue'><pre style='display:inline'>
500452 namespace CppAD {
501 inline base_alloc pow(const base_alloc&amp; x, const base_alloc&amp; y)
502 { return std::pow(*x.ptrdbl_, *y.ptrdbl_); }
503 }
504 </pre></font></code>
505
506
507 <br/>
453 inline base_alloc pow(const base_alloc&amp; x, const base_alloc&amp; y)
454 { return std::pow(*x.ptrdbl_, *y.ptrdbl_); }
455 }
456 </pre></font></code>
508457 <br/>
509458 <b><big><a name="numeric_limits" id="numeric_limits">numeric_limits</a></big></b>
510459 <br/>
513462 for the type <code><font color="blue">base_alloc</font></code>:
514463 <code><font color='blue'><pre style='display:inline'>
515464 namespace CppAD {
516 CPPAD_NUMERIC_LIMITS(double, base_alloc)
517 }
518 </pre></font></code>
519
520
465 CPPAD_NUMERIC_LIMITS(double, base_alloc)
466 }
467 </pre></font></code>
521468
522469 <hr/>Input File: example/base_alloc.hpp
523470
55 <title>Enable use of AD&lt;Base&gt; where Base is std::complex&lt;double&gt;</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Enable use of AD&lt;Base&gt; where Base is std::complex&lt;double&gt;"/>
8 <meta name="keywords" id="keywords" content=" enable use of ad&lt;base&gt; where base is std::complex&lt;double&gt; example include order condexpop condexprel equalopseq identical ordered integer azmul isnan valid unary math invalid pow numeric_limits to_string "/>
8 <meta name="keywords" id="keywords" content=" enable use ad&lt;base&gt; where base is std::complex&lt;double&gt; example include order condexpop condexprel equalopseq identical ordered integer azmul isnan valid unary math invalid pow numeric_limits to_string "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
137137 # include &lt;cppad/local/cppad_assert.hpp&gt;
138138
139139 </pre></font></code>
140
141
142 <br/>
143 <br/>
144140 <b><big><a name="CondExpOp" id="CondExpOp">CondExpOp</a></big></b>
145141 <br/>
146142 The type <code><font color="blue">std::complex&lt;double&gt;</font></code> does not supports the
150146 Hence its <code><font color="blue">CondExpOp</font></code> function is defined by
151147 <code><font color='blue'><pre style='display:inline'>
152148 namespace CppAD {
153 inline std::complex&lt;double&gt; CondExpOp(
154 enum CppAD::CompareOp cop ,
155 const std::complex&lt;double&gt; &amp;left ,
156 const std::complex&lt;double&gt; &amp;right ,
157 const std::complex&lt;double&gt; &amp;trueCase ,
158 const std::complex&lt;double&gt; &amp;falseCase )
159 { CppAD::ErrorHandler::Call(
160 true , __LINE__ , __FILE__ ,
161 &quot;std::complex&lt;float&gt; CondExpOp(...)&quot;,
162 &quot;Error: cannot use CondExp with a complex type&quot;
163 );
164 return std::complex&lt;double&gt;(0);
165 }
166 }
167 </pre></font></code>
168
169
170 <br/>
149 inline std::complex&lt;double&gt; CondExpOp(
150 enum CppAD::CompareOp cop ,
151 const std::complex&lt;double&gt; &amp;left ,
152 const std::complex&lt;double&gt; &amp;right ,
153 const std::complex&lt;double&gt; &amp;trueCase ,
154 const std::complex&lt;double&gt; &amp;falseCase )
155 { CppAD::ErrorHandler::Call(
156 true , __LINE__ , __FILE__ ,
157 &quot;std::complex&lt;float&gt; CondExpOp(...)&quot;,
158 &quot;Error: cannot use CondExp with a complex type&quot;
159 );
160 return std::complex&lt;double&gt;(0);
161 }
162 }
163 </pre></font></code>
171164 <br/>
172165 <b><big><a name="CondExpRel" id="CondExpRel">CondExpRel</a></big></b>
173166 <br/>
175168 macro invocation
176169 <code><font color='blue'><pre style='display:inline'>
177170 namespace CppAD {
178 CPPAD_COND_EXP_REL( std::complex&lt;double&gt; )
179 }
180 </pre></font></code>
181
171 CPPAD_COND_EXP_REL( std::complex&lt;double&gt; )
172 }
173 </pre></font></code>
182174 used <code><font color="blue">CondExpOp</font></code> above to
183175 define
184176 <code><font color="blue"><span style='white-space: nowrap'>CondExp</span></font><i><font color="black"><span style='white-space: nowrap'>Rel</span></font></i></code>
196188 Thus they are equal in this sense if and only if there values are equal.
197189 <code><font color='blue'><pre style='display:inline'>
198190 namespace CppAD {
199 inline bool EqualOpSeq(
200 const std::complex&lt;double&gt; &amp;x ,
201 const std::complex&lt;double&gt; &amp;y )
202 { return x == y;
203 }
204 }
205 </pre></font></code>
206
207
208 <br/>
191 inline bool EqualOpSeq(
192 const std::complex&lt;double&gt; &amp;x ,
193 const std::complex&lt;double&gt; &amp;y )
194 { return x == y;
195 }
196 }
197 </pre></font></code>
209198 <br/>
210199 <b><big><a name="Identical" id="Identical">Identical</a></big></b>
211200 <br/>
213202 Thus they are all parameters so the identical functions just check values.
214203 <code><font color='blue'><pre style='display:inline'>
215204 namespace CppAD {
216 inline bool IdenticalPar(const std::complex&lt;double&gt; &amp;x)
217 { return true; }
218 inline bool IdenticalZero(const std::complex&lt;double&gt; &amp;x)
219 { return (x == std::complex&lt;double&gt;(0., 0.) ); }
220 inline bool IdenticalOne(const std::complex&lt;double&gt; &amp;x)
221 { return (x == std::complex&lt;double&gt;(1., 0.) ); }
222 inline bool IdenticalEqualPar(
223 const std::complex&lt;double&gt; &amp;x, const std::complex&lt;double&gt; &amp;y)
224 { return (x == y); }
225 }
226 </pre></font></code>
227
228
229 <br/>
205 inline bool IdenticalPar(const std::complex&lt;double&gt; &amp;x)
206 { return true; }
207 inline bool IdenticalZero(const std::complex&lt;double&gt; &amp;x)
208 { return (x == std::complex&lt;double&gt;(0., 0.) ); }
209 inline bool IdenticalOne(const std::complex&lt;double&gt; &amp;x)
210 { return (x == std::complex&lt;double&gt;(1., 0.) ); }
211 inline bool IdenticalEqualPar(
212 const std::complex&lt;double&gt; &amp;x, const std::complex&lt;double&gt; &amp;y)
213 { return (x == y); }
214 }
215 </pre></font></code>
230216 <br/>
231217 <b><big><a name="Ordered" id="Ordered">Ordered</a></big></b>
232218 <br/>
243229 return false; \
244230 }
245231 namespace CppAD {
246 CPPAD_USER_MACRO(LessThanZero)
247 CPPAD_USER_MACRO(LessThanOrZero)
248 CPPAD_USER_MACRO(GreaterThanOrZero)
249 CPPAD_USER_MACRO(GreaterThanZero)
250 inline bool abs_geq(
251 const std::complex&lt;double&gt;&amp; x ,
252 const std::complex&lt;double&gt;&amp; y )
253 { return std::abs(x) &gt;= std::abs(y); }
254 }
255 </pre></font></code>
256
257
258 <br/>
232 CPPAD_USER_MACRO(LessThanZero)
233 CPPAD_USER_MACRO(LessThanOrZero)
234 CPPAD_USER_MACRO(GreaterThanOrZero)
235 CPPAD_USER_MACRO(GreaterThanZero)
236 inline bool abs_geq(
237 const std::complex&lt;double&gt;&amp; x ,
238 const std::complex&lt;double&gt;&amp; y )
239 { return std::abs(x) &gt;= std::abs(y); }
240 }
241 </pre></font></code>
259242 <br/>
260243 <b><big><a name="Integer" id="Integer">Integer</a></big></b>
261244 <br/>
265248 function:
266249 <code><font color='blue'><pre style='display:inline'>
267250 namespace CppAD {
268 inline int Integer(const std::complex&lt;double&gt; &amp;x)
269 { return static_cast&lt;int&gt;( x.real() ); }
270 }
271 </pre></font></code>
272
273
274 <br/>
251 inline int Integer(const std::complex&lt;double&gt; &amp;x)
252 { return static_cast&lt;int&gt;( x.real() ); }
253 }
254 </pre></font></code>
275255 <br/>
276256 <b><big><a name="azmul" id="azmul">azmul</a></big></b>
277257
278258 <code><font color='blue'><pre style='display:inline'>
279259 namespace CppAD {
280 CPPAD_AZMUL( std::complex&lt;double&gt; )
281 }
282 </pre></font></code>
283
284
285 <br/>
260 CPPAD_AZMUL( std::complex&lt;double&gt; )
261 }
262 </pre></font></code>
286263 <br/>
287264 <b><big><a name="isnan" id="isnan">isnan</a></big></b>
288265 <br/>
299276 this function in the CppAD namespace.
300277 <code><font color='blue'><pre style='display:inline'>
301278 namespace CppAD {
302 inline bool isnan(const std::complex&lt;double&gt;&amp; z)
303 { return (z != z);
304 }
305 }
306 </pre></font></code>
307
308
309 <br/>
279 inline bool isnan(const std::complex&lt;double&gt;&amp; z)
280 { return (z != z);
281 }
282 }
283 </pre></font></code>
310284 <br/>
311285 <b><big><a name="Valid Unary Math" id="Valid Unary Math">Valid Unary Math</a></big></b>
312286 <br/>
315289 required to use <code><font color="blue">AD&lt; std::complex&lt;double&gt; &gt;</font></code>.
316290 <code><font color='blue'><pre style='display:inline'>
317291 namespace CppAD {
318 CPPAD_STANDARD_MATH_UNARY(std::complex&lt;double&gt;, cos)
319 CPPAD_STANDARD_MATH_UNARY(std::complex&lt;double&gt;, cosh)
320 CPPAD_STANDARD_MATH_UNARY(std::complex&lt;double&gt;, exp)
321 CPPAD_STANDARD_MATH_UNARY(std::complex&lt;double&gt;, log)
322 CPPAD_STANDARD_MATH_UNARY(std::complex&lt;double&gt;, sin)
323 CPPAD_STANDARD_MATH_UNARY(std::complex&lt;double&gt;, sinh)
324 CPPAD_STANDARD_MATH_UNARY(std::complex&lt;double&gt;, sqrt)
325 }
326 </pre></font></code>
327
328
329 <br/>
292 CPPAD_STANDARD_MATH_UNARY(std::complex&lt;double&gt;, cos)
293 CPPAD_STANDARD_MATH_UNARY(std::complex&lt;double&gt;, cosh)
294 CPPAD_STANDARD_MATH_UNARY(std::complex&lt;double&gt;, exp)
295 CPPAD_STANDARD_MATH_UNARY(std::complex&lt;double&gt;, log)
296 CPPAD_STANDARD_MATH_UNARY(std::complex&lt;double&gt;, sin)
297 CPPAD_STANDARD_MATH_UNARY(std::complex&lt;double&gt;, sinh)
298 CPPAD_STANDARD_MATH_UNARY(std::complex&lt;double&gt;, sqrt)
299 }
300 </pre></font></code>
330301 <br/>
331302 <b><big><a name="Invalid Unary Math" id="Invalid Unary Math">Invalid Unary Math</a></big></b>
332303 <br/>
345316 return std::complex&lt;double&gt;(0); \
346317 }
347318 namespace CppAD {
348 CPPAD_USER_MACRO(abs)
349 CPPAD_USER_MACRO(acos)
350 CPPAD_USER_MACRO(asin)
351 CPPAD_USER_MACRO(atan)
352 CPPAD_USER_MACRO(sign)
319 CPPAD_USER_MACRO(abs)
320 CPPAD_USER_MACRO(acos)
321 CPPAD_USER_MACRO(asin)
322 CPPAD_USER_MACRO(atan)
323 CPPAD_USER_MACRO(sign)
353324 # if CPPAD_USE_CPLUSPLUS_2011
354 CPPAD_USER_MACRO(erf)
355 CPPAD_USER_MACRO(asinh)
356 CPPAD_USER_MACRO(acosh)
357 CPPAD_USER_MACRO(atanh)
358 CPPAD_USER_MACRO(expm1)
359 CPPAD_USER_MACRO(log1p)
325 CPPAD_USER_MACRO(erf)
326 CPPAD_USER_MACRO(asinh)
327 CPPAD_USER_MACRO(acosh)
328 CPPAD_USER_MACRO(atanh)
329 CPPAD_USER_MACRO(expm1)
330 CPPAD_USER_MACRO(log1p)
360331 # endif
361332 }
362333 </pre></font></code>
363
364
365 <br/>
366334 <br/>
367335 <b><big><a name="pow" id="pow">pow</a></big></b>
368336 <br/>
370338 is required to use <code><font color="blue">AD&lt; std::complex&lt;double&gt; &gt;</font></code>:
371339 <code><font color='blue'><pre style='display:inline'>
372340 namespace CppAD {
373 inline std::complex&lt;double&gt; pow(
374 const std::complex&lt;double&gt; &amp;x ,
375 const std::complex&lt;double&gt; &amp;y )
376 { return std::pow(x, y); }
377 }
378 </pre></font></code>
379
380
381 <br/>
341 inline std::complex&lt;double&gt; pow(
342 const std::complex&lt;double&gt; &amp;x ,
343 const std::complex&lt;double&gt; &amp;y )
344 { return std::pow(x, y); }
345 }
346 </pre></font></code>
382347 <br/>
383348 <b><big><a name="numeric_limits" id="numeric_limits">numeric_limits</a></big></b>
384349 <br/>
387352 for the type <code><font color="blue">std::complex&lt;double&gt;</font></code>:
388353 <code><font color='blue'><pre style='display:inline'>
389354 namespace CppAD {
390 CPPAD_NUMERIC_LIMITS(double, std::complex&lt;double&gt;)
391 }
392 </pre></font></code>
393
394
395 <br/>
355 CPPAD_NUMERIC_LIMITS(double, std::complex&lt;double&gt;)
356 }
357 </pre></font></code>
396358 <br/>
397359 <b><big><a name="to_string" id="to_string">to_string</a></big></b>
398360 <br/>
401363 for the type <code><font color="blue">std::complex&lt;double&gt;</font></code>:
402364 <code><font color='blue'><pre style='display:inline'>
403365 namespace CppAD {
404 CPPAD_TO_STRING(std::complex&lt;double&gt;)
405 }
406 </pre></font></code>
407
366 CPPAD_TO_STRING(std::complex&lt;double&gt;)
367 }
368 </pre></font></code>
408369
409370 <hr/>Input File: cppad/local/base_complex.hpp
410371
55 <title>Base Type Requirements for Conditional Expressions</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Base Type Requirements for Conditional Expressions"/>
8 <meta name="keywords" id="keywords" content=" base type requirements for conditional expressions Condexp require Cppad_cond_exp_rel purpose compareop condexptemplate ordered not condexprel "/>
8 <meta name="keywords" id="keywords" content=" base type requirements conditional expressions Condexp require Cppad_cond_exp_rel purpose compareop condexptemplate ordered not condexprel "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
116116 The following <code><font color="blue">enum</font></code> type is used in the specifications below:
117117 <code><font color='blue'><pre style='display:inline'>
118118 namespace CppAD {
119 // The conditional expression operator enum type
120 enum CompareOp
121 { CompareLt, // less than
122 CompareLe, // less than or equal
123 CompareEq, // equal
124 CompareGe, // greater than or equal
125 CompareGt, // greater than
126 CompareNe // not equal
127 };
119 // The conditional expression operator enum type
120 enum CompareOp
121 { CompareLt, // less than
122 CompareLe, // less than or equal
123 CompareEq, // equal
124 CompareGe, // greater than or equal
125 CompareGt, // greater than
126 CompareNe // not equal
127 };
128128 }
129129 </pre></font></code>
130
131
132 <br/>
133130 <br/>
134131 <b><big><a name="CondExpTemplate" id="CondExpTemplate">CondExpTemplate</a></big></b>
135132 <br/>
55 <title>Enable use of AD&lt;Base&gt; where Base is double</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Enable use of AD&lt;Base&gt; where Base is double"/>
8 <meta name="keywords" id="keywords" content=" enable use of ad&lt;base&gt; where base is double condexpop condexprel equalopseq identical integer azmul ordered unary standard math sign pow numeric_limits to_string "/>
8 <meta name="keywords" id="keywords" content=" enable use ad&lt;base&gt; where base is double condexpop condexprel equalopseq identical integer azmul ordered unary standard math sign pow numeric_limits to_string "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
113113 Hence its <code><font color="blue">CondExpOp</font></code> function is defined by
114114 <code><font color='blue'><pre style='display:inline'>
115115 namespace CppAD {
116 inline double CondExpOp(
117 enum CompareOp cop ,
118 const double&amp; left ,
119 const double&amp; right ,
120 const double&amp; exp_if_true ,
121 const double&amp; exp_if_false )
122 { return CondExpTemplate(cop, left, right, exp_if_true, exp_if_false);
123 }
124 }
125 </pre></font></code>
126
127
128 <br/>
116 inline double CondExpOp(
117 enum CompareOp cop ,
118 const double&amp; left ,
119 const double&amp; right ,
120 const double&amp; exp_if_true ,
121 const double&amp; exp_if_false )
122 { return CondExpTemplate(cop, left, right, exp_if_true, exp_if_false);
123 }
124 }
125 </pre></font></code>
129126 <br/>
130127 <b><big><a name="CondExpRel" id="CondExpRel">CondExpRel</a></big></b>
131128 <br/>
133130 macro invocation
134131 <code><font color='blue'><pre style='display:inline'>
135132 namespace CppAD {
136 CPPAD_COND_EXP_REL(double)
137 }
138 </pre></font></code>
139
133 CPPAD_COND_EXP_REL(double)
134 }
135 </pre></font></code>
140136 uses <code><font color="blue">CondExpOp</font></code> above to
141137 define
142138 <code><font color="blue"><span style='white-space: nowrap'>CondExp</span></font><i><font color="black"><span style='white-space: nowrap'>Rel</span></font></i></code>
153149 The type <code><font color="blue">double</font></code> is simple (in this respect) and so we define
154150 <code><font color='blue'><pre style='display:inline'>
155151 namespace CppAD {
156 inline bool EqualOpSeq(const double&amp; x, const double&amp; y)
157 { return x == y; }
158 }
159 </pre></font></code>
160
161
162 <br/>
152 inline bool EqualOpSeq(const double&amp; x, const double&amp; y)
153 { return x == y; }
154 }
155 </pre></font></code>
163156 <br/>
164157 <b><big><a name="Identical" id="Identical">Identical</a></big></b>
165158 <br/>
166159 The type <code><font color="blue">double</font></code> is simple (in this respect) and so we define
167160 <code><font color='blue'><pre style='display:inline'>
168161 namespace CppAD {
169 inline bool IdenticalPar(const double&amp; x)
170 { return true; }
171 inline bool IdenticalZero(const double&amp; x)
172 { return (x == 0.); }
173 inline bool IdenticalOne(const double&amp; x)
174 { return (x == 1.); }
175 inline bool IdenticalEqualPar(const double&amp; x, const double&amp; y)
176 { return (x == y); }
177 }
178 </pre></font></code>
179
180
181 <br/>
162 inline bool IdenticalPar(const double&amp; x)
163 { return true; }
164 inline bool IdenticalZero(const double&amp; x)
165 { return (x == 0.); }
166 inline bool IdenticalOne(const double&amp; x)
167 { return (x == 1.); }
168 inline bool IdenticalEqualPar(const double&amp; x, const double&amp; y)
169 { return (x == y); }
170 }
171 </pre></font></code>
182172 <br/>
183173 <b><big><a name="Integer" id="Integer">Integer</a></big></b>
184174
185175 <code><font color='blue'><pre style='display:inline'>
186176 namespace CppAD {
187 inline int Integer(const double&amp; x)
188 { return static_cast&lt;int&gt;(x); }
189 }
190 </pre></font></code>
191
192
193 <br/>
177 inline int Integer(const double&amp; x)
178 { return static_cast&lt;int&gt;(x); }
179 }
180 </pre></font></code>
194181 <br/>
195182 <b><big><a name="azmul" id="azmul">azmul</a></big></b>
196183
197184 <code><font color='blue'><pre style='display:inline'>
198185 namespace CppAD {
199 CPPAD_AZMUL( double )
200 }
201 </pre></font></code>
202
203
204 <br/>
186 CPPAD_AZMUL( double )
187 }
188 </pre></font></code>
205189 <br/>
206190 <b><big><a name="Ordered" id="Ordered">Ordered</a></big></b>
207191 <br/>
208192 The <code><font color="blue">double</font></code> type supports ordered comparisons
209193 <code><font color='blue'><pre style='display:inline'>
210194 namespace CppAD {
211 inline bool GreaterThanZero(const double&amp; x)
212 { return x &gt; 0.; }
213 inline bool GreaterThanOrZero(const double&amp; x)
214 { return x &gt;= 0.; }
215 inline bool LessThanZero(const double&amp; x)
216 { return x &lt; 0.; }
217 inline bool LessThanOrZero(const double&amp; x)
218 { return x &lt;= 0.; }
219 inline bool abs_geq(const double&amp; x, const double&amp; y)
220 { return std::fabs(x) &gt;= std::fabs(y); }
221 }
222 </pre></font></code>
223
224
225 <br/>
195 inline bool GreaterThanZero(const double&amp; x)
196 { return x &gt; 0.; }
197 inline bool GreaterThanOrZero(const double&amp; x)
198 { return x &gt;= 0.; }
199 inline bool LessThanZero(const double&amp; x)
200 { return x &lt; 0.; }
201 inline bool LessThanOrZero(const double&amp; x)
202 { return x &lt;= 0.; }
203 inline bool abs_geq(const double&amp; x, const double&amp; y)
204 { return std::fabs(x) &gt;= std::fabs(y); }
205 }
206 </pre></font></code>
226207 <br/>
227208 <b><big><a name="Unary Standard Math" id="Unary Standard Math">Unary Standard Math</a></big></b>
228209 <br/>
230211 required to use <code><font color="blue">AD&lt;double&gt;</font></code>:
231212 <code><font color='blue'><pre style='display:inline'>
232213 namespace CppAD {
233 CPPAD_STANDARD_MATH_UNARY(double, acos)
234 CPPAD_STANDARD_MATH_UNARY(double, asin)
235 CPPAD_STANDARD_MATH_UNARY(double, atan)
236 CPPAD_STANDARD_MATH_UNARY(double, cos)
237 CPPAD_STANDARD_MATH_UNARY(double, cosh)
238 CPPAD_STANDARD_MATH_UNARY(double, exp)
239 CPPAD_STANDARD_MATH_UNARY(double, fabs)
240 CPPAD_STANDARD_MATH_UNARY(double, log)
241 CPPAD_STANDARD_MATH_UNARY(double, log10)
242 CPPAD_STANDARD_MATH_UNARY(double, sin)
243 CPPAD_STANDARD_MATH_UNARY(double, sinh)
244 CPPAD_STANDARD_MATH_UNARY(double, sqrt)
245 CPPAD_STANDARD_MATH_UNARY(double, tan)
246 CPPAD_STANDARD_MATH_UNARY(double, tanh)
214 CPPAD_STANDARD_MATH_UNARY(double, acos)
215 CPPAD_STANDARD_MATH_UNARY(double, asin)
216 CPPAD_STANDARD_MATH_UNARY(double, atan)
217 CPPAD_STANDARD_MATH_UNARY(double, cos)
218 CPPAD_STANDARD_MATH_UNARY(double, cosh)
219 CPPAD_STANDARD_MATH_UNARY(double, exp)
220 CPPAD_STANDARD_MATH_UNARY(double, fabs)
221 CPPAD_STANDARD_MATH_UNARY(double, log)
222 CPPAD_STANDARD_MATH_UNARY(double, log10)
223 CPPAD_STANDARD_MATH_UNARY(double, sin)
224 CPPAD_STANDARD_MATH_UNARY(double, sinh)
225 CPPAD_STANDARD_MATH_UNARY(double, sqrt)
226 CPPAD_STANDARD_MATH_UNARY(double, tan)
227 CPPAD_STANDARD_MATH_UNARY(double, tanh)
247228 # if CPPAD_USE_CPLUSPLUS_2011
248 CPPAD_STANDARD_MATH_UNARY(double, erf)
249 CPPAD_STANDARD_MATH_UNARY(double, asinh)
250 CPPAD_STANDARD_MATH_UNARY(double, acosh)
251 CPPAD_STANDARD_MATH_UNARY(double, atanh)
252 CPPAD_STANDARD_MATH_UNARY(double, expm1)
253 CPPAD_STANDARD_MATH_UNARY(double, log1p)
229 CPPAD_STANDARD_MATH_UNARY(double, erf)
230 CPPAD_STANDARD_MATH_UNARY(double, asinh)
231 CPPAD_STANDARD_MATH_UNARY(double, acosh)
232 CPPAD_STANDARD_MATH_UNARY(double, atanh)
233 CPPAD_STANDARD_MATH_UNARY(double, expm1)
234 CPPAD_STANDARD_MATH_UNARY(double, log1p)
254235 # endif
255236 }
256237 </pre></font></code>
257
258238 The absolute value function is special because its <code><font color="blue">std</font></code> name is
259239 <code><font color="blue">fabs</font></code>
260240 <code><font color='blue'><pre style='display:inline'>
261241 namespace CppAD {
262 inline double abs(const double&amp; x)
263 { return std::fabs(x); }
264 }
265 </pre></font></code>
266
267
268 <br/>
242 inline double abs(const double&amp; x)
243 { return std::fabs(x); }
244 }
245 </pre></font></code>
269246 <br/>
270247 <b><big><a name="sign" id="sign">sign</a></big></b>
271248 <br/>
273250 is required to use <code><font color="blue">AD&lt;double&gt;</font></code>:
274251 <code><font color='blue'><pre style='display:inline'>
275252 namespace CppAD {
276 inline double sign(const double&amp; x)
277 { if( x &gt; 0. )
278 return 1.;
279 if( x == 0. )
280 return 0.;
281 return -1.;
282 }
283 }
284 </pre></font></code>
285
286
287 <br/>
253 inline double sign(const double&amp; x)
254 { if( x &gt; 0. )
255 return 1.;
256 if( x == 0. )
257 return 0.;
258 return -1.;
259 }
260 }
261 </pre></font></code>
288262 <br/>
289263 <b><big><a name="pow" id="pow">pow</a></big></b>
290264 <br/>
292266 is required to use <code><font color="blue">AD&lt;double&gt;</font></code>:
293267 <code><font color='blue'><pre style='display:inline'>
294268 namespace CppAD {
295 inline double pow(const double&amp; x, const double&amp; y)
296 { return std::pow(x, y); }
297 }
298 </pre></font></code>
299
300
301 <br/>
269 inline double pow(const double&amp; x, const double&amp; y)
270 { return std::pow(x, y); }
271 }
272 </pre></font></code>
302273 <br/>
303274 <b><big><a name="numeric_limits" id="numeric_limits">numeric_limits</a></big></b>
304275 <br/>
307278 for the type <code><font color="blue">double</font></code>:
308279 <code><font color='blue'><pre style='display:inline'>
309280 namespace CppAD {
310 CPPAD_NUMERIC_LIMITS(double, double)
311 }
312 </pre></font></code>
313
314
315 <br/>
281 CPPAD_NUMERIC_LIMITS(double, double)
282 }
283 </pre></font></code>
316284 <br/>
317285 <b><big><a name="to_string" id="to_string">to_string</a></big></b>
318286 <br/>
101101 </select>
102102 </td>
103103 </tr></table><br/>
104
105
106104 <center><b><big><big>Example AD Base Types That are not AD&lt;OtherBase&gt;</big></big></b></center>
107105 <br/>
108106 <b><big><a name="Contents" id="Contents">Contents</a></big></b>
55 <title>Enable use of AD&lt;Base&gt; where Base is float</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Enable use of AD&lt;Base&gt; where Base is float"/>
8 <meta name="keywords" id="keywords" content=" enable use of ad&lt;base&gt; where base is float condexpop condexprel equalopseq identical integer azmul ordered unary standard math sign pow numeric_limits to_string "/>
8 <meta name="keywords" id="keywords" content=" enable use ad&lt;base&gt; where base is float condexpop condexprel equalopseq identical integer azmul ordered unary standard math sign pow numeric_limits to_string "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
113113 Hence its <code><font color="blue">CondExpOp</font></code> function is defined by
114114 <code><font color='blue'><pre style='display:inline'>
115115 namespace CppAD {
116 inline float CondExpOp(
117 enum CompareOp cop ,
118 const float&amp; left ,
119 const float&amp; right ,
120 const float&amp; exp_if_true ,
121 const float&amp; exp_if_false )
122 { return CondExpTemplate(cop, left, right, exp_if_true, exp_if_false);
123 }
124 }
125 </pre></font></code>
126
127
128 <br/>
116 inline float CondExpOp(
117 enum CompareOp cop ,
118 const float&amp; left ,
119 const float&amp; right ,
120 const float&amp; exp_if_true ,
121 const float&amp; exp_if_false )
122 { return CondExpTemplate(cop, left, right, exp_if_true, exp_if_false);
123 }
124 }
125 </pre></font></code>
129126 <br/>
130127 <b><big><a name="CondExpRel" id="CondExpRel">CondExpRel</a></big></b>
131128 <br/>
133130 macro invocation
134131 <code><font color='blue'><pre style='display:inline'>
135132 namespace CppAD {
136 CPPAD_COND_EXP_REL(float)
137 }
138 </pre></font></code>
139
133 CPPAD_COND_EXP_REL(float)
134 }
135 </pre></font></code>
140136 uses <code><font color="blue">CondExpOp</font></code> above to
141137 define
142138 <code><font color="blue"><span style='white-space: nowrap'>CondExp</span></font><i><font color="black"><span style='white-space: nowrap'>Rel</span></font></i></code>
153149 The type <code><font color="blue">float</font></code> is simple (in this respect) and so we define
154150 <code><font color='blue'><pre style='display:inline'>
155151 namespace CppAD {
156 inline bool EqualOpSeq(const float&amp; x, const float&amp; y)
157 { return x == y; }
158 }
159 </pre></font></code>
160
161
162 <br/>
152 inline bool EqualOpSeq(const float&amp; x, const float&amp; y)
153 { return x == y; }
154 }
155 </pre></font></code>
163156 <br/>
164157 <b><big><a name="Identical" id="Identical">Identical</a></big></b>
165158 <br/>
166159 The type <code><font color="blue">float</font></code> is simple (in this respect) and so we define
167160 <code><font color='blue'><pre style='display:inline'>
168161 namespace CppAD {
169 inline bool IdenticalPar(const float&amp; x)
170 { return true; }
171 inline bool IdenticalZero(const float&amp; x)
172 { return (x == 0.f); }
173 inline bool IdenticalOne(const float&amp; x)
174 { return (x == 1.f); }
175 inline bool IdenticalEqualPar(const float&amp; x, const float&amp; y)
176 { return (x == y); }
177 }
178 </pre></font></code>
179
180
181 <br/>
162 inline bool IdenticalPar(const float&amp; x)
163 { return true; }
164 inline bool IdenticalZero(const float&amp; x)
165 { return (x == 0.f); }
166 inline bool IdenticalOne(const float&amp; x)
167 { return (x == 1.f); }
168 inline bool IdenticalEqualPar(const float&amp; x, const float&amp; y)
169 { return (x == y); }
170 }
171 </pre></font></code>
182172 <br/>
183173 <b><big><a name="Integer" id="Integer">Integer</a></big></b>
184174
185175 <code><font color='blue'><pre style='display:inline'>
186176 namespace CppAD {
187 inline int Integer(const float&amp; x)
188 { return static_cast&lt;int&gt;(x); }
189 }
190 </pre></font></code>
191
192
193 <br/>
177 inline int Integer(const float&amp; x)
178 { return static_cast&lt;int&gt;(x); }
179 }
180 </pre></font></code>
194181 <br/>
195182 <b><big><a name="azmul" id="azmul">azmul</a></big></b>
196183
197184 <code><font color='blue'><pre style='display:inline'>
198185 namespace CppAD {
199 CPPAD_AZMUL( float )
200 }
201 </pre></font></code>
202
203
204 <br/>
186 CPPAD_AZMUL( float )
187 }
188 </pre></font></code>
205189 <br/>
206190 <b><big><a name="Ordered" id="Ordered">Ordered</a></big></b>
207191 <br/>
208192 The <code><font color="blue">float</font></code> type supports ordered comparisons
209193 <code><font color='blue'><pre style='display:inline'>
210194 namespace CppAD {
211 inline bool GreaterThanZero(const float&amp; x)
212 { return x &gt; 0.f; }
213 inline bool GreaterThanOrZero(const float&amp; x)
214 { return x &gt;= 0.f; }
215 inline bool LessThanZero(const float&amp; x)
216 { return x &lt; 0.f; }
217 inline bool LessThanOrZero(const float&amp; x)
218 { return x &lt;= 0.f; }
219 inline bool abs_geq(const float&amp; x, const float&amp; y)
220 { return std::fabs(x) &gt;= std::fabs(y); }
221 }
222 </pre></font></code>
223
224
225 <br/>
195 inline bool GreaterThanZero(const float&amp; x)
196 { return x &gt; 0.f; }
197 inline bool GreaterThanOrZero(const float&amp; x)
198 { return x &gt;= 0.f; }
199 inline bool LessThanZero(const float&amp; x)
200 { return x &lt; 0.f; }
201 inline bool LessThanOrZero(const float&amp; x)
202 { return x &lt;= 0.f; }
203 inline bool abs_geq(const float&amp; x, const float&amp; y)
204 { return std::fabs(x) &gt;= std::fabs(y); }
205 }
206 </pre></font></code>
226207 <br/>
227208 <b><big><a name="Unary Standard Math" id="Unary Standard Math">Unary Standard Math</a></big></b>
228209 <br/>
231212 (in the CppAD namespace)
232213 <code><font color='blue'><pre style='display:inline'>
233214 namespace CppAD {
234 CPPAD_STANDARD_MATH_UNARY(float, acos)
235 CPPAD_STANDARD_MATH_UNARY(float, asin)
236 CPPAD_STANDARD_MATH_UNARY(float, atan)
237 CPPAD_STANDARD_MATH_UNARY(float, cos)
238 CPPAD_STANDARD_MATH_UNARY(float, cosh)
239 CPPAD_STANDARD_MATH_UNARY(float, exp)
240 CPPAD_STANDARD_MATH_UNARY(float, fabs)
241 CPPAD_STANDARD_MATH_UNARY(float, log)
242 CPPAD_STANDARD_MATH_UNARY(float, log10)
243 CPPAD_STANDARD_MATH_UNARY(float, sin)
244 CPPAD_STANDARD_MATH_UNARY(float, sinh)
245 CPPAD_STANDARD_MATH_UNARY(float, sqrt)
246 CPPAD_STANDARD_MATH_UNARY(float, tan)
247 CPPAD_STANDARD_MATH_UNARY(float, tanh)
215 CPPAD_STANDARD_MATH_UNARY(float, acos)
216 CPPAD_STANDARD_MATH_UNARY(float, asin)
217 CPPAD_STANDARD_MATH_UNARY(float, atan)
218 CPPAD_STANDARD_MATH_UNARY(float, cos)
219 CPPAD_STANDARD_MATH_UNARY(float, cosh)
220 CPPAD_STANDARD_MATH_UNARY(float, exp)
221 CPPAD_STANDARD_MATH_UNARY(float, fabs)
222 CPPAD_STANDARD_MATH_UNARY(float, log)
223 CPPAD_STANDARD_MATH_UNARY(float, log10)
224 CPPAD_STANDARD_MATH_UNARY(float, sin)
225 CPPAD_STANDARD_MATH_UNARY(float, sinh)
226 CPPAD_STANDARD_MATH_UNARY(float, sqrt)
227 CPPAD_STANDARD_MATH_UNARY(float, tan)
228 CPPAD_STANDARD_MATH_UNARY(float, tanh)
248229 # if CPPAD_USE_CPLUSPLUS_2011
249 CPPAD_STANDARD_MATH_UNARY(float, erf)
250 CPPAD_STANDARD_MATH_UNARY(float, asinh)
251 CPPAD_STANDARD_MATH_UNARY(float, acosh)
252 CPPAD_STANDARD_MATH_UNARY(float, atanh)
253 CPPAD_STANDARD_MATH_UNARY(float, expm1)
254 CPPAD_STANDARD_MATH_UNARY(float, log1p)
230 CPPAD_STANDARD_MATH_UNARY(float, erf)
231 CPPAD_STANDARD_MATH_UNARY(float, asinh)
232 CPPAD_STANDARD_MATH_UNARY(float, acosh)
233 CPPAD_STANDARD_MATH_UNARY(float, atanh)
234 CPPAD_STANDARD_MATH_UNARY(float, expm1)
235 CPPAD_STANDARD_MATH_UNARY(float, log1p)
255236 # endif
256237 }
257238 </pre></font></code>
258
259239 The absolute value function is special because its <code><font color="blue">std</font></code> name is
260240 <code><font color="blue">fabs</font></code>
261241 <code><font color='blue'><pre style='display:inline'>
262242 namespace CppAD {
263 inline float abs(const float&amp; x)
264 { return std::fabs(x); }
265 }
266 </pre></font></code>
267
268
269 <br/>
243 inline float abs(const float&amp; x)
244 { return std::fabs(x); }
245 }
246 </pre></font></code>
270247 <br/>
271248 <b><big><a name="sign" id="sign">sign</a></big></b>
272249 <br/>
274251 is required to use <code><font color="blue">AD&lt;float&gt;</font></code>:
275252 <code><font color='blue'><pre style='display:inline'>
276253 namespace CppAD {
277 inline float sign(const float&amp; x)
278 { if( x &gt; 0.f )
279 return 1.f;
280 if( x == 0.f )
281 return 0.f;
282 return -1.f;
283 }
284 }
285 </pre></font></code>
286
287
288 <br/>
254 inline float sign(const float&amp; x)
255 { if( x &gt; 0.f )
256 return 1.f;
257 if( x == 0.f )
258 return 0.f;
259 return -1.f;
260 }
261 }
262 </pre></font></code>
289263 <br/>
290264 <b><big><a name="pow" id="pow">pow</a></big></b>
291265 <br/>
293267 is required to use <code><font color="blue">AD&lt;float&gt;</font></code>:
294268 <code><font color='blue'><pre style='display:inline'>
295269 namespace CppAD {
296 inline float pow(const float&amp; x, const float&amp; y)
297 { return std::pow(x, y); }
298 }
299 </pre></font></code>
300
301
302 <br/>
270 inline float pow(const float&amp; x, const float&amp; y)
271 { return std::pow(x, y); }
272 }
273 </pre></font></code>
303274 <br/>
304275 <b><big><a name="numeric_limits" id="numeric_limits">numeric_limits</a></big></b>
305276 <br/>
308279 for the type <code><font color="blue">float</font></code>:
309280 <code><font color='blue'><pre style='display:inline'>
310281 namespace CppAD {
311 CPPAD_NUMERIC_LIMITS(float, float)
312 }
313 </pre></font></code>
314
315
316 <br/>
282 CPPAD_NUMERIC_LIMITS(float, float)
283 }
284 </pre></font></code>
317285 <br/>
318286 <b><big><a name="to_string" id="to_string">to_string</a></big></b>
319287 <br/>
55 <title>Base Type Requirements for Identically Equal Comparisons</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Base Type Requirements for Identically Equal Comparisons"/>
8 <meta name="keywords" id="keywords" content=" base type requirements for identically equal comparisons require equalopseq the simple case more complicated cases identical identicalpar prototypes functions examples "/>
8 <meta name="keywords" id="keywords" content=" base type requirements identically equal comparisons require equalopseq the simple case more complicated cases identical identicalpar prototypes functions examples "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Base Type Requirements for Numeric Limits</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Base Type Requirements for Numeric Limits"/>
8 <meta name="keywords" id="keywords" content=" base type requirements for numeric limits cppad::numeric_limits cppad_numeric_limits "/>
8 <meta name="keywords" id="keywords" content=" base type requirements numeric limits cppad::numeric_limits cppad_numeric_limits "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
146146 # define CPPAD_NUMERIC_LIMITS(Other, Base) \
147147 template &lt;&gt; class numeric_limits&lt;Base&gt;\
148148 {\
149 public:\
150 static Base min(void) \
151 { return static_cast&lt;Base&gt;( std::numeric_limits&lt;Other&gt;::min() ); }\
152 static Base max(void) \
153 { return static_cast&lt;Base&gt;( std::numeric_limits&lt;Other&gt;::max() ); }\
154 static Base epsilon(void) \
155 { return static_cast&lt;Base&gt;( std::numeric_limits&lt;Other&gt;::epsilon() ); }\
156 static Base quiet_NaN(void) \
157 { return static_cast&lt;Base&gt;( std::numeric_limits&lt;Other&gt;::quiet_NaN() ); }\
149 public:\
150 static Base min(void) \
151 { return static_cast&lt;Base&gt;( std::numeric_limits&lt;Other&gt;::min() ); }\
152 static Base max(void) \
153 { return static_cast&lt;Base&gt;( std::numeric_limits&lt;Other&gt;::max() ); }\
154 static Base epsilon(void) \
155 { return static_cast&lt;Base&gt;( std::numeric_limits&lt;Other&gt;::epsilon() ); }\
156 static Base quiet_NaN(void) \
157 { return static_cast&lt;Base&gt;( std::numeric_limits&lt;Other&gt;::quiet_NaN() ); }\
158158 };
159159 </pre></font></code>
160
161160
162161 <hr/>Input File: cppad/local/base_limits.hpp
163162
55 <title>Base Type Requirements for Ordered Comparisons</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Base Type Requirements for Ordered Comparisons"/>
8 <meta name="keywords" id="keywords" content=" base type requirements for ordered comparisons purpose not "/>
8 <meta name="keywords" id="keywords" content=" base type requirements ordered comparisons purpose not "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Using a User Defined AD Base Type: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Using a User Defined AD Base Type: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" using a user defined ad base type: example and test type purpose "/>
8 <meta name="keywords" id="keywords" content=" using user defined ad base type: example test type purpose "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
8787 </select>
8888 </td>
8989 </tr></table><br/>
90
91
92
9390 <center><b><big><big>Using a User Defined AD Base Type: Example and Test</big></big></b></center>
9491 <code><font color="blue"><pre style='display:inline'>
9592 # include &quot;base_alloc.hpp&quot;
55 <title>AD&lt;Base&gt; Requirements for a CppAD Base Type</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="AD&lt;Base&gt; Requirements for a CppAD Base Type"/>
8 <meta name="keywords" id="keywords" content=" ad&lt;base&gt; requirements for a cppad base type syntax purpose api warning standard types include order numeric output operator integer suggestion absolute zero azmul "/>
8 <meta name="keywords" id="keywords" content=" ad&lt;base&gt; requirements cppad base type syntax purpose api warning standard types include order numeric output operator integer suggestion absolute zero azmul "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
271271 return x * y; \
272272 }
273273 </pre></font></code>
274
275
276 <br/>
277274 <br/>
278275 <b><big><a name="Contents" id="Contents">Contents</a></big></b>
279276 <br/>
55 <title>Base Type Requirements for Standard Math Functions</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Base Type Requirements for Standard Math Functions"/>
8 <meta name="keywords" id="keywords" content=" base type requirements for standard math functions purpose unary cppad_standard_math_unary erf asinh acosh atanh expm1 log1p sign pow isnan "/>
8 <meta name="keywords" id="keywords" content=" base type requirements standard math functions purpose unary cppad_standard_math_unary erf asinh acosh atanh expm1 log1p sign pow isnan "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
9292 </select>
9393 </td>
9494 </tr></table><br/>
95
96
97
9895 <center><b><big><big>Extending to_string To Another Floating Point Type</big></big></b></center>
9996 <br/>
10097 <b><big><a name="Base Requirement" id="Base Requirement">Base Requirement</a></big></b>
129126 <code><font color='blue'><pre style='display:inline'>
130127 # define CPPAD_TO_STRING(Base) \
131128 template &lt;&gt; struct to_string_struct&lt;Base&gt;\
132 { std::string operator()(const Base&amp; value) \
133 { std::stringstream os;\
134 Base epsilon = CppAD::numeric_limits&lt;Base&gt;::epsilon();\
135 Base log10 = CppAD::log( epsilon ) / CppAD::log(Base(10.));\
136 size_t n_digits = 1 - Integer( log10 );\
137 os &lt;&lt; std::setprecision(n_digits);\
138 os &lt;&lt; value;\
139 return os.str();\
140 }\
129 { std::string operator()(const Base&amp; value) \
130 { std::stringstream os;\
131 Base epsilon = CppAD::numeric_limits&lt;Base&gt;::epsilon();\
132 Base log10 = CppAD::log( epsilon ) / CppAD::log(Base(10.));\
133 size_t n_digits = 1 - Integer( log10 );\
134 os &lt;&lt; std::setprecision(n_digits);\
135 os &lt;&lt; value;\
136 return os.str();\
137 }\
141138 };
142139 </pre></font></code>
143
144140
145141 <hr/>Input File: cppad/local/base_to_string.hpp
146142
55 <title>BenderQuad: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="BenderQuad: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" benderquad: example and test Benderquad "/>
8 <meta name="keywords" id="keywords" content=" benderquad: example test Benderquad "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Computing Jacobian and Hessian of Bender's Reduced Objective</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Computing Jacobian and Hessian of Bender's Reduced Objective"/>
8 <meta name="keywords" id="keywords" content=" computing jacobian and hessian of bender's reduced objective Benderquad syntax see also problem purpose x y fun fun.f fun.h fun.dy g gx gxx bavector advector example "/>
8 <meta name="keywords" id="keywords" content=" computing jacobian hessian bender's reduced objective Benderquad syntax see also problem purpose x y fun fun.f fun.h fun.dy g gx gxx bavector advector example "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Bibliography</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Bibliography"/>
8 <meta name="keywords" id="keywords" content=" bibliography abramowitz and stegun the c++ programming language evaluating derivatives numerical recipes shampine l.f. "/>
8 <meta name="keywords" id="keywords" content=" bibliography abramowitz stegun the c++ programming language evaluating derivatives numerical recipes shampine l.f. "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
110110 <br/>
111111 Evaluating Derivatives: Principles and Techniques of
112112 Algorithmic Differentiation,
113 Andreas Griewank,
114 SIAM,
113 Andreas Griewank,
114 SIAM,
115115 Philadelphia,
116116 2000
117117
55 <title>AD Boolean Functions: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="AD Boolean Functions: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" ad boolean functions: example and test bool "/>
8 <meta name="keywords" id="keywords" content=" ad boolean functions: example test bool "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Using vectorBool Sparsity To Conserve Memory: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Using vectorBool Sparsity To Conserve Memory: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" using vectorbool sparsity to conserve memory: example and test purpose "/>
8 <meta name="keywords" id="keywords" content=" using vectorbool sparsity to conserve memory: example test purpose "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Bool Valued Operations and Functions with AD Arguments</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Bool Valued Operations and Functions with AD Arguments"/>
8 <meta name="keywords" id="keywords" content=" bool valued operations and functions with ad arguments "/>
8 <meta name="keywords" id="keywords" content=" bool valued operations functions with ad arguments "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
8181 </td>
8282 <td>Headings</td>
8383 </tr></table><br/>
84
85
86
87
8884 <center><b><big><big>Bool Valued Operations and Functions with AD Arguments</big></big></b></center>
8985 <table><tr><td align='left' valign='top'>
9086 <a href="compare.xml" target="_top">Compare</a></td><td>
55 <title>Controlling Taylor Coefficient Memory Allocation: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Controlling Taylor Coefficient Memory Allocation: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" controlling taylor coefficient memory allocation: example and test capacity_order "/>
8 <meta name="keywords" id="keywords" content=" controlling taylor coefficient memory allocation: example test capacity_order "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Computing a Jacobian With Constants that Change</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Computing a Jacobian With Constants that Change"/>
8 <meta name="keywords" id="keywords" content=" computing a jacobian with constants that change multiple Ad level purpose "/>
8 <meta name="keywords" id="keywords" content=" computing jacobian with constants that change multiple Ad level purpose "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>ADFun Checking For Nan: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="ADFun Checking For Nan: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" adfun checking for nan: example and test "/>
8 <meta name="keywords" id="keywords" content=" adfun checking nan: example test "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Check an ADFun Object For Nan Results</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Check an ADFun Object For Nan Results"/>
8 <meta name="keywords" id="keywords" content=" check an adfun object for nan results syntax debugging f b default error message vector_size file_name index get_check_for_nan vec file example "/>
8 <meta name="keywords" id="keywords" content=" check adfun object nan results syntax debugging f b default error message vector_size file_name index get_check_for_nan vec file example "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>The CheckNumericType Function: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="The CheckNumericType Function: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" the checknumerictype function: example and test check Numerictype "/>
8 <meta name="keywords" id="keywords" content=" the checknumerictype function: example test check Numerictype "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>The CheckSimpleVector Function: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="The CheckSimpleVector Function: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" the checksimplevector function: example and test check Simplevector "/>
8 <meta name="keywords" id="keywords" content=" the checksimplevector function: example test check Simplevector "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Simple Checkpointing: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Simple Checkpointing: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" simple checkpointing: example and test purpose "/>
8 <meta name="keywords" id="keywords" content=" simple checkpointing: example test purpose "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Using CMake to Configure CppAD</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Using CMake to Configure CppAD"/>
8 <meta name="keywords" id="keywords" content=" using cmake to configure cppad makefile install prefix postfix include directories lib datadir documentation package compile flags profile maximum number threads sparsity internal structure vector sets memory usage tape ctor implicit explicit the program command build directory cmake_verbose_makefile generator cppad_prefix cppad_postfix cmake_install_includedirs cmake_install_libdirs cmake_install_datadir cmake_install_docdir package_prefix cppad_cxx_flags c++11 cppad_profile_flag eigen and fadbad cppad_testvector cppad_max_num_threads cppad_sparse_list cppad_tape_id_type cstdint cppad_tape_addr_type cppad_deprecated "/>
8 <meta name="keywords" id="keywords" content=" using cmake to configure cppad makefile install prefix postfix include directories lib datadir documentation package compile flags profile maximum number threads sparsity internal structure vector sets memory usage tape ctor implicit explicit the program command build directory cmake_verbose_makefile generator cppad_prefix cppad_postfix cmake_install_includedirs cmake_install_libdirs cmake_install_datadir cmake_install_docdir package_prefix cppad_cxx_flags c++11 cppad_profile_flag eigen fadbad cppad_testvector cppad_max_num_threads cppad_sparse_list cppad_tape_id_type cstdint cppad_tape_addr_type cppad_deprecated "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
425425 on your system.
426426 For example, if you are using <code><font color="blue">g++</font></code> you could specify
427427 <code><font color='blue'><pre style='display:inline'>
428 -D cppad_cxx_flags=&quot;-Wall -ansi -pedantic-errors -std=c++11 -Wshadow&quot;
428 -D cppad_cxx_flags=&quot;-Wall -ansi -pedantic-errors -std=c++11 -Wshadow&quot;
429429 </pre></font></code>
430
431 <br/>
432430 <br/>
433431 <b><a name="cppad_cxx_flags.C++11" id="cppad_cxx_flags.C++11">C++11</a></b>
434432 <br/>
55 <title>Checking the CppAD Examples and Tests</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Checking the CppAD Examples and Tests"/>
8 <meta name="keywords" id="keywords" content=" checking the cppad examples and tests purpose check all windows subsets "/>
8 <meta name="keywords" id="keywords" content=" checking the cppad examples tests purpose check all windows subsets "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
101101
102102 execute the command
103103 <code><font color='blue'><pre style='display:inline'>
104 make check
104 make check
105105 </pre></font></code>
106
107106 This will build and run all of the tests that are support
108107 by your system and the <a href="cmake.xml" target="_top"><span style='white-space: nowrap'>cmake</span></a>
109108 command options.
55 <title>Using ColPack: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Using ColPack: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" using colpack: example and test colpack hessian sparse "/>
8 <meta name="keywords" id="keywords" content=" using colpack: example test colpack hessian sparse "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Using ColPack: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Using ColPack: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" using colpack: example and test colpack jacobian sparse "/>
8 <meta name="keywords" id="keywords" content=" using colpack: example test colpack jacobian sparse "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>AD Binary Comparison Operators: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="AD Binary Comparison Operators: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" ad binary comparison operators: example and test compare &lt; &lt;= &gt; &gt;= == != "/>
8 <meta name="keywords" id="keywords" content=" ad binary comparison operators: example test compare &lt; &lt;= &gt; &gt;= == != "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Compare Speed of C and C++</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Compare Speed of C and C++"/>
8 <meta name="keywords" id="keywords" content=" compare speed of c and c++ C C++ with syntax purpose "/>
8 <meta name="keywords" id="keywords" content=" compare speed c c++ C and C++ with syntax purpose "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>CompareChange and Re-Tape: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="CompareChange and Re-Tape: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" comparechange and re-tape: example test compare change re-tape "/>
8 <meta name="keywords" id="keywords" content=" comparechange re-tape: example test compare change re-tape "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Comparison Changes Between Taping and Zero Order Forward</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Comparison Changes Between Taping and Zero Order Forward"/>
8 <meta name="keywords" id="keywords" content=" comparison changes between taping and zero order forward Adfun compare_change syntax purpose f count speed number discussion op_index example "/>
8 <meta name="keywords" id="keywords" content=" comparison changes between taping zero order forward Adfun compare_change syntax purpose f count speed number discussion op_index example "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Complex Polynomial: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Complex Polynomial: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" complex polynomial: example and test polynomial poly "/>
8 <meta name="keywords" id="keywords" content=" complex polynomial: example test polynomial poly "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
8282 </select>
8383 </td>
8484 </tr></table><br/>
85
86
87
8885 <center><b><big><big>Complex Polynomial: Example and Test</big></big></b></center>
8986 <br/>
9087 <b><big><a name="Poly" id="Poly">Poly</a></big></b>
55 <title>Conditional Expressions: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Conditional Expressions: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" conditional expressions: example and test Condexp description "/>
8 <meta name="keywords" id="keywords" content=" conditional expressions: example test Condexp description "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Differentiate Conjugate Gradient Algorithm: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Differentiate Conjugate Gradient Algorithm: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" differentiate conjugate gradient algorithm: example and test purpose algorithm "/>
8 <meta name="keywords" id="keywords" content=" differentiate conjugate gradient algorithm: example test purpose algorithm "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Conversion and I/O of AD Objects</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Conversion and I/O of AD Objects"/>
8 <meta name="keywords" id="keywords" content=" conversion and i/o of ad objects convert from "/>
8 <meta name="keywords" id="keywords" content=" conversion i/o ad objects convert from "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Correctness Test of det_by_minor Routine</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Correctness Test of det_by_minor Routine"/>
8 <meta name="keywords" id="keywords" content=" correctness test of det_by_minor routine syntax flag source code "/>
8 <meta name="keywords" id="keywords" content=" correctness test det_by_minor routine syntax flag source code "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
9797 </select>
9898 </td>
9999 </tr></table><br/>
100
101
102
103100 <center><b><big><big>Correctness Test of det_by_minor Routine</big></big></b></center>
104101 <br/>
105102 <b><big><a name="Syntax" id="Syntax">Syntax</a></big></b>
129126
130127 <code><font color='blue'><pre style='display:inline'>
131128 bool correct_det_by_minor(void)
132 { double a[9], det, check;
129 { double a[9], det, check;
133130
134 <a href="uniform_01_c.xml" target="_top">random_seed</a>(123);
135 <a href="uniform_01_c.xml" target="_top">uniform_01</a>(9, a);
131 <a href="uniform_01_c.xml" target="_top">random_seed</a>(123);
132 <a href="uniform_01_c.xml" target="_top">uniform_01</a>(9, a);
136133
137 /* compute determinant using expansion by minors */
138 det = det_by_minor(a, 3);
139
140 /* use expansion by minors to hand code the determinant */
141 check = 0.;
142 check += a[0] * ( a[4] * a[8] - a[5] * a[7] );
143 check -= a[1] * ( a[3] * a[8] - a[5] * a[6] );
144 check += a[2] * ( a[3] * a[7] - a[4] * a[6] );
134 /* compute determinant using expansion by minors */
135 det = det_by_minor(a, 3);
136
137 /* use expansion by minors to hand code the determinant */
138 check = 0.;
139 check += a[0] * ( a[4] * a[8] - a[5] * a[7] );
140 check -= a[1] * ( a[3] * a[8] - a[5] * a[6] );
141 check += a[2] * ( a[3] * a[7] - a[4] * a[6] );
145142
146 if( fabs(det / check - 1.0) &lt; 1e-10 )
147 return true;
148 return false;
143 if( fabs(det / check - 1.0) &lt; 1e-10 )
144 return true;
145 return false;
149146 }
150147 </pre></font></code>
151
152148
153149 <hr/>Input File: compare_c/det_by_minor.c
154150
55 <title>The AD cos Function: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="The AD cos Function: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" the ad cos function: example and test "/>
8 <meta name="keywords" id="keywords" content=" the ad cos function: example test "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>The AD cosh Function: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="The AD cosh Function: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" the ad cosh function: example and test "/>
8 <meta name="keywords" id="keywords" content=" the ad cosh function: example test "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
22 xmlns:math='http://www.w3.org/1998/Math/MathML'
33 >
44 <head>
5 <title>cppad-20160000.0: A Package for Differentiation of C++ Algorithms</title>
5 <title>cppad-20160000.1: A Package for Differentiation of C++ Algorithms</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
7 <meta name="description" id="description" content="cppad-20160000.0: A Package for Differentiation of C++ Algorithms"/>
8 <meta name="keywords" id="keywords" content=" cppad-20160000.0: a package for differentiation of c++ algorithms Ad algorithmic automatic C++ algorithm derivative Cppad version cppad.hpp syntax introduction example include file preprocessor symbols namespace "/>
7 <meta name="description" id="description" content="cppad-20160000.1: A Package for Differentiation of C++ Algorithms"/>
8 <meta name="keywords" id="keywords" content=" cppad-20160000.1: package differentiation c++ algorithms Ad algorithmic automatic C++ algorithm derivative Cppad version cppad.hpp syntax introduction example include file preprocessor symbols namespace "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
7070 ,
7171
7272
73 <center><b><big><big>cppad-20160000.0: A Package for Differentiation of C++ Algorithms</big></big></b></center>
73 <center><b><big><big>cppad-20160000.1: A Package for Differentiation of C++ Algorithms</big></big></b></center>
7474 <br/>
7575 <b><big><a name="Syntax" id="Syntax">Syntax</a></big></b>
7676
55 <title>CppAD Speed: Gradient of Determinant Using Lu Factorization</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="CppAD Speed: Gradient of Determinant Using Lu Factorization"/>
8 <meta name="keywords" id="keywords" content=" cppad speed: gradient of determinant using lu factorization link_det_lu speed matrix factor specifications implementation "/>
8 <meta name="keywords" id="keywords" content=" cppad speed: gradient determinant using lu factorization link_det_lu speed matrix factor specifications implementation "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
9191 </select>
9292 </td>
9393 </tr></table><br/>
94
95
96
9794 <center><b><big><big>CppAD Speed: Gradient of Determinant Using Lu Factorization</big></big></b></center>
9895 <br/>
9996 <b><big><a name="Specifications" id="Specifications">Specifications</a></big></b>
112109
113110 // Note that CppAD uses global_memory at the main program level
114111 extern bool
115 global_onetape, global_atomic, global_optimize;
112 global_onetape, global_atomic, global_optimize;
116113
117114 bool link_det_lu(
118 size_t size ,
119 size_t repeat ,
120 CppAD::vector&lt;double&gt; &amp;matrix ,
121 CppAD::vector&lt;double&gt; &amp;gradient )
115 size_t size ,
116 size_t repeat ,
117 CppAD::vector&lt;double&gt; &amp;matrix ,
118 CppAD::vector&lt;double&gt; &amp;gradient )
122119 {
123 // speed test global option values
124 if( global_onetape || global_atomic )
125 return false;
120 // speed test global option values
121 if( global_onetape || global_atomic )
122 return false;
126123
127 // -----------------------------------------------------
128 // setup
129 typedef CppAD::<a href="ad.xml" target="_top">AD</a>&lt;double&gt; ADScalar;
130 typedef CppAD::vector&lt;ADScalar&gt; ADVector;
131 CppAD::det_by_lu&lt;ADScalar&gt; Det(size);
124 // -----------------------------------------------------
125 // setup
126 typedef CppAD::<a href="ad.xml" target="_top">AD</a>&lt;double&gt; ADScalar;
127 typedef CppAD::vector&lt;ADScalar&gt; ADVector;
128 CppAD::det_by_lu&lt;ADScalar&gt; Det(size);
132129
133 size_t i; // temporary index
134 size_t m = 1; // number of dependent variables
135 size_t n = size * size; // number of independent variables
136 ADVector A(n); // AD domain space vector
137 ADVector detA(m); // AD range space vector
138 CppAD::<a href="funconstruct.xml" target="_top">ADFun</a>&lt;double&gt; f; // AD function object
130 size_t i; // temporary index
131 size_t m = 1; // number of dependent variables
132 size_t n = size * size; // number of independent variables
133 ADVector A(n); // AD domain space vector
134 ADVector detA(m); // AD range space vector
135 CppAD::<a href="funconstruct.xml" target="_top">ADFun</a>&lt;double&gt; f; // AD function object
139136
140 // vectors of reverse mode weights
141 CppAD::vector&lt;double&gt; w(1);
142 w[0] = 1.;
137 // vectors of reverse mode weights
138 CppAD::vector&lt;double&gt; w(1);
139 w[0] = 1.;
143140
144 // ------------------------------------------------------
145 while(repeat--)
146 { // get the next matrix
147 CppAD::uniform_01(n, matrix);
148 for( i = 0; i &lt; n; i++)
149 A[i] = matrix[i];
141 // ------------------------------------------------------
142 while(repeat--)
143 { // get the next matrix
144 CppAD::uniform_01(n, matrix);
145 for( i = 0; i &lt; n; i++)
146 A[i] = matrix[i];
150147
151 // declare independent variables
152 <a href="independent.xml" target="_top">Independent</a>(A);
148 // declare independent variables
149 <a href="independent.xml" target="_top">Independent</a>(A);
153150
154 // AD computation of the determinant
155 detA[0] = Det(A);
151 // AD computation of the determinant
152 detA[0] = Det(A);
156153
157 // create function object f : A -&gt; detA
158 f.Dependent(A, detA);
159 if( global_optimize )
160 f.optimize();
154 // create function object f : A -&gt; detA
155 f.Dependent(A, detA);
156 if( global_optimize )
157 f.optimize();
161158
162 // skip comparison operators
163 f.compare_change_count(0);
159 // skip comparison operators
160 f.compare_change_count(0);
164161
165 // evaluate and return gradient using reverse mode
166 f.<a href="forward.xml" target="_top">Forward</a>(0, matrix);
167 gradient = f.<a href="reverse.xml" target="_top">Reverse</a>(1, w);
168 }
169 return true;
162 // evaluate and return gradient using reverse mode
163 f.<a href="forward.xml" target="_top">Forward</a>(0, matrix);
164 gradient = f.<a href="reverse.xml" target="_top">Reverse</a>(1, w);
165 }
166 return true;
170167 }
171168 </pre></font></code>
172
173169
174170 <hr/>Input File: speed/cppad/det_lu.cpp
175171
55 <title>CppAD Speed: Gradient of Determinant by Minor Expansion</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="CppAD Speed: Gradient of Determinant by Minor Expansion"/>
8 <meta name="keywords" id="keywords" content=" cppad speed: gradient of determinant by minor expansion link_det_minor speed specifications implementation "/>
8 <meta name="keywords" id="keywords" content=" cppad speed: gradient determinant minor expansion link_det_minor speed specifications implementation "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
109109
110110 // Note that CppAD uses global_memory at the main program level
111111 extern bool
112 global_onetape, global_atomic, global_optimize;
112 global_onetape, global_atomic, global_optimize;
113113
114114 bool link_det_minor(
115 size_t size ,
116 size_t repeat ,
117 CppAD::vector&lt;double&gt; &amp;matrix ,
118 CppAD::vector&lt;double&gt; &amp;gradient )
115 size_t size ,
116 size_t repeat ,
117 CppAD::vector&lt;double&gt; &amp;matrix ,
118 CppAD::vector&lt;double&gt; &amp;gradient )
119119 {
120 // speed test global option values
121 if( global_atomic )
122 return false;
123
124 // -----------------------------------------------------
125 // setup
126
127 // object for computing determinant
128 typedef CppAD::<a href="ad.xml" target="_top">AD</a>&lt;double&gt; ADScalar;
129 typedef CppAD::vector&lt;ADScalar&gt; ADVector;
130 CppAD::det_by_minor&lt;ADScalar&gt; Det(size);
131
132 size_t i; // temporary index
133 size_t m = 1; // number of dependent variables
134 size_t n = size * size; // number of independent variables
135 ADVector A(n); // AD domain space vector
136 ADVector detA(m); // AD range space vector
137
138 // vectors of reverse mode weights
139 CppAD::vector&lt;double&gt; w(1);
140 w[0] = 1.;
141
142 // the AD function object
143 CppAD::<a href="funconstruct.xml" target="_top">ADFun</a>&lt;double&gt; f;
144
145 // ---------------------------------------------------------------------
146 if( ! global_onetape ) while(repeat--)
147 {
148 // choose a matrix
149 CppAD::uniform_01(n, matrix);
150 for( i = 0; i &lt; size * size; i++)
151 A[i] = matrix[i];
152
153 // declare independent variables
154 <a href="independent.xml" target="_top">Independent</a>(A);
155
156 // AD computation of the determinant
157 detA[0] = Det(A);
158
159 // create function object f : A -&gt; detA
160 f.Dependent(A, detA);
161
162 if( global_optimize )
163 f.optimize();
164
165 // skip comparison operators
166 f.compare_change_count(0);
167
168 // evaluate the determinant at the new matrix value
169 f.<a href="forward.xml" target="_top">Forward</a>(0, matrix);
170
171 // evaluate and return gradient using reverse mode
172 gradient = f.<a href="reverse.xml" target="_top">Reverse</a>(1, w);
173 }
174 else
175 {
176 // choose a matrix
177 CppAD::uniform_01(n, matrix);
178 for( i = 0; i &lt; size * size; i++)
179 A[i] = matrix[i];
180
181 // declare independent variables
182 <a href="independent.xml" target="_top">Independent</a>(A);
183
184 // AD computation of the determinant
185 detA[0] = Det(A);
186
187 // create function object f : A -&gt; detA
188 f.Dependent(A, detA);
189
190 if( global_optimize )
191 f.optimize();
192
193 // skip comparison operators
194 f.compare_change_count(0);
195
196 // ------------------------------------------------------
197 while(repeat--)
198 { // get the next matrix
199 CppAD::uniform_01(n, matrix);
200
201 // evaluate the determinant at the new matrix value
202 f.<a href="forward.xml" target="_top">Forward</a>(0, matrix);
203
204 // evaluate and return gradient using reverse mode
205 gradient = f.<a href="reverse.xml" target="_top">Reverse</a>(1, w);
206 }
207 }
208 return true;
120 // speed test global option values
121 if( global_atomic )
122 return false;
123
124 // -----------------------------------------------------
125 // setup
126
127 // object for computing determinant
128 typedef CppAD::<a href="ad.xml" target="_top">AD</a>&lt;double&gt; ADScalar;
129 typedef CppAD::vector&lt;ADScalar&gt; ADVector;
130 CppAD::det_by_minor&lt;ADScalar&gt; Det(size);
131
132 size_t i; // temporary index
133 size_t m = 1; // number of dependent variables
134 size_t n = size * size; // number of independent variables
135 ADVector A(n); // AD domain space vector
136 ADVector detA(m); // AD range space vector
137
138 // vectors of reverse mode weights
139 CppAD::vector&lt;double&gt; w(1);
140 w[0] = 1.;
141
142 // the AD function object
143 CppAD::<a href="funconstruct.xml" target="_top">ADFun</a>&lt;double&gt; f;
144
145 // ---------------------------------------------------------------------
146 if( ! global_onetape ) while(repeat--)
147 {
148 // choose a matrix
149 CppAD::uniform_01(n, matrix);
150 for( i = 0; i &lt; size * size; i++)
151 A[i] = matrix[i];
152
153 // declare independent variables
154 <a href="independent.xml" target="_top">Independent</a>(A);
155
156 // AD computation of the determinant
157 detA[0] = Det(A);
158
159 // create function object f : A -&gt; detA
160 f.Dependent(A, detA);
161
162 if( global_optimize )
163 f.optimize();
164
165 // skip comparison operators
166 f.compare_change_count(0);
167
168 // evaluate the determinant at the new matrix value
169 f.<a href="forward.xml" target="_top">Forward</a>(0, matrix);
170
171 // evaluate and return gradient using reverse mode
172 gradient = f.<a href="reverse.xml" target="_top">Reverse</a>(1, w);
173 }
174 else
175 {
176 // choose a matrix
177 CppAD::uniform_01(n, matrix);
178 for( i = 0; i &lt; size * size; i++)
179 A[i] = matrix[i];
180
181 // declare independent variables
182 <a href="independent.xml" target="_top">Independent</a>(A);
183
184 // AD computation of the determinant
185 detA[0] = Det(A);
186
187 // create function object f : A -&gt; detA
188 f.Dependent(A, detA);
189
190 if( global_optimize )
191 f.optimize();
192
193 // skip comparison operators
194 f.compare_change_count(0);
195
196 // ------------------------------------------------------
197 while(repeat--)
198 { // get the next matrix
199 CppAD::uniform_01(n, matrix);
200
201 // evaluate the determinant at the new matrix value
202 f.<a href="forward.xml" target="_top">Forward</a>(0, matrix);
203
204 // evaluate and return gradient using reverse mode
205 gradient = f.<a href="reverse.xml" target="_top">Reverse</a>(1, w);
206 }
207 }
208 return true;
209209 }
210210 </pre></font></code>
211211
212
213212 <hr/>Input File: speed/cppad/det_minor.cpp
214213
215214 </body>
55 <title>Enable Use of Eigen Linear Algebra Package with CppAD</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Enable Use of Eigen Linear Algebra Package with CppAD"/>
8 <meta name="keywords" id="keywords" content=" enable use of eigen linear algebra package with cppad syntax purpose example include files numtraits namespace "/>
8 <meta name="keywords" id="keywords" content=" enable use eigen linear algebra package with cppad syntax purpose example include files numtraits namespace "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
158158 # include &lt;Eigen/Core&gt;
159159 # include &lt;cppad/cppad.hpp&gt;
160160 </pre></font></code>
161
162 <br/>
163161 <br/>
164162 <b><big><a name="Eigen NumTraits" id="Eigen NumTraits">Eigen NumTraits</a></big></b>
165163 <br/>
169167 scalars:
170168 <code><font color='blue'><pre style='display:inline'>
171169 namespace Eigen {
172 template &lt;class Base&gt; struct NumTraits&lt; CppAD::<a href="ad.xml" target="_top">AD</a>&lt;Base&gt; &gt;
173 { // type that corresponds to the real part of an <a href="ad.xml" target="_top">AD</a>&lt;Base&gt; value
174 typedef CppAD::<a href="ad.xml" target="_top">AD</a>&lt;Base&gt; Real;
175 // type for <a href="ad.xml" target="_top">AD</a>&lt;Base&gt; operations that result in non-integer values
176 typedef CppAD::<a href="ad.xml" target="_top">AD</a>&lt;Base&gt; NonInteger;
177 // type for nested value inside an <a href="ad.xml" target="_top">AD</a>&lt;Base&gt; expression tree
178 typedef CppAD::<a href="ad.xml" target="_top">AD</a>&lt;Base&gt; Nested;
179
180 enum {
181 // does not support complex Base types
182 IsComplex = 0 ,
183 // does not support integer Base types
184 IsInteger = 0 ,
185 // only support signed Base types
186 IsSigned = 1 ,
187 // must initialize an <a href="ad.xml" target="_top">AD</a>&lt;Base&gt; object
188 RequireInitialization = 1 ,
189 // computational cost of the corresponding operations
190 ReadCost = 1 ,
191 AddCost = 2 ,
192 MulCost = 2
193 };
194
195 // machine epsilon with type of real part of x
196 // (use assumption that Base is not complex)
197 static CppAD::<a href="ad.xml" target="_top">AD</a>&lt;Base&gt; epsilon(void)
198 { return CppAD::numeric_limits&lt; CppAD::<a href="ad.xml" target="_top">AD</a>&lt;Base&gt; &gt;::epsilon(); }
199
200 // relaxed version of machine epsilon for comparison of different
201 // operations that should result in the same value
202 static CppAD::<a href="ad.xml" target="_top">AD</a>&lt;Base&gt; dummy_precision(void)
203 { return 100. *
204 CppAD::numeric_limits&lt; CppAD::<a href="ad.xml" target="_top">AD</a>&lt;Base&gt; &gt;::epsilon();
205 }
206
207 // minimum normalized positive value
208 static CppAD::<a href="ad.xml" target="_top">AD</a>&lt;Base&gt; lowest(void)
209 { return CppAD::numeric_limits&lt; CppAD::<a href="ad.xml" target="_top">AD</a>&lt;Base&gt; &gt;::min(); }
210
211 // maximum finite value
212 static CppAD::<a href="ad.xml" target="_top">AD</a>&lt;Base&gt; highest(void)
213 { return CppAD::numeric_limits&lt; CppAD::<a href="ad.xml" target="_top">AD</a>&lt;Base&gt; &gt;::max(); }
214
215 };
170 template &lt;class Base&gt; struct NumTraits&lt; CppAD::<a href="ad.xml" target="_top">AD</a>&lt;Base&gt; &gt;
171 { // type that corresponds to the real part of an <a href="ad.xml" target="_top">AD</a>&lt;Base&gt; value
172 typedef CppAD::<a href="ad.xml" target="_top">AD</a>&lt;Base&gt; Real;
173 // type for <a href="ad.xml" target="_top">AD</a>&lt;Base&gt; operations that result in non-integer values
174 typedef CppAD::<a href="ad.xml" target="_top">AD</a>&lt;Base&gt; NonInteger;
175 // type for nested value inside an <a href="ad.xml" target="_top">AD</a>&lt;Base&gt; expression tree
176 typedef CppAD::<a href="ad.xml" target="_top">AD</a>&lt;Base&gt; Nested;
177
178 enum {
179 // does not support complex Base types
180 IsComplex = 0 ,
181 // does not support integer Base types
182 IsInteger = 0 ,
183 // only support signed Base types
184 IsSigned = 1 ,
185 // must initialize an <a href="ad.xml" target="_top">AD</a>&lt;Base&gt; object
186 RequireInitialization = 1 ,
187 // computational cost of the corresponding operations
188 ReadCost = 1 ,
189 AddCost = 2 ,
190 MulCost = 2
191 };
192
193 // machine epsilon with type of real part of x
194 // (use assumption that Base is not complex)
195 static CppAD::<a href="ad.xml" target="_top">AD</a>&lt;Base&gt; epsilon(void)
196 { return CppAD::numeric_limits&lt; CppAD::<a href="ad.xml" target="_top">AD</a>&lt;Base&gt; &gt;::epsilon(); }
197
198 // relaxed version of machine epsilon for comparison of different
199 // operations that should result in the same value
200 static CppAD::<a href="ad.xml" target="_top">AD</a>&lt;Base&gt; dummy_precision(void)
201 { return 100. *
202 CppAD::numeric_limits&lt; CppAD::<a href="ad.xml" target="_top">AD</a>&lt;Base&gt; &gt;::epsilon();
203 }
204
205 // minimum normalized positive value
206 static CppAD::<a href="ad.xml" target="_top">AD</a>&lt;Base&gt; lowest(void)
207 { return CppAD::numeric_limits&lt; CppAD::<a href="ad.xml" target="_top">AD</a>&lt;Base&gt; &gt;::min(); }
208
209 // maximum finite value
210 static CppAD::<a href="ad.xml" target="_top">AD</a>&lt;Base&gt; highest(void)
211 { return CppAD::numeric_limits&lt; CppAD::<a href="ad.xml" target="_top">AD</a>&lt;Base&gt; &gt;::max(); }
212
213 };
216214 }
217215 </pre></font></code>
218
219 <br/>
220216 <br/>
221217 <b><big><a name="CppAD Namespace" id="CppAD Namespace">CppAD Namespace</a></big></b>
222218 <br/>
226222 scalars:
227223 <code><font color='blue'><pre style='display:inline'>
228224 namespace CppAD {
229 // functions that return references
230 template &lt;class Base&gt; const <a href="ad.xml" target="_top">AD</a>&lt;Base&gt;&amp; conj(const <a href="ad.xml" target="_top">AD</a>&lt;Base&gt;&amp; x)
231 { return x; }
232 template &lt;class Base&gt; const <a href="ad.xml" target="_top">AD</a>&lt;Base&gt;&amp; real(const <a href="ad.xml" target="_top">AD</a>&lt;Base&gt;&amp; x)
233 { return x; }
234
235 // functions that return values (note abs is defined by cppad.hpp)
236 template &lt;class Base&gt; <a href="ad.xml" target="_top">AD</a>&lt;Base&gt; imag(const <a href="ad.xml" target="_top">AD</a>&lt;Base&gt;&amp; x)
237 { return CppAD::<a href="ad.xml" target="_top">AD</a>&lt;Base&gt;(0.); }
238 template &lt;class Base&gt; <a href="ad.xml" target="_top">AD</a>&lt;Base&gt; abs2(const <a href="ad.xml" target="_top">AD</a>&lt;Base&gt;&amp; x)
239 { return x * x; }
225 // functions that return references
226 template &lt;class Base&gt; const <a href="ad.xml" target="_top">AD</a>&lt;Base&gt;&amp; conj(const <a href="ad.xml" target="_top">AD</a>&lt;Base&gt;&amp; x)
227 { return x; }
228 template &lt;class Base&gt; const <a href="ad.xml" target="_top">AD</a>&lt;Base&gt;&amp; real(const <a href="ad.xml" target="_top">AD</a>&lt;Base&gt;&amp; x)
229 { return x; }
230
231 // functions that return values (note abs is defined by cppad.hpp)
232 template &lt;class Base&gt; <a href="ad.xml" target="_top">AD</a>&lt;Base&gt; imag(const <a href="ad.xml" target="_top">AD</a>&lt;Base&gt;&amp; x)
233 { return CppAD::<a href="ad.xml" target="_top">AD</a>&lt;Base&gt;(0.); }
234 template &lt;class Base&gt; <a href="ad.xml" target="_top">AD</a>&lt;Base&gt; abs2(const <a href="ad.xml" target="_top">AD</a>&lt;Base&gt;&amp; x)
235 { return x * x; }
240236 }
241237
242238 namespace Eigen {
243 namespace internal {
244
245 template&lt;class Base&gt;
246 struct significant_decimals_default_impl&lt; CppAD::<a href="ad.xml" target="_top">AD</a>&lt;Base&gt;, false&gt;
247 { typedef CppAD::<a href="ad.xml" target="_top">AD</a>&lt;Base&gt; Scalar;
248
249 typedef typename NumTraits&lt;Scalar&gt;::Real RealScalar;
250 static inline int run()
251 { Scalar neg_log_eps = - log(
252 NumTraits&lt;RealScalar&gt;::epsilon()
253 );
254 int ceil_neg_log_eps = Integer( neg_log_eps );
255 if( Scalar(ceil_neg_log_eps) &lt; neg_log_eps )
256 ceil_neg_log_eps++;
257 return ceil_neg_log_eps;
258 }
259 };
260 }
239 namespace internal {
240
241 template&lt;class Base&gt;
242 struct significant_decimals_default_impl&lt; CppAD::<a href="ad.xml" target="_top">AD</a>&lt;Base&gt;, false&gt;
243 { typedef CppAD::<a href="ad.xml" target="_top">AD</a>&lt;Base&gt; Scalar;
244
245 typedef typename NumTraits&lt;Scalar&gt;::Real RealScalar;
246 static inline int run()
247 { Scalar neg_log_eps = - log(
248 NumTraits&lt;RealScalar&gt;::epsilon()
249 );
250 int ceil_neg_log_eps = Integer( neg_log_eps );
251 if( Scalar(ceil_neg_log_eps) &lt; neg_log_eps )
252 ceil_neg_log_eps++;
253 return ceil_neg_log_eps;
254 }
255 };
256 }
261257 }
262258 </pre></font></code>
263259
264
265260 <hr/>Input File: cppad/example/cppad_eigen.hpp
266261
267262 </body>
145145 </select>
146146 </td>
147147 </tr></table><br/>
148
149
150
151148 <center><b><big><big>Nonlinear Programming Using the CppAD Interface to Ipopt</big></big></b></center>
152149 <br/>
153150 <b><big><a name="Deprecated 2012-11-28" id="Deprecated 2012-11-28">Deprecated 2012-11-28</a></big></b>
9191 </select>
9292 </td>
9393 </tr></table><br/>
94
95
96
9794 <center><b><big><big>CppAD Speed, Matrix Multiplication</big></big></b></center>
9895 <br/>
9996 <b><big><a name="Specifications" id="Specifications">Specifications</a></big></b>
114111
115112 // Note that CppAD uses global_memory at the main program level
116113 extern bool
117 global_onetape, global_atomic, global_optimize, global_boolsparsity;
114 global_onetape, global_atomic, global_optimize, global_boolsparsity;
118115
119116 bool link_mat_mul(
120 size_t size ,
121 size_t repeat ,
122 CppAD::vector&lt;double&gt;&amp; x ,
123 CppAD::vector&lt;double&gt;&amp; z ,
124 CppAD::vector&lt;double&gt;&amp; dz
117 size_t size ,
118 size_t repeat ,
119 CppAD::vector&lt;double&gt;&amp; x ,
120 CppAD::vector&lt;double&gt;&amp; z ,
121 CppAD::vector&lt;double&gt;&amp; dz
125122 )
126123 {
127 // -----------------------------------------------------
128 // setup
129 typedef CppAD::<a href="ad.xml" target="_top">AD</a>&lt;double&gt; ADScalar;
130 typedef CppAD::vector&lt;ADScalar&gt; ADVector;
131
132 size_t j; // temporary index
133 size_t m = 1; // number of dependent variables
134 size_t n = size * size; // number of independent variables
135 ADVector X(n); // AD domain space vector
136 ADVector Y(n); // Store product matrix
137 ADVector Z(m); // AD range space vector
138 CppAD::<a href="funconstruct.xml" target="_top">ADFun</a>&lt;double&gt; f; // AD function object
139
140 // vectors of reverse mode weights
141 CppAD::vector&lt;double&gt; w(1);
142 w[0] = 1.;
143
144 // user atomic information
145 CppAD::vector&lt;ADScalar&gt; ax(2 * n), ay(n);
146 size_t nr_result = size;
147 size_t n_middle = size;
148 size_t nc_result = size;
149 matrix_mul atom_mul(nr_result, n_middle, nc_result);
150 //
151 if( global_boolsparsity )
152 atom_mul.option( CppAD::atomic_base&lt;double&gt;::pack_sparsity_enum );
153 else
154 atom_mul.option( CppAD::atomic_base&lt;double&gt;::set_sparsity_enum );
155 // ------------------------------------------------------
156 if( ! global_onetape ) while(repeat--)
157 { // get the next matrix
158 CppAD::uniform_01(n, x);
159 for( j = 0; j &lt; n; j++)
160 X[j] = x[j];
161
162 // declare independent variables
163 <a href="independent.xml" target="_top">Independent</a>(X);
164
165 // do computations
166 if( ! global_atomic )
167 mat_sum_sq(size, X, Y, Z);
168 else
169 { for(j = 0; j &lt; n; j++)
170 { ax[j] = X[j];
171 ax[j+n] = X[j];
172 }
173 // Y = X * X
174 atom_mul(ax, ay);
175 Z[0] = 0.;
176 for(j = 0; j &lt; n; j++)
177 Z[0] += ay[j];
178 }
179 // create function object f : X -&gt; Z
180 f.Dependent(X, Z);
181
182 if( global_optimize )
183 f.optimize();
184
185 // skip comparison operators
186 f.compare_change_count(0);
187
188 // evaluate and return gradient using reverse mode
189 z = f.<a href="forward.xml" target="_top">Forward</a>(0, x);
190 dz = f.<a href="reverse.xml" target="_top">Reverse</a>(1, w);
191 }
192 else
193 { // get a next matrix
194 CppAD::uniform_01(n, x);
195 for(j = 0; j &lt; n; j++)
196 X[j] = x[j];
197
198 // declare independent variables
199 <a href="independent.xml" target="_top">Independent</a>(X);
200
201 // do computations
202 if( ! global_atomic )
203 mat_sum_sq(size, X, Y, Z);
204 else
205 { for(j = 0; j &lt; n; j++)
206 { ax[j] = X[j];
207 ax[j+n] = X[j];
208 }
209 // Y = X * X
210 atom_mul(ax, ay);
211 Z[0] = 0.;
212 for(j = 0; j &lt; n; j++)
213 Z[0] += ay[j];
214 }
215
216 // create function object f : X -&gt; Z
217 f.Dependent(X, Z);
218
219 if( global_optimize )
220 f.optimize();
221
222 // skip comparison operators
223 f.compare_change_count(0);
224
225 while(repeat--)
226 { // get a next matrix
227 CppAD::uniform_01(n, x);
228
229 // evaluate and return gradient using reverse mode
230 z = f.<a href="forward.xml" target="_top">Forward</a>(0, x);
231 dz = f.<a href="reverse.xml" target="_top">Reverse</a>(1, w);
232 }
233 }
234 // --------------------------------------------------------------------
235 // Free temporary work space. (If there are future calls to
236 // mat_mul they would create new temporary work space.)
237 CppAD::user_atomic&lt;double&gt;::clear();
238
239 return true;
124 // -----------------------------------------------------
125 // setup
126 typedef CppAD::<a href="ad.xml" target="_top">AD</a>&lt;double&gt; ADScalar;
127 typedef CppAD::vector&lt;ADScalar&gt; ADVector;
128
129 size_t j; // temporary index
130 size_t m = 1; // number of dependent variables
131 size_t n = size * size; // number of independent variables
132 ADVector X(n); // AD domain space vector
133 ADVector Y(n); // Store product matrix
134 ADVector Z(m); // AD range space vector
135 CppAD::<a href="funconstruct.xml" target="_top">ADFun</a>&lt;double&gt; f; // AD function object
136
137 // vectors of reverse mode weights
138 CppAD::vector&lt;double&gt; w(1);
139 w[0] = 1.;
140
141 // user atomic information
142 CppAD::vector&lt;ADScalar&gt; ax(2 * n), ay(n);
143 size_t nr_result = size;
144 size_t n_middle = size;
145 size_t nc_result = size;
146 matrix_mul atom_mul(nr_result, n_middle, nc_result);
147 //
148 if( global_boolsparsity )
149 atom_mul.option( CppAD::atomic_base&lt;double&gt;::pack_sparsity_enum );
150 else
151 atom_mul.option( CppAD::atomic_base&lt;double&gt;::set_sparsity_enum );
152 // ------------------------------------------------------
153 if( ! global_onetape ) while(repeat--)
154 { // get the next matrix
155 CppAD::uniform_01(n, x);
156 for( j = 0; j &lt; n; j++)
157 X[j] = x[j];
158
159 // declare independent variables
160 <a href="independent.xml" target="_top">Independent</a>(X);
161
162 // do computations
163 if( ! global_atomic )
164 mat_sum_sq(size, X, Y, Z);
165 else
166 { for(j = 0; j &lt; n; j++)
167 { ax[j] = X[j];
168 ax[j+n] = X[j];
169 }
170 // Y = X * X
171 atom_mul(ax, ay);
172 Z[0] = 0.;
173 for(j = 0; j &lt; n; j++)
174 Z[0] += ay[j];
175 }
176 // create function object f : X -&gt; Z
177 f.Dependent(X, Z);
178
179 if( global_optimize )
180 f.optimize();
181
182 // skip comparison operators
183 f.compare_change_count(0);
184
185 // evaluate and return gradient using reverse mode
186 z = f.<a href="forward.xml" target="_top">Forward</a>(0, x);
187 dz = f.<a href="reverse.xml" target="_top">Reverse</a>(1, w);
188 }
189 else
190 { // get a next matrix
191 CppAD::uniform_01(n, x);
192 for(j = 0; j &lt; n; j++)
193 X[j] = x[j];
194
195 // declare independent variables
196 <a href="independent.xml" target="_top">Independent</a>(X);
197
198 // do computations
199 if( ! global_atomic )
200 mat_sum_sq(size, X, Y, Z);
201 else
202 { for(j = 0; j &lt; n; j++)
203 { ax[j] = X[j];
204 ax[j+n] = X[j];
205 }
206 // Y = X * X
207 atom_mul(ax, ay);
208 Z[0] = 0.;
209 for(j = 0; j &lt; n; j++)
210 Z[0] += ay[j];
211 }
212
213 // create function object f : X -&gt; Z
214 f.Dependent(X, Z);
215
216 if( global_optimize )
217 f.optimize();
218
219 // skip comparison operators
220 f.compare_change_count(0);
221
222 while(repeat--)
223 { // get a next matrix
224 CppAD::uniform_01(n, x);
225
226 // evaluate and return gradient using reverse mode
227 z = f.<a href="forward.xml" target="_top">Forward</a>(0, x);
228 dz = f.<a href="reverse.xml" target="_top">Reverse</a>(1, w);
229 }
230 }
231 // --------------------------------------------------------------------
232 // Free temporary work space. (If there are future calls to
233 // mat_mul they would create new temporary work space.)
234 CppAD::user_atomic&lt;double&gt;::clear();
235
236 return true;
240237 }
241238 </pre></font></code>
242239
243
244240 <hr/>Input File: speed/cppad/mat_mul.cpp
245241
246242 </body>
55 <title>CppAD Speed: Gradient of Ode Solution</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="CppAD Speed: Gradient of Ode Solution"/>
8 <meta name="keywords" id="keywords" content=" cppad speed: gradient of ode solution link_ode speed specifications implementation "/>
8 <meta name="keywords" id="keywords" content=" cppad speed: gradient ode solution link_ode speed specifications implementation "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
9191 </select>
9292 </td>
9393 </tr></table><br/>
94
95
96
9794 <center><b><big><big>CppAD Speed: Gradient of Ode Solution</big></big></b></center>
9895 <br/>
9996 <b><big><a name="Specifications" id="Specifications">Specifications</a></big></b>
114111
115112 // Note that CppAD uses global_memory at the main program level
116113 extern bool
117 global_onetape, global_atomic, global_optimize;
114 global_onetape, global_atomic, global_optimize;
118115
119116 bool link_ode(
120 size_t size ,
121 size_t repeat ,
122 CppAD::vector&lt;double&gt; &amp;x ,
123 CppAD::vector&lt;double&gt; &amp;jacobian
117 size_t size ,
118 size_t repeat ,
119 CppAD::vector&lt;double&gt; &amp;x ,
120 CppAD::vector&lt;double&gt; &amp;jacobian
124121 )
125122 {
126 // speed test global option values
127 if( global_atomic )
128 return false;
129
130 // --------------------------------------------------------------------
131 // setup
132 assert( x.size() == size );
133 assert( jacobian.size() == size * size );
134
135 typedef CppAD::<a href="ad.xml" target="_top">AD</a>&lt;double&gt; ADScalar;
136 typedef CppAD::vector&lt;ADScalar&gt; ADVector;
137
138 size_t j;
139 size_t p = 0; // use ode to calculate function values
140 size_t n = size; // number of independent variables
141 size_t m = n; // number of dependent variables
142 ADVector X(n), Y(m); // independent and dependent variables
143 CppAD::<a href="funconstruct.xml" target="_top">ADFun</a>&lt;double&gt; f; // AD function
144
145 // -------------------------------------------------------------
146 if( ! global_onetape ) while(repeat--)
147 { // choose next x value
148 uniform_01(n, x);
149 for(j = 0; j &lt; n; j++)
150 X[j] = x[j];
151
152 // declare the independent variable vector
153 <a href="independent.xml" target="_top">Independent</a>(X);
154
155 // evaluate function
156 CppAD::ode_evaluate(X, p, Y);
157
158 // create function object f : X -&gt; Y
159 f.Dependent(X, Y);
160
161 if( global_optimize )
162 f.optimize();
163
164 // skip comparison operators
165 f.compare_change_count(0);
166
167 jacobian = f.<a href="jacobian.xml" target="_top">Jacobian</a>(x);
168 }
169 else
170 { // an x value
171 uniform_01(n, x);
172 for(j = 0; j &lt; n; j++)
173 X[j] = x[j];
174
175 // declare the independent variable vector
176 <a href="independent.xml" target="_top">Independent</a>(X);
177
178 // evaluate function
179 CppAD::ode_evaluate(X, p, Y);
180
181 // create function object f : X -&gt; Y
182 f.Dependent(X, Y);
183
184 if( global_optimize )
185 f.optimize();
186
187 // skip comparison operators
188 f.compare_change_count(0);
189
190 while(repeat--)
191 { // get next argument value
192 uniform_01(n, x);
193
194 // evaluate jacobian
195 jacobian = f.<a href="jacobian.xml" target="_top">Jacobian</a>(x);
196 }
197 }
198 return true;
123 // speed test global option values
124 if( global_atomic )
125 return false;
126
127 // --------------------------------------------------------------------
128 // setup
129 assert( x.size() == size );
130 assert( jacobian.size() == size * size );
131
132 typedef CppAD::<a href="ad.xml" target="_top">AD</a>&lt;double&gt; ADScalar;
133 typedef CppAD::vector&lt;ADScalar&gt; ADVector;
134
135 size_t j;
136 size_t p = 0; // use ode to calculate function values
137 size_t n = size; // number of independent variables
138 size_t m = n; // number of dependent variables
139 ADVector X(n), Y(m); // independent and dependent variables
140 CppAD::<a href="funconstruct.xml" target="_top">ADFun</a>&lt;double&gt; f; // AD function
141
142 // -------------------------------------------------------------
143 if( ! global_onetape ) while(repeat--)
144 { // choose next x value
145 uniform_01(n, x);
146 for(j = 0; j &lt; n; j++)
147 X[j] = x[j];
148
149 // declare the independent variable vector
150 <a href="independent.xml" target="_top">Independent</a>(X);
151
152 // evaluate function
153 CppAD::ode_evaluate(X, p, Y);
154
155 // create function object f : X -&gt; Y
156 f.Dependent(X, Y);
157
158 if( global_optimize )
159 f.optimize();
160
161 // skip comparison operators
162 f.compare_change_count(0);
163
164 jacobian = f.<a href="jacobian.xml" target="_top">Jacobian</a>(x);
165 }
166 else
167 { // an x value
168 uniform_01(n, x);
169 for(j = 0; j &lt; n; j++)
170 X[j] = x[j];
171
172 // declare the independent variable vector
173 <a href="independent.xml" target="_top">Independent</a>(X);
174
175 // evaluate function
176 CppAD::ode_evaluate(X, p, Y);
177
178 // create function object f : X -&gt; Y
179 f.Dependent(X, Y);
180
181 if( global_optimize )
182 f.optimize();
183
184 // skip comparison operators
185 f.compare_change_count(0);
186
187 while(repeat--)
188 { // get next argument value
189 uniform_01(n, x);
190
191 // evaluate jacobian
192 jacobian = f.<a href="jacobian.xml" target="_top">Jacobian</a>(x);
193 }
194 }
195 return true;
199196 }
200197 </pre></font></code>
201198
202
203199 <hr/>Input File: speed/cppad/ode.cpp
204200
205201 </body>
55 <title>CppAD Speed: Second Derivative of a Polynomial</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="CppAD Speed: Second Derivative of a Polynomial"/>
8 <meta name="keywords" id="keywords" content=" cppad speed: second derivative of a polynomial link_poly speed specifications implementation "/>
8 <meta name="keywords" id="keywords" content=" cppad speed: second derivative polynomial link_poly speed specifications implementation "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
9191 </select>
9292 </td>
9393 </tr></table><br/>
94
95
96
9794 <center><b><big><big>CppAD Speed: Second Derivative of a Polynomial</big></big></b></center>
9895 <br/>
9996 <b><big><a name="Specifications" id="Specifications">Specifications</a></big></b>
112109
113110 // Note that CppAD uses global_memory at the main program level
114111 extern bool
115 global_onetape, global_atomic, global_optimize;
112 global_onetape, global_atomic, global_optimize;
116113
117114 bool link_poly(
118 size_t size ,
119 size_t repeat ,
120 CppAD::vector&lt;double&gt; &amp;a , // coefficients of polynomial
121 CppAD::vector&lt;double&gt; &amp;z , // polynomial argument value
122 CppAD::vector&lt;double&gt; &amp;ddp ) // second derivative w.r.t z
115 size_t size ,
116 size_t repeat ,
117 CppAD::vector&lt;double&gt; &amp;a , // coefficients of polynomial
118 CppAD::vector&lt;double&gt; &amp;z , // polynomial argument value
119 CppAD::vector&lt;double&gt; &amp;ddp ) // second derivative w.r.t z
123120 {
124 // speed test global option values
125 if( global_atomic )
126 return false;
127
128 // -----------------------------------------------------
129 // setup
130 typedef CppAD::<a href="ad.xml" target="_top">AD</a>&lt;double&gt; ADScalar;
131 typedef CppAD::vector&lt;ADScalar&gt; ADVector;
132
133 size_t i; // temporary index
134 size_t m = 1; // number of dependent variables
135 size_t n = 1; // number of independent variables
136 ADVector Z(n); // AD domain space vector
137 ADVector P(m); // AD range space vector
138
139 // choose the polynomial coefficients
140 CppAD::uniform_01(size, a);
141
142 // AD copy of the polynomial coefficients
143 ADVector A(size);
144 for(i = 0; i &lt; size; i++)
145 A[i] = a[i];
146
147 // forward mode first and second differentials
148 CppAD::vector&lt;double&gt; p(1), dp(1), dz(1), ddz(1);
149 dz[0] = 1.;
150 ddz[0] = 0.;
151
152 // AD function object
153 CppAD::<a href="funconstruct.xml" target="_top">ADFun</a>&lt;double&gt; f;
154
155 // --------------------------------------------------------------------
156 if( ! global_onetape ) while(repeat--)
157 {
158 // choose an argument value
159 CppAD::uniform_01(1, z);
160 Z[0] = z[0];
161
162 // declare independent variables
163 <a href="independent.xml" target="_top">Independent</a>(Z);
164
165 // AD computation of the function value
166 P[0] = CppAD::Poly(0, A, Z[0]);
167
168 // create function object f : A -&gt; detA
169 f.Dependent(Z, P);
170
171 if( global_optimize )
172 f.optimize();
173
174 // skip comparison operators
175 f.compare_change_count(0);
176
177 // pre-allocate memory for three forward mode calculations
178 f.capacity_order(3);
179
180 // evaluate the polynomial
181 p = f.<a href="forward.xml" target="_top">Forward</a>(0, z);
182
183 // evaluate first order Taylor coefficient
184 dp = f.<a href="forward.xml" target="_top">Forward</a>(1, dz);
185
186 // second derivative is twice second order Taylor coef
187 ddp = f.<a href="forward.xml" target="_top">Forward</a>(2, ddz);
188 ddp[0] *= 2.;
189 }
190 else
191 {
192 // choose an argument value
193 CppAD::uniform_01(1, z);
194 Z[0] = z[0];
195
196 // declare independent variables
197 <a href="independent.xml" target="_top">Independent</a>(Z);
198
199 // AD computation of the function value
200 P[0] = CppAD::Poly(0, A, Z[0]);
201
202 // create function object f : A -&gt; detA
203 f.Dependent(Z, P);
204
205 if( global_optimize )
206 f.optimize();
207
208 // skip comparison operators
209 f.compare_change_count(0);
210
211 while(repeat--)
212 { // sufficient memory is allocated by second repetition
213
214 // get the next argument value
215 CppAD::uniform_01(1, z);
216
217 // evaluate the polynomial at the new argument value
218 p = f.<a href="forward.xml" target="_top">Forward</a>(0, z);
219
220 // evaluate first order Taylor coefficient
221 dp = f.<a href="forward.xml" target="_top">Forward</a>(1, dz);
222
223 // second derivative is twice second order Taylor coef
224 ddp = f.<a href="forward.xml" target="_top">Forward</a>(2, ddz);
225 ddp[0] *= 2.;
226 }
227 }
228 return true;
121 // speed test global option values
122 if( global_atomic )
123 return false;
124
125 // -----------------------------------------------------
126 // setup
127 typedef CppAD::<a href="ad.xml" target="_top">AD</a>&lt;double&gt; ADScalar;
128 typedef CppAD::vector&lt;ADScalar&gt; ADVector;
129
130 size_t i; // temporary index
131 size_t m = 1; // number of dependent variables
132 size_t n = 1; // number of independent variables
133 ADVector Z(n); // AD domain space vector
134 ADVector P(m); // AD range space vector
135
136 // choose the polynomial coefficients
137 CppAD::uniform_01(size, a);
138
139 // AD copy of the polynomial coefficients
140 ADVector A(size);
141 for(i = 0; i &lt; size; i++)
142 A[i] = a[i];
143
144 // forward mode first and second differentials
145 CppAD::vector&lt;double&gt; p(1), dp(1), dz(1), ddz(1);
146 dz[0] = 1.;
147 ddz[0] = 0.;
148
149 // AD function object
150 CppAD::<a href="funconstruct.xml" target="_top">ADFun</a>&lt;double&gt; f;
151
152 // --------------------------------------------------------------------
153 if( ! global_onetape ) while(repeat--)
154 {
155 // choose an argument value
156 CppAD::uniform_01(1, z);
157 Z[0] = z[0];
158
159 // declare independent variables
160 <a href="independent.xml" target="_top">Independent</a>(Z);
161
162 // AD computation of the function value
163 P[0] = CppAD::Poly(0, A, Z[0]);
164
165 // create function object f : A -&gt; detA
166 f.Dependent(Z, P);
167
168 if( global_optimize )
169 f.optimize();
170
171 // skip comparison operators
172 f.compare_change_count(0);
173
174 // pre-allocate memory for three forward mode calculations
175 f.capacity_order(3);
176
177 // evaluate the polynomial
178 p = f.<a href="forward.xml" target="_top">Forward</a>(0, z);
179
180 // evaluate first order Taylor coefficient
181 dp = f.<a href="forward.xml" target="_top">Forward</a>(1, dz);
182
183 // second derivative is twice second order Taylor coef
184 ddp = f.<a href="forward.xml" target="_top">Forward</a>(2, ddz);
185 ddp[0] *= 2.;
186 }
187 else
188 {
189 // choose an argument value
190 CppAD::uniform_01(1, z);
191 Z[0] = z[0];
192
193 // declare independent variables
194 <a href="independent.xml" target="_top">Independent</a>(Z);
195
196 // AD computation of the function value
197 P[0] = CppAD::Poly(0, A, Z[0]);
198
199 // create function object f : A -&gt; detA
200 f.Dependent(Z, P);
201
202 if( global_optimize )
203 f.optimize();
204
205 // skip comparison operators
206 f.compare_change_count(0);
207
208 while(repeat--)
209 { // sufficient memory is allocated by second repetition
210
211 // get the next argument value
212 CppAD::uniform_01(1, z);
213
214 // evaluate the polynomial at the new argument value
215 p = f.<a href="forward.xml" target="_top">Forward</a>(0, z);
216
217 // evaluate first order Taylor coefficient
218 dp = f.<a href="forward.xml" target="_top">Forward</a>(1, dz);
219
220 // second derivative is twice second order Taylor coef
221 ddp = f.<a href="forward.xml" target="_top">Forward</a>(2, ddz);
222 ddp[0] *= 2.;
223 }
224 }
225 return true;
229226 }
230227 </pre></font></code>
231228
232
233229 <hr/>Input File: speed/cppad/poly.cpp
234230
235231 </body>
9191 </select>
9292 </td>
9393 </tr></table><br/>
94
95
96
9794 <center><b><big><big>CppAD Speed: Sparse Hessian</big></big></b></center>
9895 <br/>
9996 <b><big><a name="Specifications" id="Specifications">Specifications</a></big></b>
113110
114111 // Note that CppAD uses global_memory at the main program level
115112 extern bool
116 global_onetape, global_colpack,
117 global_atomic, global_optimize, global_boolsparsity;
113 global_onetape, global_colpack,
114 global_atomic, global_optimize, global_boolsparsity;
118115
119116 namespace {
120 using CppAD::vector;
121 typedef vector&lt; std::set&lt;size_t&gt; &gt; SetVector;
122 typedef vector&lt;bool&gt; BoolVector;
123
124 void calc_sparsity(SetVector&amp; sparsity_set, CppAD::<a href="funconstruct.xml" target="_top">ADFun</a>&lt;double&gt;&amp; f)
125 { size_t n = f.Domain();
126 size_t m = f.Range();
127 CPPAD_ASSERT_UNKNOWN( m == 1 );
128 SetVector r_set(n);
129 for(size_t i = 0; i &lt; n; i++)
130 r_set[i].insert(i);
131 f.ForSparseJac(n, r_set);
132 //
133 SetVector s_set(m);
134 s_set[0].insert(0);
135 //
136 sparsity_set = f.RevSparseHes(n, s_set);
137 }
138 void calc_sparsity(BoolVector&amp; sparsity_bool, CppAD::<a href="funconstruct.xml" target="_top">ADFun</a>&lt;double&gt;&amp; f)
139 { size_t n = f.Domain();
140 size_t m = f.Range();
141 CPPAD_ASSERT_UNKNOWN( m == 1 );
142 BoolVector r_bool(n * n);
143 size_t i, j;
144 for(i = 0; i &lt; n; i++)
145 { for(j = 0; j &lt; n; j++)
146 r_bool[ i * n + j] = false;
147 r_bool[ i * n + i] = true;
148 }
149 f.ForSparseJac(n, r_bool);
150 //
151 BoolVector s_bool(m);
152 s_bool[0] = true;
153 //
154 sparsity_bool = f.RevSparseHes(n, s_bool);
155 }
117 using CppAD::vector;
118 typedef vector&lt; std::set&lt;size_t&gt; &gt; SetVector;
119 typedef vector&lt;bool&gt; BoolVector;
120
121 void calc_sparsity(SetVector&amp; sparsity_set, CppAD::<a href="funconstruct.xml" target="_top">ADFun</a>&lt;double&gt;&amp; f)
122 { size_t n = f.Domain();
123 size_t m = f.Range();
124 CPPAD_ASSERT_UNKNOWN( m == 1 );
125 SetVector r_set(n);
126 for(size_t i = 0; i &lt; n; i++)
127 r_set[i].insert(i);
128 f.ForSparseJac(n, r_set);
129 //
130 SetVector s_set(m);
131 s_set[0].insert(0);
132 //
133 sparsity_set = f.RevSparseHes(n, s_set);
134 }
135 void calc_sparsity(BoolVector&amp; sparsity_bool, CppAD::<a href="funconstruct.xml" target="_top">ADFun</a>&lt;double&gt;&amp; f)
136 { size_t n = f.Domain();
137 size_t m = f.Range();
138 CPPAD_ASSERT_UNKNOWN( m == 1 );
139 BoolVector r_bool(n * n);
140 size_t i, j;
141 for(i = 0; i &lt; n; i++)
142 { for(j = 0; j &lt; n; j++)
143 r_bool[ i * n + j] = false;
144 r_bool[ i * n + i] = true;
145 }
146 f.ForSparseJac(n, r_bool);
147 //
148 BoolVector s_bool(m);
149 s_bool[0] = true;
150 //
151 sparsity_bool = f.RevSparseHes(n, s_bool);
152 }
156153
157154 }
158155
159156 bool link_sparse_hessian(
160 size_t size ,
161 size_t repeat ,
162 const CppAD::vector&lt;size_t&gt;&amp; row ,
163 const CppAD::vector&lt;size_t&gt;&amp; col ,
164 CppAD::vector&lt;double&gt;&amp; x ,
165 CppAD::vector&lt;double&gt;&amp; hessian ,
166 size_t&amp; n_sweep )
157 size_t size ,
158 size_t repeat ,
159 const CppAD::vector&lt;size_t&gt;&amp; row ,
160 const CppAD::vector&lt;size_t&gt;&amp; col ,
161 CppAD::vector&lt;double&gt;&amp; x ,
162 CppAD::vector&lt;double&gt;&amp; hessian ,
163 size_t&amp; n_sweep )
167164 {
168 if( global_atomic )
169 return false;
165 if( global_atomic )
166 return false;
170167 # ifndef CPPAD_COLPACK_SPEED
171 if( global_colpack )
172 return false;
168 if( global_colpack )
169 return false;
173170 # endif
174 // -----------------------------------------------------
175 // setup
176 typedef vector&lt;double&gt; DblVector;
177 typedef vector&lt; std::set&lt;size_t&gt; &gt; SetVector;
178 typedef CppAD::<a href="ad.xml" target="_top">AD</a>&lt;double&gt; ADScalar;
179 typedef vector&lt;ADScalar&gt; ADVector;
180
181 size_t j;
182 size_t order = 0; // derivative order corresponding to function
183 size_t m = 1; // number of dependent variables
184 size_t n = size; // number of independent variables
185 ADVector a_x(n); // AD domain space vector
186 ADVector a_y(m); // AD range space vector
187 DblVector w(m); // double range space vector
188 CppAD::<a href="funconstruct.xml" target="_top">ADFun</a>&lt;double&gt; f; // AD function object
189
190 // weights for hessian calculation (only one component of f)
191 w[0] = 1.;
192
193 // declare sparsity pattern
194 SetVector set_sparsity(n);
195 BoolVector bool_sparsity(n * n);
196
197 // ------------------------------------------------------
198 if( ! global_onetape ) while(repeat--)
199 { // choose a value for x
200 CppAD::uniform_01(n, x);
201 for(j = 0; j &lt; n; j++)
202 a_x[j] = x[j];
203
204 // declare independent variables
205 <a href="independent.xml" target="_top">Independent</a>(a_x);
206
207 // AD computation of f(x)
208 CppAD::sparse_hes_fun&lt;ADScalar&gt;(n, a_x, row, col, order, a_y);
209
210 // create function object f : X -&gt; Y
211 f.Dependent(a_x, a_y);
212
213 if( global_optimize )
214 f.optimize();
215
216 // skip comparison operators
217 f.compare_change_count(0);
218
219 // calculate the Hessian sparsity pattern for this function
220 if( global_boolsparsity )
221 calc_sparsity(bool_sparsity, f);
222 else
223 calc_sparsity(set_sparsity, f);
224
225 // structure that holds some of work done by SparseHessian
226 CppAD::sparse_hessian_work work;
171 // -----------------------------------------------------
172 // setup
173 typedef vector&lt;double&gt; DblVector;
174 typedef vector&lt; std::set&lt;size_t&gt; &gt; SetVector;
175 typedef CppAD::<a href="ad.xml" target="_top">AD</a>&lt;double&gt; ADScalar;
176 typedef vector&lt;ADScalar&gt; ADVector;
177
178 size_t j;
179 size_t order = 0; // derivative order corresponding to function
180 size_t m = 1; // number of dependent variables
181 size_t n = size; // number of independent variables
182 ADVector a_x(n); // AD domain space vector
183 ADVector a_y(m); // AD range space vector
184 DblVector w(m); // double range space vector
185 CppAD::<a href="funconstruct.xml" target="_top">ADFun</a>&lt;double&gt; f; // AD function object
186
187 // weights for hessian calculation (only one component of f)
188 w[0] = 1.;
189
190 // declare sparsity pattern
191 SetVector set_sparsity(n);
192 BoolVector bool_sparsity(n * n);
193
194 // ------------------------------------------------------
195 if( ! global_onetape ) while(repeat--)
196 { // choose a value for x
197 CppAD::uniform_01(n, x);
198 for(j = 0; j &lt; n; j++)
199 a_x[j] = x[j];
200
201 // declare independent variables
202 <a href="independent.xml" target="_top">Independent</a>(a_x);
203
204 // AD computation of f(x)
205 CppAD::sparse_hes_fun&lt;ADScalar&gt;(n, a_x, row, col, order, a_y);
206
207 // create function object f : X -&gt; Y
208 f.Dependent(a_x, a_y);
209
210 if( global_optimize )
211 f.optimize();
212
213 // skip comparison operators
214 f.compare_change_count(0);
215
216 // calculate the Hessian sparsity pattern for this function
217 if( global_boolsparsity )
218 calc_sparsity(bool_sparsity, f);
219 else
220 calc_sparsity(set_sparsity, f);
221
222 // structure that holds some of work done by SparseHessian
223 CppAD::sparse_hessian_work work;
227224 # ifdef CPPAD_COLPACK_SPEED
228 if( global_colpack )
229 work.color_method = &quot;colpack.star&quot;;
225 if( global_colpack )
226 work.color_method = &quot;colpack.star&quot;;
230227 # endif
231 // calculate this Hessian at this x
232 if( global_boolsparsity) n_sweep = f.SparseHessian(
233 x, w, bool_sparsity, row, col, hessian, work
234 );
235 else n_sweep = f.SparseHessian(
236 x, w, set_sparsity, row, col, hessian, work
237 );
238 }
239 else
240 { // choose a value for x
241 CppAD::uniform_01(n, x);
242 for(j = 0; j &lt; n; j++)
243 a_x[j] = x[j];
244
245 // declare independent variables
246 <a href="independent.xml" target="_top">Independent</a>(a_x);
247
248 // AD computation of f(x)
249 CppAD::sparse_hes_fun&lt;ADScalar&gt;(n, a_x, row, col, order, a_y);
250
251 // create function object f : X -&gt; Y
252 f.Dependent(a_x, a_y);
253
254 if( global_optimize )
255 f.optimize();
256
257 // skip comparison operators
258 f.compare_change_count(0);
259
260 // calculate the Hessian sparsity pattern for this function
261 if( global_boolsparsity)
262 calc_sparsity(bool_sparsity, f);
263 else
264 calc_sparsity(set_sparsity, f);
265
266 // declare structure that holds some of work done by SparseHessian
267 CppAD::sparse_hessian_work work;
228 // calculate this Hessian at this x
229 if( global_boolsparsity) n_sweep = f.SparseHessian(
230 x, w, bool_sparsity, row, col, hessian, work
231 );
232 else n_sweep = f.SparseHessian(
233 x, w, set_sparsity, row, col, hessian, work
234 );
235 }
236 else
237 { // choose a value for x
238 CppAD::uniform_01(n, x);
239 for(j = 0; j &lt; n; j++)
240 a_x[j] = x[j];
241
242 // declare independent variables
243 <a href="independent.xml" target="_top">Independent</a>(a_x);
244
245 // AD computation of f(x)
246 CppAD::sparse_hes_fun&lt;ADScalar&gt;(n, a_x, row, col, order, a_y);
247
248 // create function object f : X -&gt; Y
249 f.Dependent(a_x, a_y);
250
251 if( global_optimize )
252 f.optimize();
253
254 // skip comparison operators
255 f.compare_change_count(0);
256
257 // calculate the Hessian sparsity pattern for this function
258 if( global_boolsparsity)
259 calc_sparsity(bool_sparsity, f);
260 else
261 calc_sparsity(set_sparsity, f);
262
263 // declare structure that holds some of work done by SparseHessian
264 CppAD::sparse_hessian_work work;
268265 # ifdef CPPAD_COLPACK_SPEED
269 if( global_colpack )
270 work.color_method = &quot;colpack.star&quot;;
266 if( global_colpack )
267 work.color_method = &quot;colpack.star&quot;;
271268 # endif
272 while(repeat--)
273 { // choose a value for x
274 CppAD::uniform_01(n, x);
275
276 // calculate hessian at this x
277 if( global_boolsparsity ) n_sweep = f.SparseHessian(
278 x, w, bool_sparsity, row, col, hessian, work
279 );
280 else n_sweep = f.SparseHessian(
281 x, w, set_sparsity, row, col, hessian, work
282 );
283 }
284 }
285 return true;
269 while(repeat--)
270 { // choose a value for x
271 CppAD::uniform_01(n, x);
272
273 // calculate hessian at this x
274 if( global_boolsparsity ) n_sweep = f.SparseHessian(
275 x, w, bool_sparsity, row, col, hessian, work
276 );
277 else n_sweep = f.SparseHessian(
278 x, w, set_sparsity, row, col, hessian, work
279 );
280 }
281 }
282 return true;
286283 }
287284 </pre></font></code>
288285
289
290286 <hr/>Input File: speed/cppad/sparse_hessian.cpp
291287
292288 </body>
9191 </select>
9292 </td>
9393 </tr></table><br/>
94
95
96
9794 <center><b><big><big>CppAD Speed: Sparse Jacobian</big></big></b></center>
9895 <br/>
9996 <b><big><a name="Specifications" id="Specifications">Specifications</a></big></b>
113110
114111 // Note that CppAD uses global_memory at the main program level
115112 extern bool
116 global_onetape, global_colpack,
117 global_atomic, global_optimize, global_boolsparsity;
113 global_onetape, global_colpack,
114 global_atomic, global_optimize, global_boolsparsity;
118115
119116 namespace {
120 using CppAD::vector;
121 typedef vector&lt; std::set&lt;size_t&gt; &gt; SetVector;
122 typedef vector&lt;bool&gt; BoolVector;
123
124 void calc_sparsity(SetVector&amp; sparsity_set, CppAD::<a href="funconstruct.xml" target="_top">ADFun</a>&lt;double&gt;&amp; f)
125 { size_t n = f.Domain();
126 SetVector r_set(n);
127 for(size_t j = 0; j &lt; n; j++)
128 r_set[j].insert(j);
129 sparsity_set = f.ForSparseJac(n, r_set);
130 }
131 void calc_sparsity(BoolVector&amp; sparsity_bool, CppAD::<a href="funconstruct.xml" target="_top">ADFun</a>&lt;double&gt;&amp; f)
132 { size_t n = f.Domain();
133 BoolVector r_bool(n * n);
134 size_t i, j;
135 for(i = 0; i &lt; n; i++)
136 { for(j = 0; j &lt; n; j++)
137 r_bool[ i * n + j] = false;
138 r_bool[ i * n + i] = true;
139 }
140 sparsity_bool = f.ForSparseJac(n, r_bool);
141 }
117 using CppAD::vector;
118 typedef vector&lt; std::set&lt;size_t&gt; &gt; SetVector;
119 typedef vector&lt;bool&gt; BoolVector;
120
121 void calc_sparsity(SetVector&amp; sparsity_set, CppAD::<a href="funconstruct.xml" target="_top">ADFun</a>&lt;double&gt;&amp; f)
122 { size_t n = f.Domain();
123 SetVector r_set(n);
124 for(size_t j = 0; j &lt; n; j++)
125 r_set[j].insert(j);
126 sparsity_set = f.ForSparseJac(n, r_set);
127 }
128 void calc_sparsity(BoolVector&amp; sparsity_bool, CppAD::<a href="funconstruct.xml" target="_top">ADFun</a>&lt;double&gt;&amp; f)
129 { size_t n = f.Domain();
130 BoolVector r_bool(n * n);
131 size_t i, j;
132 for(i = 0; i &lt; n; i++)
133 { for(j = 0; j &lt; n; j++)
134 r_bool[ i * n + j] = false;
135 r_bool[ i * n + i] = true;
136 }
137 sparsity_bool = f.ForSparseJac(n, r_bool);
138 }
142139
143140 }
144141
145142 bool link_sparse_jacobian(
146 size_t size ,
147 size_t repeat ,
148 size_t m ,
149 const CppAD::vector&lt;size_t&gt;&amp; row ,
150 const CppAD::vector&lt;size_t&gt;&amp; col ,
151 CppAD::vector&lt;double&gt;&amp; x ,
152 CppAD::vector&lt;double&gt;&amp; jacobian ,
153 size_t&amp; n_sweep )
143 size_t size ,
144 size_t repeat ,
145 size_t m ,
146 const CppAD::vector&lt;size_t&gt;&amp; row ,
147 const CppAD::vector&lt;size_t&gt;&amp; col ,
148 CppAD::vector&lt;double&gt;&amp; x ,
149 CppAD::vector&lt;double&gt;&amp; jacobian ,
150 size_t&amp; n_sweep )
154151 {
155 if( global_atomic )
156 return false;
152 if( global_atomic )
153 return false;
157154 # ifndef CPPAD_COLPACK_SPEED
158 if( global_colpack )
159 return false;
155 if( global_colpack )
156 return false;
160157 # endif
161 // -----------------------------------------------------
162 // setup
163 typedef vector&lt; std::set&lt;size_t&gt; &gt; SetVector;
164 typedef CppAD::<a href="ad.xml" target="_top">AD</a>&lt;double&gt; ADScalar;
165 typedef CppAD::vector&lt;ADScalar&gt; ADVector;
166
167 size_t j;
168 size_t order = 0; // derivative order corresponding to function
169 size_t n = size; // number of independent variables
170 ADVector a_x(n); // AD domain space vector
171 ADVector a_y(m); // AD range space vector y = g(x)
172 CppAD::<a href="funconstruct.xml" target="_top">ADFun</a>&lt;double&gt; f; // AD function object
173
174 // declare sparsity pattern
175 SetVector set_sparsity(m);
176 BoolVector bool_sparsity(m * n);
177
178 // ------------------------------------------------------
179 if( ! global_onetape ) while(repeat--)
180 { // choose a value for x
181 CppAD::uniform_01(n, x);
182 for(j = 0; j &lt; n; j++)
183 a_x[j] = x[j];
184
185 // declare independent variables
186 <a href="independent.xml" target="_top">Independent</a>(a_x);
187
188 // AD computation of f (x)
189 CppAD::sparse_jac_fun&lt;ADScalar&gt;(m, n, a_x, row, col, order, a_y);
190
191 // create function object f : X -&gt; Y
192 f.Dependent(a_x, a_y);
193
194 if( global_optimize )
195 f.optimize();
196
197 // skip comparison operators
198 f.compare_change_count(0);
199
200 // calculate the Jacobian sparsity pattern for this function
201 if( global_boolsparsity )
202 calc_sparsity(bool_sparsity, f);
203 else
204 calc_sparsity(set_sparsity, f);
205
206 // structure that holds some of the work done by SparseJacobian
207 CppAD::sparse_jacobian_work work;
158 // -----------------------------------------------------
159 // setup
160 typedef vector&lt; std::set&lt;size_t&gt; &gt; SetVector;
161 typedef CppAD::<a href="ad.xml" target="_top">AD</a>&lt;double&gt; ADScalar;
162 typedef CppAD::vector&lt;ADScalar&gt; ADVector;
163
164 size_t j;
165 size_t order = 0; // derivative order corresponding to function
166 size_t n = size; // number of independent variables
167 ADVector a_x(n); // AD domain space vector
168 ADVector a_y(m); // AD range space vector y = g(x)
169 CppAD::<a href="funconstruct.xml" target="_top">ADFun</a>&lt;double&gt; f; // AD function object
170
171 // declare sparsity pattern
172 SetVector set_sparsity(m);
173 BoolVector bool_sparsity(m * n);
174
175 // ------------------------------------------------------
176 if( ! global_onetape ) while(repeat--)
177 { // choose a value for x
178 CppAD::uniform_01(n, x);
179 for(j = 0; j &lt; n; j++)
180 a_x[j] = x[j];
181
182 // declare independent variables
183 <a href="independent.xml" target="_top">Independent</a>(a_x);
184
185 // AD computation of f (x)
186 CppAD::sparse_jac_fun&lt;ADScalar&gt;(m, n, a_x, row, col, order, a_y);
187
188 // create function object f : X -&gt; Y
189 f.Dependent(a_x, a_y);
190
191 if( global_optimize )
192 f.optimize();
193
194 // skip comparison operators
195 f.compare_change_count(0);
196
197 // calculate the Jacobian sparsity pattern for this function
198 if( global_boolsparsity )
199 calc_sparsity(bool_sparsity, f);
200 else
201 calc_sparsity(set_sparsity, f);
202
203 // structure that holds some of the work done by SparseJacobian
204 CppAD::sparse_jacobian_work work;
208205 # ifdef CPPAD_COLPACK_SPEED
209 if( global_colpack )
210 work.color_method = &quot;colpack&quot;;
206 if( global_colpack )
207 work.color_method = &quot;colpack&quot;;
211208 # endif
212 // calculate the Jacobian at this x
213 // (use forward mode because m &gt; n ?)
214 if( global_boolsparsity) n_sweep = f.SparseJacobianForward(
215 x, bool_sparsity, row, col, jacobian, work
216 );
217 else n_sweep = f.SparseJacobianForward(
218 x, set_sparsity, row, col, jacobian, work
219 );
220 }
221 else
222 { // choose a value for x
223 CppAD::uniform_01(n, x);
224 for(j = 0; j &lt; n; j++)
225 a_x[j] = x[j];
226
227 // declare independent variables
228 <a href="independent.xml" target="_top">Independent</a>(a_x);
229
230 // AD computation of f (x)
231 CppAD::sparse_jac_fun&lt;ADScalar&gt;(m, n, a_x, row, col, order, a_y);
232
233 // create function object f : X -&gt; Y
234 f.Dependent(a_x, a_y);
235
236 if( global_optimize )
237 f.optimize();
238
239 // skip comparison operators
240 f.compare_change_count(0);
241
242 // calculate the Jacobian sparsity pattern for this function
243 if( global_boolsparsity )
244 calc_sparsity(bool_sparsity, f);
245 else
246 calc_sparsity(set_sparsity, f);
247
248 // structure that holds some of the work done by SparseJacobian
249 CppAD::sparse_jacobian_work work;
209 // calculate the Jacobian at this x
210 // (use forward mode because m &gt; n ?)
211 if( global_boolsparsity) n_sweep = f.SparseJacobianForward(
212 x, bool_sparsity, row, col, jacobian, work
213 );
214 else n_sweep = f.SparseJacobianForward(
215 x, set_sparsity, row, col, jacobian, work
216 );
217 }
218 else
219 { // choose a value for x
220 CppAD::uniform_01(n, x);
221 for(j = 0; j &lt; n; j++)
222 a_x[j] = x[j];
223
224 // declare independent variables
225 <a href="independent.xml" target="_top">Independent</a>(a_x);
226
227 // AD computation of f (x)
228 CppAD::sparse_jac_fun&lt;ADScalar&gt;(m, n, a_x, row, col, order, a_y);
229
230 // create function object f : X -&gt; Y
231 f.Dependent(a_x, a_y);
232
233 if( global_optimize )
234 f.optimize();
235
236 // skip comparison operators
237 f.compare_change_count(0);
238
239 // calculate the Jacobian sparsity pattern for this function
240 if( global_boolsparsity )
241 calc_sparsity(bool_sparsity, f);
242 else
243 calc_sparsity(set_sparsity, f);
244
245 // structure that holds some of the work done by SparseJacobian
246 CppAD::sparse_jacobian_work work;
250247 # ifdef CPPAD_COLPACK_SPEED
251 if( global_colpack )
252 work.color_method = &quot;colpack&quot;;
248 if( global_colpack )
249 work.color_method = &quot;colpack&quot;;
253250 # endif
254 while(repeat--)
255 { // choose a value for x
256 CppAD::uniform_01(n, x);
257
258 // calculate the Jacobian at this x
259 // (use forward mode because m &gt; n ?)
260 if( global_boolsparsity ) n_sweep = f.SparseJacobianForward(
261 x, bool_sparsity, row, col, jacobian, work
262 );
263 else n_sweep = f.SparseJacobianForward(
264 x, set_sparsity, row, col, jacobian, work
265 );
266 }
267 }
268 return true;
251 while(repeat--)
252 { // choose a value for x
253 CppAD::uniform_01(n, x);
254
255 // calculate the Jacobian at this x
256 // (use forward mode because m &gt; n ?)
257 if( global_boolsparsity ) n_sweep = f.SparseJacobianForward(
258 x, bool_sparsity, row, col, jacobian, work
259 );
260 else n_sweep = f.SparseJacobianForward(
261 x, set_sparsity, row, col, jacobian, work
262 );
263 }
264 }
265 return true;
269266 }
270267 </pre></font></code>
271268
272
273269 <hr/>Input File: speed/cppad/sparse_jacobian.cpp
274270
275271 </body>
55 <title>CppAD::vector Template Class: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="CppAD::vector Template Class: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" cppad::vector template class: example and test vector Cppad "/>
8 <meta name="keywords" id="keywords" content=" cppad::vector template class: example test vector Cppad "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
9797 <td>cppad_vector.cpp</td>
9898 <td>Headings</td>
9999 </tr></table><br/>
100
101
102
103100 <center><b><big><big>CppAD::vector Template Class: Example and Test</big></big></b></center>
104101 <code><font color="blue"><pre style='display:inline'>
105102
55 <title>The CppAD::vector Template Class</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="The CppAD::vector Template Class"/>
8 <meta name="keywords" id="keywords" content=" the cppad::vector template class vector Cppad [] push thread_alloc syntax description include capacity assignment check size return reference move semantics element access push_back push_vector output resize clear data vectorbool memory bit_per_unit type and parallel mode example exercise "/>
8 <meta name="keywords" id="keywords" content=" the cppad::vector template class vector Cppad [] push thread_alloc syntax description include capacity assignment check size return reference move semantics element access push_back push_vector output resize clear data vectorbool memory bit_per_unit type parallel mode example exercise "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
653653 <br/>
654654 Create and run a program that contains the following code:
655655 <code><font color='blue'><pre style='display:inline'>
656 CppAD::vector&lt;double&gt; x(3);
657 size_t i;
658 for(i = 0; i &lt; 3; i++)
659 x[i] = 4. - i;
660 std::cout &lt;&lt; &quot;x = &quot; &lt;&lt; x &lt;&lt; std::endl;
656 CppAD::vector&lt;double&gt; x(3);
657 size_t i;
658 for(i = 0; i &lt; 3; i++)
659 x[i] = 4. - i;
660 std::cout &lt;&lt; &quot;x = &quot; &lt;&lt; x &lt;&lt; std::endl;
661661 </pre></font></code>
662
663
664662
665663 <hr/>Input File: cppad/utility/vector.hpp
666664
55 <title>Computing Dependency: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Computing Dependency: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" computing dependency: example and test discussion dependency pattern "/>
8 <meta name="keywords" id="keywords" content=" computing dependency: example test discussion dependency pattern "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Stop Recording and Store Operation Sequence</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Stop Recording and Store Operation Sequence"/>
8 <meta name="keywords" id="keywords" content=" stop recording and store operation sequence Adfun tape Dependent syntax purpose f x y advector taping forward parallel mode example "/>
8 <meta name="keywords" id="keywords" content=" stop recording store operation sequence Adfun tape Dependent syntax purpose f x y advector taping forward parallel mode example "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Check Determinant of 3 by 3 matrix</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Check Determinant of 3 by 3 matrix"/>
8 <meta name="keywords" id="keywords" content=" check determinant of 3 by matrix det_33 correct syntax purpose inclusion x d vector ok source code "/>
8 <meta name="keywords" id="keywords" content=" check determinant 3 matrix det_33 correct syntax purpose inclusion x d vector ok source code "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Determinant Using Lu Factorization: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Determinant Using Lu Factorization: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" determinant using lu factorization: example and test minors "/>
8 <meta name="keywords" id="keywords" content=" determinant using lu factorization: example test minors "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Determinant Using Expansion by Lu Factorization</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Determinant Using Expansion by Lu Factorization"/>
8 <meta name="keywords" id="keywords" content=" determinant using expansion by lu factorization det_by_lu factor syntax inclusion constructor scalar n det a d vector example source code "/>
8 <meta name="keywords" id="keywords" content=" determinant using expansion lu factorization det_by_lu factor syntax inclusion constructor scalar n det d vector example source code "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Determinant Using Expansion by Minors: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Determinant Using Expansion by Minors: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" determinant using expansion by minors: example and test minors "/>
8 <meta name="keywords" id="keywords" content=" determinant using expansion minors: example test minors "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Determinant Using Expansion by Minors</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Determinant Using Expansion by Minors"/>
8 <meta name="keywords" id="keywords" content=" determinant using expansion by minors syntax inclusion constructor scalar n det a d vector example source code "/>
8 <meta name="keywords" id="keywords" content=" determinant using expansion minors syntax inclusion constructor scalar n det d vector example source code "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Compute Determinant using Expansion by Minors</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Compute Determinant using Expansion by Minors"/>
8 <meta name="keywords" id="keywords" content=" compute determinant using expansion by minors syntax purpose a m source code "/>
8 <meta name="keywords" id="keywords" content=" compute determinant using expansion minors syntax purpose m source code "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
9999 </select>
100100 </td>
101101 </tr></table><br/>
102
103
104
105102 <center><b><big><big>Compute Determinant using Expansion by Minors</big></big></b></center>
106103 <br/>
107104 <b><big><a name="Syntax" id="Syntax">Syntax</a></big></b>
284281
285282 <code><font color='blue'><pre style='display:inline'>
286283 double det_by_minor(double* a, size_t m)
287 { size_t *r, *c, i;
288 double value;
289
290 r = (size_t*) malloc( (m+1) * sizeof(size_t) );
291 c = (size_t*) malloc( (m+1) * sizeof(size_t) );
292
293 assert(m &lt;= 100);
294 for(i = 0; i &lt; m; i++)
295 { r[i] = i+1;
296 c[i] = i+1;
297 }
298 r[m] = 0;
299 c[m] = 0;
300
301 value = <a href="det_of_minor_c.xml" target="_top">det_of_minor</a>(a, m, m, r, c);
302
303 free(r);
304 free(c);
305 return value;
284 { size_t *r, *c, i;
285 double value;
286
287 r = (size_t*) malloc( (m+1) * sizeof(size_t) );
288 c = (size_t*) malloc( (m+1) * sizeof(size_t) );
289
290 assert(m &lt;= 100);
291 for(i = 0; i &lt; m; i++)
292 { r[i] = i+1;
293 c[i] = i+1;
294 }
295 r[m] = 0;
296 c[m] = 0;
297
298 value = <a href="det_of_minor_c.xml" target="_top">det_of_minor</a>(a, m, m, r, c);
299
300 free(r);
301 free(c);
302 return value;
306303 }
307304 </pre></font></code>
308
309305
310306 <hr/>Input File: compare_c/det_by_minor.c
311307
55 <title>Check Gradient of Determinant of 3 by 3 matrix</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Check Gradient of Determinant of 3 by 3 matrix"/>
8 <meta name="keywords" id="keywords" content=" check gradient of determinant 3 by matrix det_grad_33 correct syntax purpose inclusion x g vector ok source code "/>
8 <meta name="keywords" id="keywords" content=" check gradient determinant 3 matrix det_grad_33 correct syntax purpose inclusion x g vector ok source code "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Determinant of a Minor: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Determinant of a Minor: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" determinant of a minor: example and test det_of_minor "/>
8 <meta name="keywords" id="keywords" content=" determinant minor: example test det_of_minor "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Determinant of a Minor</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Determinant of a Minor"/>
8 <meta name="keywords" id="keywords" content=" determinant of a minor det_of_minor matrix syntax inclusion purpose m n r c d scalar example source code "/>
8 <meta name="keywords" id="keywords" content=" determinant minor det_of_minor matrix syntax inclusion purpose m n r c d scalar example source code "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Determinant of a Minor</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Determinant of a Minor"/>
8 <meta name="keywords" id="keywords" content=" determinant of a minor syntax purpose m n r c d source code "/>
8 <meta name="keywords" id="keywords" content=" determinant minor syntax purpose m n r c d source code "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
671671
672672 <code><font color='blue'><pre style='display:inline'>
673673 double det_of_minor(
674 const double* a ,
675 size_t m ,
676 size_t n ,
677 size_t* r ,
678 size_t* c )
679 { size_t R0, Cj, Cj1, j;
680 double detM, M0j, detS;
681 int s;
682
683 R0 = r[m]; /* R(0) */
684 Cj = c[m]; /* C(j) (case j = 0) */
685 Cj1 = m; /* C(j-1) (case j = 0) */
686
687 /* check for 1 by 1 case */
688 if( n == 1 ) return a[ R0 * m + Cj ];
689
690 /* initialize determinant of the minor M */
691 detM = 0.;
692
693 /* initialize sign of factor for neat sub-minor */
694 s = 1;
695
696 /* remove row with index 0 in M from all the sub-minors of M */
697 r[m] = r[R0];
698
699 /* for each column of M */
700 for(j = 0; j &lt; n; j++)
701 { /* element with index (0,j) in the minor M */
702 M0j = a[ R0 * m + Cj ];
703
704 /* remove column with index j in M to form next sub-minor S of M */
705 c[Cj1] = c[Cj];
706
707 /* compute determinant of the current sub-minor S */
708 detS = det_of_minor(a, m, n - 1, r, c);
709
710 /* restore column Cj to representation of M as a minor of A */
711 c[Cj1] = Cj;
712
713 /* include this sub-minor term in the summation */
714 if( s &gt; 0 )
715 detM = detM + M0j * detS;
716 else detM = detM - M0j * detS;
717
718 /* advance to neat column of M */
719 Cj1 = Cj;
720 Cj = c[Cj];
721 s = - s;
722 }
723
724 /* restore row zero to the minor representation for M */
725 r[m] = R0;
726
727 /* return the determinant of the minor M */
728 return detM;
674 const double* a ,
675 size_t m ,
676 size_t n ,
677 size_t* r ,
678 size_t* c )
679 { size_t R0, Cj, Cj1, j;
680 double detM, M0j, detS;
681 int s;
682
683 R0 = r[m]; /* R(0) */
684 Cj = c[m]; /* C(j) (case j = 0) */
685 Cj1 = m; /* C(j-1) (case j = 0) */
686
687 /* check for 1 by 1 case */
688 if( n == 1 ) return a[ R0 * m + Cj ];
689
690 /* initialize determinant of the minor M */
691 detM = 0.;
692
693 /* initialize sign of factor for neat sub-minor */
694 s = 1;
695
696 /* remove row with index 0 in M from all the sub-minors of M */
697 r[m] = r[R0];
698
699 /* for each column of M */
700 for(j = 0; j &lt; n; j++)
701 { /* element with index (0,j) in the minor M */
702 M0j = a[ R0 * m + Cj ];
703
704 /* remove column with index j in M to form next sub-minor S of M */
705 c[Cj1] = c[Cj];
706
707 /* compute determinant of the current sub-minor S */
708 detS = det_of_minor(a, m, n - 1, r, c);
709
710 /* restore column Cj to representation of M as a minor of A */
711 c[Cj1] = Cj;
712
713 /* include this sub-minor term in the summation */
714 if( s &gt; 0 )
715 detM = detM + M0j * detS;
716 else detM = detM - M0j * detS;
717
718 /* advance to neat column of M */
719 Cj1 = Cj;
720 Cj = c[Cj];
721 s = - s;
722 }
723
724 /* restore row zero to the minor representation for M */
725 r[m] = R0;
726
727 /* return the determinant of the minor M */
728 return detM;
729729 }
730730 </pre></font></code>
731731
732
733732 <hr/>Input File: compare_c/det_by_minor.c
734733
735734 </body>
55 <title>AD Binary Division: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="AD Binary Division: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" ad binary division: example and test / divide quotient "/>
8 <meta name="keywords" id="keywords" content=" ad binary division: example test / divide quotient "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>AD Computed Assignment Division: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="AD Computed Assignment Division: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" ad computed assignment division: example and test /= divide assign plus add "/>
8 <meta name="keywords" id="keywords" content=" ad computed assignment division: example test /= divide assign plus add "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
9191 </select>
9292 </td>
9393 </tr></table><br/>
94
95
96
9794 <center><b><big><big>Double Speed: Determinant Using Lu Factorization</big></big></b></center>
9895 <br/>
9996 <b><big><a name="Specifications" id="Specifications">Specifications</a></big></b>
112109
113110 // Note that CppAD uses global_memory at the main program level
114111 extern bool
115 global_onetape, global_atomic, global_optimize;
112 global_onetape, global_atomic, global_optimize;
116113
117114 bool link_det_lu(
118 size_t size ,
119 size_t repeat ,
120 CppAD::vector&lt;double&gt; &amp;matrix ,
121 CppAD::vector&lt;double&gt; &amp;det )
115 size_t size ,
116 size_t repeat ,
117 CppAD::vector&lt;double&gt; &amp;matrix ,
118 CppAD::vector&lt;double&gt; &amp;det )
122119 {
123 if(global_onetape||global_atomic||global_optimize)
124 return false;
125 // -----------------------------------------------------
126 // setup
127 CppAD::det_by_lu&lt;double&gt; Det(size);
128 size_t n = size * size; // number of independent variables
120 if(global_onetape||global_atomic||global_optimize)
121 return false;
122 // -----------------------------------------------------
123 // setup
124 CppAD::det_by_lu&lt;double&gt; Det(size);
125 size_t n = size * size; // number of independent variables
129126
130 // ------------------------------------------------------
127 // ------------------------------------------------------
131128
132 while(repeat--)
133 { // get the next matrix
134 CppAD::uniform_01(n, matrix);
129 while(repeat--)
130 { // get the next matrix
131 CppAD::uniform_01(n, matrix);
135132
136 // computation of the determinant
137 det[0] = Det(matrix);
138 }
139 return true;
133 // computation of the determinant
134 det[0] = Det(matrix);
135 }
136 return true;
140137 }
141138 </pre></font></code>
142
143139
144140 <hr/>Input File: speed/double/det_lu.cpp
145141
55 <title>Double Speed: Determinant by Minor Expansion</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Double Speed: Determinant by Minor Expansion"/>
8 <meta name="keywords" id="keywords" content=" double speed: determinant by minor expansion link_det_minor speed specifications implementation "/>
8 <meta name="keywords" id="keywords" content=" double speed: determinant minor expansion link_det_minor speed specifications implementation "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
110110
111111 // Note that CppAD uses global_memory at the main program level
112112 extern bool
113 global_onetape, global_atomic, global_optimize;
113 global_onetape, global_atomic, global_optimize;
114114
115115 bool link_det_minor(
116 size_t size ,
117 size_t repeat ,
118 CppAD::vector&lt;double&gt; &amp;matrix ,
119 CppAD::vector&lt;double&gt; &amp;det )
116 size_t size ,
117 size_t repeat ,
118 CppAD::vector&lt;double&gt; &amp;matrix ,
119 CppAD::vector&lt;double&gt; &amp;det )
120120 {
121 if(global_onetape||global_atomic||global_optimize)
122 return false;
123 // -----------------------------------------------------
124 // setup
125 CppAD::det_by_minor&lt;double&gt; Det(size);
126 size_t n = size * size; // number of independent variables
121 if(global_onetape||global_atomic||global_optimize)
122 return false;
123 // -----------------------------------------------------
124 // setup
125 CppAD::det_by_minor&lt;double&gt; Det(size);
126 size_t n = size * size; // number of independent variables
127127
128 // ------------------------------------------------------
129 while(repeat--)
130 { // get the next matrix
131 CppAD::uniform_01(n, matrix);
128 // ------------------------------------------------------
129 while(repeat--)
130 { // get the next matrix
131 CppAD::uniform_01(n, matrix);
132132
133 // computation of the determinant
134 det[0] = Det(matrix);
135 }
136 return true;
133 // computation of the determinant
134 det[0] = Det(matrix);
135 }
136 return true;
137137 }
138138 </pre></font></code>
139
140139
141140 <hr/>Input File: speed/double/det_minor.cpp
142141
9191 </select>
9292 </td>
9393 </tr></table><br/>
94
95
96
9794 <center><b><big><big>CppAD Speed: Matrix Multiplication (Double Version)</big></big></b></center>
9895 <br/>
9996 <b><big><a name="Specifications" id="Specifications">Specifications</a></big></b>
112109
113110 // Note that CppAD uses global_memory at the main program level
114111 extern bool
115 global_onetape, global_atomic, global_optimize;
112 global_onetape, global_atomic, global_optimize;
116113
117114 bool link_mat_mul(
118 size_t size ,
119 size_t repeat ,
120 CppAD::vector&lt;double&gt;&amp; x ,
121 CppAD::vector&lt;double&gt;&amp; z ,
122 CppAD::vector&lt;double&gt;&amp; dz
115 size_t size ,
116 size_t repeat ,
117 CppAD::vector&lt;double&gt;&amp; x ,
118 CppAD::vector&lt;double&gt;&amp; z ,
119 CppAD::vector&lt;double&gt;&amp; dz
123120 )
124121 {
125 if(global_onetape||global_atomic||global_optimize)
126 return false;
127 // -----------------------------------------------------
128 size_t n = size * size; // number of independent variables
129 CppAD::vector&lt;double&gt; y(n);
122 if(global_onetape||global_atomic||global_optimize)
123 return false;
124 // -----------------------------------------------------
125 size_t n = size * size; // number of independent variables
126 CppAD::vector&lt;double&gt; y(n);
130127
131 while(repeat--)
132 { // get the next matrix
133 CppAD::uniform_01(n, x);
128 while(repeat--)
129 { // get the next matrix
130 CppAD::uniform_01(n, x);
134131
135 // do computation
136 mat_sum_sq(size, x, y, z);
132 // do computation
133 mat_sum_sq(size, x, y, z);
137134
138 }
139 return true;
135 }
136 return true;
140137 }
141138 </pre></font></code>
142
143139
144140 <hr/>Input File: speed/double/mat_mul.cpp
145141
9191 </select>
9292 </td>
9393 </tr></table><br/>
94
95
96
9794 <center><b><big><big>Double Speed: Ode Solution</big></big></b></center>
9895 <br/>
9996 <b><big><a name="Specifications" id="Specifications">Specifications</a></big></b>
114111
115112 // Note that CppAD uses global_memory at the main program level
116113 extern bool
117 global_onetape, global_atomic, global_optimize;
114 global_onetape, global_atomic, global_optimize;
118115
119116 bool link_ode(
120 size_t size ,
121 size_t repeat ,
122 CppAD::vector&lt;double&gt; &amp;x ,
123 CppAD::vector&lt;double&gt; &amp;jacobian
117 size_t size ,
118 size_t repeat ,
119 CppAD::vector&lt;double&gt; &amp;x ,
120 CppAD::vector&lt;double&gt; &amp;jacobian
124121 )
125122 {
126 if(global_onetape||global_atomic||global_optimize)
127 return false;
128 // -------------------------------------------------------------
129 // setup
130 assert( x.size() == size );
123 if(global_onetape||global_atomic||global_optimize)
124 return false;
125 // -------------------------------------------------------------
126 // setup
127 assert( x.size() == size );
131128
132 size_t n = size;
129 size_t n = size;
133130
134 size_t m = 0;
135 CppAD::vector&lt;double&gt; f(n);
131 size_t m = 0;
132 CppAD::vector&lt;double&gt; f(n);
136133
137 while(repeat--)
138 { // choose next x value
139 uniform_01(n, x);
134 while(repeat--)
135 { // choose next x value
136 uniform_01(n, x);
140137
141 // evaluate function
142 CppAD::ode_evaluate(x, m, f);
138 // evaluate function
139 CppAD::ode_evaluate(x, m, f);
143140
144 }
145 size_t i;
146 for(i = 0; i &lt; n; i++)
147 jacobian[i] = f[i];
148 return true;
141 }
142 size_t i;
143 for(i = 0; i &lt; n; i++)
144 jacobian[i] = f[i];
145 return true;
149146 }
150147 </pre></font></code>
151
152148
153149 <hr/>Input File: speed/double/ode.cpp
154150
55 <title>Double Speed: Evaluate a Polynomial</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Double Speed: Evaluate a Polynomial"/>
8 <meta name="keywords" id="keywords" content=" double speed: evaluate a polynomial link_poly speed specifications implementation "/>
8 <meta name="keywords" id="keywords" content=" double speed: evaluate polynomial link_poly speed specifications implementation "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
9191 </select>
9292 </td>
9393 </tr></table><br/>
94
95
96
9794 <center><b><big><big>Double Speed: Evaluate a Polynomial</big></big></b></center>
9895 <br/>
9996 <b><big><a name="Specifications" id="Specifications">Specifications</a></big></b>
112109
113110 // Note that CppAD uses global_memory at the main program level
114111 extern bool
115 global_onetape, global_atomic, global_optimize;
112 global_onetape, global_atomic, global_optimize;
116113
117114 bool link_poly(
118 size_t size ,
119 size_t repeat ,
120 CppAD::vector&lt;double&gt; &amp;a , // coefficients of polynomial
121 CppAD::vector&lt;double&gt; &amp;z , // polynomial argument value
122 CppAD::vector&lt;double&gt; &amp;p ) // second derivative w.r.t z
115 size_t size ,
116 size_t repeat ,
117 CppAD::vector&lt;double&gt; &amp;a , // coefficients of polynomial
118 CppAD::vector&lt;double&gt; &amp;z , // polynomial argument value
119 CppAD::vector&lt;double&gt; &amp;p ) // second derivative w.r.t z
123120 {
124 if(global_onetape||global_atomic||global_optimize)
125 return false;
126 // -----------------------------------------------------
127 // setup
121 if(global_onetape||global_atomic||global_optimize)
122 return false;
123 // -----------------------------------------------------
124 // setup
128125
129 // ------------------------------------------------------
130 while(repeat--)
131 { // get the next argument value
132 CppAD::uniform_01(1, z);
126 // ------------------------------------------------------
127 while(repeat--)
128 { // get the next argument value
129 CppAD::uniform_01(1, z);
133130
134 // evaluate the polynomial at the new argument value
135 p[0] = CppAD::Poly(0, a, z[0]);
136 }
137 return true;
131 // evaluate the polynomial at the new argument value
132 p[0] = CppAD::Poly(0, a, z[0]);
133 }
134 return true;
138135 }
139136 </pre></font></code>
140
141137
142138 <hr/>Input File: speed/double/poly.cpp
143139
9191 </select>
9292 </td>
9393 </tr></table><br/>
94
95
96
9794 <center><b><big><big>Double Speed: Sparse Hessian</big></big></b></center>
9895 <br/>
9996 <b><big><a name="Specifications" id="Specifications">Specifications</a></big></b>
113110
114111 // Note that CppAD uses global_memory at the main program level
115112 extern bool
116 global_onetape, global_atomic, global_optimize, global_boolsparsity;
113 global_onetape, global_atomic, global_optimize, global_boolsparsity;
117114
118115 bool link_sparse_hessian(
119 size_t size ,
120 size_t repeat ,
121 const CppAD::vector&lt;size_t&gt;&amp; row ,
122 const CppAD::vector&lt;size_t&gt;&amp; col ,
123 CppAD::vector&lt;double&gt;&amp; x ,
124 CppAD::vector&lt;double&gt;&amp; hessian ,
125 size_t&amp; n_sweep )
116 size_t size ,
117 size_t repeat ,
118 const CppAD::vector&lt;size_t&gt;&amp; row ,
119 const CppAD::vector&lt;size_t&gt;&amp; col ,
120 CppAD::vector&lt;double&gt;&amp; x ,
121 CppAD::vector&lt;double&gt;&amp; hessian ,
122 size_t&amp; n_sweep )
126123 {
127 if(global_onetape||global_atomic||global_optimize||global_boolsparsity)
128 return false;
129 // -----------------------------------------------------
130 // setup
131 using CppAD::vector;
132 size_t order = 0; // derivative order corresponding to function
133 size_t n = size; // argument space dimension
134 size_t m = 1; // range space dimension
135 vector&lt;double&gt; y(m); // function value
124 if(global_onetape||global_atomic||global_optimize||global_boolsparsity)
125 return false;
126 // -----------------------------------------------------
127 // setup
128 using CppAD::vector;
129 size_t order = 0; // derivative order corresponding to function
130 size_t n = size; // argument space dimension
131 size_t m = 1; // range space dimension
132 vector&lt;double&gt; y(m); // function value
136133
137 // choose a value for x
138 CppAD::uniform_01(n, x);
134 // choose a value for x
135 CppAD::uniform_01(n, x);
139136
140 // ------------------------------------------------------
137 // ------------------------------------------------------
141138
142 while(repeat--)
143 {
144 // computation of the function
145 CppAD::sparse_hes_fun&lt;double&gt;(n, x, row, col, order, y);
146 }
147 hessian[0] = y[0];
139 while(repeat--)
140 {
141 // computation of the function
142 CppAD::sparse_hes_fun&lt;double&gt;(n, x, row, col, order, y);
143 }
144 hessian[0] = y[0];
148145
149 return true;
146 return true;
150147 }
151148 </pre></font></code>
152
153149
154150 <hr/>Input File: speed/double/sparse_hessian.cpp
155151
9191 </select>
9292 </td>
9393 </tr></table><br/>
94
95
96
9794 <center><b><big><big>Double Speed: Sparse Jacobian</big></big></b></center>
9895 <br/>
9996 <b><big><a name="Specifications" id="Specifications">Specifications</a></big></b>
113110
114111 // Note that CppAD uses global_memory at the main program level
115112 extern bool
116 global_onetape, global_atomic, global_optimize, global_boolsparsity;
113 global_onetape, global_atomic, global_optimize, global_boolsparsity;
117114
118115 bool link_sparse_jacobian(
119 size_t size ,
120 size_t repeat ,
121 size_t m ,
122 const CppAD::vector&lt;size_t&gt;&amp; row ,
123 const CppAD::vector&lt;size_t&gt;&amp; col ,
124 CppAD::vector&lt;double&gt;&amp; x ,
125 CppAD::vector&lt;double&gt;&amp; jacobian ,
126 size_t&amp; n_sweep )
116 size_t size ,
117 size_t repeat ,
118 size_t m ,
119 const CppAD::vector&lt;size_t&gt;&amp; row ,
120 const CppAD::vector&lt;size_t&gt;&amp; col ,
121 CppAD::vector&lt;double&gt;&amp; x ,
122 CppAD::vector&lt;double&gt;&amp; jacobian ,
123 size_t&amp; n_sweep )
127124 {
128 if(global_onetape||global_atomic||global_optimize||global_boolsparsity)
129 return false;
130 // -----------------------------------------------------
131 // setup
132 using CppAD::vector;
133 size_t i;
134 size_t order = 0; // order for computing function value
135 size_t n = size; // argument space dimension
136 vector&lt;double&gt; yp(m); // function value yp = f(x)
125 if(global_onetape||global_atomic||global_optimize||global_boolsparsity)
126 return false;
127 // -----------------------------------------------------
128 // setup
129 using CppAD::vector;
130 size_t i;
131 size_t order = 0; // order for computing function value
132 size_t n = size; // argument space dimension
133 vector&lt;double&gt; yp(m); // function value yp = f(x)
137134
138 // ------------------------------------------------------
139 while(repeat--)
140 { // choose a value for x
141 CppAD::uniform_01(n, x);
135 // ------------------------------------------------------
136 while(repeat--)
137 { // choose a value for x
138 CppAD::uniform_01(n, x);
142139
143 // computation of the function
144 CppAD::sparse_jac_fun&lt;double&gt;(m, n, x, row, col, order, yp);
145 }
146 for(i = 0; i &lt; m; i++)
147 jacobian[i] = yp[i];
140 // computation of the function
141 CppAD::sparse_jac_fun&lt;double&gt;(m, n, x, row, col, order, yp);
142 }
143 for(i = 0; i &lt; m; i++)
144 jacobian[i] = yp[i];
148145
149 return true;
146 return true;
150147 }
151148 </pre></font></code>
152
153149
154150 <hr/>Input File: speed/double/sparse_jacobian.cpp
155151
55 <title>Download The CppAD Source Code</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Download The CppAD Source Code"/>
8 <meta name="keywords" id="keywords" content=" download the cppad source code purpose distribution directory compressed archives current version release versions monthly unix file extraction windows and testing install instructions subversion limitations stable "/>
8 <meta name="keywords" id="keywords" content=" download the cppad source code purpose distribution directory compressed archives current version release versions monthly unix file extraction windows testing install instructions subversion limitations stable "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
121121
122122 current </td><td align='left' valign='top'>
123123 EPL </td><td align='left' valign='top'>
124 <a href="http://www.coin-or.org/download/source/CppAD/cppad-20160000.0.epl.tgz" target="_top"><span style='white-space: nowrap'>cppad-20160000.0.epl.tgz</span></a>
124 <a href="http://www.coin-or.org/download/source/CppAD/cppad-20160000.1.epl.tgz" target="_top"><span style='white-space: nowrap'>cppad-20160000.1.epl.tgz</span></a>
125125
126126 </td></tr><tr><td align='left' valign='top'>
127127
128128 current </td><td align='left' valign='top'>
129129 GPL </td><td align='left' valign='top'>
130 <a href="http://www.coin-or.org/download/source/CppAD/cppad-20160000.0.gpl.tgz" target="_top"><span style='white-space: nowrap'>cppad-20160000.0.gpl.tgz</span></a>
130 <a href="http://www.coin-or.org/download/source/CppAD/cppad-20160000.1.gpl.tgz" target="_top"><span style='white-space: nowrap'>cppad-20160000.1.gpl.tgz</span></a>
131131
132132 </td></tr><tr><td align='left' valign='top'>
133133
412412 .
413413 You will need to install the <code><font color="blue">omhelp</font></code> command so that
414414 <code><font color='blue'><pre style='display:inline'>
415 which omhelp
415 which omhelp
416416 </pre></font></code>
417
418417 shows it is in your path.
419418 Once you have done this,
420419 in the distribution directory execute the following command:
55 <title>First and Second Derivatives: Easy Drivers</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="First and Second Derivatives: Easy Drivers"/>
8 <meta name="keywords" id="keywords" content=" first and second derivatives: easy drivers forward reverse "/>
8 <meta name="keywords" id="keywords" content=" first second derivatives: easy drivers forward reverse "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Using Eigen Arrays: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Using Eigen Arrays: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" using eigen arrays: example and test array "/>
8 <meta name="keywords" id="keywords" content=" using eigen arrays: example test array "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
8383 <td>eigen_array.cpp</td>
8484 <td>Headings</td>
8585 </tr></table><br/>
86
87
88
8986 <center><b><big><big>Using Eigen Arrays: Example and Test</big></big></b></center>
9087 <code><font color="blue"><pre style='display:inline'>
9188 # include &lt;cppad/example/cppad_eigen.hpp&gt;
55 <title>Using Eigen To Compute Determinant: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Using Eigen To Compute Determinant: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" using eigen to compute determinant: example and test determinant "/>
8 <meta name="keywords" id="keywords" content=" using eigen to compute determinant: example test determinant "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Source Code for eigen_plugin.hpp</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Source Code for eigen_plugin.hpp"/>
8 <meta name="keywords" id="keywords" content=" source code for eigen_plugin.hpp "/>
8 <meta name="keywords" id="keywords" content=" source code eigen_plugin.hpp "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
8383 <td>eigen_plugin.hpp</td>
8484 <td>Headings</td>
8585 </tr></table><br/>
86
87
88
8986 <center><b><big><big>Source Code for eigen_plugin.hpp</big></big></b></center>
90 <code><font color='blue'><pre style='display:inline'> // Declaration needed so an Eigen vector is a simple vector
87 <code><font color='blue'><pre style='display:inline'>
88 // Declaration needed so an Eigen vector is a simple vector
9189 typedef Scalar value_type;
9290 </pre></font></code>
93
9491
9592 <hr/>Input File: cppad/example/eigen_plugin.hpp
9693
55 <title>Including the Eigen Examples and Tests</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Including the Eigen Examples and Tests"/>
8 <meta name="keywords" id="keywords" content=" including the eigen examples and tests prefix get purpose eigen_prefix test vector get_eigen "/>
8 <meta name="keywords" id="keywords" content=" including the eigen examples tests prefix get purpose eigen_prefix test vector get_eigen "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Elapsed Seconds: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Elapsed Seconds: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" elapsed seconds: example and test seconds timer "/>
8 <meta name="keywords" id="keywords" content=" elapsed seconds: example test seconds timer "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Returns Elapsed Number of Seconds</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Returns Elapsed Number of Seconds"/>
8 <meta name="keywords" id="keywords" content=" returns elapsed number of seconds elapsed_seconds time syntax purpose s microsoft systems example "/>
8 <meta name="keywords" id="keywords" content=" returns elapsed number seconds elapsed_seconds time syntax purpose s microsoft systems example "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Returns Elapsed Number of Seconds</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Returns Elapsed Number of Seconds"/>
8 <meta name="keywords" id="keywords" content=" returns elapsed number of seconds syntax purpose s source code "/>
8 <meta name="keywords" id="keywords" content=" returns elapsed number seconds syntax purpose s source code "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
9898 </select>
9999 </td>
100100 </tr></table><br/>
101
102
103
104101 <center><b><big><big>Returns Elapsed Number of Seconds</big></big></b></center>
105102 <br/>
106103 <b><big><a name="Syntax" id="Syntax">Syntax</a></big></b>
136133 # include &lt;windows.h&gt;
137134 # include &lt;cassert&gt;
138135 double elapsed_seconds(void)
139 { static bool first_ = true;
140 static SYSTEMTIME st_;
141 double hour, minute, second, milli, diff;
142 SYSTEMTIME st;
136 { static bool first_ = true;
137 static SYSTEMTIME st_;
138 double hour, minute, second, milli, diff;
139 SYSTEMTIME st;
143140
144 if( first_ )
145 { GetSystemTime(&amp;st_);
146 first_ = false;
147 return 0.;
148 }
149 GetSystemTime(&amp;st);
141 if( first_ )
142 { GetSystemTime(&amp;st_);
143 first_ = false;
144 return 0.;
145 }
146 GetSystemTime(&amp;st);
150147
151 hour = (double) st.wHour - (double) st_.wHour;
152 minute = (double) st.wMinute - (double) st_.wMinute;
153 second = (double) st.wSecond - (double) st_.wSecond;
154 milli = (double) st.wMilliseconds - (double) st_.wMilliseconds;
148 hour = (double) st.wHour - (double) st_.wHour;
149 minute = (double) st.wMinute - (double) st_.wMinute;
150 second = (double) st.wSecond - (double) st_.wSecond;
151 milli = (double) st.wMilliseconds - (double) st_.wMilliseconds;
155152
156 diff = 1e-3*milli + second + 60.*minute + 3600.*hour;
157 if( diff &lt; 0. )
158 diff += 3600.*24.;
159 assert( 0 &lt;= diff &amp;&amp; diff &lt; 3600.*24. );
153 diff = 1e-3*milli + second + 60.*minute + 3600.*hour;
154 if( diff &lt; 0. )
155 diff += 3600.*24.;
156 assert( 0 &lt;= diff &amp;&amp; diff &lt; 3600.*24. );
160157
161 return diff;
158 return diff;
162159 }
163160 # else
164161 // ---------------------------------------------------------------------------
165162 // Unix version of timer
166163 # include &lt;sys/time.h&gt;
167164 double elapsed_seconds(void)
168 { double sec, usec, diff;
165 { double sec, usec, diff;
169166
170 static bool first_ = true;
171 static struct timeval tv_first;
172 struct timeval tv;
173 if( first_ )
174 { gettimeofday(&amp;tv_first, NULL);
175 first_ = false;
176 return 0.;
177 }
178 gettimeofday(&amp;tv, NULL);
179 assert( tv.tv_sec &gt;= tv_first.tv_sec );
167 static bool first_ = true;
168 static struct timeval tv_first;
169 struct timeval tv;
170 if( first_ )
171 { gettimeofday(&amp;tv_first, NULL);
172 first_ = false;
173 return 0.;
174 }
175 gettimeofday(&amp;tv, NULL);
176 assert( tv.tv_sec &gt;= tv_first.tv_sec );
180177
181 sec = (double)(tv.tv_sec - tv_first.tv_sec);
182 usec = (double)tv.tv_usec - (double)tv_first.tv_usec;
183 diff = sec + 1e-6*usec;
178 sec = (double)(tv.tv_sec - tv_first.tv_sec);
179 usec = (double)tv.tv_usec - (double)tv_first.tv_usec;
180 diff = sec + 1e-6*usec;
184181
185 return diff;
182 return diff;
186183 }
187184 # endif
188185 </pre></font></code>
189
190186
191187 <hr/>Input File: compare_c/det_by_minor.c
192188
55 <title>Machine Epsilon For AD Types</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Machine Epsilon For AD Types"/>
8 <meta name="keywords" id="keywords" content=" machine epsilon for ad types deprecated 2012-06-17 syntax purpose float eps "/>
8 <meta name="keywords" id="keywords" content=" machine epsilon ad types deprecated 2012-06-17 syntax purpose float eps "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>EqualOpSeq: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="EqualOpSeq: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" equalopseq: example and test Equalopseq "/>
8 <meta name="keywords" id="keywords" content=" equalopseq: example test Equalopseq "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>The AD erf Function: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="The AD erf Function: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" the ad erf function: example and test "/>
8 <meta name="keywords" id="keywords" content=" the ad erf function: example test "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Replacing The CppAD Error Handler: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Replacing The CppAD Error Handler: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" replacing the cppad error handler: example and test handler "/>
8 <meta name="keywords" id="keywords" content=" replacing the cppad error handler: example test handler "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>CppAD Examples and Tests</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="CppAD Examples and Tests"/>
8 <meta name="keywords" id="keywords" content=" cppad examples and tests running "/>
8 <meta name="keywords" id="keywords" content=" cppad examples tests running "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Utility Routines used by CppAD Examples</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Utility Routines used by CppAD Examples"/>
8 <meta name="keywords" id="keywords" content=" utility routines used by cppad examples "/>
8 <meta name="keywords" id="keywords" content=" utility routines used cppad examples "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>The AD exp Function: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="The AD exp Function: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" the ad exp function: example and test "/>
8 <meta name="keywords" id="keywords" content=" the ad exp function: example test "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
9292 # include &quot;exp_2.hpp&quot; // definition of exp_2 algorithm
9393 bool exp_2(void)
9494 { double x = .5;
95 double check = 1 + x + x * x / 2.;
96 bool ok = std::fabs( exp_2(x) - check ) &lt;= 1e-10;
95 double check = 1 + x + x * x / 2.;
96 bool ok = std::fabs( exp_2(x) - check ) &lt;= 1e-10;
9797 return ok;
9898 }
9999 </pre>
353353 <ol type="1"><li>
354354 Suppose that we make the call
355355 <code><font color='blue'><pre style='display:inline'>
356 double x = .1;
357 double y = exp_2(x);
356 double x = .1;
357 double y = exp_2(x);
358358 </pre></font></code>
359
360359 What is the value assigned to
361360 <code><font color="blue">v1</font></code>, <code><font color="blue">v2</font></code>, ... ,<code><font color="blue">v5</font></code> in <a href="exp_2.hpp.xml" target="_top"><span style='white-space: nowrap'>exp_2.hpp</span></a>
362361 ?
389388
390389 Suppose that we make the call
391390 <code><font color='blue'><pre style='display:inline'>
392 double x = .5;
393 double y = exp_3(x);
391 double x = .5;
392 double y = exp_3(x);
394393 </pre></font></code>
395
396394 using <code><font color="blue">exp_3</font></code> created in the previous problem.
397395 What is the value assigned to the new variables in <code><font color="blue">exp_3</font></code>
398396 (variables that are in <code><font color="blue">exp_3</font></code> and not in <code><font color="blue">exp_2</font></code>) ?
55 <title>exp_2: CppAD Forward and Reverse Sweeps</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="exp_2: CppAD Forward and Reverse Sweeps"/>
8 <meta name="keywords" id="keywords" content=" exp_2: cppad forward and reverse sweeps purpose exercises "/>
8 <meta name="keywords" id="keywords" content=" exp_2: cppad forward reverse sweeps purpose exercises "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
8989 </select>
9090 </td>
9191 </tr></table><br/>
92
93
94
9592 <center><b><big><big>exp_2: CppAD Forward and Reverse Sweeps</big></big></b></center>
9693 .
9794
114111 </mrow></math>
115112
116113 ,
117 of the function
114 of the function
118115
119116 <code><font color="blue"><span style='white-space: nowrap'><br/>
120117 &#xA0;&#xA0;&#xA0;&#xA0;&#xA0;exp_2(</span></font><i><font color="black"><span style='white-space: nowrap'>x</span></font></i><font color="blue"><span style='white-space: nowrap'>)<br/>
141138 <mn>.1</mn>
142139 </mrow></math>
143140
144
145 of the function
141
142 of the function
146143
147144 <code><font color="blue"><span style='white-space: nowrap'><br/>
148145 &#xA0;&#xA0;&#xA0;&#xA0;&#xA0;exp_2(</span></font><i><font color="black"><span style='white-space: nowrap'>x</span></font></i><font color="blue"><span style='white-space: nowrap'>)<br/>
198195
199196 <code><font color='blue'><pre style='display:inline'>
200197
201 # include &lt;cppad/cppad.hpp&gt; // http://www.coin-or.org/CppAD/
198 # include &lt;cppad/cppad.hpp&gt; // http://www.coin-or.org/CppAD/
202199 # include &quot;exp_2.hpp&quot; // second order exponential approximation
203200 bool exp_2_cppad(void)
204 { bool ok = true;
205 using CppAD::AD;
206 using CppAD::vector; // can use any simple vector template class
207 using CppAD::NearEqual; // checks if values are nearly equal
208
209 // domain space vector
210 size_t n = 1; // dimension of the domain space
211 vector&lt; <a href="ad.xml" target="_top">AD</a>&lt;double&gt; &gt; X(n);
212 X[0] = .5; // value of x for this operation sequence
213
214 // declare independent variables and start recording operation sequence
215 CppAD::<a href="independent.xml" target="_top">Independent</a>(X);
216
217 // evaluate our exponential approximation
218 <a href="ad.xml" target="_top">AD</a>&lt;double&gt; x = X[0];
219 <a href="ad.xml" target="_top">AD</a>&lt;double&gt; apx = exp_2(x);
220
221 // range space vector
222 size_t m = 1; // dimension of the range space
223 vector&lt; <a href="ad.xml" target="_top">AD</a>&lt;double&gt; &gt; Y(m);
224 Y[0] = apx; // variable that represents only range space component
225
226 // Create f: X -&gt; Y corresponding to this operation sequence
227 // and stop recording. This also executes a zero order forward
228 // sweep using values in X for x.
229 CppAD::<a href="funconstruct.xml" target="_top">ADFun</a>&lt;double&gt; f(X, Y);
230
231 // first order forward sweep that computes
232 // partial of exp_2(x) with respect to x
233 vector&lt;double&gt; dx(n); // differential in domain space
234 vector&lt;double&gt; dy(m); // differential in range space
235 dx[0] = 1.; // direction for partial derivative
236 dy = f.<a href="forward.xml" target="_top">Forward</a>(1, dx);
237 double check = 1.5;
238 ok &amp;= <a href="nearequal.xml" target="_top">NearEqual</a>(dy[0], check, 1e-10, 1e-10);
239
240 // first order reverse sweep that computes the derivative
241 vector&lt;double&gt; w(m); // weights for components of the range
242 vector&lt;double&gt; dw(n); // derivative of the weighted function
243 w[0] = 1.; // there is only one weight
244 dw = f.<a href="reverse.xml" target="_top">Reverse</a>(1, w); // derivative of w[0] * exp_2(x)
245 check = 1.5; // partial of exp_2(x) with respect to x
246 ok &amp;= <a href="nearequal.xml" target="_top">NearEqual</a>(dw[0], check, 1e-10, 1e-10);
247
248 // second order forward sweep that computes
249 // second partial of exp_2(x) with respect to x
250 vector&lt;double&gt; x2(n); // second order Taylor coefficients
251 vector&lt;double&gt; y2(m);
252 x2[0] = 0.; // evaluate second partial .w.r.t. x
253 y2 = f.<a href="forward.xml" target="_top">Forward</a>(2, x2);
254 check = 0.5 * 1.; // Taylor coef is 1/2 second derivative
255 ok &amp;= <a href="nearequal.xml" target="_top">NearEqual</a>(y2[0], check, 1e-10, 1e-10);
256
257 // second order reverse sweep that computes
258 // derivative of partial of exp_2(x) w.r.t. x
259 dw.resize(2 * n); // space for first and second derivatives
260 dw = f.<a href="reverse.xml" target="_top">Reverse</a>(2, w);
261 check = 1.; // result should be second derivative
262 ok &amp;= <a href="nearequal.xml" target="_top">NearEqual</a>(dw[0*2+1], check, 1e-10, 1e-10);
263
264 return ok;
201 { bool ok = true;
202 using CppAD::AD;
203 using CppAD::vector; // can use any simple vector template class
204 using CppAD::NearEqual; // checks if values are nearly equal
205
206 // domain space vector
207 size_t n = 1; // dimension of the domain space
208 vector&lt; <a href="ad.xml" target="_top">AD</a>&lt;double&gt; &gt; X(n);
209 X[0] = .5; // value of x for this operation sequence
210
211 // declare independent variables and start recording operation sequence
212 CppAD::<a href="independent.xml" target="_top">Independent</a>(X);
213
214 // evaluate our exponential approximation
215 <a href="ad.xml" target="_top">AD</a>&lt;double&gt; x = X[0];
216 <a href="ad.xml" target="_top">AD</a>&lt;double&gt; apx = exp_2(x);
217
218 // range space vector
219 size_t m = 1; // dimension of the range space
220 vector&lt; <a href="ad.xml" target="_top">AD</a>&lt;double&gt; &gt; Y(m);
221 Y[0] = apx; // variable that represents only range space component
222
223 // Create f: X -&gt; Y corresponding to this operation sequence
224 // and stop recording. This also executes a zero order forward
225 // sweep using values in X for x.
226 CppAD::<a href="funconstruct.xml" target="_top">ADFun</a>&lt;double&gt; f(X, Y);
227
228 // first order forward sweep that computes
229 // partial of exp_2(x) with respect to x
230 vector&lt;double&gt; dx(n); // differential in domain space
231 vector&lt;double&gt; dy(m); // differential in range space
232 dx[0] = 1.; // direction for partial derivative
233 dy = f.<a href="forward.xml" target="_top">Forward</a>(1, dx);
234 double check = 1.5;
235 ok &amp;= <a href="nearequal.xml" target="_top">NearEqual</a>(dy[0], check, 1e-10, 1e-10);
236
237 // first order reverse sweep that computes the derivative
238 vector&lt;double&gt; w(m); // weights for components of the range
239 vector&lt;double&gt; dw(n); // derivative of the weighted function
240 w[0] = 1.; // there is only one weight
241 dw = f.<a href="reverse.xml" target="_top">Reverse</a>(1, w); // derivative of w[0] * exp_2(x)
242 check = 1.5; // partial of exp_2(x) with respect to x
243 ok &amp;= <a href="nearequal.xml" target="_top">NearEqual</a>(dw[0], check, 1e-10, 1e-10);
244
245 // second order forward sweep that computes
246 // second partial of exp_2(x) with respect to x
247 vector&lt;double&gt; x2(n); // second order Taylor coefficients
248 vector&lt;double&gt; y2(m);
249 x2[0] = 0.; // evaluate second partial .w.r.t. x
250 y2 = f.<a href="forward.xml" target="_top">Forward</a>(2, x2);
251 check = 0.5 * 1.; // Taylor coef is 1/2 second derivative
252 ok &amp;= <a href="nearequal.xml" target="_top">NearEqual</a>(y2[0], check, 1e-10, 1e-10);
253
254 // second order reverse sweep that computes
255 // derivative of partial of exp_2(x) w.r.t. x
256 dw.resize(2 * n); // space for first and second derivatives
257 dw = f.<a href="reverse.xml" target="_top">Reverse</a>(2, w);
258 check = 1.; // result should be second derivative
259 ok &amp;= <a href="nearequal.xml" target="_top">NearEqual</a>(dw[0*2+1], check, 1e-10, 1e-10);
260
261 return ok;
265262 }
266263
267264 </pre></font></code>
268
269265
270266 <hr/>Input File: introduction/exp_apx/exp_2_cppad.cpp
271267
7878
7979
8080 <center><b><big><big>exp_2: Verify Zero Order Forward Sweep</big></big></b></center>
81 <code><font color='blue'><pre style='display:inline'> # include &lt;cmath&gt; // for fabs function
81 <code><font color='blue'><pre style='display:inline'>
82 # include &lt;cmath&gt; // for fabs function
8283 bool exp_2_for0(double *v0) // double v0[6]
83 { bool ok = true;
84 double x = .5;
84 { bool ok = true;
85 double x = .5;
8586
86 v0[1] = x; // v1 = x
87 ok &amp;= std::fabs( v0[1] - 0.5) &lt; 1e-10;
87 v0[1] = x; // v1 = x
88 ok &amp;= std::fabs( v0[1] - 0.5) &lt; 1e-10;
8889
89 v0[2] = 1. + v0[1]; // v2 = 1 + v1
90 ok &amp;= std::fabs( v0[2] - 1.5) &lt; 1e-10;
90 v0[2] = 1. + v0[1]; // v2 = 1 + v1
91 ok &amp;= std::fabs( v0[2] - 1.5) &lt; 1e-10;
9192
92 v0[3] = v0[1] * v0[1]; // v3 = v1 * v1
93 ok &amp;= std::fabs( v0[3] - 0.25) &lt; 1e-10;
93 v0[3] = v0[1] * v0[1]; // v3 = v1 * v1
94 ok &amp;= std::fabs( v0[3] - 0.25) &lt; 1e-10;
9495
95 v0[4] = v0[3] / 2.; // v4 = v3 / 2
96 ok &amp;= std::fabs( v0[4] - 0.125) &lt; 1e-10;
96 v0[4] = v0[3] / 2.; // v4 = v3 / 2
97 ok &amp;= std::fabs( v0[4] - 0.125) &lt; 1e-10;
9798
98 v0[5] = v0[2] + v0[4]; // v5 = v2 + v4
99 ok &amp;= std::fabs( v0[5] - 1.625) &lt; 1e-10;
99 v0[5] = v0[2] + v0[4]; // v5 = v2 + v4
100 ok &amp;= std::fabs( v0[5] - 1.625) &lt; 1e-10;
100101
101 return ok;
102 return ok;
102103 }
103104 bool exp_2_for0(void)
104 { double v0[6];
105 return exp_2_for0(v0);
105 { double v0[6];
106 return exp_2_for0(v0);
106107 }
107108 </pre></font></code>
108
109109
110110 <hr/>Input File: introduction/exp_apx/exp_2_for0.cpp
111111
55 <title>exp_2: Operation Sequence and Zero Order Forward Mode</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="exp_2: Operation Sequence and Zero Order Forward Mode"/>
8 <meta name="keywords" id="keywords" content=" exp_2: operation sequence and zero order forward mode example mathematical form expansion index code sweep return value verification exercises "/>
8 <meta name="keywords" id="keywords" content=" exp_2: operation sequence zero order forward mode example mathematical form expansion index code sweep return value verification exercises "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
7474 <td>exp_2_for1.cpp</td>
7575 <td>Headings</td>
7676 </tr></table><br/>
77
78
79
8077 <center><b><big><big>exp_2: Verify First Order Forward Sweep</big></big></b></center>
81 <code><font color='blue'><pre style='display:inline'> # include &lt;cmath&gt; // prototype for fabs
78 <code><font color='blue'><pre style='display:inline'>
79 # include &lt;cmath&gt; // prototype for fabs
8280 extern bool exp_2_for0(double *v0); // computes zero order forward sweep
8381 bool exp_2_for1(double *v1) // double v1[6]
84 { bool ok = true;
85 double v0[6];
82 { bool ok = true;
83 double v0[6];
8684
87 // set the value of v0[j] for j = 1 , ... , 5
88 ok &amp;= exp_2_for0(v0);
85 // set the value of v0[j] for j = 1 , ... , 5
86 ok &amp;= exp_2_for0(v0);
8987
90 v1[1] = 1.; // v1 = x
91 ok &amp;= std::fabs( v1[1] - 1. ) &lt;= 1e-10;
88 v1[1] = 1.; // v1 = x
89 ok &amp;= std::fabs( v1[1] - 1. ) &lt;= 1e-10;
9290
93 v1[2] = v1[1]; // v2 = 1 + v1
94 ok &amp;= std::fabs( v1[2] - 1. ) &lt;= 1e-10;
91 v1[2] = v1[1]; // v2 = 1 + v1
92 ok &amp;= std::fabs( v1[2] - 1. ) &lt;= 1e-10;
9593
96 v1[3] = v1[1] * v0[1] + v0[1] * v1[1]; // v3 = v1 * v1
97 ok &amp;= std::fabs( v1[3] - 1. ) &lt;= 1e-10;
94 v1[3] = v1[1] * v0[1] + v0[1] * v1[1]; // v3 = v1 * v1
95 ok &amp;= std::fabs( v1[3] - 1. ) &lt;= 1e-10;
9896
99 v1[4] = v1[3] / 2.; // v4 = v3 / 2
100 ok &amp;= std::fabs( v1[4] - 0.5) &lt;= 1e-10;
97 v1[4] = v1[3] / 2.; // v4 = v3 / 2
98 ok &amp;= std::fabs( v1[4] - 0.5) &lt;= 1e-10;
10199
102 v1[5] = v1[2] + v1[4]; // v5 = v2 + v4
103 ok &amp;= std::fabs( v1[5] - 1.5) &lt;= 1e-10;
100 v1[5] = v1[2] + v1[4]; // v5 = v2 + v4
101 ok &amp;= std::fabs( v1[5] - 1.5) &lt;= 1e-10;
104102
105 return ok;
103 return ok;
106104 }
107105 bool exp_2_for1(void)
108 { double v1[6];
109 return exp_2_for1(v1);
106 { double v1[6];
107 return exp_2_for1(v1);
110108 }
111109 </pre></font></code>
112
113110
114111 <hr/>Input File: introduction/exp_apx/exp_2_for1.cpp
115112
7474 <td>exp_2_for2.cpp</td>
7575 <td>Headings</td>
7676 </tr></table><br/>
77
78
79
8077 <center><b><big><big>exp_2: Verify Second Order Forward Sweep</big></big></b></center>
81 <code><font color='blue'><pre style='display:inline'> # include &lt;cmath&gt; // prototype for fabs
78 <code><font color='blue'><pre style='display:inline'>
79 # include &lt;cmath&gt; // prototype for fabs
8280 extern bool exp_2_for0(double *v0); // computes zero order forward sweep
8381 extern bool exp_2_for1(double *v1); // computes first order forward sweep
8482 bool exp_2_for2(void)
85 { bool ok = true;
86 double v0[6], v1[6], v2[6];
83 { bool ok = true;
84 double v0[6], v1[6], v2[6];
8785
88 // set the value of v0[j], v1[j], for j = 1 , ... , 5
89 ok &amp;= exp_2_for0(v0);
90 ok &amp;= exp_2_for1(v1);
86 // set the value of v0[j], v1[j], for j = 1 , ... , 5
87 ok &amp;= exp_2_for0(v0);
88 ok &amp;= exp_2_for1(v1);
9189
92 v2[1] = 0.; // v1 = x
93 ok &amp;= std::fabs( v2[1] - 0. ) &lt;= 1e-10;
90 v2[1] = 0.; // v1 = x
91 ok &amp;= std::fabs( v2[1] - 0. ) &lt;= 1e-10;
9492
95 v2[2] = v2[1]; // v2 = 1 + v1
96 ok &amp;= std::fabs( v2[2] - 0. ) &lt;= 1e-10;
93 v2[2] = v2[1]; // v2 = 1 + v1
94 ok &amp;= std::fabs( v2[2] - 0. ) &lt;= 1e-10;
9795
98 v2[3] = 2.*(v0[1]*v2[1] + v1[1]*v1[1]); // v3 = v1 * v1
99 ok &amp;= std::fabs( v2[3] - 2. ) &lt;= 1e-10;
96 v2[3] = 2.*(v0[1]*v2[1] + v1[1]*v1[1]); // v3 = v1 * v1
97 ok &amp;= std::fabs( v2[3] - 2. ) &lt;= 1e-10;
10098
101 v2[4] = v2[3] / 2.; // v4 = v3 / 2
102 ok &amp;= std::fabs( v2[4] - 1. ) &lt;= 1e-10;
99 v2[4] = v2[3] / 2.; // v4 = v3 / 2
100 ok &amp;= std::fabs( v2[4] - 1. ) &lt;= 1e-10;
103101
104 v2[5] = v2[2] + v2[4]; // v5 = v2 + v4
105 ok &amp;= std::fabs( v2[5] - 1. ) &lt;= 1e-10;
102 v2[5] = v2[2] + v2[4]; // v5 = v2 + v4
103 ok &amp;= std::fabs( v2[5] - 1. ) &lt;= 1e-10;
106104
107 return ok;
105 return ok;
108106 }
109107 </pre></font></code>
110
111108
112109 <hr/>Input File: introduction/exp_apx/exp_2_for2.cpp
113110
7474 <td>exp_2_rev1.cpp</td>
7575 <td>Headings</td>
7676 </tr></table><br/>
77
78
79
8077 <center><b><big><big>exp_2: Verify First Order Reverse Sweep</big></big></b></center>
81 <code><font color='blue'><pre style='display:inline'> # include &lt;cstddef&gt; // define size_t
78 <code><font color='blue'><pre style='display:inline'>
79 # include &lt;cstddef&gt; // define size_t
8280 # include &lt;cmath&gt; // prototype for fabs
8381 extern bool exp_2_for0(double *v0); // computes zero order forward sweep
8482 bool exp_2_rev1(void)
85 { bool ok = true;
83 { bool ok = true;
8684
87 // set the value of v0[j] for j = 1 , ... , 5
88 double v0[6];
89 ok &amp;= exp_2_for0(v0);
85 // set the value of v0[j] for j = 1 , ... , 5
86 double v0[6];
87 ok &amp;= exp_2_for0(v0);
9088
91 // initial all partial derivatives as zero
92 double f_v[6];
93 size_t j;
94 for(j = 0; j &lt; 6; j++)
95 f_v[j] = 0.;
89 // initial all partial derivatives as zero
90 double f_v[6];
91 size_t j;
92 for(j = 0; j &lt; 6; j++)
93 f_v[j] = 0.;
9694
97 // set partial derivative for f5
98 f_v[5] = 1.;
99 ok &amp;= std::fabs( f_v[5] - 1. ) &lt;= 1e-10; // f5_v5
95 // set partial derivative for f5
96 f_v[5] = 1.;
97 ok &amp;= std::fabs( f_v[5] - 1. ) &lt;= 1e-10; // f5_v5
10098
101 // f4 = f5( v1 , v2 , v3 , v4 , v2 + v4 )
102 f_v[2] += f_v[5] * 1.;
103 f_v[4] += f_v[5] * 1.;
104 ok &amp;= std::fabs( f_v[2] - 1. ) &lt;= 1e-10; // f4_v2
105 ok &amp;= std::fabs( f_v[4] - 1. ) &lt;= 1e-10; // f4_v4
99 // f4 = f5( v1 , v2 , v3 , v4 , v2 + v4 )
100 f_v[2] += f_v[5] * 1.;
101 f_v[4] += f_v[5] * 1.;
102 ok &amp;= std::fabs( f_v[2] - 1. ) &lt;= 1e-10; // f4_v2
103 ok &amp;= std::fabs( f_v[4] - 1. ) &lt;= 1e-10; // f4_v4
106104
107 // f3 = f4( v1 , v2 , v3 , v3 / 2 )
108 f_v[3] += f_v[4] / 2.;
109 ok &amp;= std::fabs( f_v[3] - 0.5) &lt;= 1e-10; // f3_v3
105 // f3 = f4( v1 , v2 , v3 , v3 / 2 )
106 f_v[3] += f_v[4] / 2.;
107 ok &amp;= std::fabs( f_v[3] - 0.5) &lt;= 1e-10; // f3_v3
110108
111 // f2 = f3( v1 , v2 , v1 * v1 )
112 f_v[1] += f_v[3] * 2. * v0[1];
113 ok &amp;= std::fabs( f_v[1] - 0.5) &lt;= 1e-10; // f2_v1
109 // f2 = f3( v1 , v2 , v1 * v1 )
110 f_v[1] += f_v[3] * 2. * v0[1];
111 ok &amp;= std::fabs( f_v[1] - 0.5) &lt;= 1e-10; // f2_v1
114112
115 // f1 = f2( v1 , 1 + v1 )
116 f_v[1] += f_v[2] * 1.;
117 ok &amp;= std::fabs( f_v[1] - 1.5) &lt;= 1e-10; // f1_v1
113 // f1 = f2( v1 , 1 + v1 )
114 f_v[1] += f_v[2] * 1.;
115 ok &amp;= std::fabs( f_v[1] - 1.5) &lt;= 1e-10; // f1_v1
118116
119 return ok;
117 return ok;
120118 }
121119 </pre></font></code>
122
123120
124121 <hr/>Input File: introduction/exp_apx/exp_2_rev1.cpp
125122
7474 <td>exp_2_rev2.cpp</td>
7575 <td>Headings</td>
7676 </tr></table><br/>
77
78
79
8077 <center><b><big><big>exp_2: Verify Second Order Reverse Sweep</big></big></b></center>
81 <code><font color='blue'><pre style='display:inline'> # include &lt;cstddef&gt; // define size_t
78 <code><font color='blue'><pre style='display:inline'>
79 # include &lt;cstddef&gt; // define size_t
8280 # include &lt;cmath&gt; // prototype for fabs
8381 extern bool exp_2_for0(double *v0); // computes zero order forward sweep
8482 extern bool exp_2_for1(double *v1); // computes first order forward sweep
8583 bool exp_2_rev2(void)
86 { bool ok = true;
84 { bool ok = true;
8785
88 // set the value of v0[j], v1[j] for j = 1 , ... , 5
89 double v0[6], v1[6];
90 ok &amp;= exp_2_for0(v0);
91 ok &amp;= exp_2_for1(v1);
86 // set the value of v0[j], v1[j] for j = 1 , ... , 5
87 double v0[6], v1[6];
88 ok &amp;= exp_2_for0(v0);
89 ok &amp;= exp_2_for1(v1);
9290
93 // initial all partial derivatives as zero
94 double f_v0[6], f_v1[6];
95 size_t j;
96 for(j = 0; j &lt; 6; j++)
97 { f_v0[j] = 0.;
98 f_v1[j] = 0.;
99 }
91 // initial all partial derivatives as zero
92 double f_v0[6], f_v1[6];
93 size_t j;
94 for(j = 0; j &lt; 6; j++)
95 { f_v0[j] = 0.;
96 f_v1[j] = 0.;
97 }
10098
101 // set partial derivative for f_5
102 f_v1[5] = 1.;
103 ok &amp;= std::fabs( f_v1[5] - 1. ) &lt;= 1e-10; // partial f_5 w.r.t v_5^1
99 // set partial derivative for f_5
100 f_v1[5] = 1.;
101 ok &amp;= std::fabs( f_v1[5] - 1. ) &lt;= 1e-10; // partial f_5 w.r.t v_5^1
104102
105 // f_4 = f_5( v_1^0 , ... , v_4^1 , v_2^0 + v_4^0 , v_2^1 + v_4^1 )
106 f_v0[2] += f_v0[5] * 1.;
107 f_v0[4] += f_v0[5] * 1.;
108 f_v1[2] += f_v1[5] * 1.;
109 f_v1[4] += f_v1[5] * 1.;
110 ok &amp;= std::fabs( f_v0[2] - 0. ) &lt;= 1e-10; // partial f_4 w.r.t. v_2^0
111 ok &amp;= std::fabs( f_v0[4] - 0. ) &lt;= 1e-10; // partial f_4 w.r.t. v_4^0
112 ok &amp;= std::fabs( f_v1[2] - 1. ) &lt;= 1e-10; // partial f_4 w.r.t. v_2^1
113 ok &amp;= std::fabs( f_v1[4] - 1. ) &lt;= 1e-10; // partial f_4 w.r.t. v_4^1
103 // f_4 = f_5( v_1^0 , ... , v_4^1 , v_2^0 + v_4^0 , v_2^1 + v_4^1 )
104 f_v0[2] += f_v0[5] * 1.;
105 f_v0[4] += f_v0[5] * 1.;
106 f_v1[2] += f_v1[5] * 1.;
107 f_v1[4] += f_v1[5] * 1.;
108 ok &amp;= std::fabs( f_v0[2] - 0. ) &lt;= 1e-10; // partial f_4 w.r.t. v_2^0
109 ok &amp;= std::fabs( f_v0[4] - 0. ) &lt;= 1e-10; // partial f_4 w.r.t. v_4^0
110 ok &amp;= std::fabs( f_v1[2] - 1. ) &lt;= 1e-10; // partial f_4 w.r.t. v_2^1
111 ok &amp;= std::fabs( f_v1[4] - 1. ) &lt;= 1e-10; // partial f_4 w.r.t. v_4^1
114112
115 // f_3 = f_4( v_1^0 , ... , v_3^1, v_3^0 / 2 , v_3^1 / 2 )
116 f_v0[3] += f_v0[4] / 2.;
117 f_v1[3] += f_v1[4] / 2.;
118 ok &amp;= std::fabs( f_v0[3] - 0. ) &lt;= 1e-10; // partial f_3 w.r.t. v_3^0
119 ok &amp;= std::fabs( f_v1[3] - 0.5 ) &lt;= 1e-10; // partial f_3 w.r.t. v_3^1
113 // f_3 = f_4( v_1^0 , ... , v_3^1, v_3^0 / 2 , v_3^1 / 2 )
114 f_v0[3] += f_v0[4] / 2.;
115 f_v1[3] += f_v1[4] / 2.;
116 ok &amp;= std::fabs( f_v0[3] - 0. ) &lt;= 1e-10; // partial f_3 w.r.t. v_3^0
117 ok &amp;= std::fabs( f_v1[3] - 0.5 ) &lt;= 1e-10; // partial f_3 w.r.t. v_3^1
120118
121 // f_2 = f_3( v_1^0 , ... , v_2^1, v_1^0 * v_1^0 , 2 * v_1^0 * v_1^1 )
122 f_v0[1] += f_v0[3] * 2. * v0[1];
123 f_v0[1] += f_v1[3] * 2. * v1[1];
124 f_v1[1] += f_v1[3] * 2. * v0[1];
125 ok &amp;= std::fabs( f_v0[1] - 1. ) &lt;= 1e-10; // partial f_2 w.r.t. v_1^0
126 ok &amp;= std::fabs( f_v1[1] - 0.5 ) &lt;= 1e-10; // partial f_2 w.r.t. v_1^1
119 // f_2 = f_3( v_1^0 , ... , v_2^1, v_1^0 * v_1^0 , 2 * v_1^0 * v_1^1 )
120 f_v0[1] += f_v0[3] * 2. * v0[1];
121 f_v0[1] += f_v1[3] * 2. * v1[1];
122 f_v1[1] += f_v1[3] * 2. * v0[1];
123 ok &amp;= std::fabs( f_v0[1] - 1. ) &lt;= 1e-10; // partial f_2 w.r.t. v_1^0
124 ok &amp;= std::fabs( f_v1[1] - 0.5 ) &lt;= 1e-10; // partial f_2 w.r.t. v_1^1
127125
128 // f_1 = f_2( v_1^0 , v_1^1 , 1 + v_1^0 , v_1^1 )
129 f_v0[1] += f_v0[2] * 1.;
130 f_v1[1] += f_v1[2] * 1.;
131 ok &amp;= std::fabs( f_v0[1] - 1. ) &lt;= 1e-10; // partial f_1 w.r.t. v_1^0
132 ok &amp;= std::fabs( f_v1[1] - 1.5) &lt;= 1e-10; // partial f_1 w.r.t. v_1^1
126 // f_1 = f_2( v_1^0 , v_1^1 , 1 + v_1^0 , v_1^1 )
127 f_v0[1] += f_v0[2] * 1.;
128 f_v1[1] += f_v1[2] * 1.;
129 ok &amp;= std::fabs( f_v0[1] - 1. ) &lt;= 1e-10; // partial f_1 w.r.t. v_1^0
130 ok &amp;= std::fabs( f_v1[1] - 1.5) &lt;= 1e-10; // partial f_1 w.r.t. v_1^1
133131
134 return ok;
132 return ok;
135133 }
136134 </pre></font></code>
137
138135
139136 <hr/>Input File: introduction/exp_apx/exp_2_rev2.cpp
140137
55 <title>Correctness Tests For Exponential Approximation in Introduction</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Correctness Tests For Exponential Approximation in Introduction"/>
8 <meta name="keywords" id="keywords" content=" correctness tests for exponential approximation in introduction exp_apx main run running main.cpp "/>
8 <meta name="keywords" id="keywords" content=" correctness tests exponential approximation introduction exp_apx main run running main.cpp "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
7575 </select>
7676 </td>
7777 </tr></table><br/>
78
79
80
8178 <center><b><big><big>Correctness Tests For Exponential Approximation in Introduction</big></big></b></center>
8279 <br/>
8380 <b><big><a name="Running Tests" id="Running Tests">Running Tests</a></big></b>
55 <title>exp_eps: Test of exp_eps</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="exp_eps: Test of exp_eps"/>
8 <meta name="keywords" id="keywords" content=" exp_eps: test of exp_eps "/>
8 <meta name="keywords" id="keywords" content=" exp_eps: test exp_eps "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
9494 { double x = .5;
9595 double epsilon = .2;
9696 double check = 1 + .5 + .125; // include 1 term less than epsilon
97 bool ok = std::fabs( exp_eps(x, epsilon) - check ) &lt;= 1e-10;
97 bool ok = std::fabs( exp_eps(x, epsilon) - check ) &lt;= 1e-10;
9898 return ok;
9999 }
100100 </pre>
55 <title>An Epsilon Accurate Exponential Approximation</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="An Epsilon Accurate Exponential Approximation"/>
8 <meta name="keywords" id="keywords" content=" an epsilon accurate exponential approximation exp_eps example algorithm syntax purpose mathematical function include x y type implementation test exercises "/>
8 <meta name="keywords" id="keywords" content=" epsilon accurate exponential approximation exp_eps example algorithm syntax purpose mathematical function include x y type implementation test exercises "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
9696 </select>
9797 </td>
9898 </tr></table><br/>
99
100
101
10299 <center><b><big><big>An Epsilon Accurate Exponential Approximation</big></big></b></center>
103100 <br/>
104101 <b><big><a name="Syntax" id="Syntax">Syntax</a></big></b>
570567
571568 Suppose that we make the following call to <code><font color="blue">exp_eps</font></code>:
572569 <code><font color='blue'><pre style='display:inline'>
573 double x = 1.;
574 double epsilon = .01;
575 double y = exp_eps(x, epsilon);
570 double x = 1.;
571 double epsilon = .01;
572 double y = exp_eps(x, epsilon);
576573 </pre></font></code>
577
578574 What is the value assigned to
579575 <code><font color="blue">k</font></code>, <code><font color="blue">temp</font></code>, <code><font color="blue">term</font></code>, and <code><font color="blue">sum</font></code>
580576 the first time through the <code><font color="blue">while</font></code> loop in <a href="exp_eps.hpp.xml" target="_top"><span style='white-space: nowrap'>exp_eps.hpp</span></a>
55 <title>exp_eps: CppAD Forward and Reverse Sweeps</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="exp_eps: CppAD Forward and Reverse Sweeps"/>
8 <meta name="keywords" id="keywords" content=" exp_eps: cppad forward and reverse sweeps purpose exercises "/>
8 <meta name="keywords" id="keywords" content=" exp_eps: cppad forward reverse sweeps purpose exercises "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
8989 </select>
9090 </td>
9191 </tr></table><br/>
92
93
94
9592 <center><b><big><big>exp_eps: CppAD Forward and Reverse Sweeps</big></big></b></center>
9693 .
9794
121118 </mrow></math>
122119
123120 ,
124 of the function
121 of the function
125122
126123 <code><font color="blue"><span style='white-space: nowrap'><br/>
127124 &#xA0;&#xA0;&#xA0;&#xA0;&#xA0;exp_eps(</span></font><i><font color="black"><span style='white-space: nowrap'>x</span></font></i><font color="blue"><span style='white-space: nowrap'>,&#xA0;</span></font><i><font color="black"><span style='white-space: nowrap'>epsilon</span></font></i><font color="blue"><span style='white-space: nowrap'>)<br/>
156153 </mrow></math>
157154
158155 ,
159 of the function
156 of the function
160157
161158 <code><font color="blue"><span style='white-space: nowrap'><br/>
162159 &#xA0;&#xA0;&#xA0;&#xA0;&#xA0;exp_eps(</span></font><i><font color="black"><span style='white-space: nowrap'>x</span></font></i><font color="blue"><span style='white-space: nowrap'>,&#xA0;</span></font><i><font color="black"><span style='white-space: nowrap'>epsilon</span></font></i><font color="blue"><span style='white-space: nowrap'>)<br/>
184181 </mrow></math>
185182
186183 ,
187 of the function corresponding to the operation sequence
184 of the function corresponding to the operation sequence
188185 for
189186 <math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow>
190187 <mi mathvariant='italic'>x</mi>
213210 </li></ol>
214211
215212 <code><font color='blue'><pre style='display:inline'>
216 # include &lt;cppad/cppad.hpp&gt; // http://www.coin-or.org/CppAD/
213 # include &lt;cppad/cppad.hpp&gt; // http://www.coin-or.org/CppAD/
217214 # include &quot;exp_eps.hpp&quot; // our example exponential function approximation
218215 bool exp_eps_cppad(void)
219 { bool ok = true;
220 using CppAD::AD;
221 using CppAD::vector; // can use any simple vector template class
222 using CppAD::NearEqual; // checks if values are nearly equal
223
224 // domain space vector
225 size_t n = 2; // dimension of the domain space
226 vector&lt; <a href="ad.xml" target="_top">AD</a>&lt;double&gt; &gt; U(n);
227 U[0] = .5; // value of x for this operation sequence
228 U[1] = .2; // value of e for this operation sequence
229
230 // declare independent variables and start recording operation sequence
231 CppAD::<a href="independent.xml" target="_top">Independent</a>(U);
232
233 // evaluate our exponential approximation
234 <a href="ad.xml" target="_top">AD</a>&lt;double&gt; x = U[0];
235 <a href="ad.xml" target="_top">AD</a>&lt;double&gt; epsilon = U[1];
236 <a href="ad.xml" target="_top">AD</a>&lt;double&gt; apx = exp_eps(x, epsilon);
237
238 // range space vector
239 size_t m = 1; // dimension of the range space
240 vector&lt; <a href="ad.xml" target="_top">AD</a>&lt;double&gt; &gt; Y(m);
241 Y[0] = apx; // variable that represents only range space component
242
243 // Create f: U -&gt; Y corresponding to this operation sequence
244 // and stop recording. This also executes a zero order forward
245 // mode sweep using values in U for x and e.
246 CppAD::<a href="funconstruct.xml" target="_top">ADFun</a>&lt;double&gt; f(U, Y);
247
248 // first order forward mode sweep that computes partial w.r.t x
249 vector&lt;double&gt; du(n); // differential in domain space
250 vector&lt;double&gt; dy(m); // differential in range space
251 du[0] = 1.; // x direction in domain space
252 du[1] = 0.;
253 dy = f.<a href="forward.xml" target="_top">Forward</a>(1, du); // partial w.r.t. x
254 double check = 1.5;
255 ok &amp;= <a href="nearequal.xml" target="_top">NearEqual</a>(dy[0], check, 1e-10, 1e-10);
256
257 // first order reverse mode sweep that computes the derivative
258 vector&lt;double&gt; w(m); // weights for components of the range
259 vector&lt;double&gt; dw(n); // derivative of the weighted function
260 w[0] = 1.; // there is only one weight
261 dw = f.<a href="reverse.xml" target="_top">Reverse</a>(1, w); // derivative of w[0] * exp_eps(x, epsilon)
262 check = 1.5; // partial w.r.t. x
263 ok &amp;= <a href="nearequal.xml" target="_top">NearEqual</a>(dw[0], check, 1e-10, 1e-10);
264 check = 0.; // partial w.r.t. epsilon
265 ok &amp;= <a href="nearequal.xml" target="_top">NearEqual</a>(dw[1], check, 1e-10, 1e-10);
266
267 // second order forward sweep that computes
268 // second partial of exp_eps(x, epsilon) w.r.t. x
269 vector&lt;double&gt; x2(n); // second order Taylor coefficients
270 vector&lt;double&gt; y2(m);
271 x2[0] = 0.; // evaluate partial w.r.t x
272 x2[1] = 0.;
273 y2 = f.<a href="forward.xml" target="_top">Forward</a>(2, x2);
274 check = 0.5 * 1.; // Taylor coef is 1/2 second derivative
275 ok &amp;= <a href="nearequal.xml" target="_top">NearEqual</a>(y2[0], check, 1e-10, 1e-10);
276
277 // second order reverse sweep that computes
278 // derivative of partial of exp_eps(x, epsilon) w.r.t. x
279 dw.resize(2 * n); // space for first and second derivative
280 dw = f.<a href="reverse.xml" target="_top">Reverse</a>(2, w);
281 check = 1.; // result should be second derivative
282 ok &amp;= <a href="nearequal.xml" target="_top">NearEqual</a>(dw[0*2+1], check, 1e-10, 1e-10);
283
284 return ok;
216 { bool ok = true;
217 using CppAD::AD;
218 using CppAD::vector; // can use any simple vector template class
219 using CppAD::NearEqual; // checks if values are nearly equal
220
221 // domain space vector
222 size_t n = 2; // dimension of the domain space
223 vector&lt; <a href="ad.xml" target="_top">AD</a>&lt;double&gt; &gt; U(n);
224 U[0] = .5; // value of x for this operation sequence
225 U[1] = .2; // value of e for this operation sequence
226
227 // declare independent variables and start recording operation sequence
228 CppAD::<a href="independent.xml" target="_top">Independent</a>(U);
229
230 // evaluate our exponential approximation
231 <a href="ad.xml" target="_top">AD</a>&lt;double&gt; x = U[0];
232 <a href="ad.xml" target="_top">AD</a>&lt;double&gt; epsilon = U[1];
233 <a href="ad.xml" target="_top">AD</a>&lt;double&gt; apx = exp_eps(x, epsilon);
234
235 // range space vector
236 size_t m = 1; // dimension of the range space
237 vector&lt; <a href="ad.xml" target="_top">AD</a>&lt;double&gt; &gt; Y(m);
238 Y[0] = apx; // variable that represents only range space component
239
240 // Create f: U -&gt; Y corresponding to this operation sequence
241 // and stop recording. This also executes a zero order forward
242 // mode sweep using values in U for x and e.
243 CppAD::<a href="funconstruct.xml" target="_top">ADFun</a>&lt;double&gt; f(U, Y);
244
245 // first order forward mode sweep that computes partial w.r.t x
246 vector&lt;double&gt; du(n); // differential in domain space
247 vector&lt;double&gt; dy(m); // differential in range space
248 du[0] = 1.; // x direction in domain space
249 du[1] = 0.;
250 dy = f.<a href="forward.xml" target="_top">Forward</a>(1, du); // partial w.r.t. x
251 double check = 1.5;
252 ok &amp;= <a href="nearequal.xml" target="_top">NearEqual</a>(dy[0], check, 1e-10, 1e-10);
253
254 // first order reverse mode sweep that computes the derivative
255 vector&lt;double&gt; w(m); // weights for components of the range
256 vector&lt;double&gt; dw(n); // derivative of the weighted function
257 w[0] = 1.; // there is only one weight
258 dw = f.<a href="reverse.xml" target="_top">Reverse</a>(1, w); // derivative of w[0] * exp_eps(x, epsilon)
259 check = 1.5; // partial w.r.t. x
260 ok &amp;= <a href="nearequal.xml" target="_top">NearEqual</a>(dw[0], check, 1e-10, 1e-10);
261 check = 0.; // partial w.r.t. epsilon
262 ok &amp;= <a href="nearequal.xml" target="_top">NearEqual</a>(dw[1], check, 1e-10, 1e-10);
263
264 // second order forward sweep that computes
265 // second partial of exp_eps(x, epsilon) w.r.t. x
266 vector&lt;double&gt; x2(n); // second order Taylor coefficients
267 vector&lt;double&gt; y2(m);
268 x2[0] = 0.; // evaluate partial w.r.t x
269 x2[1] = 0.;
270 y2 = f.<a href="forward.xml" target="_top">Forward</a>(2, x2);
271 check = 0.5 * 1.; // Taylor coef is 1/2 second derivative
272 ok &amp;= <a href="nearequal.xml" target="_top">NearEqual</a>(y2[0], check, 1e-10, 1e-10);
273
274 // second order reverse sweep that computes
275 // derivative of partial of exp_eps(x, epsilon) w.r.t. x
276 dw.resize(2 * n); // space for first and second derivative
277 dw = f.<a href="reverse.xml" target="_top">Reverse</a>(2, w);
278 check = 1.; // result should be second derivative
279 ok &amp;= <a href="nearequal.xml" target="_top">NearEqual</a>(dw[0*2+1], check, 1e-10, 1e-10);
280
281 return ok;
285282 }
286283 </pre></font></code>
287284
288
289285 <hr/>Input File: introduction/exp_apx/exp_eps_cppad.cpp
290286
291287 </body>
7979
8080
8181 <center><b><big><big>exp_eps: Verify Zero Order Forward Sweep</big></big></b></center>
82 <code><font color='blue'><pre style='display:inline'> # include &lt;cmath&gt; // for fabs function
82 <code><font color='blue'><pre style='display:inline'>
83 # include &lt;cmath&gt; // for fabs function
8384 bool exp_eps_for0(double *v0) // double v0[8]
84 { bool ok = true;
85 double x = .5;
85 { bool ok = true;
86 double x = .5;
8687
87 v0[1] = x; // abs_x = x;
88 ok &amp;= std::fabs( v0[1] - 0.5) &lt; 1e-10;
88 v0[1] = x; // abs_x = x;
89 ok &amp;= std::fabs( v0[1] - 0.5) &lt; 1e-10;
8990
90 v0[2] = 1. * v0[1]; // temp = term * abs_x;
91 ok &amp;= std::fabs( v0[2] - 0.5) &lt; 1e-10;
91 v0[2] = 1. * v0[1]; // temp = term * abs_x;
92 ok &amp;= std::fabs( v0[2] - 0.5) &lt; 1e-10;
9293
93 v0[3] = v0[2] / 1.; // term = temp / Type(k);
94 ok &amp;= std::fabs( v0[3] - 0.5) &lt; 1e-10;
94 v0[3] = v0[2] / 1.; // term = temp / Type(k);
95 ok &amp;= std::fabs( v0[3] - 0.5) &lt; 1e-10;
9596
96 v0[4] = 1. + v0[3]; // sum = sum + term;
97 ok &amp;= std::fabs( v0[4] - 1.5) &lt; 1e-10;
97 v0[4] = 1. + v0[3]; // sum = sum + term;
98 ok &amp;= std::fabs( v0[4] - 1.5) &lt; 1e-10;
9899
99 v0[5] = v0[3] * v0[1]; // temp = term * abs_x;
100 ok &amp;= std::fabs( v0[5] - 0.25) &lt; 1e-10;
100 v0[5] = v0[3] * v0[1]; // temp = term * abs_x;
101 ok &amp;= std::fabs( v0[5] - 0.25) &lt; 1e-10;
101102
102 v0[6] = v0[5] / 2.; // term = temp / Type(k);
103 ok &amp;= std::fabs( v0[6] - 0.125) &lt; 1e-10;
103 v0[6] = v0[5] / 2.; // term = temp / Type(k);
104 ok &amp;= std::fabs( v0[6] - 0.125) &lt; 1e-10;
104105
105 v0[7] = v0[4] + v0[6]; // sum = sum + term;
106 ok &amp;= std::fabs( v0[7] - 1.625) &lt; 1e-10;
106 v0[7] = v0[4] + v0[6]; // sum = sum + term;
107 ok &amp;= std::fabs( v0[7] - 1.625) &lt; 1e-10;
107108
108 return ok;
109 return ok;
109110 }
110111 bool exp_eps_for0(void)
111 { double v0[8];
112 return exp_eps_for0(v0);
112 { double v0[8];
113 return exp_eps_for0(v0);
113114 }
114115 </pre></font></code>
115
116116
117117 <hr/>Input File: introduction/exp_apx/exp_eps_for0.cpp
118118
55 <title>exp_eps: Operation Sequence and Zero Order Forward Sweep</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="exp_eps: Operation Sequence and Zero Order Forward Sweep"/>
8 <meta name="keywords" id="keywords" content=" exp_eps: operation sequence and zero order forward sweep example mathematical form variable parameter index code return value comparisons verification exercises "/>
8 <meta name="keywords" id="keywords" content=" exp_eps: operation sequence zero order forward sweep example mathematical form variable parameter index code return value comparisons verification exercises "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
562562 were a much smaller or much larger value,
563563 the results of the following comparisons could be different:
564564 <code><font color='blue'><pre style='display:inline'>
565 if( Type(0) &gt; x )
566 while(term &gt; epsilon)
565 if( Type(0) &gt; x )
566 while(term &gt; epsilon)
567567 </pre></font></code>
568
569568 This in turn would result in a different operation sequence.
570569 Thus the operation sequence above only corresponds to
571570 <a href="exp_eps.hpp.xml" target="_top"><span style='white-space: nowrap'>exp_eps.hpp</span></a>
7474 <td>exp_eps_for1.cpp</td>
7575 <td>Headings</td>
7676 </tr></table><br/>
77
78
79
8077 <center><b><big><big>exp_eps: Verify First Order Forward Sweep</big></big></b></center>
81 <code><font color='blue'><pre style='display:inline'> # include &lt;cmath&gt; // for fabs function
78 <code><font color='blue'><pre style='display:inline'>
79 # include &lt;cmath&gt; // for fabs function
8280 extern bool exp_eps_for0(double *v0); // computes zero order forward sweep
8381 bool exp_eps_for1(double *v1) // double v[8]
84 { bool ok = true;
85 double v0[8];
82 { bool ok = true;
83 double v0[8];
8684
87 // set the value of v0[j] for j = 1 , ... , 7
88 ok &amp;= exp_eps_for0(v0);
85 // set the value of v0[j] for j = 1 , ... , 7
86 ok &amp;= exp_eps_for0(v0);
8987
90 v1[1] = 1.; // v1 = x
91 ok &amp;= std::fabs( v1[1] - 1. ) &lt;= 1e-10;
88 v1[1] = 1.; // v1 = x
89 ok &amp;= std::fabs( v1[1] - 1. ) &lt;= 1e-10;
9290
93 v1[2] = 1. * v1[1]; // v2 = 1 * v1
94 ok &amp;= std::fabs( v1[2] - 1. ) &lt;= 1e-10;
91 v1[2] = 1. * v1[1]; // v2 = 1 * v1
92 ok &amp;= std::fabs( v1[2] - 1. ) &lt;= 1e-10;
9593
96 v1[3] = v1[2] / 1.; // v3 = v2 / 1
97 ok &amp;= std::fabs( v1[3] - 1. ) &lt;= 1e-10;
94 v1[3] = v1[2] / 1.; // v3 = v2 / 1
95 ok &amp;= std::fabs( v1[3] - 1. ) &lt;= 1e-10;
9896
99 v1[4] = v1[3]; // v4 = 1 + v3
100 ok &amp;= std::fabs( v1[4] - 1. ) &lt;= 1e-10;
97 v1[4] = v1[3]; // v4 = 1 + v3
98 ok &amp;= std::fabs( v1[4] - 1. ) &lt;= 1e-10;
10199
102 v1[5] = v1[3] * v0[1] + v0[3] * v1[1]; // v5 = v3 * v1
103 ok &amp;= std::fabs( v1[5] - 1. ) &lt;= 1e-10;
100 v1[5] = v1[3] * v0[1] + v0[3] * v1[1]; // v5 = v3 * v1
101 ok &amp;= std::fabs( v1[5] - 1. ) &lt;= 1e-10;
104102
105 v1[6] = v1[5] / 2.; // v6 = v5 / 2
106 ok &amp;= std::fabs( v1[6] - 0.5 ) &lt;= 1e-10;
103 v1[6] = v1[5] / 2.; // v6 = v5 / 2
104 ok &amp;= std::fabs( v1[6] - 0.5 ) &lt;= 1e-10;
107105
108 v1[7] = v1[4] + v1[6]; // v7 = v4 + v6
109 ok &amp;= std::fabs( v1[7] - 1.5 ) &lt;= 1e-10;
106 v1[7] = v1[4] + v1[6]; // v7 = v4 + v6
107 ok &amp;= std::fabs( v1[7] - 1.5 ) &lt;= 1e-10;
110108
111 return ok;
109 return ok;
112110 }
113111 bool exp_eps_for1(void)
114 { double v1[8];
115 return exp_eps_for1(v1);
112 { double v1[8];
113 return exp_eps_for1(v1);
116114 }
117115 </pre></font></code>
118
119116
120117 <hr/>Input File: introduction/exp_apx/exp_eps_for1.cpp
121118
7474 <td>exp_eps_for2.cpp</td>
7575 <td>Headings</td>
7676 </tr></table><br/>
77
78
79
8077 <center><b><big><big>exp_eps: Verify Second Order Forward Sweep</big></big></b></center>
81 <code><font color='blue'><pre style='display:inline'> # include &lt;cmath&gt; // for fabs function
78 <code><font color='blue'><pre style='display:inline'>
79 # include &lt;cmath&gt; // for fabs function
8280 extern bool exp_eps_for0(double *v0); // computes zero order forward sweep
8381 extern bool exp_eps_for1(double *v1); // computes first order forward sweep
8482 bool exp_eps_for2(void)
85 { bool ok = true;
86 double v0[8], v1[8], v2[8];
83 { bool ok = true;
84 double v0[8], v1[8], v2[8];
8785
88 // set the value of v0[j], v1[j] for j = 1 , ... , 7
89 ok &amp;= exp_eps_for0(v0);
90 ok &amp;= exp_eps_for1(v1);
86 // set the value of v0[j], v1[j] for j = 1 , ... , 7
87 ok &amp;= exp_eps_for0(v0);
88 ok &amp;= exp_eps_for1(v1);
9189
92 v2[1] = 0.; // v1 = x
93 ok &amp;= std::fabs( v2[1] - 0. ) &lt;= 1e-10;
90 v2[1] = 0.; // v1 = x
91 ok &amp;= std::fabs( v2[1] - 0. ) &lt;= 1e-10;
9492
95 v2[2] = 1. * v2[1]; // v2 = 1 * v1
96 ok &amp;= std::fabs( v2[2] - 0. ) &lt;= 1e-10;
93 v2[2] = 1. * v2[1]; // v2 = 1 * v1
94 ok &amp;= std::fabs( v2[2] - 0. ) &lt;= 1e-10;
9795
98 v2[3] = v2[2] / 1.; // v3 = v2 / 1
99 ok &amp;= std::fabs( v2[3] - 0. ) &lt;= 1e-10;
96 v2[3] = v2[2] / 1.; // v3 = v2 / 1
97 ok &amp;= std::fabs( v2[3] - 0. ) &lt;= 1e-10;
10098
101 v2[4] = v2[3]; // v4 = 1 + v3
102 ok &amp;= std::fabs( v2[4] - 0. ) &lt;= 1e-10;
99 v2[4] = v2[3]; // v4 = 1 + v3
100 ok &amp;= std::fabs( v2[4] - 0. ) &lt;= 1e-10;
103101
104 v2[5] = v2[3] * v0[1] + 2. * v1[3] * v1[1] // v5 = v3 * v1
105 + v0[3] * v2[1];
106 ok &amp;= std::fabs( v2[5] - 2. ) &lt;= 1e-10;
102 v2[5] = v2[3] * v0[1] + 2. * v1[3] * v1[1] // v5 = v3 * v1
103 + v0[3] * v2[1];
104 ok &amp;= std::fabs( v2[5] - 2. ) &lt;= 1e-10;
107105
108 v2[6] = v2[5] / 2.; // v6 = v5 / 2
109 ok &amp;= std::fabs( v2[6] - 1. ) &lt;= 1e-10;
106 v2[6] = v2[5] / 2.; // v6 = v5 / 2
107 ok &amp;= std::fabs( v2[6] - 1. ) &lt;= 1e-10;
110108
111 v2[7] = v2[4] + v2[6]; // v7 = v4 + v6
112 ok &amp;= std::fabs( v2[7] - 1. ) &lt;= 1e-10;
109 v2[7] = v2[4] + v2[6]; // v7 = v4 + v6
110 ok &amp;= std::fabs( v2[7] - 1. ) &lt;= 1e-10;
113111
114 return ok;
112 return ok;
115113 }
116114 </pre></font></code>
117
118115
119116 <hr/>Input File: introduction/exp_apx/exp_eps_for2.cpp
120117
7474 <td>exp_eps_rev1.cpp</td>
7575 <td>Headings</td>
7676 </tr></table><br/>
77
78
79
8077 <center><b><big><big>exp_eps: Verify First Order Reverse Sweep</big></big></b></center>
81 <code><font color='blue'><pre style='display:inline'> # include &lt;cstddef&gt; // define size_t
78 <code><font color='blue'><pre style='display:inline'>
79 # include &lt;cstddef&gt; // define size_t
8280 # include &lt;cmath&gt; // for fabs function
8381 extern bool exp_eps_for0(double *v0); // computes zero order forward sweep
8482 bool exp_eps_rev1(void)
85 { bool ok = true;
83 { bool ok = true;
8684
87 // set the value of v0[j] for j = 1 , ... , 7
88 double v0[8];
89 ok &amp;= exp_eps_for0(v0);
85 // set the value of v0[j] for j = 1 , ... , 7
86 double v0[8];
87 ok &amp;= exp_eps_for0(v0);
9088
91 // initial all partial derivatives as zero
92 double f_v[8];
93 size_t j;
94 for(j = 0; j &lt; 8; j++)
95 f_v[j] = 0.;
89 // initial all partial derivatives as zero
90 double f_v[8];
91 size_t j;
92 for(j = 0; j &lt; 8; j++)
93 f_v[j] = 0.;
9694
97 // set partial derivative for f7
98 f_v[7] = 1.;
99 ok &amp;= std::fabs( f_v[7] - 1. ) &lt;= 1e-10; // f7_v7
95 // set partial derivative for f7
96 f_v[7] = 1.;
97 ok &amp;= std::fabs( f_v[7] - 1. ) &lt;= 1e-10; // f7_v7
10098
101 // f6( v1 , v2 , v3 , v4 , v5 , v6 )
102 f_v[4] += f_v[7] * 1.;
103 f_v[6] += f_v[7] * 1.;
104 ok &amp;= std::fabs( f_v[4] - 1. ) &lt;= 1e-10; // f6_v4
105 ok &amp;= std::fabs( f_v[6] - 1. ) &lt;= 1e-10; // f6_v6
99 // f6( v1 , v2 , v3 , v4 , v5 , v6 )
100 f_v[4] += f_v[7] * 1.;
101 f_v[6] += f_v[7] * 1.;
102 ok &amp;= std::fabs( f_v[4] - 1. ) &lt;= 1e-10; // f6_v4
103 ok &amp;= std::fabs( f_v[6] - 1. ) &lt;= 1e-10; // f6_v6
106104
107 // f5( v1 , v2 , v3 , v4 , v5 )
108 f_v[5] += f_v[6] / 2.;
109 ok &amp;= std::fabs( f_v[5] - 0.5 ) &lt;= 1e-10; // f5_v5
105 // f5( v1 , v2 , v3 , v4 , v5 )
106 f_v[5] += f_v[6] / 2.;
107 ok &amp;= std::fabs( f_v[5] - 0.5 ) &lt;= 1e-10; // f5_v5
110108
111 // f4( v1 , v2 , v3 , v4 )
112 f_v[1] += f_v[5] * v0[3];
113 f_v[3] += f_v[5] * v0[1];
114 ok &amp;= std::fabs( f_v[1] - 0.25) &lt;= 1e-10; // f4_v1
115 ok &amp;= std::fabs( f_v[3] - 0.25) &lt;= 1e-10; // f4_v3
109 // f4( v1 , v2 , v3 , v4 )
110 f_v[1] += f_v[5] * v0[3];
111 f_v[3] += f_v[5] * v0[1];
112 ok &amp;= std::fabs( f_v[1] - 0.25) &lt;= 1e-10; // f4_v1
113 ok &amp;= std::fabs( f_v[3] - 0.25) &lt;= 1e-10; // f4_v3
116114
117 // f3( v1 , v2 , v3 )
118 f_v[3] += f_v[4] * 1.;
119 ok &amp;= std::fabs( f_v[3] - 1.25) &lt;= 1e-10; // f3_v3
115 // f3( v1 , v2 , v3 )
116 f_v[3] += f_v[4] * 1.;
117 ok &amp;= std::fabs( f_v[3] - 1.25) &lt;= 1e-10; // f3_v3
120118
121 // f2( v1 , v2 )
122 f_v[2] += f_v[3] / 1.;
123 ok &amp;= std::fabs( f_v[2] - 1.25) &lt;= 1e-10; // f2_v2
119 // f2( v1 , v2 )
120 f_v[2] += f_v[3] / 1.;
121 ok &amp;= std::fabs( f_v[2] - 1.25) &lt;= 1e-10; // f2_v2
124122
125 // f1( v1 )
126 f_v[1] += f_v[2] * 1.;
127 ok &amp;= std::fabs( f_v[1] - 1.5 ) &lt;= 1e-10; // f1_v2
123 // f1( v1 )
124 f_v[1] += f_v[2] * 1.;
125 ok &amp;= std::fabs( f_v[1] - 1.5 ) &lt;= 1e-10; // f1_v2
128126
129 return ok;
127 return ok;
130128 }
131129 </pre></font></code>
132
133130
134131 <hr/>Input File: introduction/exp_apx/exp_eps_rev1.cpp
135132
7474 <td>exp_eps_rev2.cpp</td>
7575 <td>Headings</td>
7676 </tr></table><br/>
77
78
79
8077 <center><b><big><big>exp_eps: Verify Second Order Reverse Sweep</big></big></b></center>
81 <code><font color='blue'><pre style='display:inline'> # include &lt;cstddef&gt; // define size_t
78 <code><font color='blue'><pre style='display:inline'>
79 # include &lt;cstddef&gt; // define size_t
8280 # include &lt;cmath&gt; // for fabs function
8381 extern bool exp_eps_for0(double *v0); // computes zero order forward sweep
8482 extern bool exp_eps_for1(double *v1); // computes first order forward sweep
8583 bool exp_eps_rev2(void)
86 { bool ok = true;
84 { bool ok = true;
8785
88 // set the value of v0[j], v1[j] for j = 1 , ... , 7
89 double v0[8], v1[8];
90 ok &amp;= exp_eps_for0(v0);
91 ok &amp;= exp_eps_for1(v1);
86 // set the value of v0[j], v1[j] for j = 1 , ... , 7
87 double v0[8], v1[8];
88 ok &amp;= exp_eps_for0(v0);
89 ok &amp;= exp_eps_for1(v1);
9290
93 // initial all partial derivatives as zero
94 double f_v0[8], f_v1[8];
95 size_t j;
96 for(j = 0; j &lt; 8; j++)
97 { f_v0[j] = 0.;
98 f_v1[j] = 0.;
99 }
91 // initial all partial derivatives as zero
92 double f_v0[8], f_v1[8];
93 size_t j;
94 for(j = 0; j &lt; 8; j++)
95 { f_v0[j] = 0.;
96 f_v1[j] = 0.;
97 }
10098
101 // set partial derivative for f_7
102 f_v1[7] = 1.;
103 ok &amp;= std::fabs( f_v1[7] - 1. ) &lt;= 1e-10; // partial f_7 w.r.t. v_7^1
99 // set partial derivative for f_7
100 f_v1[7] = 1.;
101 ok &amp;= std::fabs( f_v1[7] - 1. ) &lt;= 1e-10; // partial f_7 w.r.t. v_7^1
104102
105 // f_6 = f_7( v_1^0 , ... , v_6^1 , v_4^0 + v_6^0, v_4^1 , v_6^1 )
106 f_v0[4] += f_v0[7];
107 f_v0[6] += f_v0[7];
108 f_v1[4] += f_v1[7];
109 f_v1[6] += f_v1[7];
110 ok &amp;= std::fabs( f_v0[4] - 0. ) &lt;= 1e-10; // partial f_6 w.r.t. v_4^0
111 ok &amp;= std::fabs( f_v0[6] - 0. ) &lt;= 1e-10; // partial f_6 w.r.t. v_6^0
112 ok &amp;= std::fabs( f_v1[4] - 1. ) &lt;= 1e-10; // partial f_6 w.r.t. v_4^1
113 ok &amp;= std::fabs( f_v1[6] - 1. ) &lt;= 1e-10; // partial f_6 w.r.t. v_6^1
103 // f_6 = f_7( v_1^0 , ... , v_6^1 , v_4^0 + v_6^0, v_4^1 , v_6^1 )
104 f_v0[4] += f_v0[7];
105 f_v0[6] += f_v0[7];
106 f_v1[4] += f_v1[7];
107 f_v1[6] += f_v1[7];
108 ok &amp;= std::fabs( f_v0[4] - 0. ) &lt;= 1e-10; // partial f_6 w.r.t. v_4^0
109 ok &amp;= std::fabs( f_v0[6] - 0. ) &lt;= 1e-10; // partial f_6 w.r.t. v_6^0
110 ok &amp;= std::fabs( f_v1[4] - 1. ) &lt;= 1e-10; // partial f_6 w.r.t. v_4^1
111 ok &amp;= std::fabs( f_v1[6] - 1. ) &lt;= 1e-10; // partial f_6 w.r.t. v_6^1
114112
115 // f_5 = f_6( v_1^0 , ... , v_5^1 , v_5^0 / 2 , v_5^1 / 2 )
116 f_v0[5] += f_v0[6] / 2.;
117 f_v1[5] += f_v1[6] / 2.;
118 ok &amp;= std::fabs( f_v0[5] - 0. ) &lt;= 1e-10; // partial f_5 w.r.t. v_5^0
119 ok &amp;= std::fabs( f_v1[5] - 0.5 ) &lt;= 1e-10; // partial f_5 w.r.t. v_5^1
113 // f_5 = f_6( v_1^0 , ... , v_5^1 , v_5^0 / 2 , v_5^1 / 2 )
114 f_v0[5] += f_v0[6] / 2.;
115 f_v1[5] += f_v1[6] / 2.;
116 ok &amp;= std::fabs( f_v0[5] - 0. ) &lt;= 1e-10; // partial f_5 w.r.t. v_5^0
117 ok &amp;= std::fabs( f_v1[5] - 0.5 ) &lt;= 1e-10; // partial f_5 w.r.t. v_5^1
120118
121 // f_4 = f_5( v_1^0 , ... , v_4^1 , v_3^0 * v_1^0 ,
122 // v_3^1 * v_1^0 + v_3^0 * v_1^1 )
123 f_v0[1] += f_v0[5] * v0[3] + f_v1[5] * v1[3];
124 f_v0[3] += f_v0[5] * v0[1] + f_v1[5] * v1[1];
125 f_v1[1] += f_v1[5] * v0[3];
126 f_v1[3] += f_v1[5] * v0[1];
127 ok &amp;= std::fabs( f_v0[1] - 0.5 ) &lt;= 1e-10; // partial f_4 w.r.t. v_1^0
128 ok &amp;= std::fabs( f_v0[3] - 0.5 ) &lt;= 1e-10; // partial f_4 w.r.t. v_3^0
129 ok &amp;= std::fabs( f_v1[1] - 0.25 ) &lt;= 1e-10; // partial f_4 w.r.t. v_1^1
130 ok &amp;= std::fabs( f_v1[3] - 0.25 ) &lt;= 1e-10; // partial f_4 w.r.t. v_3^1
119 // f_4 = f_5( v_1^0 , ... , v_4^1 , v_3^0 * v_1^0 ,
120 // v_3^1 * v_1^0 + v_3^0 * v_1^1 )
121 f_v0[1] += f_v0[5] * v0[3] + f_v1[5] * v1[3];
122 f_v0[3] += f_v0[5] * v0[1] + f_v1[5] * v1[1];
123 f_v1[1] += f_v1[5] * v0[3];
124 f_v1[3] += f_v1[5] * v0[1];
125 ok &amp;= std::fabs( f_v0[1] - 0.5 ) &lt;= 1e-10; // partial f_4 w.r.t. v_1^0
126 ok &amp;= std::fabs( f_v0[3] - 0.5 ) &lt;= 1e-10; // partial f_4 w.r.t. v_3^0
127 ok &amp;= std::fabs( f_v1[1] - 0.25 ) &lt;= 1e-10; // partial f_4 w.r.t. v_1^1
128 ok &amp;= std::fabs( f_v1[3] - 0.25 ) &lt;= 1e-10; // partial f_4 w.r.t. v_3^1
131129
132 // f_3 = f_4( v_1^0 , ... , v_3^1 , 1 + v_3^0 , v_3^1 )
133 f_v0[3] += f_v0[4];
134 f_v1[3] += f_v1[4];
135 ok &amp;= std::fabs( f_v0[3] - 0.5 ) &lt;= 1e-10; // partial f_3 w.r.t. v_3^0
136 ok &amp;= std::fabs( f_v1[3] - 1.25) &lt;= 1e-10; // partial f_3 w.r.t. v_3^1
130 // f_3 = f_4( v_1^0 , ... , v_3^1 , 1 + v_3^0 , v_3^1 )
131 f_v0[3] += f_v0[4];
132 f_v1[3] += f_v1[4];
133 ok &amp;= std::fabs( f_v0[3] - 0.5 ) &lt;= 1e-10; // partial f_3 w.r.t. v_3^0
134 ok &amp;= std::fabs( f_v1[3] - 1.25) &lt;= 1e-10; // partial f_3 w.r.t. v_3^1
137135
138 // f_2 = f_3( v_1^0 , ... , v_2^1 , v_2^0 , v_2^1 )
139 f_v0[2] += f_v0[3];
140 f_v1[2] += f_v1[3];
141 ok &amp;= std::fabs( f_v0[2] - 0.5 ) &lt;= 1e-10; // partial f_2 w.r.t. v_2^0
142 ok &amp;= std::fabs( f_v1[2] - 1.25) &lt;= 1e-10; // partial f_2 w.r.t. v_2^1
136 // f_2 = f_3( v_1^0 , ... , v_2^1 , v_2^0 , v_2^1 )
137 f_v0[2] += f_v0[3];
138 f_v1[2] += f_v1[3];
139 ok &amp;= std::fabs( f_v0[2] - 0.5 ) &lt;= 1e-10; // partial f_2 w.r.t. v_2^0
140 ok &amp;= std::fabs( f_v1[2] - 1.25) &lt;= 1e-10; // partial f_2 w.r.t. v_2^1
143141
144 // f_1 = f_2 ( v_1^0 , v_2^0 , v_1^0 , v_2^0 )
145 f_v0[1] += f_v0[2];
146 f_v1[1] += f_v1[2];
147 ok &amp;= std::fabs( f_v0[1] - 1. ) &lt;= 1e-10; // partial f_1 w.r.t. v_1^0
148 ok &amp;= std::fabs( f_v1[1] - 1.5 ) &lt;= 1e-10; // partial f_1 w.r.t. v_1^1
142 // f_1 = f_2 ( v_1^0 , v_2^0 , v_1^0 , v_2^0 )
143 f_v0[1] += f_v0[2];
144 f_v1[1] += f_v1[2];
145 ok &amp;= std::fabs( f_v0[1] - 1. ) &lt;= 1e-10; // partial f_1 w.r.t. v_1^0
146 ok &amp;= std::fabs( f_v1[1] - 1.5 ) &lt;= 1e-10; // partial f_1 w.r.t. v_1^1
149147
150 return ok;
148 return ok;
151149 }
152150 </pre></font></code>
153
154151
155152 <hr/>Input File: introduction/exp_apx/exp_eps_rev2.cpp
156153
55 <title>The AD exp Function: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="The AD exp Function: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" the ad exp function: example and test "/>
8 <meta name="keywords" id="keywords" content=" the ad exp function: example test "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Fadbad Speed: Gradient of Determinant Using Lu Factorization</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Fadbad Speed: Gradient of Determinant Using Lu Factorization"/>
8 <meta name="keywords" id="keywords" content=" fadbad speed: gradient of determinant using lu factorization link_det_lu speed matrix factor specifications implementation "/>
8 <meta name="keywords" id="keywords" content=" fadbad speed: gradient determinant using lu factorization link_det_lu speed matrix factor specifications implementation "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
9191 </select>
9292 </td>
9393 </tr></table><br/>
94
95
96
9794 <center><b><big><big>Fadbad Speed: Gradient of Determinant Using Lu Factorization</big></big></b></center>
9895 <br/>
9996 <b><big><a name="Specifications" id="Specifications">Specifications</a></big></b>
115112 extern bool global_memory, global_onetape, global_atomic, global_optimize;
116113
117114 bool link_det_lu(
118 size_t size ,
119 size_t repeat ,
120 CppAD::vector&lt;double&gt; &amp;matrix ,
121 CppAD::vector&lt;double&gt; &amp;gradient )
115 size_t size ,
116 size_t repeat ,
117 CppAD::vector&lt;double&gt; &amp;matrix ,
118 CppAD::vector&lt;double&gt; &amp;gradient )
122119 {
123 // speed test global option values
124 if( global_onetape || global_atomic )
125 return false;
126 if( global_memory || global_optimize )
127 return false;
128 // -----------------------------------------------------
129 // setup
130 //
131 // object for computing determinant
132 typedef fadbad::B&lt;double&gt; ADScalar;
133 typedef CppAD::vector&lt;ADScalar&gt; ADVector;
134 CppAD::det_by_lu&lt;ADScalar&gt; Det(size);
120 // speed test global option values
121 if( global_onetape || global_atomic )
122 return false;
123 if( global_memory || global_optimize )
124 return false;
125 // -----------------------------------------------------
126 // setup
127 //
128 // object for computing determinant
129 typedef fadbad::B&lt;double&gt; ADScalar;
130 typedef CppAD::vector&lt;ADScalar&gt; ADVector;
131 CppAD::det_by_lu&lt;ADScalar&gt; Det(size);
135132
136 size_t i; // temporary index
137 size_t m = 1; // number of dependent variables
138 size_t n = size * size; // number of independent variables
139 ADScalar detA; // AD value of the determinant
140 ADVector A(n); // AD version of matrix
133 size_t i; // temporary index
134 size_t m = 1; // number of dependent variables
135 size_t n = size * size; // number of independent variables
136 ADScalar detA; // AD value of the determinant
137 ADVector A(n); // AD version of matrix
141138
142 // ------------------------------------------------------
143 while(repeat--)
144 { // get the next matrix
145 CppAD::uniform_01(n, matrix);
139 // ------------------------------------------------------
140 while(repeat--)
141 { // get the next matrix
142 CppAD::uniform_01(n, matrix);
146143
147 // set independent variable values
148 for(i = 0; i &lt; n; i++)
149 A[i] = matrix[i];
144 // set independent variable values
145 for(i = 0; i &lt; n; i++)
146 A[i] = matrix[i];
150147
151 // compute the determinant
152 detA = Det(A);
148 // compute the determinant
149 detA = Det(A);
153150
154 // create function object f : A -&gt; detA
155 detA.diff(0, m); // index 0 of m dependent variables
151 // create function object f : A -&gt; detA
152 detA.diff(0, m); // index 0 of m dependent variables
156153
157 // evaluate and return gradient using reverse mode
158 for(i =0; i &lt; n; i++)
159 gradient[i] = A[i].d(0); // partial detA w.r.t A[i]
160 }
161 // ---------------------------------------------------------
162 return true;
154 // evaluate and return gradient using reverse mode
155 for(i =0; i &lt; n; i++)
156 gradient[i] = A[i].d(0); // partial detA w.r.t A[i]
157 }
158 // ---------------------------------------------------------
159 return true;
163160 }
164161 </pre></font></code>
165
166162
167163 <hr/>Input File: speed/fadbad/det_lu.cpp
168164
55 <title>Fadbad Speed: Gradient of Determinant by Minor Expansion</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Fadbad Speed: Gradient of Determinant by Minor Expansion"/>
8 <meta name="keywords" id="keywords" content=" fadbad speed: gradient of determinant by minor expansion link_det_minor speed specifications implementation "/>
8 <meta name="keywords" id="keywords" content=" fadbad speed: gradient determinant minor expansion link_det_minor speed specifications implementation "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
113113 extern bool global_memory, global_onetape, global_atomic, global_optimize;
114114
115115 bool link_det_minor(
116 size_t size ,
117 size_t repeat ,
118 CppAD::vector&lt;double&gt; &amp;matrix ,
119 CppAD::vector&lt;double&gt; &amp;gradient )
116 size_t size ,
117 size_t repeat ,
118 CppAD::vector&lt;double&gt; &amp;matrix ,
119 CppAD::vector&lt;double&gt; &amp;gradient )
120120 {
121 // speed test global option values
122 if( global_atomic )
123 return false;
124 if( global_memory || global_onetape || global_optimize )
125 return false;
126 // -----------------------------------------------------
127 // setup
121 // speed test global option values
122 if( global_atomic )
123 return false;
124 if( global_memory || global_onetape || global_optimize )
125 return false;
126 // -----------------------------------------------------
127 // setup
128128
129 // object for computing determinant
130 typedef fadbad::B&lt;double&gt; ADScalar;
131 typedef CppAD::vector&lt;ADScalar&gt; ADVector;
132 CppAD::det_by_minor&lt;ADScalar&gt; Det(size);
129 // object for computing determinant
130 typedef fadbad::B&lt;double&gt; ADScalar;
131 typedef CppAD::vector&lt;ADScalar&gt; ADVector;
132 CppAD::det_by_minor&lt;ADScalar&gt; Det(size);
133133
134 size_t i; // temporary index
135 size_t m = 1; // number of dependent variables
136 size_t n = size * size; // number of independent variables
137 ADScalar detA; // AD value of the determinant
138 ADVector A(n); // AD version of matrix
134 size_t i; // temporary index
135 size_t m = 1; // number of dependent variables
136 size_t n = size * size; // number of independent variables
137 ADScalar detA; // AD value of the determinant
138 ADVector A(n); // AD version of matrix
139139
140 // ------------------------------------------------------
141 while(repeat--)
142 { // get the next matrix
143 CppAD::uniform_01(n, matrix);
140 // ------------------------------------------------------
141 while(repeat--)
142 { // get the next matrix
143 CppAD::uniform_01(n, matrix);
144144
145 // set independent variable values
146 for(i = 0; i &lt; n; i++)
147 A[i] = matrix[i];
145 // set independent variable values
146 for(i = 0; i &lt; n; i++)
147 A[i] = matrix[i];
148148
149 // compute the determinant
150 detA = Det(A);
149 // compute the determinant
150 detA = Det(A);
151151
152 // create function object f : A -&gt; detA
153 detA.diff(0, m); // index 0 of m dependent variables
152 // create function object f : A -&gt; detA
153 detA.diff(0, m); // index 0 of m dependent variables
154154
155 // evaluate and return gradient using reverse mode
156 for(i =0; i &lt; n; i++)
157 gradient[i] = A[i].d(0); // partial detA w.r.t A[i]
158 }
159 // ---------------------------------------------------------
160 return true;
155 // evaluate and return gradient using reverse mode
156 for(i =0; i &lt; n; i++)
157 gradient[i] = A[i].d(0); // partial detA w.r.t A[i]
158 }
159 // ---------------------------------------------------------
160 return true;
161161 }
162162 </pre></font></code>
163
164163
165164 <hr/>Input File: speed/fadbad/det_minor.cpp
166165
9191 </select>
9292 </td>
9393 </tr></table><br/>
94
95
96
9794 <center><b><big><big>Fadbad Speed: Matrix Multiplication</big></big></b></center>
9895 <br/>
9996 <b><big><a name="Specifications" id="Specifications">Specifications</a></big></b>
116113 extern bool global_memory, global_onetape, global_atomic, global_optimize;
117114
118115 bool link_mat_mul(
119 size_t size ,
120 size_t repeat ,
121 CppAD::vector&lt;double&gt;&amp; x ,
122 CppAD::vector&lt;double&gt;&amp; z ,
123 CppAD::vector&lt;double&gt;&amp; dz )
116 size_t size ,
117 size_t repeat ,
118 CppAD::vector&lt;double&gt;&amp; x ,
119 CppAD::vector&lt;double&gt;&amp; z ,
120 CppAD::vector&lt;double&gt;&amp; dz )
124121 {
125 // speed test global option values
126 if( global_memory || global_onetape || global_atomic || global_optimize )
127 return false;
128 // The correctness check for this test is failing, so abort (for now).
129 return false;
122 // speed test global option values
123 if( global_memory || global_onetape || global_atomic || global_optimize )
124 return false;
125 // The correctness check for this test is failing, so abort (for now).
126 return false;
130127
131 // -----------------------------------------------------
132 // setup
128 // -----------------------------------------------------
129 // setup
133130
134 // object for computing determinant
135 typedef fadbad::B&lt;double&gt; ADScalar;
136 typedef CppAD::vector&lt;ADScalar&gt; ADVector;
131 // object for computing determinant
132 typedef fadbad::B&lt;double&gt; ADScalar;
133 typedef CppAD::vector&lt;ADScalar&gt; ADVector;
137134
138 size_t j; // temporary index
139 size_t m = 1; // number of dependent variables
140 size_t n = size * size; // number of independent variables
141 ADVector X(n); // AD domain space vector
142 ADVector Y(n); // Store product matrix
143 ADVector Z(m); // AD range space vector
135 size_t j; // temporary index
136 size_t m = 1; // number of dependent variables
137 size_t n = size * size; // number of independent variables
138 ADVector X(n); // AD domain space vector
139 ADVector Y(n); // Store product matrix
140 ADVector Z(m); // AD range space vector
144141
145 // ------------------------------------------------------
146 while(repeat--)
147 { // get the next matrix
148 CppAD::uniform_01(n, x);
142 // ------------------------------------------------------
143 while(repeat--)
144 { // get the next matrix
145 CppAD::uniform_01(n, x);
149146
150 // set independent variable values
151 for(j = 0; j &lt; n; j++)
152 X[j] = x[j];
147 // set independent variable values
148 for(j = 0; j &lt; n; j++)
149 X[j] = x[j];
153150
154 // do the computation
155 mat_sum_sq(size, X, Y, Z);
151 // do the computation
152 mat_sum_sq(size, X, Y, Z);
156153
157 // create function object f : X -&gt; Z
158 Z[0].diff(0, m); // index 0 of m dependent variables
154 // create function object f : X -&gt; Z
155 Z[0].diff(0, m); // index 0 of m dependent variables
159156
160 // evaluate and return gradient using reverse mode
161 for(j = 0; j &lt; n; j++)
162 dz[j] = X[j].d(0); // partial Z[0] w.r.t X[j]
163 }
164 // return function value
165 z[0] = Z[0].x();
157 // evaluate and return gradient using reverse mode
158 for(j = 0; j &lt; n; j++)
159 dz[j] = X[j].d(0); // partial Z[0] w.r.t X[j]
160 }
161 // return function value
162 z[0] = Z[0].x();
166163
167 // ---------------------------------------------------------
168 return true;
164 // ---------------------------------------------------------
165 return true;
169166 }
170167 </pre></font></code>
171
172168
173169 <hr/>Input File: speed/fadbad/mat_mul.cpp
174170
9191 </select>
9292 </td>
9393 </tr></table><br/>
94
95
96
9794 <center><b><big><big>Fadbad Speed: Ode</big></big></b></center>
9895 <br/>
9996 <b><big><a name="Specifications" id="Specifications">Specifications</a></big></b>
118115 extern bool global_memory, global_onetape, global_atomic, global_optimize;
119116
120117 namespace fadbad {
121 // define fabs for use by ode_evaluate
122 fadbad::F&lt;double&gt; fabs(const fadbad::F&lt;double&gt;&amp; x)
123 { return std::max(-x, x); }
118 // define fabs for use by ode_evaluate
119 fadbad::F&lt;double&gt; fabs(const fadbad::F&lt;double&gt;&amp; x)
120 { return std::max(-x, x); }
124121 }
125122
126123 bool link_ode(
127 size_t size ,
128 size_t repeat ,
129 CppAD::vector&lt;double&gt; &amp;x ,
130 CppAD::vector&lt;double&gt; &amp;jacobian
124 size_t size ,
125 size_t repeat ,
126 CppAD::vector&lt;double&gt; &amp;x ,
127 CppAD::vector&lt;double&gt; &amp;jacobian
131128 )
132129 {
133 // speed test global option values
134 if( global_atomic )
135 return false;
136 if( global_memory || global_onetape || global_optimize )
137 return false;
138 // -------------------------------------------------------------
139 // setup
140 assert( x.size() == size );
141 assert( jacobian.size() == size * size );
130 // speed test global option values
131 if( global_atomic )
132 return false;
133 if( global_memory || global_onetape || global_optimize )
134 return false;
135 // -------------------------------------------------------------
136 // setup
137 assert( x.size() == size );
138 assert( jacobian.size() == size * size );
142139
143 typedef fadbad::F&lt;double&gt; ADScalar;
144 typedef CppAD::vector&lt;ADScalar&gt; ADVector;
140 typedef fadbad::F&lt;double&gt; ADScalar;
141 typedef CppAD::vector&lt;ADScalar&gt; ADVector;
145142
146 size_t i, j;
147 size_t p = 0; // use ode to calculate function values
148 size_t n = size; // number of independent variables
149 size_t m = n; // number of dependent variables
150 ADVector X(n), Y(m); // independent and dependent variables
143 size_t i, j;
144 size_t p = 0; // use ode to calculate function values
145 size_t n = size; // number of independent variables
146 size_t m = n; // number of dependent variables
147 ADVector X(n), Y(m); // independent and dependent variables
151148
152 // -------------------------------------------------------------
153 while(repeat--)
154 { // choose next x value
155 CppAD::uniform_01(n, x);
156 for(j = 0; j &lt; n; j++)
157 { // set value of x[j]
158 X[j] = x[j];
159 // set up for X as the independent variable vector
160 X[j].diff(j, n);
161 }
149 // -------------------------------------------------------------
150 while(repeat--)
151 { // choose next x value
152 CppAD::uniform_01(n, x);
153 for(j = 0; j &lt; n; j++)
154 { // set value of x[j]
155 X[j] = x[j];
156 // set up for X as the independent variable vector
157 X[j].diff(j, n);
158 }
162159
163 // evaluate function
164 CppAD::ode_evaluate(X, p, Y);
160 // evaluate function
161 CppAD::ode_evaluate(X, p, Y);
165162
166 // return values with Y as the dependent variable vector
167 for(i = 0; i &lt; m; i++)
168 { for(j = 0; j &lt; n; j++)
169 jacobian[ i * n + j ] = Y[i].d(j);
170 }
171 }
172 return true;
163 // return values with Y as the dependent variable vector
164 for(i = 0; i &lt; m; i++)
165 { for(j = 0; j &lt; n; j++)
166 jacobian[ i * n + j ] = Y[i].d(j);
167 }
168 }
169 return true;
173170 }
174171 </pre></font></code>
175
176172
177173 <hr/>Input File: speed/fadbad/ode.cpp
178174
55 <title>Fadbad Speed: Second Derivative of a Polynomial</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Fadbad Speed: Second Derivative of a Polynomial"/>
8 <meta name="keywords" id="keywords" content=" fadbad speed: second derivative of a polynomial link_poly speed specifications implementation "/>
8 <meta name="keywords" id="keywords" content=" fadbad speed: second derivative polynomial link_poly speed specifications implementation "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
9191 </select>
9292 </td>
9393 </tr></table><br/>
94
95
96
9794 <center><b><big><big>Fadbad Speed: Second Derivative of a Polynomial</big></big></b></center>
9895 <br/>
9996 <b><big><a name="Specifications" id="Specifications">Specifications</a></big></b>
116113 extern bool global_memory, global_onetape, global_atomic, global_optimize;
117114
118115 bool link_poly(
119 size_t size ,
120 size_t repeat ,
121 CppAD::vector&lt;double&gt; &amp;a , // coefficients of polynomial
122 CppAD::vector&lt;double&gt; &amp;z , // polynomial argument value
123 CppAD::vector&lt;double&gt; &amp;ddp ) // second derivative w.r.t z
116 size_t size ,
117 size_t repeat ,
118 CppAD::vector&lt;double&gt; &amp;a , // coefficients of polynomial
119 CppAD::vector&lt;double&gt; &amp;z , // polynomial argument value
120 CppAD::vector&lt;double&gt; &amp;ddp ) // second derivative w.r.t z
124121 {
125 if( global_atomic )
126 return false;
127 if( global_memory || global_onetape || global_optimize )
128 return false;
129 // -----------------------------------------------------
130 // setup
131 size_t i; // temporary index
132 fadbad::T&lt;double&gt; Z; // domain space AD value
133 fadbad::T&lt;double&gt; P; // range space AD value
122 if( global_atomic )
123 return false;
124 if( global_memory || global_onetape || global_optimize )
125 return false;
126 // -----------------------------------------------------
127 // setup
128 size_t i; // temporary index
129 fadbad::T&lt;double&gt; Z; // domain space AD value
130 fadbad::T&lt;double&gt; P; // range space AD value
134131
135 // choose the polynomial coefficients
136 CppAD::uniform_01(size, a);
132 // choose the polynomial coefficients
133 CppAD::uniform_01(size, a);
137134
138 // AD copy of the polynomial coefficients
139 CppAD::vector&lt; fadbad::T&lt;double&gt; &gt; A(size);
140 for(i = 0; i &lt; size; i++)
141 A[i] = a[i];
135 // AD copy of the polynomial coefficients
136 CppAD::vector&lt; fadbad::T&lt;double&gt; &gt; A(size);
137 for(i = 0; i &lt; size; i++)
138 A[i] = a[i];
142139
143 // ------------------------------------------------------
144 while(repeat--)
145 { // get the next argument value
146 CppAD::uniform_01(1, z);
140 // ------------------------------------------------------
141 while(repeat--)
142 { // get the next argument value
143 CppAD::uniform_01(1, z);
147144
148 // independent variable value
149 Z = z[0]; // argument value
150 Z[1] = 1; // argument first order Taylor coefficient
145 // independent variable value
146 Z = z[0]; // argument value
147 Z[1] = 1; // argument first order Taylor coefficient
151148
152 // AD computation of the dependent variable
153 P = CppAD::Poly(0, A, Z);
149 // AD computation of the dependent variable
150 P = CppAD::Poly(0, A, Z);
154151
155 // Taylor-expand P to degree one
156 P.eval(2);
152 // Taylor-expand P to degree one
153 P.eval(2);
157154
158 // second derivative is twice second order Taylor coefficient
159 ddp[0] = 2. * P[2];
155 // second derivative is twice second order Taylor coefficient
156 ddp[0] = 2. * P[2];
160157
161 // Free DAG corresponding to P does not seem to improve speed.
162 // Probably because it gets freed the next time P is assigned.
163 // P.reset();
164 }
165 // ------------------------------------------------------
166 return true;
158 // Free DAG corresponding to P does not seem to improve speed.
159 // Probably because it gets freed the next time P is assigned.
160 // P.reset();
161 }
162 // ------------------------------------------------------
163 return true;
167164 }
168165 </pre></font></code>
169
170166
171167 <hr/>Input File: speed/fadbad/poly.cpp
172168
8585 <td>fadbad_sparse_hessian.cpp</td>
8686 <td>Headings</td>
8787 </tr></table><br/>
88
89
90
9188 <center><b><big><big>Fadbad Speed: Sparse Hessian</big></big></b></center>
92 <code><font color='blue'><pre style='display:inline'> // A fadbad version of this test is not yet available
89 <code><font color='blue'><pre style='display:inline'>
90 // A fadbad version of this test is not yet available
9391 bool link_sparse_hessian(
9492 size_t size ,
9593 size_t repeat ,
10098 size_t&amp; n_sweep
10199 )
102100 {
103 return false;
101 return false;
104102 }
105103 </pre></font></code>
106
107104
108105 <hr/>Input File: speed/fadbad/sparse_hessian.cpp
109106
8585 <td>fadbad_sparse_jacobian.cpp</td>
8686 <td>Headings</td>
8787 </tr></table><br/>
88
89
90
9188 <center><b><big><big>fadbad Speed: sparse_jacobian</big></big></b></center>
92 <code><font color='blue'><pre style='display:inline'> // A fadbad version of this test is not yet available
89 <code><font color='blue'><pre style='display:inline'>
90 // A fadbad version of this test is not yet available
9391 bool link_sparse_jacobian(
94 size_t size ,
95 size_t repeat ,
96 size_t m ,
97 const CppAD::vector&lt;size_t&gt;&amp; row ,
98 const CppAD::vector&lt;size_t&gt;&amp; col ,
99 CppAD::vector&lt;double&gt;&amp; x ,
100 CppAD::vector&lt;double&gt;&amp; jacobian ,
101 size_t&amp; n_sweep )
92 size_t size ,
93 size_t repeat ,
94 size_t m ,
95 const CppAD::vector&lt;size_t&gt;&amp; row ,
96 const CppAD::vector&lt;size_t&gt;&amp; col ,
97 CppAD::vector&lt;double&gt;&amp; x ,
98 CppAD::vector&lt;double&gt;&amp; jacobian ,
99 size_t&amp; n_sweep )
102100 {
103 return false;
101 return false;
104102 }
105103 </pre></font></code>
106
107104
108105 <hr/>Input File: speed/fadbad/sparse_jacobian.cpp
109106
55 <title>Frequently Asked Questions and Answers</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Frequently Asked Questions and Answers"/>
8 <meta name="keywords" id="keywords" content=" frequently asked questions and answers Faq operator reporting Errorhandler avoid record taping mode Cppad_testvector standard math function storage assignment independent bugs comparechange complex types exceptions variables matrix inverse mode: forward or reverse namespace test vector preprocessor symbol using speed ndebug optimize memory allocation tape storage: disk "/>
8 <meta name="keywords" id="keywords" content=" frequently asked questions answers Faq operator reporting Errorhandler avoid record taping mode Cppad_testvector standard math function storage assignment independent bugs comparechange complex types exceptions variables matrix inverse mode: forward reverse namespace test vector preprocessor symbol using speed ndebug optimize memory allocation tape storage: disk "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
313313 <br/>
314314 Why do I have trouble when the following command
315315 <code><font color='blue'><pre style='display:inline'>
316 using namespace CppAD
316 using namespace CppAD
317317 </pre></font></code>
318
319318 is at the global level
320319 (not within a function or some other limited scope).
321320 <code><span style='white-space: nowrap'><br/>
55 <title>First Order Partial Driver: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="First Order Partial Driver: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" first order partial driver: example and test "/>
8 <meta name="keywords" id="keywords" content=" first order partial driver: example test "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Forward Mode Jacobian Sparsity: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Forward Mode Jacobian Sparsity: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" forward mode jacobian sparsity: example and test Forsparsejac sparsity "/>
8 <meta name="keywords" id="keywords" content=" forward mode jacobian sparsity: example test Forsparsejac sparsity "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Subset of Second Order Partials: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Subset of Second Order Partials: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" subset of second order partials: example and test partial "/>
8 <meta name="keywords" id="keywords" content=" subset second order partials: example test partial "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Forward Mode: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Forward Mode: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" forward mode: example and test "/>
8 <meta name="keywords" id="keywords" content=" forward mode: example test "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Forward Mode: Example and Test of Multiple Directions</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Forward Mode: Example and Test of Multiple Directions"/>
8 <meta name="keywords" id="keywords" content=" forward mode: example and test of multiple directions orders order "/>
8 <meta name="keywords" id="keywords" content=" forward mode: example test multiple directions orders order "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Forward Mode: Example and Test of Multiple Orders</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Forward Mode: Example and Test of Multiple Orders"/>
8 <meta name="keywords" id="keywords" content=" forward mode: example and test of multiple orders "/>
8 <meta name="keywords" id="keywords" content=" forward mode: example test multiple orders "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>The Theory of Forward Mode</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="The Theory of Forward Mode"/>
8 <meta name="keywords" id="keywords" content=" the theory of forward mode taylor notation binary operators addition subtraction multiplication division standard math functions differential equation coefficients recursion formula cases that apply above special "/>
8 <meta name="keywords" id="keywords" content=" the theory forward mode taylor notation binary operators addition subtraction multiplication division standard math functions differential equation coefficients recursion formula cases that apply above special "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>ADFun Assignment: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="ADFun Assignment: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" adfun assignment: example and test assignment "/>
8 <meta name="keywords" id="keywords" content=" adfun assignment: example test assignment "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>ADFun Check and Re-Tape: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="ADFun Check and Re-Tape: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" adfun check and re-tape: example test Funcheck Dependent "/>
8 <meta name="keywords" id="keywords" content=" adfun check re-tape: example test Funcheck Dependent "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Check an ADFun Sequence of Operations</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Check an ADFun Sequence of Operations"/>
8 <meta name="keywords" id="keywords" content=" check an adfun sequence of operations syntax purpose f g x y r a ok vector funcheck uses forward discussion example "/>
8 <meta name="keywords" id="keywords" content=" check adfun sequence operations syntax purpose f g x y r ok vector funcheck uses forward discussion example "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Construct an ADFun Object and Stop Recording</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Construct an ADFun Object and Stop Recording"/>
8 <meta name="keywords" id="keywords" content=" construct an adfun object and stop recording tape syntax purpose x y vectorad default constructor sequence copy assignment operator taylor coefficients sparsity patterns parallel mode example "/>
8 <meta name="keywords" id="keywords" content=" construct adfun object stop recording tape syntax purpose x y vectorad default constructor sequence copy assignment operator taylor coefficients sparsity patterns parallel mode example "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Evaluate ADFun Functions, Derivatives, and Sparsity Patterns</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Evaluate ADFun Functions, Derivatives, and Sparsity Patterns"/>
8 <meta name="keywords" id="keywords" content=" evaluate adfun functions derivatives and sparsity patterns "/>
8 <meta name="keywords" id="keywords" content=" evaluate adfun functions derivatives sparsity patterns "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Download and Install Adolc in Build Directory</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Download and Install Adolc in Build Directory"/>
8 <meta name="keywords" id="keywords" content=" download and install adolc in build directory syntax purpose requirements distribution external prefix reuse "/>
8 <meta name="keywords" id="keywords" content=" download install adolc build directory syntax purpose requirements distribution external prefix reuse "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Download and Install ColPack in Build Directory</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Download and Install ColPack in Build Directory"/>
8 <meta name="keywords" id="keywords" content=" download and install colpack in build directory syntax purpose distribution external prefix reuse "/>
8 <meta name="keywords" id="keywords" content=" download install colpack build directory syntax purpose distribution external prefix reuse "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Download and Install Eigen in Build Directory</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Download and Install Eigen in Build Directory"/>
8 <meta name="keywords" id="keywords" content=" download and install eigen in build directory syntax purpose distribution external prefix reuse "/>
8 <meta name="keywords" id="keywords" content=" download install eigen build directory and syntax purpose distribution external prefix reuse "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Download and Install Fadbad in Build Directory</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Download and Install Fadbad in Build Directory"/>
8 <meta name="keywords" id="keywords" content=" download and install fadbad in build directory syntax purpose distribution external prefix "/>
8 <meta name="keywords" id="keywords" content=" download install fadbad build directory and syntax purpose distribution external prefix "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Download and Install Ipopt in Build Directory</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Download and Install Ipopt in Build Directory"/>
8 <meta name="keywords" id="keywords" content=" download and install ipopt in build directory syntax purpose distribution external prefix reuse "/>
8 <meta name="keywords" id="keywords" content=" download install ipopt build directory and syntax purpose distribution external prefix reuse "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Download and Install Sacado in Build Directory</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Download and Install Sacado in Build Directory"/>
8 <meta name="keywords" id="keywords" content=" download and install sacado in build directory syntax purpose distribution external prefix reuse "/>
8 <meta name="keywords" id="keywords" content=" download install sacado build directory and syntax purpose distribution external prefix reuse "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
449449 return error_code;
450450 }
451451 </pre></font></code>
452
453 <br/>
454452 <br/>
455453 <b><big><a name="Output" id="Output">Output</a></big></b>
456454 <br/>
457455 Executing the program above will generate the following output:
458456 <code><font color='blue'><pre style='display:inline'>
459 f'(3) computed by CppAD = 142
457 f'(3) computed by CppAD = 142
460458 </pre></font></code>
461
462
463 <br/>
464459 <br/>
465460 <b><big><a name="Running" id="Running">Running</a></big></b>
466461 <br/>
55 <title>Glossary</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Glossary"/>
8 <meta name="keywords" id="keywords" content=" efficient ad function of base type above elementary vector operation atomic sequence dependent independent parameter sparsity pattern boolean sets tape active inactive variable variables taylor coefficient "/>
8 <meta name="keywords" id="keywords" content=" efficient ad function base type above elementary vector operation atomic sequence dependent independent parameter sparsity pattern boolean sets tape active inactive variable variables taylor coefficient "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Multi-Threaded Implementation of Summation of 1/i</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Multi-Threaded Implementation of Summation of 1/i"/>
8 <meta name="keywords" id="keywords" content=" multi-threaded implementation of summation 1/i harmonic multi_thread syntax ok sum num_sum num_threads source "/>
8 <meta name="keywords" id="keywords" content=" multi-threaded implementation summation 1/i harmonic multi_thread syntax ok sum num_sum num_threads source "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Timing Test of Multi-Threaded Summation of 1/i</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Timing Test of Multi-Threaded Summation of 1/i"/>
8 <meta name="keywords" id="keywords" content=" timing test of multi-threaded summation 1/i harmonic_time multi_thread speed syntax purpose ok time_out test_time num_threads mega_sum source "/>
8 <meta name="keywords" id="keywords" content=" timing test multi-threaded summation 1/i harmonic_time multi_thread speed syntax purpose ok time_out test_time num_threads mega_sum source "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Multi-threading Sum of 1/i Utility Routines</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Multi-threading Sum of 1/i Utility Routines"/>
8 <meta name="keywords" id="keywords" content=" multi-threading sum of 1/i utility routines harmonic_work setup worker combine syntax purpose harmonic_setup num_sum num_threads harmonic_worker harmonic_combine source "/>
8 <meta name="keywords" id="keywords" content=" multi-threading sum 1/i utility routines harmonic_work setup worker combine syntax purpose harmonic_setup num_sum num_threads harmonic_worker harmonic_combine source "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Hessian of Lagrangian and ADFun Default Constructor: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Hessian of Lagrangian and ADFun Default Constructor: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" hessian of lagrangian and adfun default constructor: example test Heslagrangian constructor "/>
8 <meta name="keywords" id="keywords" content=" hessian lagrangian adfun default constructor: example test Heslagrangian constructor "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Gradient of Determinant Using LU Factorization: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Gradient of Determinant Using LU Factorization: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" gradient of determinant using lu factorization: example and test "/>
8 <meta name="keywords" id="keywords" content=" gradient determinant using lu factorization: example test "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Gradient of Determinant Using Expansion by Minors: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Gradient of Determinant Using Expansion by Minors: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" gradient of determinant using expansion by minors: example and test minors "/>
8 <meta name="keywords" id="keywords" content=" gradient determinant using expansion minors: example test minors "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Hessian Times Direction: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Hessian Times Direction: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" hessian times direction: example and test direction "/>
8 <meta name="keywords" id="keywords" content=" hessian times direction: example test direction "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Hessian: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Hessian: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" hessian: example and test Hessian "/>
8 <meta name="keywords" id="keywords" content=" hessian: example test Hessian "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
108108 The <a href="utility.xml" target="_top"><span style='white-space: nowrap'>utility</span></a>
109109 individual include files have been deprecated; e.g.,
110110 <code><font color='blue'><pre style='display:inline'>
111 # include &lt;cppad/runge_45.hpp&gt;
111 # include &lt;cppad/runge_45.hpp&gt;
112112 </pre></font></code>
113
114113 You should instead use
115114 <code><font color='blue'><pre style='display:inline'>
116 # include &lt;cppad/utility.hpp&gt;
115 # include &lt;cppad/utility.hpp&gt;
117116 </pre></font></code>
118
119
120 <br/>
121117 <br/>
122118 <b><big><a name="Deprecated 2006-12-17" id="Deprecated 2006-12-17">Deprecated 2006-12-17</a></big></b>
123119 <br/>
125121 and the corresponding names that should be used.
126122 For example, if your program uses the deprecated preprocessor command
127123 <code><font color='blue'><pre style='display:inline'>
128 # include &lt;CppAD/CppAD.h&gt;
124 # include &lt;CppAD/CppAD.h&gt;
129125 </pre></font></code>
130
131126 you should change it to the command
132127 <code><font color='blue'><pre style='display:inline'>
133 # include &lt;cppad/cppad.hpp&gt;
128 # include &lt;cppad/cppad.hpp&gt;
134129 </pre></font></code>
135
136
137
138 <br/>
139130 <br/>
140131 <b><big><a name="Linking New Files to Deprecated Commands" id="Linking New Files to Deprecated Commands">Linking New Files to Deprecated Commands</a></big></b>
141132 <br/>
55 <title>Independent and ADFun Constructor: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Independent and ADFun Constructor: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" independent and adfun constructor: example test "/>
8 <meta name="keywords" id="keywords" content=" independent adfun constructor: example test "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Declare Independent Variables and Start Recording</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Declare Independent Variables and Start Recording"/>
8 <meta name="keywords" id="keywords" content=" declare independent variables and start recording syntax purpose stop x abort_op_index vectorad parallel mode example "/>
8 <meta name="keywords" id="keywords" content=" declare independent variables start recording syntax purpose stop x abort_op_index vectorad parallel mode example "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Index Sort: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Index Sort: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" index sort: example and test index_sort "/>
8 <meta name="keywords" id="keywords" content=" index sort: example test index_sort "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Returns Indices that Sort a Vector</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Returns Indices that Sort a Vector"/>
8 <meta name="keywords" id="keywords" content=" returns indices that sort a vector index_sort syntax keys ind input return example "/>
8 <meta name="keywords" id="keywords" content=" returns indices that sort vector index_sort syntax keys ind input return example "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>CppAD Download, Test, and Install Instructions</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="CppAD Download, Test, and Install Instructions"/>
8 <meta name="keywords" id="keywords" content=" cppad download test and install instructions step 1: 2: cmake 3: check 4: installation "/>
8 <meta name="keywords" id="keywords" content=" cppad download test install instructions step 1: 2: cmake 3: check 4: installation "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
111111 <br/>
112112 Use the command
113113 <code><font color='blue'><pre style='display:inline'>
114 make install
114 make install
115115 </pre></font></code>
116
117116 to install CppAD.
118117 If you created <code><font color="blue">nmake</font></code> makefiles, you will have
119118 to use
120119 <code><font color='blue'><pre style='display:inline'>
121 nmake install
120 nmake install
122121 </pre></font></code>
123
124122 see the
125123 <a href="cmake.xml#generator" target="_top"><span style='white-space: nowrap'>generator</span></a>
126124 option for the <code><font color="blue">cmake</font></code> command.
55 <title>Convert From AD to Integer: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Convert From AD to Integer: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" convert from ad to integer: example and test Integer "/>
8 <meta name="keywords" id="keywords" content=" convert from ad to integer: example test Integer "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Interfacing to C: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Interfacing to C: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" interfacing to c: example and test C interface difference central "/>
8 <meta name="keywords" id="keywords" content=" interfacing to c: example test C interface difference central "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Interpolation With Out Retaping: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Interpolation With Out Retaping: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" interpolation with out retaping: example and test interpolate tape retape see also "/>
8 <meta name="keywords" id="keywords" content=" interpolation with out retaping: example test interpolate tape retape see also "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Interpolation With Retaping: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Interpolation With Retaping: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" interpolation with retaping: example and test interpolate tape retape see also "/>
8 <meta name="keywords" id="keywords" content=" interpolation with retaping: example test interpolate tape retape see also "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>An Introduction by Example to Algorithmic Differentiation</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="An Introduction by Example to Algorithmic Differentiation"/>
8 <meta name="keywords" id="keywords" content=" an introduction by example to algorithmic differentiation Ad Automatic purpose preface forward mode reverse operation count efficiency outline reference "/>
8 <meta name="keywords" id="keywords" content=" introduction example to algorithmic differentiation Ad Automatic purpose preface forward mode reverse operation count efficiency outline reference "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Nonlinear Programming Using CppAD and Ipopt: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Nonlinear Programming Using CppAD and Ipopt: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" nonlinear programming using cppad and ipopt: example test ipopt Ad purpose configuration requirement "/>
8 <meta name="keywords" id="keywords" content=" nonlinear programming using cppad ipopt: example test ipopt Ad purpose configuration requirement "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Example Simultaneous Solution of Forward and Inverse Problem</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Example Simultaneous Solution of Forward and Inverse Problem"/>
8 <meta name="keywords" id="keywords" content=" example simultaneous solution of forward and inverse problem "/>
8 <meta name="keywords" id="keywords" content=" example simultaneous solution forward inverse problem "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Correctness Check for Both Simple and Fast Representations</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Correctness Check for Both Simple and Fast Representations"/>
8 <meta name="keywords" id="keywords" content=" correctness check for both simple and fast representations "/>
8 <meta name="keywords" id="keywords" content=" correctness check both simple fast representations "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
113113 { y_0[j] = x[j];
114114 y_1[j] = x[Ny + j];
115115 y_2[j] = x[2 * Ny + j];
116 }
116 }
117117
118118 // Check some of the optimal a value
119119 Number rel_tol = max_step * max_step;
121121 Number check_a[] = {a0, a1, a2}; // see the y_one function
122122 for(j = 0; j &lt; Na; j++)
123123 {
124 ok &amp;= CppAD::<a href="nearequal.xml" target="_top">NearEqual</a>(
124 ok &amp;= CppAD::<a href="nearequal.xml" target="_top">NearEqual</a>(
125125 check_a[j], a[j], rel_tol, abs_tol
126126 );
127127 }
55 <title>An ODE Inverse Problem Example</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="An ODE Inverse Problem Example"/>
8 <meta name="keywords" id="keywords" content=" an ode inverse problem example notation forward measurements simulation analytic solution parameter values simulated measurement trapezoidal approximation time grid black box method two levels of iteration derivatives simultaneous source "/>
8 <meta name="keywords" id="keywords" content=" ode inverse problem example notation forward measurements simulation analytic solution parameter values simulated measurement trapezoidal approximation time grid black box method two levels iteration derivatives simultaneous source "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Driver for Running the Ipopt ODE Example</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Driver for Running the Ipopt ODE Example"/>
8 <meta name="keywords" id="keywords" content=" driver for running the ipopt ode example "/>
8 <meta name="keywords" id="keywords" content=" driver running the ipopt ode example "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Speed Test for Both Simple and Fast Representations</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Speed Test for Both Simple and Fast Representations"/>
8 <meta name="keywords" id="keywords" content=" speed test for both simple and fast representations "/>
8 <meta name="keywords" id="keywords" content=" speed test both simple fast representations "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Including the cppad_ipopt Library and Tests</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Including the cppad_ipopt Library and Tests"/>
8 <meta name="keywords" id="keywords" content=" including the cppad_ipopt library and tests ipopt cppad prefix get purpose ipopt_prefix examples get_ipopt "/>
8 <meta name="keywords" id="keywords" content=" including the cppad_ipopt library tests ipopt cppad prefix get purpose ipopt_prefix examples get_ipopt "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Use Ipopt to Solve a Nonlinear Programming Problem</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Use Ipopt to Solve a Nonlinear Programming Problem"/>
8 <meta name="keywords" id="keywords" content=" use ipopt to solve a nonlinear programming problem syntax purpose include file bvector dvector options retape sparse string numeric integer xi xl xu gl gu fg_eval advector x fg solution status zl zu g lambda obj_value example get_started ode_inverse "/>
8 <meta name="keywords" id="keywords" content=" use ipopt to solve nonlinear programming problem syntax purpose include file bvector dvector options retape sparse string numeric integer xi xl xu gl gu fg_eval advector x fg solution status zl zu g lambda obj_value example get_started ode_inverse "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Nonlinear Programming Using CppAD and Ipopt: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Nonlinear Programming Using CppAD and Ipopt: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" nonlinear programming using cppad and ipopt: example test ipopt Ad purpose configuration requirement "/>
8 <meta name="keywords" id="keywords" content=" nonlinear programming using cppad ipopt: example test ipopt Ad purpose configuration requirement "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Nonlinear Programming Retaping: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Nonlinear Programming Retaping: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" nonlinear programming retaping: example and test retape ipopt_solve purpose "/>
8 <meta name="keywords" id="keywords" content=" nonlinear programming retaping: example test retape ipopt_solve purpose "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Gradient of Determinant Using Lu Factorization: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Gradient of Determinant Using Lu Factorization: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" gradient of determinant using lu factorization: example and test "/>
8 <meta name="keywords" id="keywords" content=" gradient determinant using lu factorization: example test "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Gradient of Determinant Using Expansion by Minors: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Gradient of Determinant Using Expansion by Minors: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" gradient of determinant using expansion by minors: example and test minors "/>
8 <meta name="keywords" id="keywords" content=" gradient determinant using expansion minors: example test minors "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Jacobian: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Jacobian: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" jacobian: example and test Jacobian "/>
8 <meta name="keywords" id="keywords" content=" jacobian: example test Jacobian "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Jacobian: Driver Routine</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Jacobian: Driver Routine"/>
8 <meta name="keywords" id="keywords" content=" jacobian: driver routine Jacobian first derivative syntax purpose f x jac vector forward or reverse example "/>
8 <meta name="keywords" id="keywords" content=" jacobian: driver routine Jacobian first derivative syntax purpose f x jac vector forward reverse example "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Your License for the CppAD Software</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Your License for the CppAD Software"/>
8 <meta name="keywords" id="keywords" content=" your license for the cppad software "/>
8 <meta name="keywords" id="keywords" content=" your license the cppad software "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Speed Testing Gradient of Determinant Using Lu Factorization</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Speed Testing Gradient of Determinant Using Lu Factorization"/>
8 <meta name="keywords" id="keywords" content=" speed testing gradient of determinant using lu factorization link_det_lu test prototype purpose method return value size repeat matrix double "/>
8 <meta name="keywords" id="keywords" content=" speed testing gradient determinant using lu factorization link_det_lu test prototype purpose method return value size repeat matrix double "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Speed Testing Gradient of Determinant by Minor Expansion</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Speed Testing Gradient of Determinant by Minor Expansion"/>
8 <meta name="keywords" id="keywords" content=" speed testing gradient of determinant by minor expansion link_det_minor test prototype purpose method return value size repeat matrix double "/>
8 <meta name="keywords" id="keywords" content=" speed testing gradient determinant minor expansion link_det_minor test prototype purpose method return value size repeat matrix double "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Speed Testing Derivative of Matrix Multiply</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Speed Testing Derivative of Matrix Multiply"/>
8 <meta name="keywords" id="keywords" content=" speed testing derivative of matrix multiply link_mat_mul test multiple prototype purpose return value n repeat x z dz "/>
8 <meta name="keywords" id="keywords" content=" speed testing derivative matrix multiply link_mat_mul test multiple prototype purpose return value n repeat x z dz "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Speed Testing the Jacobian of Ode Solution</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Speed Testing the Jacobian of Ode Solution"/>
8 <meta name="keywords" id="keywords" content=" speed testing the jacobian of ode solution link_ode test prototype purpose method f return value size repeat x double "/>
8 <meta name="keywords" id="keywords" content=" speed testing the jacobian ode solution link_ode test prototype purpose method f return value size repeat x double "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Speed Testing Second Derivative of a Polynomial</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Speed Testing Second Derivative of a Polynomial"/>
8 <meta name="keywords" id="keywords" content=" speed testing second derivative of a polynomial link_poly test prototype purpose method return value size repeat z ddp double "/>
8 <meta name="keywords" id="keywords" content=" speed testing second derivative polynomial link_poly test prototype purpose method return value size repeat z ddp double "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>List of All the CppAD Examples</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="List of All the CppAD Examples"/>
8 <meta name="keywords" id="keywords" content=" list of all the cppad examples "/>
8 <meta name="keywords" id="keywords" content=" list all the cppad examples "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>The AD log Function: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="The AD log Function: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" the ad log function: example and test "/>
8 <meta name="keywords" id="keywords" content=" the ad log function: example test "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>The AD log10 Function: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="The AD log10 Function: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" the ad log10 function: example and test "/>
8 <meta name="keywords" id="keywords" content=" the ad log10 function: example test "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>The AD log1p Function: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="The AD log1p Function: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" the ad log1p function: example and test "/>
8 <meta name="keywords" id="keywords" content=" the ad log1p function: example test "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>The Logarithm of One Plus Argument: log1p</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="The Logarithm of One Plus Argument: log1p"/>
8 <meta name="keywords" id="keywords" content=" the logarithm of one plus argument: log1p syntax description x y cppad_use_cplusplus_2011 true false example "/>
8 <meta name="keywords" id="keywords" content=" the logarithm one plus argument: log1p syntax description x y cppad_use_cplusplus_2011 true false example "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>LuFactor: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="LuFactor: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" lufactor: example and test Lufactor "/>
8 <meta name="keywords" id="keywords" content=" lufactor: example test Lufactor "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>LuInvert: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="LuInvert: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" luinvert: example and test Luinvert "/>
8 <meta name="keywords" id="keywords" content=" luinvert: example test Luinvert "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>LuRatio: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="LuRatio: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" luratio: example and test Luratio "/>
8 <meta name="keywords" id="keywords" content=" luratio: example test Luratio "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>LuSolve With Complex Arguments: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="LuSolve With Complex Arguments: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" lusolve with complex arguments: example and test "/>
8 <meta name="keywords" id="keywords" content=" lusolve with complex arguments: example test "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Lu Factor and Solve with Recorded Pivoting</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Lu Factor and Solve with Recorded Pivoting"/>
8 <meta name="keywords" id="keywords" content=" lu factor and solve with recorded pivoting Luvecad linear equation determinant syntax purpose storage convention n m matrix rhs result logdet example "/>
8 <meta name="keywords" id="keywords" content=" lu factor solve with recorded pivoting Luvecad linear equation determinant syntax purpose storage convention n m matrix rhs result logdet example "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Lu Factor and Solve With Recorded Pivoting: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Lu Factor and Solve With Recorded Pivoting: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" lu factor and solve with recorded pivoting: example test record pivot "/>
8 <meta name="keywords" id="keywords" content=" lu factor solve with recorded pivoting: example test record pivot "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Compute Determinants and Solve Equations by LU Factorization</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Compute Determinants and Solve Equations by LU Factorization"/>
8 <meta name="keywords" id="keywords" content=" compute determinants and solve equations by lu factorization matrix factor linear "/>
8 <meta name="keywords" id="keywords" content=" compute determinants solve equations lu factorization matrix factor linear "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>LU Factorization of A Square Matrix</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="LU Factorization of A Square Matrix"/>
8 <meta name="keywords" id="keywords" content=" lu factorization of a square matrix Lufactor linear equation solve syntax description include storage sign ip jp p l u factor determinant sizevector floatvector float absgeq example source "/>
8 <meta name="keywords" id="keywords" content=" lu factorization square matrix Lufactor linear equation solve syntax description include storage sign ip jp p l u factor determinant sizevector floatvector float absgeq example source "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Invert an LU Factored Equation</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Invert an LU Factored Equation"/>
8 <meta name="keywords" id="keywords" content=" invert an lu factored equation Luinvert linear syntax description include matrix storage ip jp l u p a x example source "/>
8 <meta name="keywords" id="keywords" content=" invert lu factored equation Luinvert linear syntax description include matrix storage ip jp l u p x example source "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>LU Factorization of A Square Matrix and Stability Calculation</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="LU Factorization of A Square Matrix and Stability Calculation"/>
8 <meta name="keywords" id="keywords" content=" lu factorization of a square matrix and stability calculation Luratio linear equation solve syntax description include storage sign ip jp p l u factor determinant ratio purpose sizevector advector example "/>
8 <meta name="keywords" id="keywords" content=" lu factorization square matrix stability calculation Luratio linear equation solve syntax description include storage sign ip jp p l u factor determinant ratio purpose sizevector advector example "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Compute Determinant and Solve Linear Equations</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Compute Determinant and Solve Linear Equations"/>
8 <meta name="keywords" id="keywords" content=" compute determinant and solve linear equations Lusolve Lu syntax description include factor invert matrix storage signdet n m a b x logdet float floatvector leqzero absgeq example source "/>
8 <meta name="keywords" id="keywords" content=" compute determinant solve linear equations Lusolve Lu syntax description include factor invert matrix storage signdet n m b x logdet float floatvector leqzero absgeq example source "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Main Program For Comparing C and C++ Speed</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Main Program For Comparing C and C++ Speed"/>
8 <meta name="keywords" id="keywords" content=" main program for comparing c and c++ speed source code "/>
8 <meta name="keywords" id="keywords" content=" main program comparing c c++ speed source code "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
9595 </select>
9696 </td>
9797 </tr></table><br/>
98
99
10098 <center><b><big><big>Main Program For Comparing C and C++ Speed</big></big></b></center>
10199 <br/>
102100 <b><big><a name="Source Code" id="Source Code">Source Code</a></big></b>
103101
104102 <code><font color='blue'><pre style='display:inline'>
105103 int main(void)
106 { bool flag;
107 size_t i;
104 { bool flag;
105 size_t i;
108106
109 <a href="uniform_01_c.xml" target="_top">random_seed</a>(123);
107 <a href="uniform_01_c.xml" target="_top">random_seed</a>(123);
110108
111 printf(&quot;correct_det_by_minor: &quot;);
112 flag = <a href="correct_det_by_minor_c.xml" target="_top">correct_det_by_minor</a>();
113 if( flag )
114 printf(&quot;OK\n&quot;);
115 else printf(&quot;Error\n&quot;);
109 printf(&quot;correct_det_by_minor: &quot;);
110 flag = <a href="correct_det_by_minor_c.xml" target="_top">correct_det_by_minor</a>();
111 if( flag )
112 printf(&quot;OK\n&quot;);
113 else printf(&quot;Error\n&quot;);
116114
117 for(i = 0; i &lt; 5; i++)
118 { double time_min = 1.0;
119 size_t size = 2 + i * 2;
120 int i_size = (int) size;
121 printf(&quot;time_det_minor for %d x %d matrix = &quot;, i_size, i_size);
122 printf(&quot;%g\n&quot;, time_det_by_minor(size, time_min) );
123 }
115 for(i = 0; i &lt; 5; i++)
116 { double time_min = 1.0;
117 size_t size = 2 + i * 2;
118 int i_size = (int) size;
119 printf(&quot;time_det_minor for %d x %d matrix = &quot;, i_size, i_size);
120 printf(&quot;%g\n&quot;, time_det_by_minor(size, time_min) );
121 }
124122
125 if( flag )
126 return 0;
127 return 1;
123 if( flag )
124 return 0;
125 return 1;
128126 }
129127 </pre></font></code>
130
131128
132129 <hr/>Input File: compare_c/det_by_minor.c
133130
55 <title>Sum of the Elements of the Square of a Matrix: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Sum of the Elements of the Square of a Matrix: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" sum of the elements square a matrix: example and test mat_sum_sq "/>
8 <meta name="keywords" id="keywords" content=" sum the elements square matrix: example test mat_sum_sq "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Sum Elements of a Matrix Times Itself</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Sum Elements of a Matrix Times Itself"/>
8 <meta name="keywords" id="keywords" content=" sum elements of a matrix times itself mat_sum_sq multiply speed test syntax purpose inclusion n x y z vector example source code "/>
8 <meta name="keywords" id="keywords" content=" sum elements matrix times itself mat_sum_sq multiply speed test syntax purpose inclusion n x y z vector example source code "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Microsoft Version of Elapsed Number of Seconds</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Microsoft Version of Elapsed Number of Seconds"/>
8 <meta name="keywords" id="keywords" content=" microsoft version of elapsed number seconds syntax purpose s linking "/>
8 <meta name="keywords" id="keywords" content=" microsoft version elapsed number seconds syntax purpose s linking "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>AD Binary Multiplication: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="AD Binary Multiplication: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" ad binary multiplication: example and test * multiply times "/>
8 <meta name="keywords" id="keywords" content=" ad binary multiplication: example test * multiply times "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>AD Computed Assignment Multiplication: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="AD Computed Assignment Multiplication: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" ad computed assignment multiplication: example and test *= multiply assign plus add "/>
8 <meta name="keywords" id="keywords" content=" ad computed assignment multiplication: example test *= multiply assign plus add "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Multiple Level of AD: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Multiple Level of AD: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" multiple level of ad: example and test purpose source "/>
8 <meta name="keywords" id="keywords" content=" multiple level ad: example test purpose source "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Using Multiple Levels of AD</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Using Multiple Levels of AD"/>
8 <meta name="keywords" id="keywords" content=" using multiple levels of ad background motivation procedure first start ad&lt;double&gt; ad&lt; &gt; recording inner function second outer derivatives example "/>
8 <meta name="keywords" id="keywords" content=" using multiple levels ad background motivation procedure first start ad&lt;double&gt; ad&lt; &gt; recording inner function second outer derivatives example "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Using Adolc with Multiple Levels of Taping: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Using Adolc with Multiple Levels of Taping: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" using adolc with multiple levels of taping: example and test purpose memory management configuration requirement source "/>
8 <meta name="keywords" id="keywords" content=" using adolc with multiple levels taping: example test purpose memory management configuration requirement source "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
8585 </select>
8686 </td>
8787 </tr></table><br/>
88
89
90
9188 <center><b><big><big>Using Adolc with Multiple Levels of Taping: Example and Test</big></big></b></center>
9289 <br/>
9390 <b><big><a name="Purpose" id="Purpose">Purpose</a></big></b>
55 <title>Taylor's Ode Solver: A Multi-Level Adolc Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Taylor's Ode Solver: A Multi-Level Adolc Example and Test"/>
8 <meta name="keywords" id="keywords" content=" taylor's ode solver: a multi-level adolc example and test purpose solution derivative of method using ad base_adolc.hpp memory management configuration requirement source "/>
8 <meta name="keywords" id="keywords" content=" taylor's ode solver: multi-level adolc example test purpose solution derivative method using ad base_adolc.hpp memory management configuration requirement source "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Taylor's Ode Solver: A Multi-Level AD Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Taylor's Ode Solver: A Multi-Level AD Example and Test"/>
8 <meta name="keywords" id="keywords" content=" taylor's ode solver: a multi-level ad example and test purpose solution derivative of method using source "/>
8 <meta name="keywords" id="keywords" content=" taylor's ode solver: multi-level ad example test purpose solution derivative method using source "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>A Multi-Threaded Newton's Method</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="A Multi-Threaded Newton's Method"/>
8 <meta name="keywords" id="keywords" content=" a multi-threaded newton's method multi_newton threading thread multi-threading syntax purpose ok xout fun num_sub xlow xup epsilon max_itr num_threads source "/>
8 <meta name="keywords" id="keywords" content=" multi-threaded newton's method multi_newton threading thread multi-threading syntax purpose ok xout fun num_sub xlow xup epsilon max_itr num_threads source "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Timing Test of Multi-Threaded Newton Method</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Timing Test of Multi-Threaded Newton Method"/>
8 <meta name="keywords" id="keywords" content=" timing test of multi-threaded newton method multi_newton_time multi_thread Ad speed syntax purpose ok time_out test_time num_threads num_zero num_sub num_sum use_ad source "/>
8 <meta name="keywords" id="keywords" content=" timing test multi-threaded newton method multi_newton_time multi_thread Ad speed syntax purpose ok time_out test_time num_threads num_zero num_sub num_sum use_ad source "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Using CppAD in a Multi-Threading Environment</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Using CppAD in a Multi-Threading Environment"/>
8 <meta name="keywords" id="keywords" content=" using cppad in a multi-threading environment mode execution maximum number purpose cppad_max_num_threads parallel_setup hold_memory parallel ad initialization same thread prohibited "/>
8 <meta name="keywords" id="keywords" content=" using cppad multi-threading environment mode execution maximum number purpose cppad_max_num_threads parallel_setup hold_memory parallel ad initialization same thread prohibited "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>nan: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="nan: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" nan: example and test "/>
8 <meta name="keywords" id="keywords" content=" nan: example test "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Obtain Nan or Determine if a Value is Nan</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Obtain Nan or Determine if a Value is Nan"/>
8 <meta name="keywords" id="keywords" content=" obtain nan or determine if a value is syntax purpose include macros isnan s b hasnan v nan(zero) deprecated 2015-10-04 z scalar vector example "/>
8 <meta name="keywords" id="keywords" content=" obtain nan determine if value is syntax purpose include macros isnan s b hasnan v nan(zero) deprecated 2015-10-04 z scalar vector example "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>NearEqual Function: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="NearEqual Function: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" nearequal function: example and test file name "/>
8 <meta name="keywords" id="keywords" content=" nearequal function: example test file name "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
101101 </select>
102102 </td>
103103 </tr></table><br/>
104
105
106
107104 <center><b><big><big>NearEqual Function: Example and Test</big></big></b></center>
108105 <br/>
109106 <b><big><a name="File Name" id="File Name">File Name</a></big></b>
55 <title>Compare AD with Base Objects: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Compare AD with Base Objects: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" compare ad with base objects: example and test Nearequalext "/>
8 <meta name="keywords" id="keywords" content=" compare ad with base objects: example test Nearequalext "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Determine if Two Values Are Nearly Equal</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Determine if Two Values Are Nearly Equal"/>
8 <meta name="keywords" id="keywords" content=" determine if two values are nearly equal Nearequal near absolute difference relative syntax purpose x y r a b type include files example exercise "/>
8 <meta name="keywords" id="keywords" content=" determine if two values are nearly equal Nearequal near absolute difference relative syntax purpose x y r b type include files example exercise "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
294294 <br/>
295295 Create and run a program that contains the following code:
296296 <code><font color='blue'><pre style='display:inline'>
297 using std::complex;
298 using std::cout;
299 using std::endl;
300
301 complex&lt;double&gt; one(1., 0), i(0., 1);
302 complex&lt;double&gt; x = one / i;
303 complex&lt;double&gt; y = - i;
304 double r = 1e-12;
305 double a = 0;
306 bool ok = CppAD::<a href="nearequal.xml" target="_top">NearEqual</a>(x, y, r, a);
307 if( ok )
308 cout &lt;&lt; &quot;Ok&quot; &lt;&lt; endl;
309 else cout &lt;&lt; &quot;Error&quot; &lt;&lt; endl;
297 using std::complex;
298 using std::cout;
299 using std::endl;
300
301 complex&lt;double&gt; one(1., 0), i(0., 1);
302 complex&lt;double&gt; x = one / i;
303 complex&lt;double&gt; y = - i;
304 double r = 1e-12;
305 double a = 0;
306 bool ok = CppAD::<a href="nearequal.xml" target="_top">NearEqual</a>(x, y, r, a);
307 if( ok )
308 cout &lt;&lt; &quot;Ok&quot; &lt;&lt; endl;
309 else cout &lt;&lt; &quot;Error&quot; &lt;&lt; endl;
310310 </pre></font></code>
311
312
313311
314312 <hr/>Input File: cppad/utility/near_equal.hpp
315313
55 <title>Compare AD and Base Objects for Nearly Equal</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Compare AD and Base Objects for Nearly Equal"/>
8 <meta name="keywords" id="keywords" content=" compare ad and base objects for nearly equal Nearequal with syntax purpose x y r a b type operation sequence example "/>
8 <meta name="keywords" id="keywords" content=" compare ad base objects nearly equal Nearequal with syntax purpose x y r b type operation sequence example "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Numeric Limits: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Numeric Limits: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" numeric limits: example and test "/>
8 <meta name="keywords" id="keywords" content=" numeric limits: example test "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Number of Variables That Can be Skipped: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Number of Variables That Can be Skipped: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" number of variables that can be skipped: example and test number_skip optimize conditional expression condition "/>
8 <meta name="keywords" id="keywords" content=" number variables that can be skipped: example test number_skip optimize conditional expression condition "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Number of Variables that Can be Skipped</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Number of Variables that Can be Skipped"/>
8 <meta name="keywords" id="keywords" content=" number of variables that can be skipped number_skip syntax see also purpose n f example "/>
8 <meta name="keywords" id="keywords" content=" number variables that can be skipped number_skip syntax see also purpose n f example "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
8888 </select>
8989 </td>
9090 </tr></table><br/>
91
92
93
94
9591 <center><b><big><big>Some Numerical AD Utilities</big></big></b></center>
9692 The routines listed below are numerical utilities that are
9793 designed to work with CppAD in particular.
55 <title>Numeric Limits For an AD and Base Types</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Numeric Limits For an AD and Base Types"/>
8 <meta name="keywords" id="keywords" content=" numeric limits for an ad and base types syntax cppad::numeric_limits std::numeric_limits float epsilon min max quiet_nan example "/>
8 <meta name="keywords" id="keywords" content=" numeric limits ad base types syntax cppad::numeric_limits std::numeric_limits float epsilon min max quiet_nan example "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>The NumericType: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="The NumericType: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" the numerictype: example and test Numerictype "/>
8 <meta name="keywords" id="keywords" content=" the numerictype: example test Numerictype "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Definition of a Numeric Type</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Definition of a Numeric Type"/>
8 <meta name="keywords" id="keywords" content=" definition of a numeric type int requirements default constructor from integer copy assignment operators example exercise "/>
8 <meta name="keywords" id="keywords" content=" definition numeric type int requirements default constructor from integer copy assignment operators example exercise "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>OdeErrControl: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="OdeErrControl: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" odeerrcontrol: example and test nan "/>
8 <meta name="keywords" id="keywords" content=" odeerrcontrol: example test nan "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>OdeErrControl: Example and Test Using Maxabs Argument</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="OdeErrControl: Example and Test Using Maxabs Argument"/>
8 <meta name="keywords" id="keywords" content=" odeerrcontrol: example and test using maxabs argument Odeerrcontrol "/>
8 <meta name="keywords" id="keywords" content=" odeerrcontrol: example test using maxabs argument Odeerrcontrol "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>ode_evaluate: Example and test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="ode_evaluate: Example and test"/>
8 <meta name="keywords" id="keywords" content=" ode_evaluate: example and test ode_evaluate "/>
8 <meta name="keywords" id="keywords" content=" ode_evaluate: example test ode_evaluate "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Evaluate a Function Defined in Terms of an ODE</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Evaluate a Function Defined in Terms of an ODE"/>
8 <meta name="keywords" id="keywords" content=" evaluate a function defined in terms of an ode ode_evaluate syntax purpose inclusion float operation sequence fabs x p == 0 = 1 fp gradient example source code "/>
8 <meta name="keywords" id="keywords" content=" evaluate function defined terms ode ode_evaluate syntax purpose inclusion float operation sequence fabs x p == 0 = 1 fp gradient example source code "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>OdeGear: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="OdeGear: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" odegear: example and test Odegear "/>
8 <meta name="keywords" id="keywords" content=" odegear: example test Odegear "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>OdeGearControl: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="OdeGearControl: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" odegearcontrol: example and test Odegearcontrol "/>
8 <meta name="keywords" id="keywords" content=" odegearcontrol: example test Odegearcontrol "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>A Stiff Ode: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="A Stiff Ode: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" a stiff ode: example and test ode "/>
8 <meta name="keywords" id="keywords" content=" stiff ode: example test ode "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Taylor's Ode Solver: An Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Taylor's Ode Solver: An Example and Test"/>
8 <meta name="keywords" id="keywords" content=" taylor's ode solver: an example and test Taylor purpose solution forward mode "/>
8 <meta name="keywords" id="keywords" content=" taylor's ode solver: example test Taylor purpose solution forward mode "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>An Error Controller for ODE Solvers</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="An Error Controller for ODE Solvers"/>
8 <meta name="keywords" id="keywords" content=" an error controller for ode solvers Odeerrcontrol differential equation syntax description include notation xf method step nan order ti tf xi smin smax scur eabs erel ef maxabs nstep criteria discussion scalar vector example theory source code "/>
8 <meta name="keywords" id="keywords" content=" error controller ode solvers Odeerrcontrol differential equation syntax description include notation xf method step nan order ti tf xi smin smax scur eabs erel ef maxabs nstep criteria discussion scalar vector example theory source code "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>An Arbitrary Order Gear Method</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="An Arbitrary Order Gear Method"/>
8 <meta name="keywords" id="keywords" content=" an arbitrary order gear method Odegear Ode stiff differential equation syntax purpose include fun t x f f_x warning m n e scalar vector example source code theory gear's "/>
8 <meta name="keywords" id="keywords" content=" arbitrary order gear method Odegear Ode stiff differential equation syntax purpose include fun t x f f_x warning m n e scalar vector example source code theory gear's "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>An Error Controller for Gear's Ode Solvers</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="An Error Controller for Gear's Ode Solvers"/>
8 <meta name="keywords" id="keywords" content=" an error controller for gear's ode solvers Odegearcontrol Gear differential equation syntax purpose include notation xf fun t x f f_x warning m ti tf xi smin smax sini eabs erel ef maxabs nstep criteria discussion scalar vector example theory source code "/>
8 <meta name="keywords" id="keywords" content=" error controller gear's ode solvers Odegearcontrol Gear differential equation syntax purpose include notation xf fun t x f f_x warning m ti tf xi smin smax sini eabs erel ef maxabs nstep criteria discussion scalar vector example theory source code "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Old Matrix Multiply as a User Atomic Operation: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Old Matrix Multiply as a User Atomic Operation: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" old matrix multiply as a user atomic operation: example and test deprecated 2013-05-27 include file "/>
8 <meta name="keywords" id="keywords" content=" old matrix multiply user atomic operation: example test deprecated 2013-05-27 include file "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Define Matrix Multiply as a User Atomic Operation</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Define Matrix Multiply as a User Atomic Operation"/>
8 <meta name="keywords" id="keywords" content=" define matrix multiply as a user atomic operation old_mat_mul old_atomic test syntax example begin source extra call information indexing one reverse partials order set union cppad callback functions declare mat_mul function "/>
8 <meta name="keywords" id="keywords" content=" define matrix multiply user atomic operation old_mat_mul old_atomic test syntax example begin source extra call information indexing one reverse partials order set union cppad callback functions declare mat_mul function "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
124124 <code><font color='blue'><pre style='display:inline'>
125125 # include &lt;cppad/cppad.hpp&gt; // Include CppAD definitions
126126 namespace { // Begin empty namespace
127 using CppAD::vector; // Let vector denote CppAD::vector
128 </pre></font></code>
129
130
131 <br/>
127 using CppAD::vector; // Let vector denote CppAD::vector
128 </pre></font></code>
132129 <br/>
133130 <b><big><a name="Extra Call Information" id="Extra Call Information">Extra Call Information</a></big></b>
134131
135132 <code><font color='blue'><pre style='display:inline'>
136 // Information we will attach to each mat_mul call
137 struct call_info {
138 size_t nr_result;
139 size_t n_middle;
140 size_t nc_result;
141 vector&lt;bool&gt; vx;
142 };
143 vector&lt;call_info&gt; info_; // vector of call information
144
145 // number of orders for this operation (k + 1)
146 size_t n_order_ = 0;
147 // number of rows in the result matrix
148 size_t nr_result_ = 0;
149 // number of columns in left matrix and number of rows in right matrix
150 size_t n_middle_ = 0;
151 // number of columns in the result matrix
152 size_t nc_result_ = 0;
153 // which components of x are variables
154 vector&lt;bool&gt;* vx_ = CPPAD_NULL;
155
156 // get the information corresponding to this call
157 void get_info(size_t id, size_t k, size_t n, size_t m)
158 { n_order_ = k + 1;
159 nr_result_ = info_[id].nr_result;
160 n_middle_ = info_[id].n_middle;
161 nc_result_ = info_[id].nc_result;
162 vx_ = &amp;(info_[id].vx);
163
164 assert(n == nr_result_ * n_middle_ + n_middle_ * nc_result_);
165 assert(m == nr_result_ * nc_result_);
166 }
167
168 </pre></font></code>
169
170 <br/>
171 <br/>
133 // Information we will attach to each mat_mul call
134 struct call_info {
135 size_t nr_result;
136 size_t n_middle;
137 size_t nc_result;
138 vector&lt;bool&gt; vx;
139 };
140 vector&lt;call_info&gt; info_; // vector of call information
141
142 // number of orders for this operation (k + 1)
143 size_t n_order_ = 0;
144 // number of rows in the result matrix
145 size_t nr_result_ = 0;
146 // number of columns in left matrix and number of rows in right matrix
147 size_t n_middle_ = 0;
148 // number of columns in the result matrix
149 size_t nc_result_ = 0;
150 // which components of x are variables
151 vector&lt;bool&gt;* vx_ = CPPAD_NULL;
152
153 // get the information corresponding to this call
154 void get_info(size_t id, size_t k, size_t n, size_t m)
155 { n_order_ = k + 1;
156 nr_result_ = info_[id].nr_result;
157 n_middle_ = info_[id].n_middle;
158 nc_result_ = info_[id].nc_result;
159 vx_ = &amp;(info_[id].vx);
160
161 assert(n == nr_result_ * n_middle_ + n_middle_ * nc_result_);
162 assert(m == nr_result_ * nc_result_);
163 }
164
165 </pre></font></code>
172166 <b><big><a name="Matrix Indexing" id="Matrix Indexing">Matrix Indexing</a></big></b>
173167
174168 <code><font color='blue'><pre style='display:inline'>
175 // Convert left matrix index pair and order to a single argument index
176 size_t left(size_t i, size_t j, size_t ell)
177 { assert( i &lt; nr_result_ );
178 assert( j &lt; n_middle_ );
179 return (i * n_middle_ + j) * n_order_ + ell;
180 }
181 // Convert right matrix index pair and order to a single argument index
182 size_t right(size_t i, size_t j, size_t ell)
183 { assert( i &lt; n_middle_ );
184 assert( j &lt; nc_result_ );
185 size_t offset = nr_result_ * n_middle_;
186 return (offset + i * nc_result_ + j) * n_order_ + ell;
187 }
188 // Convert result matrix index pair and order to a single result index
189 size_t result(size_t i, size_t j, size_t ell)
190 { assert( i &lt; nr_result_ );
191 assert( j &lt; nc_result_ );
192 return (i * nc_result_ + j) * n_order_ + ell;
193 }
194 </pre></font></code>
195
196
197 <br/>
169 // Convert left matrix index pair and order to a single argument index
170 size_t left(size_t i, size_t j, size_t ell)
171 { assert( i &lt; nr_result_ );
172 assert( j &lt; n_middle_ );
173 return (i * n_middle_ + j) * n_order_ + ell;
174 }
175 // Convert right matrix index pair and order to a single argument index
176 size_t right(size_t i, size_t j, size_t ell)
177 { assert( i &lt; n_middle_ );
178 assert( j &lt; nc_result_ );
179 size_t offset = nr_result_ * n_middle_;
180 return (offset + i * nc_result_ + j) * n_order_ + ell;
181 }
182 // Convert result matrix index pair and order to a single result index
183 size_t result(size_t i, size_t j, size_t ell)
184 { assert( i &lt; nr_result_ );
185 assert( j &lt; nc_result_ );
186 return (i * nc_result_ + j) * n_order_ + ell;
187 }
188 </pre></font></code>
198189 <br/>
199190 <b><big><a name="One Matrix Multiply" id="One Matrix Multiply">One Matrix Multiply</a></big></b>
200191 <br/>
201192 Forward mode matrix multiply left times right and sum into result:
202193 <code><font color='blue'><pre style='display:inline'>
203 void multiply_and_sum(
204 size_t order_left ,
205 size_t order_right,
206 const vector&lt;double&gt;&amp; tx ,
207 vector&lt;double&gt;&amp; ty )
208 { size_t i, j;
209 size_t order_result = order_left + order_right;
210 for(i = 0; i &lt; nr_result_; i++)
211 { for(j = 0; j &lt; nc_result_; j++)
212 { double sum = 0.;
213 size_t middle, im_left, mj_right, ij_result;
214 for(middle = 0; middle &lt; n_middle_; middle++)
215 { im_left = left(i, middle, order_left);
216 mj_right = right(middle, j, order_right);
217 sum += tx[im_left] * tx[mj_right];
218 }
219 ij_result = result(i, j, order_result);
220 ty[ ij_result ] += sum;
221 }
222 }
223 return;
224 }
225 </pre></font></code>
226
227
228 <br/>
194 void multiply_and_sum(
195 size_t order_left ,
196 size_t order_right,
197 const vector&lt;double&gt;&amp; tx ,
198 vector&lt;double&gt;&amp; ty )
199 { size_t i, j;
200 size_t order_result = order_left + order_right;
201 for(i = 0; i &lt; nr_result_; i++)
202 { for(j = 0; j &lt; nc_result_; j++)
203 { double sum = 0.;
204 size_t middle, im_left, mj_right, ij_result;
205 for(middle = 0; middle &lt; n_middle_; middle++)
206 { im_left = left(i, middle, order_left);
207 mj_right = right(middle, j, order_right);
208 sum += tx[im_left] * tx[mj_right];
209 }
210 ij_result = result(i, j, order_result);
211 ty[ ij_result ] += sum;
212 }
213 }
214 return;
215 }
216 </pre></font></code>
229217 <br/>
230218 <b><big><a name="Reverse Partials One Order" id="Reverse Partials One Order">Reverse Partials One Order</a></big></b>
231219 <br/>
232220 Compute reverse mode partials for one order and sum into px:
233221 <code><font color='blue'><pre style='display:inline'>
234 void reverse_multiply(
235 size_t order_left ,
236 size_t order_right,
237 const vector&lt;double&gt;&amp; tx ,
238 const vector&lt;double&gt;&amp; ty ,
239 vector&lt;double&gt;&amp; px ,
240 const vector&lt;double&gt;&amp; py )
241 { size_t i, j;
242 size_t order_result = order_left + order_right;
243 for(i = 0; i &lt; nr_result_; i++)
244 { for(j = 0; j &lt; nc_result_; j++)
245 { size_t middle, im_left, mj_right, ij_result;
246 for(middle = 0; middle &lt; n_middle_; middle++)
247 { ij_result = result(i, j, order_result);
248 im_left = left(i, middle, order_left);
249 mj_right = right(middle, j, order_right);
250 // sum += tx[im_left] * tx[mj_right];
251 px[im_left] += tx[mj_right] * py[ij_result];
252 px[mj_right] += tx[im_left] * py[ij_result];
253 }
254 }
255 }
256 return;
257 }
258 </pre></font></code>
259
260 <br/>
222 void reverse_multiply(
223 size_t order_left ,
224 size_t order_right,
225 const vector&lt;double&gt;&amp; tx ,
226 const vector&lt;double&gt;&amp; ty ,
227 vector&lt;double&gt;&amp; px ,
228 const vector&lt;double&gt;&amp; py )
229 { size_t i, j;
230 size_t order_result = order_left + order_right;
231 for(i = 0; i &lt; nr_result_; i++)
232 { for(j = 0; j &lt; nc_result_; j++)
233 { size_t middle, im_left, mj_right, ij_result;
234 for(middle = 0; middle &lt; n_middle_; middle++)
235 { ij_result = result(i, j, order_result);
236 im_left = left(i, middle, order_left);
237 mj_right = right(middle, j, order_right);
238 // sum += tx[im_left] * tx[mj_right];
239 px[im_left] += tx[mj_right] * py[ij_result];
240 px[mj_right] += tx[im_left] * py[ij_result];
241 }
242 }
243 }
244 return;
245 }
246 </pre></font></code>
261247 <br/>
262248 <b><big><a name="Set Union" id="Set Union">Set Union</a></big></b>
263249
264250 <code><font color='blue'><pre style='display:inline'>
265 void my_union(
266 std::set&lt;size_t&gt;&amp; result ,
267 const std::set&lt;size_t&gt;&amp; left ,
268 const std::set&lt;size_t&gt;&amp; right )
269 { std::set&lt;size_t&gt; temp;
270 std::set_union(
271 left.begin() ,
272 left.end() ,
273 right.begin() ,
274 right.end() ,
275 std::inserter(temp, temp.begin())
276 );
277 result.swap(temp);
278 }
279 </pre></font></code>
280
281
282 <br/>
251 void my_union(
252 std::set&lt;size_t&gt;&amp; result ,
253 const std::set&lt;size_t&gt;&amp; left ,
254 const std::set&lt;size_t&gt;&amp; right )
255 { std::set&lt;size_t&gt; temp;
256 std::set_union(
257 left.begin() ,
258 left.end() ,
259 right.begin() ,
260 right.end() ,
261 std::inserter(temp, temp.begin())
262 );
263 result.swap(temp);
264 }
265 </pre></font></code>
283266 <br/>
284267 <b><big><a name="CppAD User Atomic Callback Functions" id="CppAD User Atomic Callback Functions">CppAD User Atomic Callback Functions</a></big></b>
285268
286269 <code><font color='blue'><pre style='display:inline'>
287 // ----------------------------------------------------------------------
288 // forward mode routine called by CppAD
289 bool mat_mul_forward(
290 size_t id ,
291 size_t k ,
292 size_t n ,
293 size_t m ,
294 const vector&lt;bool&gt;&amp; vx ,
295 vector&lt;bool&gt;&amp; vy ,
296 const vector&lt;double&gt;&amp; tx ,
297 vector&lt;double&gt;&amp; ty
298 )
299 { size_t i, j, ell;
300 get_info(id, k, n, m);
301
302 // check if this is during the call to mat_mul(id, ax, ay)
303 if( vx.size() &gt; 0 )
304 { assert( k == 0 &amp;&amp; vx.size() &gt; 0 );
305
306 // store the vx information in info_
307 assert( vx_-&gt;size() == 0 );
308 info_[id].vx.resize(n);
309 for(j = 0; j &lt; n; j++)
310 info_[id].vx[j] = vx[j];
311 assert( vx_-&gt;size() == n );
312
313 // now compute vy
314 for(i = 0; i &lt; nr_result_; i++)
315 { for(j = 0; j &lt; nc_result_; j++)
316 { // compute vy[ result(i, j, 0) ]
317 bool var = false;
318 bool nz_left, nz_right;
319 size_t middle, im_left, mj_right, ij_result;
320 for(middle = 0; middle &lt; n_middle_; middle++)
321 { im_left = left(i, middle, k);
322 mj_right = right(middle, j, k);
323 nz_left = vx[im_left] | (tx[im_left] != 0.);
324 nz_right = vx[mj_right] | (tx[mj_right]!= 0.);
325 // if not multiplying by the constant zero
326 if( nz_left &amp; nz_right )
327 var |= (vx[im_left] | vx[mj_right]);
328 }
329 ij_result = result(i, j, k);
330 vy[ij_result] = var;
331 }
332 }
333 }
334
335 // initialize result as zero
336 for(i = 0; i &lt; nr_result_; i++)
337 { for(j = 0; j &lt; nc_result_; j++)
338 ty[ result(i, j, k) ] = 0.;
339 }
340 // sum the product of proper orders
341 for(ell = 0; ell &lt;=k; ell++)
342 multiply_and_sum(ell, k-ell, tx, ty);
343
344 // All orders are implemented and there are no possible error
345 // conditions, so always return true.
346 return true;
347 }
348 // ----------------------------------------------------------------------
349 // reverse mode routine called by CppAD
350 bool mat_mul_reverse(
351 size_t id ,
352 size_t k ,
353 size_t n ,
354 size_t m ,
355 const vector&lt;double&gt;&amp; tx ,
356 const vector&lt;double&gt;&amp; ty ,
357 vector&lt;double&gt;&amp; px ,
358 const vector&lt;double&gt;&amp; py
359 )
360 { get_info(id, k, n, m);
361
362 size_t ell = n * n_order_;
363 while(ell--)
364 px[ell] = 0.;
365
366 size_t order = n_order_;
367 while(order--)
368 { // reverse sum the products for specified order
369 for(ell = 0; ell &lt;=order; ell++)
370 reverse_multiply(ell, order-ell, tx, ty, px, py);
371 }
372
373 // All orders are implemented and there are no possible error
374 // conditions, so always return true.
375 return true;
376 }
377
378 // ----------------------------------------------------------------------
379 // forward Jacobian sparsity routine called by CppAD
380 bool mat_mul_for_jac_sparse(
381 size_t id ,
382 size_t n ,
383 size_t m ,
384 size_t p ,
385 const vector&lt; std::set&lt;size_t&gt; &gt;&amp; r ,
386 vector&lt; std::set&lt;size_t&gt; &gt;&amp; s )
387 { size_t i, j, k, im_left, middle, mj_right, ij_result;
388 k = 0;
389 get_info(id, k, n, m);
390
391 for(i = 0; i &lt; nr_result_; i++)
392 { for(j = 0; j &lt; nc_result_; j++)
393 { ij_result = result(i, j, k);
394 s[ij_result].clear();
395 for(middle = 0; middle &lt; n_middle_; middle++)
396 { im_left = left(i, middle, k);
397 mj_right = right(middle, j, k);
398
399 // s[ij_result] = union( s[ij_result], r[im_left] )
400 my_union(s[ij_result], s[ij_result], r[im_left]);
401
402 // s[ij_result] = union( s[ij_result], r[mj_right] )
403 my_union(s[ij_result], s[ij_result], r[mj_right]);
404 }
405 }
406 }
407 return true;
408 }
409 // ----------------------------------------------------------------------
410 // reverse Jacobian sparsity routine called by CppAD
411 bool mat_mul_rev_jac_sparse(
412 size_t id ,
413 size_t n ,
414 size_t m ,
415 size_t p ,
416 vector&lt; std::set&lt;size_t&gt; &gt;&amp; r ,
417 const vector&lt; std::set&lt;size_t&gt; &gt;&amp; s )
418 { size_t i, j, k, im_left, middle, mj_right, ij_result;
419 k = 0;
420 get_info(id, k, n, m);
421
422 for(j = 0; j &lt; n; j++)
423 r[j].clear();
424
425 for(i = 0; i &lt; nr_result_; i++)
426 { for(j = 0; j &lt; nc_result_; j++)
427 { ij_result = result(i, j, k);
428 for(middle = 0; middle &lt; n_middle_; middle++)
429 { im_left = left(i, middle, k);
430 mj_right = right(middle, j, k);
431
432 // r[im_left] = union( r[im_left], s[ij_result] )
433 my_union(r[im_left], r[im_left], s[ij_result]);
434
435 // r[mj_right] = union( r[mj_right], s[ij_result] )
436 my_union(r[mj_right], r[mj_right], s[ij_result]);
437 }
438 }
439 }
440 return true;
441 }
442 // ----------------------------------------------------------------------
443 // reverse Hessian sparsity routine called by CppAD
444 bool mat_mul_rev_hes_sparse(
445 size_t id ,
446 size_t n ,
447 size_t m ,
448 size_t p ,
449 const vector&lt; std::set&lt;size_t&gt; &gt;&amp; r ,
450 const vector&lt;bool&gt;&amp; s ,
451 vector&lt;bool&gt;&amp; t ,
452 const vector&lt; std::set&lt;size_t&gt; &gt;&amp; u ,
453 vector&lt; std::set&lt;size_t&gt; &gt;&amp; v )
454 { size_t i, j, k, im_left, middle, mj_right, ij_result;
455 k = 0;
456 get_info(id, k, n, m);
457
458 for(j = 0; j &lt; n; j++)
459 { t[j] = false;
460 v[j].clear();
461 }
462
463 assert( vx_-&gt;size() == n );
464 for(i = 0; i &lt; nr_result_; i++)
465 { for(j = 0; j &lt; nc_result_; j++)
466 { ij_result = result(i, j, k);
467 for(middle = 0; middle &lt; n_middle_; middle++)
468 { im_left = left(i, middle, k);
469 mj_right = right(middle, j, k);
470
471 // back propagate Jacobian sparsity
472 t[im_left] = (t[im_left] | s[ij_result]);
473 t[mj_right] = (t[mj_right] | s[ij_result]);
474 // Visual Studio C++ 2008 warns unsafe mix of int and
475 // bool if we use the following code directly above:
476 // t[im_left] |= s[ij_result];
477 // t[mj_right] |= s[ij_result];
478
479 // back propagate Hessian sparsity
480 // v[im_left] = union( v[im_left], u[ij_result] )
481 // v[mj_right] = union( v[mj_right], u[ij_result] )
482 my_union(v[im_left], v[im_left], u[ij_result] );
483 my_union(v[mj_right], v[mj_right], u[ij_result] );
484
485 // Check for case where the (i,j) result element
486 // is in reverse Jacobian and both left and right
487 // operands in multiplication are variables
488 if(s[ij_result] &amp; (*vx_)[im_left] &amp; (*vx_)[mj_right])
489 { // v[im_left] = union( v[im_left], r[mj_right] )
490 my_union(v[im_left], v[im_left], r[mj_right] );
491 // v[mj_right] = union( v[mj_right], r[im_left] )
492 my_union(v[mj_right], v[mj_right], r[im_left] );
493 }
494 }
495 }
496 }
497 return true;
498 }
499 </pre></font></code>
500
501
502 <br/>
270 // ----------------------------------------------------------------------
271 // forward mode routine called by CppAD
272 bool mat_mul_forward(
273 size_t id ,
274 size_t k ,
275 size_t n ,
276 size_t m ,
277 const vector&lt;bool&gt;&amp; vx ,
278 vector&lt;bool&gt;&amp; vy ,
279 const vector&lt;double&gt;&amp; tx ,
280 vector&lt;double&gt;&amp; ty
281 )
282 { size_t i, j, ell;
283 get_info(id, k, n, m);
284
285 // check if this is during the call to mat_mul(id, ax, ay)
286 if( vx.size() &gt; 0 )
287 { assert( k == 0 &amp;&amp; vx.size() &gt; 0 );
288
289 // store the vx information in info_
290 assert( vx_-&gt;size() == 0 );
291 info_[id].vx.resize(n);
292 for(j = 0; j &lt; n; j++)
293 info_[id].vx[j] = vx[j];
294 assert( vx_-&gt;size() == n );
295
296 // now compute vy
297 for(i = 0; i &lt; nr_result_; i++)
298 { for(j = 0; j &lt; nc_result_; j++)
299 { // compute vy[ result(i, j, 0) ]
300 bool var = false;
301 bool nz_left, nz_right;
302 size_t middle, im_left, mj_right, ij_result;
303 for(middle = 0; middle &lt; n_middle_; middle++)
304 { im_left = left(i, middle, k);
305 mj_right = right(middle, j, k);
306 nz_left = vx[im_left] | (tx[im_left] != 0.);
307 nz_right = vx[mj_right] | (tx[mj_right]!= 0.);
308 // if not multiplying by the constant zero
309 if( nz_left &amp; nz_right )
310 var |= (vx[im_left] | vx[mj_right]);
311 }
312 ij_result = result(i, j, k);
313 vy[ij_result] = var;
314 }
315 }
316 }
317
318 // initialize result as zero
319 for(i = 0; i &lt; nr_result_; i++)
320 { for(j = 0; j &lt; nc_result_; j++)
321 ty[ result(i, j, k) ] = 0.;
322 }
323 // sum the product of proper orders
324 for(ell = 0; ell &lt;=k; ell++)
325 multiply_and_sum(ell, k-ell, tx, ty);
326
327 // All orders are implemented and there are no possible error
328 // conditions, so always return true.
329 return true;
330 }
331 // ----------------------------------------------------------------------
332 // reverse mode routine called by CppAD
333 bool mat_mul_reverse(
334 size_t id ,
335 size_t k ,
336 size_t n ,
337 size_t m ,
338 const vector&lt;double&gt;&amp; tx ,
339 const vector&lt;double&gt;&amp; ty ,
340 vector&lt;double&gt;&amp; px ,
341 const vector&lt;double&gt;&amp; py
342 )
343 { get_info(id, k, n, m);
344
345 size_t ell = n * n_order_;
346 while(ell--)
347 px[ell] = 0.;
348
349 size_t order = n_order_;
350 while(order--)
351 { // reverse sum the products for specified order
352 for(ell = 0; ell &lt;=order; ell++)
353 reverse_multiply(ell, order-ell, tx, ty, px, py);
354 }
355
356 // All orders are implemented and there are no possible error
357 // conditions, so always return true.
358 return true;
359 }
360
361 // ----------------------------------------------------------------------
362 // forward Jacobian sparsity routine called by CppAD
363 bool mat_mul_for_jac_sparse(
364 size_t id ,
365 size_t n ,
366 size_t m ,
367 size_t p ,
368 const vector&lt; std::set&lt;size_t&gt; &gt;&amp; r ,
369 vector&lt; std::set&lt;size_t&gt; &gt;&amp; s )
370 { size_t i, j, k, im_left, middle, mj_right, ij_result;
371 k = 0;
372 get_info(id, k, n, m);
373
374 for(i = 0; i &lt; nr_result_; i++)
375 { for(j = 0; j &lt; nc_result_; j++)
376 { ij_result = result(i, j, k);
377 s[ij_result].clear();
378 for(middle = 0; middle &lt; n_middle_; middle++)
379 { im_left = left(i, middle, k);
380 mj_right = right(middle, j, k);
381
382 // s[ij_result] = union( s[ij_result], r[im_left] )
383 my_union(s[ij_result], s[ij_result], r[im_left]);
384
385 // s[ij_result] = union( s[ij_result], r[mj_right] )
386 my_union(s[ij_result], s[ij_result], r[mj_right]);
387 }
388 }
389 }
390 return true;
391 }
392 // ----------------------------------------------------------------------
393 // reverse Jacobian sparsity routine called by CppAD
394 bool mat_mul_rev_jac_sparse(
395 size_t id ,
396 size_t n ,
397 size_t m ,
398 size_t p ,
399 vector&lt; std::set&lt;size_t&gt; &gt;&amp; r ,
400 const vector&lt; std::set&lt;size_t&gt; &gt;&amp; s )
401 { size_t i, j, k, im_left, middle, mj_right, ij_result;
402 k = 0;
403 get_info(id, k, n, m);
404
405 for(j = 0; j &lt; n; j++)
406 r[j].clear();
407
408 for(i = 0; i &lt; nr_result_; i++)
409 { for(j = 0; j &lt; nc_result_; j++)
410 { ij_result = result(i, j, k);
411 for(middle = 0; middle &lt; n_middle_; middle++)
412 { im_left = left(i, middle, k);
413 mj_right = right(middle, j, k);
414
415 // r[im_left] = union( r[im_left], s[ij_result] )
416 my_union(r[im_left], r[im_left], s[ij_result]);
417
418 // r[mj_right] = union( r[mj_right], s[ij_result] )
419 my_union(r[mj_right], r[mj_right], s[ij_result]);
420 }
421 }
422 }
423 return true;
424 }
425 // ----------------------------------------------------------------------
426 // reverse Hessian sparsity routine called by CppAD
427 bool mat_mul_rev_hes_sparse(
428 size_t id ,
429 size_t n ,
430 size_t m ,
431 size_t p ,
432 const vector&lt; std::set&lt;size_t&gt; &gt;&amp; r ,
433 const vector&lt;bool&gt;&amp; s ,
434 vector&lt;bool&gt;&amp; t ,
435 const vector&lt; std::set&lt;size_t&gt; &gt;&amp; u ,
436 vector&lt; std::set&lt;size_t&gt; &gt;&amp; v )
437 { size_t i, j, k, im_left, middle, mj_right, ij_result;
438 k = 0;
439 get_info(id, k, n, m);
440
441 for(j = 0; j &lt; n; j++)
442 { t[j] = false;
443 v[j].clear();
444 }
445
446 assert( vx_-&gt;size() == n );
447 for(i = 0; i &lt; nr_result_; i++)
448 { for(j = 0; j &lt; nc_result_; j++)
449 { ij_result = result(i, j, k);
450 for(middle = 0; middle &lt; n_middle_; middle++)
451 { im_left = left(i, middle, k);
452 mj_right = right(middle, j, k);
453
454 // back propagate Jacobian sparsity
455 t[im_left] = (t[im_left] | s[ij_result]);
456 t[mj_right] = (t[mj_right] | s[ij_result]);
457 // Visual Studio C++ 2008 warns unsafe mix of int and
458 // bool if we use the following code directly above:
459 // t[im_left] |= s[ij_result];
460 // t[mj_right] |= s[ij_result];
461
462 // back propagate Hessian sparsity
463 // v[im_left] = union( v[im_left], u[ij_result] )
464 // v[mj_right] = union( v[mj_right], u[ij_result] )
465 my_union(v[im_left], v[im_left], u[ij_result] );
466 my_union(v[mj_right], v[mj_right], u[ij_result] );
467
468 // Check for case where the (i,j) result element
469 // is in reverse Jacobian and both left and right
470 // operands in multiplication are variables
471 if(s[ij_result] &amp; (*vx_)[im_left] &amp; (*vx_)[mj_right])
472 { // v[im_left] = union( v[im_left], r[mj_right] )
473 my_union(v[im_left], v[im_left], r[mj_right] );
474 // v[mj_right] = union( v[mj_right], r[im_left] )
475 my_union(v[mj_right], v[mj_right], r[im_left] );
476 }
477 }
478 }
479 }
480 return true;
481 }
482 </pre></font></code>
503483 <br/>
504484 <b><big><a name="Declare mat_mul Function" id="Declare mat_mul Function">Declare mat_mul Function</a></big></b>
505485 <br/>
511491
512492 instead of <code><font color="blue">CppAD::vector</font></code>):
513493 <code><font color='blue'><pre style='display:inline'>
514 CPPAD_USER_ATOMIC(
515 mat_mul ,
516 CppAD::vector ,
517 double ,
518 mat_mul_forward ,
519 mat_mul_reverse ,
520 mat_mul_for_jac_sparse ,
521 mat_mul_rev_jac_sparse ,
522 mat_mul_rev_hes_sparse
523 )
494 CPPAD_USER_ATOMIC(
495 mat_mul ,
496 CppAD::vector ,
497 double ,
498 mat_mul_forward ,
499 mat_mul_reverse ,
500 mat_mul_for_jac_sparse ,
501 mat_mul_rev_jac_sparse ,
502 mat_mul_rev_hes_sparse
503 )
524504 } // End empty namespace
525505 </pre></font></code>
526
527506
528507 <hr/>Input File: test_more/old_mat_mul.hpp
529508
55 <title>Set Maximum Number of Threads for omp_alloc Allocator</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Set Maximum Number of Threads for omp_alloc Allocator"/>
8 <meta name="keywords" id="keywords" content=" set maximum number of threads for omp_alloc allocator max_num_threads removed syntax purpose restrictions "/>
8 <meta name="keywords" id="keywords" content=" set maximum number threads omp_alloc allocator max_num_threads removed syntax purpose restrictions "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Old Atomic Operation Reciprocal: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Old Atomic Operation Reciprocal: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" old atomic operation reciprocal: example and test deprecated 2013-05-27 theory "/>
8 <meta name="keywords" id="keywords" content=" old atomic operation reciprocal: example test deprecated 2013-05-27 theory "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Old Tan and Tanh as User Atomic Operations: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Old Tan and Tanh as User Atomic Operations: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" old tan and tanh as user atomic operations: example test deprecated 2013-05-27 theory "/>
8 <meta name="keywords" id="keywords" content=" old tan tanh user atomic operations: example test deprecated 2013-05-27 theory "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>OpenMP Memory Allocator: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="OpenMP Memory Allocator: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" openmp memory allocator: example and test allocation multi thread deprecated 2011-08-31 "/>
8 <meta name="keywords" id="keywords" content=" openmp memory allocator: example test allocation multi thread deprecated 2011-08-31 "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>A Quick OpenMP Memory Allocator Used by CppAD</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="A Quick OpenMP Memory Allocator Used by CppAD"/>
8 <meta name="keywords" id="keywords" content=" a quick openmp memory allocator used by cppad multi-threading allocation syntax purpose include deprecated 2011-08-23 "/>
8 <meta name="keywords" id="keywords" content=" quick openmp memory allocator used cppad multi-threading allocation syntax purpose include deprecated 2011-08-23 "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Amount of Memory Available for Quick Use by a Thread</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Amount of Memory Available for Quick Use by a Thread"/>
8 <meta name="keywords" id="keywords" content=" amount of memory available for quick use by a thread deprecated 2011-08-31 syntax purpose num_bytes example "/>
8 <meta name="keywords" id="keywords" content=" amount memory available quick use thread deprecated 2011-08-31 syntax purpose num_bytes example "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Allocate Memory and Create A Raw Array</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Allocate Memory and Create A Raw Array"/>
8 <meta name="keywords" id="keywords" content=" allocate memory and create a raw array create_array deprecated 2011-08-31 syntax purpose type size_min size_out delta example "/>
8 <meta name="keywords" id="keywords" content=" allocate memory create raw array create_array deprecated 2011-08-31 syntax purpose type size_min size_out delta example "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Return A Raw Array to The Available Memory for a Thread</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Return A Raw Array to The Available Memory for a Thread"/>
8 <meta name="keywords" id="keywords" content=" return a raw array to the available memory for thread delete_array deprecated 2011-08-31 syntax purpose type delta example "/>
8 <meta name="keywords" id="keywords" content=" return raw array to the available memory thread delete_array deprecated 2011-08-31 syntax purpose type delta example "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Check If A Memory Allocation is Efficient for Another Use</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Check If A Memory Allocation is Efficient for Another Use"/>
8 <meta name="keywords" id="keywords" content=" check if a memory allocation is efficient for another use removed syntax purpose v_ptr num_bytes flag thread ndebug "/>
8 <meta name="keywords" id="keywords" content=" check if memory allocation is efficient another use removed syntax purpose v_ptr num_bytes flag thread ndebug "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Free Memory Currently Available for Quick Use by a Thread</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Free Memory Currently Available for Quick Use by a Thread"/>
8 <meta name="keywords" id="keywords" content=" free memory currently available for quick use by a thread free_available deprecated 2011-08-31 syntax purpose example "/>
8 <meta name="keywords" id="keywords" content=" free memory currently available quick use thread free_available deprecated 2011-08-31 syntax purpose example "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Get At Least A Specified Amount of Memory</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Get At Least A Specified Amount of Memory"/>
8 <meta name="keywords" id="keywords" content=" get at least a specified amount of memory deprecated 2011-08-31 syntax purpose min_bytes cap_bytes v_ptr allocation speed example "/>
8 <meta name="keywords" id="keywords" content=" get least specified amount memory deprecated 2011-08-31 syntax purpose min_bytes cap_bytes v_ptr allocation speed example "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Is The Current Execution in OpenMP Parallel Mode</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Is The Current Execution in OpenMP Parallel Mode"/>
8 <meta name="keywords" id="keywords" content=" is the current execution in openmp parallel mode in_parallel deprecated 2011-08-31 syntax purpose flag example "/>
8 <meta name="keywords" id="keywords" content=" is the current execution openmp parallel mode in_parallel deprecated 2011-08-31 syntax purpose flag example "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Amount of Memory a Thread is Currently Using</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Amount of Memory a Thread is Currently Using"/>
8 <meta name="keywords" id="keywords" content=" amount of memory a thread is currently using inuse deprecated 2011-08-31 syntax purpose num_bytes example "/>
8 <meta name="keywords" id="keywords" content=" amount memory thread is currently using inuse deprecated 2011-08-31 syntax purpose num_bytes example "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Set and Get Maximum Number of Threads for omp_alloc Allocator</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Set and Get Maximum Number of Threads for omp_alloc Allocator"/>
8 <meta name="keywords" id="keywords" content=" set and get maximum number of threads for omp_alloc allocator deprecated 2011-08-31 syntax purpose set_max_num_threads get_max_num_threads restrictions "/>
8 <meta name="keywords" id="keywords" content=" set get maximum number threads omp_alloc allocator deprecated 2011-08-31 syntax purpose set_max_num_threads get_max_num_threads restrictions "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>opt_val_hes: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="opt_val_hes: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" opt_val_hes: example and test opt_val_hes "/>
8 <meta name="keywords" id="keywords" content=" opt_val_hes: example test opt_val_hes "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Jacobian and Hessian of Optimal Values</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Jacobian and Hessian of Optimal Values"/>
8 <meta name="keywords" id="keywords" content=" jacobian and hessian of optimal values opt_val_hes syntax see also reference purpose basevector x y fun fun::ad_vector fun.ell fun.s fun.sy jac hes signdet example "/>
8 <meta name="keywords" id="keywords" content=" jacobian hessian optimal values opt_val_hes syntax see also reference purpose basevector x y fun fun::ad_vector fun.ell fun.s fun.sy jac hes signdet example "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>ADFun Operation Sequence Optimization: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="ADFun Operation Sequence Optimization: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" adfun operation sequence optimization: example and test optimize "/>
8 <meta name="keywords" id="keywords" content=" adfun operation sequence optimization: example test optimize "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Optimize an ADFun Object Tape</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Optimize an ADFun Object Tape"/>
8 <meta name="keywords" id="keywords" content=" optimize an adfun object tape sequence operations speed memory Ndebug syntax purpose f improvements testing efficiency atomic functions rev_sparse_jac nan checking optimization example "/>
8 <meta name="keywords" id="keywords" content=" optimize adfun object tape sequence operations speed memory Ndebug syntax purpose f improvements testing efficiency atomic functions rev_sparse_jac nan checking optimization example "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>AD Parameter and Variable Functions: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="AD Parameter and Variable Functions: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" ad parameter and variable functions: example test "/>
8 <meta name="keywords" id="keywords" content=" ad parameter variable functions: example test "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Is an AD Object a Parameter or Variable</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Is an AD Object a Parameter or Variable"/>
8 <meta name="keywords" id="keywords" content=" is an ad object a parameter or variable syntax purpose x b operation sequence example "/>
8 <meta name="keywords" id="keywords" content=" is ad object parameter variable syntax purpose x b operation sequence example "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
9595 The necessary flags for compiling code that includes CppAD can
9696 be obtained with the command
9797 <code><font color='blue'><pre style='display:inline'>
98 pkg-config --cflags cppad
98 pkg-config --cflags cppad
9999 </pre></font></code>
100
101100 Note that this command assumes <a href="pkgconfig.xml" target="_top"><span style='white-space: nowrap'>cppad.pc</span></a>
102101 is in
103102 the search path <code><font color="blue">PKG_CONFIG_PATH</font></code>.
107106
108107 can be obtained with the commands
109108 <code><font color='blue'><pre style='display:inline'>
110 pkg-config --libs cppad
109 pkg-config --libs cppad
111110 </pre></font></code>
112
113111 Note that this command assumes <code><font color="blue">ipopt.pc</font></code> is in
114112 the search path <code><font color="blue">PKG_CONFIG_PATH</font></code>.
115113
55 <title>Polynomial Evaluation: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Polynomial Evaluation: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" polynomial evaluation: example and test "/>
8 <meta name="keywords" id="keywords" content=" polynomial evaluation: example test "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Evaluate a Polynomial or its Derivative</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Evaluate a Polynomial or its Derivative"/>
8 <meta name="keywords" id="keywords" content=" evaluate a polynomial or its derivative Poly template syntax description include k z p type operations vector operation sequence example source "/>
8 <meta name="keywords" id="keywords" content=" evaluate polynomial its derivative Poly template syntax description include k z p type operations vector operation sequence example source "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>The AD Power Function: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="The AD Power Function: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" the ad power function: example and test "/>
8 <meta name="keywords" id="keywords" content=" the ad power function: example test "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>The Pow Integer Exponent: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="The Pow Integer Exponent: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" the pow integer exponent: example and test int "/>
8 <meta name="keywords" id="keywords" content=" the pow integer exponent: example test int "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Printing During Forward Mode: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Printing During Forward Mode: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" printing during forward mode: example and test mode print running source code output "/>
8 <meta name="keywords" id="keywords" content=" printing during forward mode: example test mode print running source code output "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
102102 # include &lt;cppad/cppad.hpp&gt;
103103
104104 namespace {
105 using std::cout;
106 using std::endl;
107 using CppAD::AD;
108
109 // use of PrintFor to check for invalid function arguments
110 <a href="ad.xml" target="_top">AD</a>&lt;double&gt; check_log(const <a href="ad.xml" target="_top">AD</a>&lt;double&gt;&amp; y)
111 { // check during recording
112 if( y &lt;= 0. )
113 cout &lt;&lt; &quot;check_log: y = &quot; &lt;&lt; y &lt;&lt; &quot; is &lt;= 0&quot; &lt;&lt; endl;
114
115 // check during zero order forward calculation
116 PrintFor(y, &quot;check_log: y == &quot;, y , &quot; which is &lt;= 0\n&quot;);
117
118 return log(y);
119 }
105 using std::cout;
106 using std::endl;
107 using CppAD::AD;
108
109 // use of PrintFor to check for invalid function arguments
110 <a href="ad.xml" target="_top">AD</a>&lt;double&gt; check_log(const <a href="ad.xml" target="_top">AD</a>&lt;double&gt;&amp; y)
111 { // check during recording
112 if( y &lt;= 0. )
113 cout &lt;&lt; &quot;check_log: y = &quot; &lt;&lt; y &lt;&lt; &quot; is &lt;= 0&quot; &lt;&lt; endl;
114
115 // check during zero order forward calculation
116 PrintFor(y, &quot;check_log: y == &quot;, y , &quot; which is &lt;= 0\n&quot;);
117
118 return log(y);
119 }
120120 }
121121
122122 void print_for(void)
123 { using CppAD::PrintFor;
124
125 // independent variable vector
126 size_t n = 1;
127 <a href="testvector.xml" target="_top">CPPAD_TESTVECTOR</a>(AD&lt;double&gt;) ax(n);
128 ax[0] = 1.;
129 <a href="independent.xml" target="_top">Independent</a>(ax);
130
131 // print a VecAD&lt;double&gt;::reference object that is a parameter
132 CppAD::VecAD&lt;double&gt; av(1);
133 <a href="ad.xml" target="_top">AD</a>&lt;double&gt; Zero(0);
134 av[Zero] = 0.;
135 PrintFor(&quot;v[0] = &quot;, av[Zero]);
136
137 // Print a newline to separate this from previous output,
138 // then print an <a href="ad.xml" target="_top">AD</a>&lt;double&gt; object that is a variable.
139 PrintFor(&quot;\nv[0] + x[0] = &quot;, av[0] + ax[0]);
140
141 // A conditional print that will not generate output when x[0] = 2.
142 PrintFor(ax[0], &quot;\n 2. + x[0] = &quot;, 2. + ax[0], &quot;\n&quot;);
143
144 // A conditional print that will generate output when x[0] = 2.
145 PrintFor(ax[0] - 2., &quot;\n 3. + x[0] = &quot;, 3. + ax[0], &quot;\n&quot;);
146
147 // A log evaluations that will result in an error message when x[0] = 2.
148 <a href="ad.xml" target="_top">AD</a>&lt;double&gt; var = 2. - ax[0];
149 <a href="ad.xml" target="_top">AD</a>&lt;double&gt; log_var = check_log(var);
150
151 // dependent variable vector
152 size_t m = 2;
153 <a href="testvector.xml" target="_top">CPPAD_TESTVECTOR</a>(AD&lt;double&gt;) ay(m);
154 ay[0] = av[Zero] + ax[0];
155
156 // define f: x -&gt; y and stop tape recording
157 CppAD::<a href="funconstruct.xml" target="_top">ADFun</a>&lt;double&gt; f(ax, ay);
158
159 // zero order forward with x[0] = 2
160 <a href="testvector.xml" target="_top">CPPAD_TESTVECTOR</a>(double) x(n);
161 x[0] = 2.;
162
163 cout &lt;&lt; &quot;v[0] = 0&quot; &lt;&lt; endl;
164 cout &lt;&lt; &quot;v[0] + x[0] = 2&quot; &lt;&lt; endl;
165 cout &lt;&lt; &quot; 3. + x[0] = 5&quot; &lt;&lt; endl;
166 cout &lt;&lt; &quot;check_log: y == 0 which is &lt;= 0&quot; &lt;&lt; endl;
167 // ./makefile.am expects &quot;Test passes&quot; at beginning of next output line
168 cout &lt;&lt; &quot;Test passes if four lines above repeat below:&quot; &lt;&lt; endl;
169 f.<a href="forward.xml" target="_top">Forward</a>(0, x);
170
171 return;
123 { using CppAD::PrintFor;
124
125 // independent variable vector
126 size_t n = 1;
127 <a href="testvector.xml" target="_top">CPPAD_TESTVECTOR</a>(AD&lt;double&gt;) ax(n);
128 ax[0] = 1.;
129 <a href="independent.xml" target="_top">Independent</a>(ax);
130
131 // print a VecAD&lt;double&gt;::reference object that is a parameter
132 CppAD::VecAD&lt;double&gt; av(1);
133 <a href="ad.xml" target="_top">AD</a>&lt;double&gt; Zero(0);
134 av[Zero] = 0.;
135 PrintFor(&quot;v[0] = &quot;, av[Zero]);
136
137 // Print a newline to separate this from previous output,
138 // then print an <a href="ad.xml" target="_top">AD</a>&lt;double&gt; object that is a variable.
139 PrintFor(&quot;\nv[0] + x[0] = &quot;, av[0] + ax[0]);
140
141 // A conditional print that will not generate output when x[0] = 2.
142 PrintFor(ax[0], &quot;\n 2. + x[0] = &quot;, 2. + ax[0], &quot;\n&quot;);
143
144 // A conditional print that will generate output when x[0] = 2.
145 PrintFor(ax[0] - 2., &quot;\n 3. + x[0] = &quot;, 3. + ax[0], &quot;\n&quot;);
146
147 // A log evaluations that will result in an error message when x[0] = 2.
148 <a href="ad.xml" target="_top">AD</a>&lt;double&gt; var = 2. - ax[0];
149 <a href="ad.xml" target="_top">AD</a>&lt;double&gt; log_var = check_log(var);
150
151 // dependent variable vector
152 size_t m = 2;
153 <a href="testvector.xml" target="_top">CPPAD_TESTVECTOR</a>(AD&lt;double&gt;) ay(m);
154 ay[0] = av[Zero] + ax[0];
155
156 // define f: x -&gt; y and stop tape recording
157 CppAD::<a href="funconstruct.xml" target="_top">ADFun</a>&lt;double&gt; f(ax, ay);
158
159 // zero order forward with x[0] = 2
160 <a href="testvector.xml" target="_top">CPPAD_TESTVECTOR</a>(double) x(n);
161 x[0] = 2.;
162
163 cout &lt;&lt; &quot;v[0] = 0&quot; &lt;&lt; endl;
164 cout &lt;&lt; &quot;v[0] + x[0] = 2&quot; &lt;&lt; endl;
165 cout &lt;&lt; &quot; 3. + x[0] = 5&quot; &lt;&lt; endl;
166 cout &lt;&lt; &quot;check_log: y == 0 which is &lt;= 0&quot; &lt;&lt; endl;
167 // ./makefile.am expects &quot;Test passes&quot; at beginning of next output line
168 cout &lt;&lt; &quot;Test passes if four lines above repeat below:&quot; &lt;&lt; endl;
169 f.<a href="forward.xml" target="_top">Forward</a>(0, x);
170
171 return;
172172 }
173173 int main(void)
174 { bool ok = true;
175 print_for();
176
177 size_t thread;
178 for(thread = 0; thread &lt; 2; thread++)
179 { ok &amp;= CppAD::omp_alloc::inuse(thread) == 0;
180 ok &amp;= CppAD::omp_alloc::available(thread) == 0;
181 }
182 if( ! ok )
183 return 1;
184 return 0;
174 { bool ok = true;
175 print_for();
176
177 size_t thread;
178 for(thread = 0; thread &lt; 2; thread++)
179 { ok &amp;= CppAD::omp_alloc::inuse(thread) == 0;
180 ok &amp;= CppAD::omp_alloc::available(thread) == 0;
181 }
182 if( ! ok )
183 return 1;
184 return 0;
185185 }
186186 </pre></font></code>
187
188
189 <br/>
190187 <br/>
191188 <b><big><a name="Output" id="Output">Output</a></big></b>
192189 <br/>
193190 Executing the program above generates the following output:
194191 <code><font color='blue'><pre style='display:inline'>
195 v[0] = 0
196 v[0] + x[0] = 2
197 Test passes if two lines above repeat below:
198 v[0] = 0
199 v[0] + x[0] = 2
192 v[0] = 0
193 v[0] + x[0] = 2
194 Test passes if two lines above repeat below:
195 v[0] = 0
196 v[0] + x[0] = 2
200197 </pre></font></code>
201
202198
203199 <hr/>Input File: print_for/print_for.cpp
204200
55 <title>Print During Zero Order Forward Mode: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Print During Zero Order Forward Mode: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" print during zero order forward mode: example and test "/>
8 <meta name="keywords" id="keywords" content=" print during zero order forward mode: example test "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
7777 <td>print_for_string.cpp</td>
7878 <td>Headings</td>
7979 </tr></table><br/>
80
81
82
8380 <center><b><big><big>Print During Zero Order Forward Mode: Example and Test</big></big></b></center>
8481 <code><font color="blue"><pre style='display:inline'>
8582 # include &lt;cppad/cppad.hpp&gt;
55 <title>Repeat det_by_minor Routine A Specified Number of Times</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Repeat det_by_minor Routine A Specified Number of Times"/>
8 <meta name="keywords" id="keywords" content=" repeat det_by_minor routine a specified number of times syntax size source code "/>
8 <meta name="keywords" id="keywords" content=" repeat det_by_minor routine specified number times syntax size source code "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
9898 </select>
9999 </td>
100100 </tr></table><br/>
101
102
103
104101 <center><b><big><big>Repeat det_by_minor Routine A Specified Number of Times</big></big></b></center>
105102 <br/>
106103 <b><big><a name="Syntax" id="Syntax">Syntax</a></big></b>
142139
143140 <code><font color='blue'><pre style='display:inline'>
144141 void repeat_det_by_minor(size_t repeat, size_t size)
145 { double *a;
146 a = (double*) malloc( (size * size) * sizeof(double) );
142 { double *a;
143 a = (double*) malloc( (size * size) * sizeof(double) );
147144
148 while(repeat--)
149 { <a href="uniform_01_c.xml" target="_top">uniform_01</a>(size * size, a);
150 <a href="det_by_minor_c.xml" target="_top">det_by_minor</a>(a, size);
151 }
152
153 free(a);
154 return;
145 while(repeat--)
146 { <a href="uniform_01_c.xml" target="_top">uniform_01</a>(size * size, a);
147 <a href="det_by_minor_c.xml" target="_top">det_by_minor</a>(a, size);
148 }
149
150 free(a);
151 return;
155152 }
156153 </pre></font></code>
157
158154
159155 <hr/>Input File: compare_c/det_by_minor.c
160156
55 <title>First Order Derivative Driver: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="First Order Derivative Driver: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" first order derivative driver: example and test "/>
8 <meta name="keywords" id="keywords" content=" first order derivative driver: example test "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Reverse Mode Hessian Sparsity: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Reverse Mode Hessian Sparsity: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" reverse mode hessian sparsity: example and test Revsparsehes sparsity "/>
8 <meta name="keywords" id="keywords" content=" reverse mode hessian sparsity: example test Revsparsehes sparsity "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Reverse Mode Jacobian Sparsity: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Reverse Mode Jacobian Sparsity: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" reverse mode jacobian sparsity: example and test Revsparsejac sparsity "/>
8 <meta name="keywords" id="keywords" content=" reverse mode jacobian sparsity: example test Revsparsejac sparsity "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Second Partials Reverse Driver: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Second Partials Reverse Driver: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" second partials reverse driver: example and test "/>
8 <meta name="keywords" id="keywords" content=" second partials reverse driver: example test "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Reverse Mode General Case: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Reverse Mode General Case: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" reverse mode general case: example and test purpose processing steps "/>
8 <meta name="keywords" id="keywords" content=" reverse mode general case: example test purpose processing steps "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>An Important Reverse Mode Identity</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="An Important Reverse Mode Identity"/>
8 <meta name="keywords" id="keywords" content=" an important reverse mode identity notation sweep theorem proof "/>
8 <meta name="keywords" id="keywords" content=" important reverse mode identity notation sweep theorem proof "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
551551
552552 times
553553 continuously differentiable function.
554 Define the functions
554 Define the functions
555555
556556 <math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow>
557557 <mi mathvariant='italic'>Z</mi>
724724 </msup>
725725 </mrow></math>
726726
727 denotes the <code><i>j</i></code>-th column of
727 denotes the <code><i>j</i></code>-th column of
728728
729729 <math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow>
730730 <mi mathvariant='italic'>x</mi>
991991 <mi mathvariant='italic'>i</mi>
992992 </mrow></math>
993993
994 , the <code><i>k</i></code>-th
994 , the <code><i>k</i></code>-th
995995 partial of
996996 <math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow>
997997 <msup><mi mathvariant='italic'>t</mi>
55 <title>First Order Reverse Mode: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="First Order Reverse Mode: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" first order reverse mode: example and test "/>
8 <meta name="keywords" id="keywords" content=" first order reverse mode: example test "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Third Order Reverse Mode: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Third Order Reverse Mode: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" third order reverse mode: example and test taylor coefficients "/>
8 <meta name="keywords" id="keywords" content=" third order reverse mode: example test taylor coefficients "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Second Order Reverse ModeExample and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Second Order Reverse ModeExample and Test"/>
8 <meta name="keywords" id="keywords" content=" second order reverse modeexample and test example "/>
8 <meta name="keywords" id="keywords" content=" second order reverse modeexample test example "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>The Theory of Reverse Mode</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="The Theory of Reverse Mode"/>
8 <meta name="keywords" id="keywords" content=" the theory of reverse mode taylor notation binary operators addition subtraction multiplication division standard math functions "/>
8 <meta name="keywords" id="keywords" content=" the theory reverse mode taylor notation binary operators addition subtraction multiplication division standard math functions "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
114114 <br/>
115115 <b><big><a name="Taylor Notation" id="Taylor Notation">Taylor Notation</a></big></b>
116116 <br/>
117 In Taylor notation, each variable corresponds to
117 In Taylor notation, each variable corresponds to
118118 a function of a single argument which we denote by
119119 <code><i><font color="black"><span style='white-space: nowrap'>t</span></font></i></code>
120120
140140
141141 , and
142142 <code><i><font color="black"><span style='white-space: nowrap'>Z(t)</span></font></i></code>
143 are scalar valued functions
143 are scalar valued functions
144144 and the corresponding <code><i>p</i></code>-th order Taylor coefficients row vectors are
145145
146146 <math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow>
319319 </mrow></math>
320320
321321 .
322 In addition, we are given the partial derivatives of a scalar valued function
322 In addition, we are given the partial derivatives of a scalar valued function
323323
324324 <math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><mrow>
325325 <mi mathvariant='italic'>G</mi>
415415 </msup>
416416 </mrow></math>
417417
418 is expressed as a function of the
418 is expressed as a function of the
419419 <code><i>j-1</i></code>-th order Taylor coefficient row
420420 vector for
421421 <math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow>
13631363 <b><big><a name="Standard Math Functions" id="Standard Math Functions">Standard Math Functions</a></big></b>
13641364 <br/>
13651365 The standard math functions have only one argument.
1366 Hence we are given the partial derivatives of a scalar valued function
1366 Hence we are given the partial derivatives of a scalar valued function
13671367
13681368 <math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><mrow>
13691369 <mi mathvariant='italic'>G</mi>
14531453 </msup>
14541454 </mrow></math>
14551455
1456 is expressed as a function of the
1456 is expressed as a function of the
14571457 <code><i>j-1</i></code>-th order Taylor coefficient row
14581458 vector for
14591459 <math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow>
55 <title>One Dimensional Romberg Integration: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="One Dimensional Romberg Integration: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" one dimensional romberg integration: example and test "/>
8 <meta name="keywords" id="keywords" content=" one dimensional romberg integration: example test "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>One Dimensional Romberg Integration: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="One Dimensional Romberg Integration: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" one dimensional romberg integration: example and test "/>
8 <meta name="keywords" id="keywords" content=" one dimensional romberg integration: example test "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Multi-dimensional Romberg Integration</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Multi-dimensional Romberg Integration"/>
8 <meta name="keywords" id="keywords" content=" multi-dimensional romberg integration integrate multi dimensional dimension syntax description include m r f a b n p e float floatvector example source code "/>
8 <meta name="keywords" id="keywords" content=" multi-dimensional romberg integration integrate multi dimensional dimension syntax description include m r f b n p e float floatvector example source code "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>One DimensionalRomberg Integration</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="One DimensionalRomberg Integration"/>
8 <meta name="keywords" id="keywords" content=" one dimensionalromberg integration integrate Romberg syntax description include r f a b n p e float example source code "/>
8 <meta name="keywords" id="keywords" content=" one dimensionalromberg integration integrate Romberg syntax description include r f b n p e float example source code "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>A 3rd and 4th Order Rosenbrock ODE Solver</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="A 3rd and 4th Order Rosenbrock ODE Solver"/>
8 <meta name="keywords" id="keywords" content=" a 3rd and 4th order rosenbrock ode solver Rosen34 solve stiff differential equation syntax description include xf fun t x f f_t f_x nan warning optimization m ti tf xi e scalar vector parallel mode example source code "/>
8 <meta name="keywords" id="keywords" content=" 3rd 4th order rosenbrock ode solver Rosen34 solve stiff differential equation syntax description include xf fun t x f f_t f_x nan warning optimization m ti tf xi e scalar vector parallel mode example source code "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Rosen34: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Rosen34: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" rosen34: example and test Rosen34 "/>
8 <meta name="keywords" id="keywords" content=" rosen34: example test Rosen34 "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>An Embedded 4th and 5th Order Runge-Kutta ODE Solver</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="An Embedded 4th and 5th Order Runge-Kutta ODE Solver"/>
8 <meta name="keywords" id="keywords" content=" an embedded 4th and 5th order runge-kutta ode solver Runge45 Runge Kutta solve differential equation syntax purpose operation sequence include xf fun t x f warning m ti tf xi e scalar fabs vector parallel mode example source code "/>
8 <meta name="keywords" id="keywords" content=" embedded 4th 5th order runge-kutta ode solver Runge45 Runge Kutta solve differential equation syntax purpose operation sequence include xf fun t x f warning m ti tf xi e scalar fabs vector parallel mode example source code "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Runge45: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Runge45: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" runge45: example and test Runge45 "/>
8 <meta name="keywords" id="keywords" content=" runge45: example test Runge45 "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Runge45: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Runge45: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" runge45: example and test Runge45 "/>
8 <meta name="keywords" id="keywords" content=" runge45: example test Runge45 "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Sacado Speed: Gradient of Determinant Using Lu Factorization</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Sacado Speed: Gradient of Determinant Using Lu Factorization"/>
8 <meta name="keywords" id="keywords" content=" sacado speed: gradient of determinant using lu factorization link_det_lu speed matrix factor specifications implementation "/>
8 <meta name="keywords" id="keywords" content=" sacado speed: gradient determinant using lu factorization link_det_lu speed matrix factor specifications implementation "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
9191 </select>
9292 </td>
9393 </tr></table><br/>
94
95
96
9794 <center><b><big><big>Sacado Speed: Gradient of Determinant Using Lu Factorization</big></big></b></center>
9895 <br/>
9996 <b><big><a name="Specifications" id="Specifications">Specifications</a></big></b>
115112 extern bool global_memory, global_onetape, global_atomic, global_optimize;
116113
117114 bool link_det_lu(
118 size_t size ,
119 size_t repeat ,
120 CppAD::vector&lt;double&gt; &amp;matrix ,
121 CppAD::vector&lt;double&gt; &amp;gradient )
115 size_t size ,
116 size_t repeat ,
117 CppAD::vector&lt;double&gt; &amp;matrix ,
118 CppAD::vector&lt;double&gt; &amp;gradient )
122119 {
123 // speed test global option values
124 if( global_onetape || global_atomic )
125 return false;
126 if( global_memory || global_optimize )
127 return false;
128 // -----------------------------------------------------
129 // setup
130 //
131 // object for computing determinant
132 typedef Sacado::Rad::ADvar&lt;double&gt; ADScalar;
133 typedef CppAD::vector&lt;ADScalar&gt; ADVector;
134 CppAD::det_by_lu&lt;ADScalar&gt; Det(size);
120 // speed test global option values
121 if( global_onetape || global_atomic )
122 return false;
123 if( global_memory || global_optimize )
124 return false;
125 // -----------------------------------------------------
126 // setup
127 //
128 // object for computing determinant
129 typedef Sacado::Rad::ADvar&lt;double&gt; ADScalar;
130 typedef CppAD::vector&lt;ADScalar&gt; ADVector;
131 CppAD::det_by_lu&lt;ADScalar&gt; Det(size);
135132
136 size_t i; // temporary index
137 size_t n = size * size; // number of independent variables
138 ADScalar detA; // AD value of the determinant
139 ADVector A(n); // AD version of matrix
133 size_t i; // temporary index
134 size_t n = size * size; // number of independent variables
135 ADScalar detA; // AD value of the determinant
136 ADVector A(n); // AD version of matrix
140137
141 // ------------------------------------------------------
142 while(repeat--)
143 { // get the next matrix
144 CppAD::uniform_01(n, matrix);
138 // ------------------------------------------------------
139 while(repeat--)
140 { // get the next matrix
141 CppAD::uniform_01(n, matrix);
145142
146 // set independent variable values
147 for(i = 0; i &lt; n; i++)
148 A[i] = matrix[i];
143 // set independent variable values
144 for(i = 0; i &lt; n; i++)
145 A[i] = matrix[i];
149146
150 // compute the determinant
151 detA = Det(A);
147 // compute the determinant
148 detA = Det(A);
152149
153 // compute the gradient of detA
154 ADScalar::Gradcomp();
150 // compute the gradient of detA
151 ADScalar::Gradcomp();
155152
156 // evaluate and return gradient using reverse mode
157 for(i =0; i &lt; n; i++)
158 gradient[i] = A[i].adj(); // partial detA w.r.t A[i]
159 }
160 // ---------------------------------------------------------
161 return true;
153 // evaluate and return gradient using reverse mode
154 for(i =0; i &lt; n; i++)
155 gradient[i] = A[i].adj(); // partial detA w.r.t A[i]
156 }
157 // ---------------------------------------------------------
158 return true;
162159 }
163160 </pre></font></code>
164
165161
166162 <hr/>Input File: speed/sacado/det_lu.cpp
167163
55 <title>Sacado Speed: Gradient of Determinant by Minor Expansion</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Sacado Speed: Gradient of Determinant by Minor Expansion"/>
8 <meta name="keywords" id="keywords" content=" sacado speed: gradient of determinant by minor expansion link_det_minor speed specifications implementation "/>
8 <meta name="keywords" id="keywords" content=" sacado speed: gradient determinant minor expansion link_det_minor speed specifications implementation "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
113113 extern bool global_memory, global_onetape, global_atomic, global_optimize;
114114
115115 bool link_det_minor(
116 size_t size ,
117 size_t repeat ,
118 CppAD::vector&lt;double&gt; &amp;matrix ,
119 CppAD::vector&lt;double&gt; &amp;gradient )
116 size_t size ,
117 size_t repeat ,
118 CppAD::vector&lt;double&gt; &amp;matrix ,
119 CppAD::vector&lt;double&gt; &amp;gradient )
120120 {
121 // speed test global option values
122 if( global_atomic )
123 return false;
124 if( global_memory || global_onetape || global_optimize )
125 return false;
126 // -----------------------------------------------------
127 // setup
121 // speed test global option values
122 if( global_atomic )
123 return false;
124 if( global_memory || global_onetape || global_optimize )
125 return false;
126 // -----------------------------------------------------
127 // setup
128128
129 // object for computing determinant
130 typedef Sacado::Rad::ADvar&lt;double&gt; ADScalar;
131 typedef CppAD::vector&lt;ADScalar&gt; ADVector;
132 CppAD::det_by_minor&lt;ADScalar&gt; Det(size);
129 // object for computing determinant
130 typedef Sacado::Rad::ADvar&lt;double&gt; ADScalar;
131 typedef CppAD::vector&lt;ADScalar&gt; ADVector;
132 CppAD::det_by_minor&lt;ADScalar&gt; Det(size);
133133
134 size_t i; // temporary index
135 size_t n = size * size; // number of independent variables
136 ADScalar detA; // AD value of the determinant
137 ADVector A(n); // AD version of matrix
134 size_t i; // temporary index
135 size_t n = size * size; // number of independent variables
136 ADScalar detA; // AD value of the determinant
137 ADVector A(n); // AD version of matrix
138138
139 // ------------------------------------------------------
140 while(repeat--)
141 { // get the next matrix
142 CppAD::uniform_01(n, matrix);
139 // ------------------------------------------------------
140 while(repeat--)
141 { // get the next matrix
142 CppAD::uniform_01(n, matrix);
143143
144 // set independent variable values
145 for(i = 0; i &lt; n; i++)
146 A[i] = matrix[i];
144 // set independent variable values
145 for(i = 0; i &lt; n; i++)
146 A[i] = matrix[i];
147147
148 // compute the determinant
149 detA = Det(A);
148 // compute the determinant
149 detA = Det(A);
150150
151 // reverse mode compute gradient of last computed value; i.e., detA
152 ADScalar::Gradcomp();
151 // reverse mode compute gradient of last computed value; i.e., detA
152 ADScalar::Gradcomp();
153153
154 // return gradient
155 for(i =0; i &lt; n; i++)
156 gradient[i] = A[i].adj(); // partial detA w.r.t A[i]
157 }
158 // ---------------------------------------------------------
159 return true;
154 // return gradient
155 for(i =0; i &lt; n; i++)
156 gradient[i] = A[i].adj(); // partial detA w.r.t A[i]
157 }
158 // ---------------------------------------------------------
159 return true;
160160 }
161161 </pre></font></code>
162
163162
164163 <hr/>Input File: speed/sacado/det_minor.cpp
165164
9191 </select>
9292 </td>
9393 </tr></table><br/>
94
95
96
9794 <center><b><big><big>Sacado Speed: Matrix Multiplication</big></big></b></center>
9895 <br/>
9996 <b><big><a name="Specifications" id="Specifications">Specifications</a></big></b>
116113 extern bool global_memory, global_onetape, global_atomic, global_optimize;
117114
118115 bool link_mat_mul(
119 size_t size ,
120 size_t repeat ,
121 CppAD::vector&lt;double&gt;&amp; x ,
122 CppAD::vector&lt;double&gt;&amp; z ,
123 CppAD::vector&lt;double&gt;&amp; dz )
116 size_t size ,
117 size_t repeat ,
118 CppAD::vector&lt;double&gt;&amp; x ,
119 CppAD::vector&lt;double&gt;&amp; z ,
120 CppAD::vector&lt;double&gt;&amp; dz )
124121 {
125 // speed test global option values
126 if( global_memory || global_onetape || global_atomic || global_optimize )
127 return false;
128 // -----------------------------------------------------
129 // setup
122 // speed test global option values
123 if( global_memory || global_onetape || global_atomic || global_optimize )
124 return false;
125 // -----------------------------------------------------
126 // setup
130127
131 // object for computing determinant
132 typedef Sacado::Rad::ADvar&lt;double&gt; ADScalar;
133 typedef CppAD::vector&lt;ADScalar&gt; ADVector;
128 // object for computing determinant
129 typedef Sacado::Rad::ADvar&lt;double&gt; ADScalar;
130 typedef CppAD::vector&lt;ADScalar&gt; ADVector;
134131
135 size_t j; // temporary index
136 size_t m = 1; // number of dependent variables
137 size_t n = size * size; // number of independent variables
138 ADVector X(n); // AD domain space vector
139 ADVector Y(n); // Store product matrix
140 ADVector Z(m); // AD range space vector
141 ADScalar f;
132 size_t j; // temporary index
133 size_t m = 1; // number of dependent variables
134 size_t n = size * size; // number of independent variables
135 ADVector X(n); // AD domain space vector
136 ADVector Y(n); // Store product matrix
137 ADVector Z(m); // AD range space vector
138 ADScalar f;
142139
143 // ------------------------------------------------------
144 while(repeat--)
145 { // get the next matrix
146 CppAD::uniform_01(n, x);
140 // ------------------------------------------------------
141 while(repeat--)
142 { // get the next matrix
143 CppAD::uniform_01(n, x);
147144
148 // set independent variable values
149 for(j = 0; j &lt; n; j++)
150 X[j] = x[j];
145 // set independent variable values
146 for(j = 0; j &lt; n; j++)
147 X[j] = x[j];
151148
152 // do the computation
153 mat_sum_sq(size, X, Y, Z);
149 // do the computation
150 mat_sum_sq(size, X, Y, Z);
154151
155 // create function object f : X -&gt; Z
156 f = Z[0];
152 // create function object f : X -&gt; Z
153 f = Z[0];
157154
158 // reverse mode gradient of last ADvar computed value; i.e., f
159 ADScalar::Gradcomp();
155 // reverse mode gradient of last ADvar computed value; i.e., f
156 ADScalar::Gradcomp();
160157
161 // return gradient
162 for(j = 0; j &lt; n; j++)
163 dz[j] = X[j].adj(); // partial f w.r.t X[j]
164 }
165 // return function value
166 z[0] = f.val();
158 // return gradient
159 for(j = 0; j &lt; n; j++)
160 dz[j] = X[j].adj(); // partial f w.r.t X[j]
161 }
162 // return function value
163 z[0] = f.val();
167164
168 // ---------------------------------------------------------
169 return true;
165 // ---------------------------------------------------------
166 return true;
170167 }
171168 </pre></font></code>
172
173169
174170 <hr/>Input File: speed/sacado/mat_mul.cpp
175171
55 <title>Sacado Speed: Gradient of Ode Solution</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Sacado Speed: Gradient of Ode Solution"/>
8 <meta name="keywords" id="keywords" content=" sacado speed: gradient of ode solution link_ode speed specifications implementation "/>
8 <meta name="keywords" id="keywords" content=" sacado speed: gradient ode solution link_ode speed specifications implementation "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
9191 </select>
9292 </td>
9393 </tr></table><br/>
94
95
96
9794 <center><b><big><big>Sacado Speed: Gradient of Ode Solution</big></big></b></center>
9895 <br/>
9996 <b><big><a name="Specifications" id="Specifications">Specifications</a></big></b>
118115 extern bool global_memory, global_onetape, global_atomic, global_optimize;
119116
120117 bool link_ode(
121 size_t size ,
122 size_t repeat ,
123 CppAD::vector&lt;double&gt; &amp;x ,
124 CppAD::vector&lt;double&gt; &amp;jacobian
118 size_t size ,
119 size_t repeat ,
120 CppAD::vector&lt;double&gt; &amp;x ,
121 CppAD::vector&lt;double&gt; &amp;jacobian
125122 )
126123 {
127 // speed test global option values
128 if( global_atomic )
129 return false;
130 if( global_memory || global_onetape || global_optimize )
131 return false;
132 // -------------------------------------------------------------
133 // setup
134 assert( x.size() == size );
135 assert( jacobian.size() == size * size );
124 // speed test global option values
125 if( global_atomic )
126 return false;
127 if( global_memory || global_onetape || global_optimize )
128 return false;
129 // -------------------------------------------------------------
130 // setup
131 assert( x.size() == size );
132 assert( jacobian.size() == size * size );
136133
137 typedef Sacado::Fad::DFad&lt;double&gt; ADScalar;
138 typedef CppAD::vector&lt;ADScalar&gt; ADVector;
134 typedef Sacado::Fad::DFad&lt;double&gt; ADScalar;
135 typedef CppAD::vector&lt;ADScalar&gt; ADVector;
139136
140 size_t i, j;
141 size_t p = 0; // use ode to calculate function values
142 size_t n = size; // number of independent variables
143 size_t m = n; // number of dependent variables
144 ADVector X(n), Y(m); // independent and dependent variables
137 size_t i, j;
138 size_t p = 0; // use ode to calculate function values
139 size_t n = size; // number of independent variables
140 size_t m = n; // number of dependent variables
141 ADVector X(n), Y(m); // independent and dependent variables
145142
146 // -------------------------------------------------------------
147 while(repeat--)
148 { // choose next x value
149 CppAD::uniform_01(n, x);
150 for(j = 0; j &lt; n; j++)
151 { // set up for X as the independent variable vector
152 X[j] = ADScalar(int(n), int(j), x[j]);
153 }
143 // -------------------------------------------------------------
144 while(repeat--)
145 { // choose next x value
146 CppAD::uniform_01(n, x);
147 for(j = 0; j &lt; n; j++)
148 { // set up for X as the independent variable vector
149 X[j] = ADScalar(int(n), int(j), x[j]);
150 }
154151
155 // evaluate function
156 CppAD::ode_evaluate(X, p, Y);
152 // evaluate function
153 CppAD::ode_evaluate(X, p, Y);
157154
158 // return values with Y as the dependent variable vector
159 for(i = 0; i &lt; m; i++)
160 { for(j = 0; j &lt; n; j++)
161 jacobian[ i * n + j ] = Y[i].dx(j);
162 }
163 }
164 return true;
155 // return values with Y as the dependent variable vector
156 for(i = 0; i &lt; m; i++)
157 { for(j = 0; j &lt; n; j++)
158 jacobian[ i * n + j ] = Y[i].dx(j);
159 }
160 }
161 return true;
165162 }
166163 </pre></font></code>
167
168164
169165 <hr/>Input File: speed/sacado/ode.cpp
170166
55 <title>Sacado Speed: Second Derivative of a Polynomial</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Sacado Speed: Second Derivative of a Polynomial"/>
8 <meta name="keywords" id="keywords" content=" sacado speed: second derivative of a polynomial link_poly speed specifications implementation "/>
8 <meta name="keywords" id="keywords" content=" sacado speed: second derivative polynomial link_poly speed specifications implementation "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
9191 </select>
9292 </td>
9393 </tr></table><br/>
94
95
96
9794 <center><b><big><big>Sacado Speed: Second Derivative of a Polynomial</big></big></b></center>
9895 <br/>
9996 <b><big><a name="Specifications" id="Specifications">Specifications</a></big></b>
117114 extern bool global_memory, global_onetape, global_atomic, global_optimize;
118115
119116 bool link_poly(
120 size_t size ,
121 size_t repeat ,
122 CppAD::vector&lt;double&gt; &amp;a , // coefficients of polynomial
123 CppAD::vector&lt;double&gt; &amp;z , // polynomial argument value
124 CppAD::vector&lt;double&gt; &amp;ddp ) // second derivative w.r.t z
117 size_t size ,
118 size_t repeat ,
119 CppAD::vector&lt;double&gt; &amp;a , // coefficients of polynomial
120 CppAD::vector&lt;double&gt; &amp;z , // polynomial argument value
121 CppAD::vector&lt;double&gt; &amp;ddp ) // second derivative w.r.t z
125122 {
126 if( global_atomic )
127 return false;
128 if( global_memory || global_onetape || global_optimize )
129 return false;
130 // -----------------------------------------------------
131 // setup
132 typedef Sacado::Tay::Taylor&lt;double&gt; ADScalar;
133 CppAD::vector&lt;ADScalar&gt; A(size);
123 if( global_atomic )
124 return false;
125 if( global_memory || global_onetape || global_optimize )
126 return false;
127 // -----------------------------------------------------
128 // setup
129 typedef Sacado::Tay::Taylor&lt;double&gt; ADScalar;
130 CppAD::vector&lt;ADScalar&gt; A(size);
134131
135 size_t i; // temporary index
136 ADScalar Z; // domain space AD value
137 ADScalar P; // range space AD value
138 unsigned int order = 2; // order of Taylor coefficients
139 Z.resize(order+1, false);
140 P.resize(order+1, false);
132 size_t i; // temporary index
133 ADScalar Z; // domain space AD value
134 ADScalar P; // range space AD value
135 unsigned int order = 2; // order of Taylor coefficients
136 Z.resize(order+1, false);
137 P.resize(order+1, false);
141138
142 // choose the polynomial coefficients
143 CppAD::uniform_01(size, a);
139 // choose the polynomial coefficients
140 CppAD::uniform_01(size, a);
144141
145 // AD copy of the polynomial coefficients
146 for(i = 0; i &lt; size; i++)
147 A[i] = a[i];
142 // AD copy of the polynomial coefficients
143 for(i = 0; i &lt; size; i++)
144 A[i] = a[i];
148145
149 // ------------------------------------------------------
150 while(repeat--)
151 { // get the next argument value
152 CppAD::uniform_01(1, z);
146 // ------------------------------------------------------
147 while(repeat--)
148 { // get the next argument value
149 CppAD::uniform_01(1, z);
153150
154 // independent variable value
155 Z.fastAccessCoeff(0) = z[0]; // argument value
156 Z.fastAccessCoeff(1) = 1.; // first order coefficient
157 Z.fastAccessCoeff(2) = 0.; // second order coefficient
151 // independent variable value
152 Z.fastAccessCoeff(0) = z[0]; // argument value
153 Z.fastAccessCoeff(1) = 1.; // first order coefficient
154 Z.fastAccessCoeff(2) = 0.; // second order coefficient
158155
159 // AD computation of the dependent variable
160 P = CppAD::Poly(0, A, Z);
156 // AD computation of the dependent variable
157 P = CppAD::Poly(0, A, Z);
161158
162 // second derivative is twice second order Taylor coefficient
163 ddp[0] = 2. * P.fastAccessCoeff(2);
164 }
165 // ------------------------------------------------------
166 return true;
159 // second derivative is twice second order Taylor coefficient
160 ddp[0] = 2. * P.fastAccessCoeff(2);
161 }
162 // ------------------------------------------------------
163 return true;
167164 }
168165 </pre></font></code>
169
170166
171167 <hr/>Input File: speed/sacado/poly.cpp
172168
8585 <td>sacado_sparse_hessian.cpp</td>
8686 <td>Headings</td>
8787 </tr></table><br/>
88
89
90
9188 <center><b><big><big>Sacado Speed: Sparse Hessian</big></big></b></center>
92 <code><font color='blue'><pre style='display:inline'> // A sacado version of this test is not yet implemented
89 <code><font color='blue'><pre style='display:inline'>
90 // A sacado version of this test is not yet implemented
9391 extern bool link_sparse_hessian(
9492 size_t size ,
9593 size_t repeat ,
10098 size_t&amp; n_sweep
10199 )
102100 {
103 return false;
101 return false;
104102 }
105103 </pre></font></code>
106
107104
108105 <hr/>Input File: speed/sacado/sparse_hessian.cpp
109106
8585 <td>sacado_sparse_jacobian.cpp</td>
8686 <td>Headings</td>
8787 </tr></table><br/>
88
89
90
9188 <center><b><big><big>sacado Speed: sparse_jacobian</big></big></b></center>
92 <code><font color='blue'><pre style='display:inline'> // A sacado version of this test is not yet available
89 <code><font color='blue'><pre style='display:inline'>
90 // A sacado version of this test is not yet available
9391 bool link_sparse_jacobian(
94 size_t size ,
95 size_t repeat ,
96 size_t m ,
97 const CppAD::vector&lt;size_t&gt;&amp; row ,
98 const CppAD::vector&lt;size_t&gt;&amp; col ,
99 CppAD::vector&lt;double&gt;&amp; x ,
100 CppAD::vector&lt;double&gt;&amp; jacobian ,
101 size_t&amp; n_sweep )
92 size_t size ,
93 size_t repeat ,
94 size_t m ,
95 const CppAD::vector&lt;size_t&gt;&amp; row ,
96 const CppAD::vector&lt;size_t&gt;&amp; col ,
97 CppAD::vector&lt;double&gt;&amp; x ,
98 CppAD::vector&lt;double&gt;&amp; jacobian ,
99 size_t&amp; n_sweep )
102100 {
103 return false;
101 return false;
104102 }
105103 </pre></font></code>
106
107104
108105 <hr/>Input File: speed/sacado/sparse_jacobian.cpp
109106
55 <title>ADFun Sequence Properties: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="ADFun Sequence Properties: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" adfun sequence properties: example and test Domain Range Parameter size_var size_par size_op_arg size_vecad "/>
8 <meta name="keywords" id="keywords" content=" adfun sequence properties: example test Domain Range Parameter size_var size_par size_op_arg size_vecad "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Sign Function: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Sign Function: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" sign function: example and test "/>
8 <meta name="keywords" id="keywords" content=" sign function: example test "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>A Simple Boost Threading AD: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="A Simple Boost Threading AD: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" a simple boost threading ad: example and test thread Ad purpose source code "/>
8 <meta name="keywords" id="keywords" content=" simple boost threading ad: example test thread Ad purpose source code "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>A Simple OpenMP AD: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="A Simple OpenMP AD: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" a simple openmp ad: example and test Ad purpose source code "/>
8 <meta name="keywords" id="keywords" content=" simple openmp ad: example test Ad purpose source code "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>A Simple pthread AD: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="A Simple pthread AD: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" a simple pthread ad: example and test Ad purpose source code "/>
8 <meta name="keywords" id="keywords" content=" simple pthread ad: example test Ad purpose source code "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Simple Vector Template Class: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Simple Vector Template Class: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" simple vector template class: example and test "/>
8 <meta name="keywords" id="keywords" content=" simple vector template class: example test "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Definition of a Simple Vector</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Definition of a Simple Vector"/>
8 <meta name="keywords" id="keywords" content=" definition of a simple vector value_type [] Ndebug template class requirements elements specified type default constructor sizing copy element and destructor assignment size resize value access using example exercise "/>
8 <meta name="keywords" id="keywords" content=" definition simple vector value_type [] Ndebug template class requirements elements specified type default constructor sizing copy element destructor assignment size resize value access using example exercise "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>The AD sin Function: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="The AD sin Function: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" the ad sin function: example and test "/>
8 <meta name="keywords" id="keywords" content=" the ad sin function: example test "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Trigonometric and Hyperbolic Sine and Cosine Forward Theory</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Trigonometric and Hyperbolic Sine and Cosine Forward Theory"/>
8 <meta name="keywords" id="keywords" content=" trigonometric and hyperbolic sine cosine forward theory sin sinh cos cosh differential equation "/>
8 <meta name="keywords" id="keywords" content=" trigonometric hyperbolic sine cosine forward theory sin sinh cos cosh differential equation "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Trigonometric and Hyperbolic Sine and Cosine Reverse Theory</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Trigonometric and Hyperbolic Sine and Cosine Reverse Theory"/>
8 <meta name="keywords" id="keywords" content=" trigonometric and hyperbolic sine cosine reverse theory sin sinh cos cosh "/>
8 <meta name="keywords" id="keywords" content=" trigonometric hyperbolic sine cosine reverse theory sin sinh cos cosh "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>The AD sinh Function: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="The AD sinh Function: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" the ad sinh function: example and test "/>
8 <meta name="keywords" id="keywords" content=" the ad sinh function: example test "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
123123 Determine the number of Taylor coefficient orders, per variable,direction,
124124 currently calculated and stored in the ADFun object
125125 <code><i><font color="black"><span style='white-space: nowrap'>f</span></font></i></code>
126 .
127 See the discussion under
126 .
127 See the discussion under
128128 <a href="size_order.xml#Constructor" target="_top"><span style='white-space: nowrap'>Constructor</span></a>
129129 ,
130130 <a href="size_order.xml#Forward" target="_top"><span style='white-space: nowrap'>Forward</span></a>
155155 <code><font color="blue"><span style='white-space: nowrap'><br/>
156156 &#xA0;&#xA0;&#xA0;&#xA0;&#xA0;size_t&#xA0;</span></font><i><font color="black"><span style='white-space: nowrap'>s</span></font></i><font color="blue"><span style='white-space: nowrap'><br/>
157157 </span></font></code>
158 and is the number of Taylor coefficient orders,
158 and is the number of Taylor coefficient orders,
159159 per variable,direction in the AD operation sequence,
160160 currently calculated and stored in the ADFun object
161161 <code><i><font color="black"><span style='white-space: nowrap'>f</span></font></i></code>
190190 </span></font></code>
191191 the value of
192192 <code><i><font color="black"><span style='white-space: nowrap'>s</span></font></i></code>
193 returned by <code><font color="blue">size_order</font></code>
193 returned by <code><font color="blue">size_order</font></code>
194194 would be
195195 <math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow>
196196 <mi mathvariant='italic'>q</mi>
200200
201201 .
202202 The call to <code><font color="blue">Forward</font></code> above
203 uses the lower order Taylor coefficients to compute and store
203 uses the lower order Taylor coefficients to compute and store
204204 the <code><i>q</i></code>-th order Taylor coefficients for all
205205 the variables in the operation sequence corresponding to
206206 <code><i><font color="black"><span style='white-space: nowrap'>f</span></font></i></code>
229229 <code><i><font color="black"><span style='white-space: nowrap'>f</span></font></i></code>
230230 is less than or equal
231231 <code><i><font color="black"><span style='white-space: nowrap'>c</span></font></i></code>
232 ,
232 ,
233233 a call to <a href="capacity_order.xml" target="_top"><span style='white-space: nowrap'>capacity_order</span></a>
234234 with the syntax
235235
252252 <mn>-1</mn>
253253 </mrow></math>
254254
255
255
256256 have been retained).
257257
258258 <br/>
55 <title>sparse_hes_fun: Example and test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="sparse_hes_fun: Example and test"/>
8 <meta name="keywords" id="keywords" content=" sparse_hes_fun: example and test sparse_hes_fun "/>
8 <meta name="keywords" id="keywords" content=" sparse_hes_fun: example test sparse_hes_fun "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Evaluate a Function That Has a Sparse Hessian</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Evaluate a Function That Has a Sparse Hessian"/>
8 <meta name="keywords" id="keywords" content=" evaluate a function that has sparse hessian sparse_hes_fun syntax purpose inclusion float floatvector n x row col p fp example source code "/>
8 <meta name="keywords" id="keywords" content=" evaluate function that has sparse hessian sparse_hes_fun syntax purpose inclusion float floatvector n x row col p fp example source code "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Sparse Hessian: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Sparse Hessian: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" sparse hessian: example and test Hessian spare "/>
8 <meta name="keywords" id="keywords" content=" sparse hessian: example test Hessian spare "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>sparse_jac_fun: Example and test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="sparse_jac_fun: Example and test"/>
8 <meta name="keywords" id="keywords" content=" sparse_jac_fun: example and test sparse_jac_fun "/>
8 <meta name="keywords" id="keywords" content=" sparse_jac_fun: example test sparse_jac_fun "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Evaluate a Function That Has a Sparse Jacobian</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Evaluate a Function That Has a Sparse Jacobian"/>
8 <meta name="keywords" id="keywords" content=" evaluate a function that has sparse jacobian sparse_jac_fun syntax purpose inclusion float floatvector n m x row col p fp example source code "/>
8 <meta name="keywords" id="keywords" content=" evaluate function that has sparse jacobian sparse_jac_fun syntax purpose inclusion float floatvector n m x row col p fp example source code "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Sparse Jacobian: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Sparse Jacobian: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" sparse jacobian: example and test Jacobian spare "/>
8 <meta name="keywords" id="keywords" content=" sparse jacobian: example test Jacobian spare "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
628628 or rows (reverse mode) can be computed during the same sweep.
629629 This field has prototype
630630 <code><font color='blue'><pre style='display:inline'>
631 std::string %work%.color_method
631 std::string %work%.color_method
632632 </pre></font></code>
633
634633 and its default value (after a constructor or <code><font color="blue">clear()</font></code>)
635634 is <code><font color="blue">&quot;cppad&quot;</font></code>.
636635 If <a href="colpack_prefix.xml" target="_top"><span style='white-space: nowrap'>colpack_prefix</span></a>
55 <title>Sparse Hessian on Subset of Variables: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Sparse Hessian on Subset of Variables: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" sparse hessian on subset of variables: example and test purpose see also "/>
8 <meta name="keywords" id="keywords" content=" sparse hessian on subset variables: example test purpose see also "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Sparsity Patterns For a Subset of Variables: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Sparsity Patterns For a Subset of Variables: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" sparsity patterns for a subset of variables: example and test see also forsparsejac revsparsehes "/>
8 <meta name="keywords" id="keywords" content=" sparsity patterns subset variables: example test see also forsparsejac revsparsehes "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Speed Test an Operator Overloading AD Package</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Speed Test an Operator Overloading AD Package"/>
8 <meta name="keywords" id="keywords" content=" speed test an operator overloading ad package purpose "/>
8 <meta name="keywords" id="keywords" content=" speed test operator overloading ad package purpose "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Speed Test of Derivatives Using Adolc</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Speed Test of Derivatives Using Adolc"/>
8 <meta name="keywords" id="keywords" content=" speed test of derivatives using adolc purpose adolc_prefix running tests "/>
8 <meta name="keywords" id="keywords" content=" speed test derivatives using adolc purpose adolc_prefix running tests "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
9292 </select>
9393 </td>
9494 </tr></table><br/>
95
96
97
98
9995 <center><b><big><big>Speed Test of Derivatives Using Adolc</big></big></b></center>
10096 <br/>
10197 <b><big><a name="Purpose" id="Purpose">Purpose</a></big></b>
55 <title>Speed Test of Functions in Double</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Speed Test of Functions in Double"/>
8 <meta name="keywords" id="keywords" content=" speed test of functions in double purpose running tests "/>
8 <meta name="keywords" id="keywords" content=" speed test functions double purpose running tests "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
9191 </select>
9292 </td>
9393 </tr></table><br/>
94
95
96
97
9894 <center><b><big><big>Speed Test Derivatives Using Fadbad</big></big></b></center>
9995 <br/>
10096 <b><big><a name="Purpose" id="Purpose">Purpose</a></big></b>
270270 <br/>
271271 If the option <code><font color="blue">onetape</font></code> is present, the symbol
272272 <code><font color='blue'><pre style='display:inline'>
273 extern bool global_onetape
273 extern bool global_onetape
274274 </pre></font></code>
275
276275 is true and otherwise it is false.
277276 If this external symbol is true,
278277 CppAD will use one taping of the operation
301300 <br/>
302301 If the option <code><font color="blue">optimize</font></code> is present, the symbol
303302 <code><font color='blue'><pre style='display:inline'>
304 extern bool global_optimize
303 extern bool global_optimize
305304 </pre></font></code>
306
307305 is true and otherwise it is false.
308306 If this external symbol is true,
309307 CppAD will optimize the operation sequence before doing computations.
315313 <br/>
316314 If the option <code><font color="blue">atomic</font></code> is present, the symbol
317315 <code><font color='blue'><pre style='display:inline'>
318 extern bool global_atomic
316 extern bool global_atomic
319317 </pre></font></code>
320
321318 is true and otherwise it is false.
322319 If this external symbol is true, CppAD will use its user defined
323320 <a href="atomic_base.xml" target="_top"><span style='white-space: nowrap'>atomic</span></a>
331328 <br/>
332329 If the option <code><font color="blue">memory</font></code> is present, the symbol
333330 <code><font color='blue'><pre style='display:inline'>
334 extern bool global_memory
331 extern bool global_memory
335332 </pre></font></code>
336
337333 is true and otherwise it is false.
338334 If it is true, the CppAD
339335 <a href="ta_hold_memory.xml" target="_top"><span style='white-space: nowrap'>hold_memory</span></a>
359355 <br/>
360356 If the option <code><font color="blue">boolsparsity</font></code> is present, the symbol
361357 <code><font color='blue'><pre style='display:inline'>
362 extern bool global_boolsparsity
358 extern bool global_boolsparsity
363359 </pre></font></code>
364
365360 is true and otherwise it is false.
366361 If it is true, CppAD will use a
367362 <a href="glossary.xml#Sparsity Pattern.Vector of Boolean" target="_top"><span style='white-space: nowrap'>vector&#xA0;of&#xA0;bool</span></a>
377372 <br/>
378373 If the option <code><font color="blue">colpack</font></code> is present, the symbol
379374 <code><font color='blue'><pre style='display:inline'>
380 extern bool global_colpack
375 extern bool global_colpack
381376 </pre></font></code>
382
383377 is true and otherwise it is false.
384378 If this external symbol is true,
385379 CppAD will use <a href="colpack_prefix.xml" target="_top"><span style='white-space: nowrap'>colpack</span></a>
55 <title>Example Use of SpeedTest</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Example Use of SpeedTest"/>
8 <meta name="keywords" id="keywords" content=" example use of speedtest test speed running this program output "/>
8 <meta name="keywords" id="keywords" content=" example use speedtest test speed running this program output "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
115115 you can compile and run this program by changing into the
116116 <code><font color="blue">speed/example</font></code> directory and executing the following commands
117117 <code><font color='blue'><pre style='display:inline'>
118 g++ -I../.. speed_program.cpp -o speed_program.exe
119 ./speed_program.exe
118 g++ -I../.. speed_program.cpp -o speed_program.exe
119 ./speed_program.exe
120120 </pre></font></code>
121
122
123 <br/>
124121 <br/>
125122 <b><big><a name="Program" id="Program">Program</a></big></b>
126123
128125 # include &lt;cppad/utility/speed_test.hpp&gt;
129126
130127 std::string Test(size_t size, size_t repeat)
131 { // setup
132 double *a = new double[size];
133 double *b = new double[size];
134 double *c = new double[size];
135 size_t i = size;;
136 while(i)
137 { --i;
138 a[i] = i;
139 b[i] = 2 * i;
140 }
141 // operations we are timing
142 while(repeat--)
143 { i = size;;
144 while(i)
145 { --i;
146 c[i] = a[i] + b[i];
147 }
148 }
149 // teardown
150 delete [] a;
151 delete [] b;
152 delete [] c;
128 { // setup
129 double *a = new double[size];
130 double *b = new double[size];
131 double *c = new double[size];
132 size_t i = size;;
133 while(i)
134 { --i;
135 a[i] = i;
136 b[i] = 2 * i;
137 }
138 // operations we are timing
139 while(repeat--)
140 { i = size;;
141 while(i)
142 { --i;
143 c[i] = a[i] + b[i];
144 }
145 }
146 // teardown
147 delete [] a;
148 delete [] b;
149 delete [] c;
153150
154 // return a test name that is valid for all sizes and repeats
155 return &quot;double: c[*] = a[*] + b[*]&quot;;
151 // return a test name that is valid for all sizes and repeats
152 return &quot;double: c[*] = a[*] + b[*]&quot;;
156153 }
157154 int main(void)
158155 {
159 CppAD::SpeedTest(Test, 10, 10, 100);
160 return 0;
156 CppAD::SpeedTest(Test, 10, 10, 100);
157 return 0;
161158 }
162159
163160 </pre></font></code>
164
165
166 <br/>
167 <br/>
168161 <b><big><a name="Output" id="Output">Output</a></big></b>
169162 <br/>
170163 Executing of the program above generated the following output
171164 (the rates will be different for each particular system):
172165 <code><font color='blue'><pre style='display:inline'>
173 double: c[*] = a[*] + b[*]
174 size = 10 rate = 14,122,236
175 size = 20 rate = 7,157,515
176 size = 30 rate = 4,972,500
177 size = 40 rate = 3,887,214
178 size = 50 rate = 3,123,086
179 size = 60 rate = 2,685,214
180 size = 70 rate = 2,314,737
181 size = 80 rate = 2,032,124
182 size = 90 rate = 1,814,145
183 size = 100 rate = 1,657,828
166 double: c[*] = a[*] + b[*]
167 size = 10 rate = 14,122,236
168 size = 20 rate = 7,157,515
169 size = 30 rate = 4,972,500
170 size = 40 rate = 3,887,214
171 size = 50 rate = 3,123,086
172 size = 60 rate = 2,685,214
173 size = 70 rate = 2,314,737
174 size = 80 rate = 2,032,124
175 size = 90 rate = 1,814,145
176 size = 100 rate = 1,657,828
184177 </pre></font></code>
185
186
187178
188179 <hr/>Input File: speed/example/speed_program.cpp
189180
9191 </select>
9292 </td>
9393 </tr></table><br/>
94
95
96
97
9894 <center><b><big><big>Speed Test Derivatives Using Sacado</big></big></b></center>
9995 <br/>
10096 <b><big><a name="Purpose" id="Purpose">Purpose</a></big></b>
55 <title>speed_test: Example and test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="speed_test: Example and test"/>
8 <meta name="keywords" id="keywords" content=" speed_test: example and test speed_test "/>
8 <meta name="keywords" id="keywords" content=" speed_test: example test speed_test "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Run One Speed Test and Return Results</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Run One Speed Test and Return Results"/>
8 <meta name="keywords" id="keywords" content=" run one speed test and return results speed_test syntax purpose motivation include vector size repeat size_vec time_min rate_vec timing example "/>
8 <meta name="keywords" id="keywords" content=" run one speed test return results speed_test syntax purpose motivation include vector size repeat size_vec time_min rate_vec timing example "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
305305 Otherwise,
306306 time is measured by the difference in
307307 <code><font color='blue'><pre style='display:inline'>
308 (double) clock() / (double) CLOCKS_PER_SEC
308 (double) clock() / (double) CLOCKS_PER_SEC
309309 </pre></font></code>
310
311310 in the context of the standard <code><font color="blue">&lt;ctime&gt;</font></code> definitions.
312311
313312
55 <title>Run One Speed Test and Print Results</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Run One Speed Test and Print Results"/>
8 <meta name="keywords" id="keywords" content=" run one speed test and print results Speedtest syntax purpose motivation include size repeat name first last inc rate errors example "/>
8 <meta name="keywords" id="keywords" content=" run one speed test print results Speedtest syntax purpose motivation include size repeat name first last inc rate errors example "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
326326 corresponding elapsed execution time in seconds.
327327 The elapsed execution time is measured by the difference in
328328 <code><font color='blue'><pre style='display:inline'>
329 (double) clock() / (double) CLOCKS_PER_SEC
329 (double) clock() / (double) CLOCKS_PER_SEC
330330 </pre></font></code>
331
332331 in the context of the standard <code><font color="blue">&lt;ctime&gt;</font></code> definitions.
333332
334333
55 <title>The AD sqrt Function: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="The AD sqrt Function: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" the ad sqrt function: example and test "/>
8 <meta name="keywords" id="keywords" content=" the ad sqrt function: example test "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Example Differentiating a Stack Machine Interpreter</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Example Differentiating a Stack Machine Interpreter"/>
8 <meta name="keywords" id="keywords" content=" example differentiating a stack machine interpreter test "/>
8 <meta name="keywords" id="keywords" content=" example differentiating stack machine interpreter test "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>AD Binary Subtraction: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="AD Binary Subtraction: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" ad binary subtraction: example and test - subtract minus "/>
8 <meta name="keywords" id="keywords" content=" ad binary subtraction: example test - subtract minus "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>AD Computed Assignment Subtraction: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="AD Computed Assignment Subtraction: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" ad computed assignment subtraction: example and test -= subtract assign plus add "/>
8 <meta name="keywords" id="keywords" content=" ad computed assignment subtraction: example test -= subtract assign plus add "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Computing Sparse Hessian for a Subset of Variables</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Computing Sparse Hessian for a Subset of Variables"/>
8 <meta name="keywords" id="keywords" content=" computing sparse hessian for a subset of variables purpose see also function example "/>
8 <meta name="keywords" id="keywords" content=" computing sparse hessian subset variables purpose see also function example "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Amount of Memory Available for Quick Use by a Thread</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Amount of Memory Available for Quick Use by a Thread"/>
8 <meta name="keywords" id="keywords" content=" amount of memory available for quick use by a thread syntax purpose num_bytes example "/>
8 <meta name="keywords" id="keywords" content=" amount memory available quick use thread syntax purpose num_bytes example "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Allocate An Array and Call Default Constructor for its Elements</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Allocate An Array and Call Default Constructor for its Elements"/>
8 <meta name="keywords" id="keywords" content=" allocate an array and call default constructor for its elements create_array syntax purpose type size_min size_out delta alignment example "/>
8 <meta name="keywords" id="keywords" content=" allocate array call default constructor its elements create_array syntax purpose type size_min size_out delta alignment example "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Deallocate An Array and Call Destructor for its Elements</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Deallocate An Array and Call Destructor for its Elements"/>
8 <meta name="keywords" id="keywords" content=" deallocate an array and call destructor for its elements delete_array syntax purpose type thread delta example "/>
8 <meta name="keywords" id="keywords" content=" deallocate array call destructor its elements delete_array syntax purpose type thread delta example "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Free All Memory That Was Allocated for Use by thread_alloc</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Free All Memory That Was Allocated for Use by thread_alloc"/>
8 <meta name="keywords" id="keywords" content=" free all memory that was allocated for use by thread_alloc syntax purpose ok restrictions example "/>
8 <meta name="keywords" id="keywords" content=" free all memory that was allocated use thread_alloc syntax purpose ok restrictions example "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Free Memory Currently Available for Quick Use by a Thread</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Free Memory Currently Available for Quick Use by a Thread"/>
8 <meta name="keywords" id="keywords" content=" free memory currently available for quick use by a thread free_available syntax purpose extra example "/>
8 <meta name="keywords" id="keywords" content=" free memory currently available quick use thread free_available syntax purpose extra example "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Get At Least A Specified Amount of Memory</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Get At Least A Specified Amount of Memory"/>
8 <meta name="keywords" id="keywords" content=" get at least a specified amount of memory allocate syntax purpose min_bytes cap_bytes v_ptr allocation speed alignment example "/>
8 <meta name="keywords" id="keywords" content=" get least specified amount memory allocate syntax purpose min_bytes cap_bytes v_ptr allocation speed alignment example "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
154154 It specifies the minimum number of bytes to allocate.
155155 This value must be less than
156156 <code><font color='blue'><pre style='display:inline'>
157 std::numeric_limits&lt;size_t&gt;::max() / 2
157 std::numeric_limits&lt;size_t&gt;::max() / 2
158158 </pre></font></code>
159
160
161 <br/>
162159 <br/>
163160 <b><big><a name="cap_bytes" id="cap_bytes">cap_bytes</a></big></b>
164161 <br/>
55 <title>Control When Thread Alloc Retains Memory For Future Use</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Control When Thread Alloc Retains Memory For Future Use"/>
8 <meta name="keywords" id="keywords" content=" control when thread alloc retains memory for future use hold syntax purpose value free_available "/>
8 <meta name="keywords" id="keywords" content=" control when thread alloc retains memory future use hold syntax purpose value free_available "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Is The Current Execution in Parallel Mode</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Is The Current Execution in Parallel Mode"/>
8 <meta name="keywords" id="keywords" content=" is the current execution in parallel mode sequential syntax purpose flag example "/>
8 <meta name="keywords" id="keywords" content=" is the current execution parallel mode sequential syntax purpose flag example "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Amount of Memory a Thread is Currently Using</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Amount of Memory a Thread is Currently Using"/>
8 <meta name="keywords" id="keywords" content=" amount of memory a thread is currently using inuse syntax purpose num_bytes example "/>
8 <meta name="keywords" id="keywords" content=" amount memory thread is currently using inuse syntax purpose num_bytes example "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Get Number of Threads</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Get Number of Threads"/>
8 <meta name="keywords" id="keywords" content=" get number of threads syntax purpose example "/>
8 <meta name="keywords" id="keywords" content=" get number threads syntax purpose example "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Setup thread_alloc For Use in Multi-Threading Environment</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Setup thread_alloc For Use in Multi-Threading Environment"/>
8 <meta name="keywords" id="keywords" content=" setup thread_alloc for use in multi-threading environment parallel initialize syntax purpose speed num_threads in_parallel thread_num restrictions example "/>
8 <meta name="keywords" id="keywords" content=" setup thread_alloc use multi-threading environment parallel initialize syntax purpose speed num_threads in_parallel thread_num restrictions example "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>The AD tan Function: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="The AD tan Function: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" the ad tan function: example and test "/>
8 <meta name="keywords" id="keywords" content=" the ad tan function: example test "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Tangent and Hyperbolic Tangent Forward Taylor Polynomial Theory</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Tangent and Hyperbolic Tangent Forward Taylor Polynomial Theory"/>
8 <meta name="keywords" id="keywords" content=" tangent and hyperbolic forward taylor polynomial theory tan derivatives coefficients recursion "/>
8 <meta name="keywords" id="keywords" content=" tangent hyperbolic forward taylor polynomial theory tan derivatives coefficients recursion "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Tangent and Hyperbolic Tangent Reverse Mode Theory</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Tangent and Hyperbolic Tangent Reverse Mode Theory"/>
8 <meta name="keywords" id="keywords" content=" tangent and hyperbolic reverse mode theory tan notation eliminating y(t) positive orders z(t) order zero "/>
8 <meta name="keywords" id="keywords" content=" tangent hyperbolic reverse mode theory tan notation eliminating y(t) positive orders z(t) order zero "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>The AD tanh Function: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="The AD tanh Function: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" the ad tanh function: example and test "/>
8 <meta name="keywords" id="keywords" content=" the ad tanh function: example test "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Taping Array Index Operation: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Taping Array Index Operation: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" taping array index operation: example and test tape operation "/>
8 <meta name="keywords" id="keywords" content=" taping array index operation: example test tape operation "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Boost Thread Implementation of a Team of AD Threads</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Boost Thread Implementation of a Team of AD Threads"/>
8 <meta name="keywords" id="keywords" content=" boost thread implementation of a team ad threads bthread "/>
8 <meta name="keywords" id="keywords" content=" boost thread implementation team ad threads bthread "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Using a Team of AD Threads: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Using a Team of AD Threads: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" using a team of ad threads: example and test thread purpose thread_team source code "/>
8 <meta name="keywords" id="keywords" content=" using team ad threads: example test thread purpose thread_team source code "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>OpenMP Implementation of a Team of AD Threads</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="OpenMP Implementation of a Team of AD Threads"/>
8 <meta name="keywords" id="keywords" content=" openmp implementation of a team ad threads "/>
8 <meta name="keywords" id="keywords" content=" openmp implementation team ad threads "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
7676 <td>team_openmp.cpp</td>
7777 <td>Headings</td>
7878 </tr></table><br/>
79
80
81
82
8379 <center><b><big><big>OpenMP Implementation of a Team of AD Threads</big></big></b></center>
8480 See <a href="team_thread.hpp.xml" target="_top"><span style='white-space: nowrap'>team_thread.hpp</span></a>
8581 for this routines specifications.
55 <title>Pthread Implementation of a Team of AD Threads</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Pthread Implementation of a Team of AD Threads"/>
8 <meta name="keywords" id="keywords" content=" pthread implementation of a team ad threads pthread_exit bug in cygwin "/>
8 <meta name="keywords" id="keywords" content=" pthread implementation team ad threads pthread_exit bug cygwin "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
103103 <code><font color='blue'><pre style='display:inline'>
104104 # define DEMONSTRATE_BUG_IN_CYGWIN 0
105105 </pre></font></code>
106
107 <code><font color="blue">
108 <pre style='display:inline'>
106 <code><font color="blue"><pre style='display:inline'>
109107 # include &lt;pthread.h&gt;
110108 # include &lt;cppad/cppad.hpp&gt;
111109 # include &quot;../team_thread.hpp&quot;
55 <title>Specifications for A Team of AD Threads</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Specifications for A Team of AD Threads"/>
8 <meta name="keywords" id="keywords" content=" specifications for a team of ad threads syntax purpose restrictions team_create team_work team_destroy team_name ok example use implementation speed test source "/>
8 <meta name="keywords" id="keywords" content=" specifications team ad threads syntax purpose restrictions team_create team_work team_destroy team_name ok example use implementation speed test source "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
281281 extern const char* team_name(void);
282282 </pre></font></code>
283283
284
285284 <hr/>Input File: multi_thread/team_thread.hpp
286285
287286 </body>
150150 # endif
151151 # endif
152152 </pre></font></code>
153
154
155 <br/>
156153 <br/>
157154 <b><big><a name="CppAD::vector" id="CppAD::vector">CppAD::vector</a></big></b>
158155 <br/>
164161 # define CPPAD_TEST_VECTOR CppAD::vector
165162 # endif
166163 </pre></font></code>
167
168164 If you specify <code><font color="blue">--with-eigenvector</font></code> on the
169165 <a href="auto_tools.xml#Configure" target="_top"><span style='white-space: nowrap'>configure</span></a>
170166 command line,
179175 # define CPPAD_TEST_VECTOR CppAD::vector
180176 # endif
181177 </pre></font></code>
182
183
184
185 <br/>
186178 <br/>
187179 <b><big><a name="std::vector" id="std::vector">std::vector</a></big></b>
188180 <br/>
199191 # define CPPAD_TEST_VECTOR std::vector
200192 # endif
201193 </pre></font></code>
202
203194 In this case CppAD will use <code><font color="blue">std::vector</font></code> for its examples and tests.
204195 Use of <code><font color="blue">CppAD::vector</font></code>, <code><font color="blue">std::vector</font></code>,
205196 and <code><font color="blue">std::valarray</font></code> with CppAD is always tested to some degree.
223214 # define CPPAD_TEST_VECTOR boost::numeric::ublas::vector
224215 # endif
225216 </pre></font></code>
226
227217 In this case CppAD will use Ublas vectors for its examples and tests.
228218 Use of <code><font color="blue">CppAD::vector</font></code>, <code><font color="blue">std::vector</font></code>,
229219 and <code><font color="blue">std::valarray</font></code> with CppAD is always tested to some degree.
242232 # define CppADvector CPPAD_TEST_VECTOR
243233 </pre></font></code>
244234
245
246235 <hr/>Input File: cppad/local/test_vector.hpp
247236
248237 </body>
126126 # define <a href="testvector.xml" target="_top">CPPAD_TESTVECTOR</a>(Scalar) CppAD::vector&lt; Scalar &gt;
127127 # endif
128128 </pre></font></code>
129
130129 In this case CppAD will use its own vector for
131130 many of its examples and tests.
132131
147146 # define <a href="testvector.xml" target="_top">CPPAD_TESTVECTOR</a>(Scalar) std::vector&lt; Scalar &gt;
148147 # endif
149148 </pre></font></code>
150
151149 In this case CppAD will use standard vector for
152150 many of its examples and tests.
153151
168166 # define <a href="testvector.xml" target="_top">CPPAD_TESTVECTOR</a>(Scalar) boost::numeric::ublas::vector&lt; Scalar &gt;
169167 # endif
170168 </pre></font></code>
171
172169 In this case CppAD will use this boost vector for
173170 many of its examples and tests.
174171
189186 # define <a href="testvector.xml" target="_top">CPPAD_TESTVECTOR</a>(Scalar) Eigen::Matrix&lt; Scalar , Eigen::Dynamic, 1&gt;
190187 # endif
191188 </pre></font></code>
192
193189 In this case CppAD will use the Eigen vector
194190 for many of its examples and tests.
195191
55 <title>The Theory of Derivative Calculations</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="The Theory of Derivative Calculations"/>
8 <meta name="keywords" id="keywords" content=" the theory of derivative calculations "/>
8 <meta name="keywords" id="keywords" content=" the theory derivative calculations "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Fast Multi-Threading Memory Allocator: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Fast Multi-Threading Memory Allocator: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" fast multi-threading memory allocator: example and test openmp allocation pthread boost multi-thread "/>
8 <meta name="keywords" id="keywords" content=" fast multi-threading memory allocator: example test openmp allocation pthread boost multi-thread "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>A Fast Multi-Threading Memory Allocator</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="A Fast Multi-Threading Memory Allocator"/>
8 <meta name="keywords" id="keywords" content=" a fast multi-threading memory allocator allocation syntax purpose include "/>
8 <meta name="keywords" id="keywords" content=" fast multi-threading memory allocator allocation syntax purpose include "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Run Multi-Threading Examples and Speed Tests</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Run Multi-Threading Examples and Speed Tests"/>
8 <meta name="keywords" id="keywords" content=" run multi-threading examples and speed tests thread_test multi openmp pthread bthread syntax running threading purpose a11c simple_ad team_example harmonic test_time max_threads mega_sum multi_newton num_zero num_sub num_sum use_ad team implementations source "/>
8 <meta name="keywords" id="keywords" content=" run multi-threading examples speed tests thread_test multi openmp pthread bthread syntax running threading purpose a11c simple_ad team_example harmonic test_time max_threads mega_sum multi_newton num_zero num_sub num_sum use_ad team implementations source "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Determine Amount of Time to Execute det_by_minor</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Determine Amount of Time to Execute det_by_minor"/>
8 <meta name="keywords" id="keywords" content=" determine amount of time to execute det_by_minor syntax purpose time_min source code "/>
8 <meta name="keywords" id="keywords" content=" determine amount time to execute det_by_minor syntax purpose time_min source code "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
9999 </select>
100100 </td>
101101 </tr></table><br/>
102
103
104
105102 <center><b><big><big>Determine Amount of Time to Execute det_by_minor</big></big></b></center>
106103 <br/>
107104 <b><big><a name="Syntax" id="Syntax">Syntax</a></big></b>
170167
171168 <code><font color='blue'><pre style='display:inline'>
172169 double time_det_by_minor(size_t size, double time_min)
173 { size_t repeat;
174 double s0, s1, time;
175 repeat = 0;
176 s0 = <a href="elapsed_seconds_c.xml" target="_top">elapsed_seconds</a>();
177 s1 = s0;
178 while( s1 - s0 &lt; time_min )
179 { if( repeat == 0 )
180 repeat = 1;
181 else repeat = 2 * repeat;
182 s0 = <a href="elapsed_seconds_c.xml" target="_top">elapsed_seconds</a>();
183 <a href="elapsed_seconds_c.xml" target="_top">repeat_det_by_minor</a>(repeat, size);
184 s1 = <a href="elapsed_seconds_c.xml" target="_top">elapsed_seconds</a>();
185 }
186 time = (s1 - s0) / (double) repeat;
187 return time;
170 { size_t repeat;
171 double s0, s1, time;
172 repeat = 0;
173 s0 = <a href="elapsed_seconds_c.xml" target="_top">elapsed_seconds</a>();
174 s1 = s0;
175 while( s1 - s0 &lt; time_min )
176 { if( repeat == 0 )
177 repeat = 1;
178 else repeat = 2 * repeat;
179 s0 = <a href="elapsed_seconds_c.xml" target="_top">elapsed_seconds</a>();
180 <a href="elapsed_seconds_c.xml" target="_top">repeat_det_by_minor</a>(repeat, size);
181 s1 = <a href="elapsed_seconds_c.xml" target="_top">elapsed_seconds</a>();
182 }
183 time = (s1 - s0) / (double) repeat;
184 return time;
188185 }
189186 </pre></font></code>
190
191187
192188 <hr/>Input File: compare_c/det_by_minor.c
193189
55 <title>time_test: Example and test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="time_test: Example and test"/>
8 <meta name="keywords" id="keywords" content=" time_test: example and test time_test "/>
8 <meta name="keywords" id="keywords" content=" time_test: example test time_test "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Determine Amount of Time to Execute a Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Determine Amount of Time to Execute a Test"/>
8 <meta name="keywords" id="keywords" content=" determine amount of time to execute a test time_test speed syntax purpose motivation include size repeat time_min test_size timing example "/>
8 <meta name="keywords" id="keywords" content=" determine amount time to execute test time_test speed syntax purpose motivation include size repeat time_min test_size timing example "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
111111 </select>
112112 </td>
113113 </tr></table><br/>
114
115
116
117
118114 <center><b><big><big>Determine Amount of Time to Execute a Test</big></big></b></center>
119115 <br/>
120116 <b><big><a name="Syntax" id="Syntax">Syntax</a></big></b>
55 <title>to_string: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="to_string: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" to_string: example and test "/>
8 <meta name="keywords" id="keywords" content=" to_string: example test "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Convert Certain Types to a String</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Convert Certain Types to a String"/>
8 <meta name="keywords" id="keywords" content=" convert certain types to a string syntax see also purpose value integer float s example "/>
8 <meta name="keywords" id="keywords" content=" convert certain types to string syntax see also purpose value integer float s example "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Tracking Use of New and Delete: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Tracking Use of New and Delete: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" tracking use of new and delete: example test delete "/>
8 <meta name="keywords" id="keywords" content=" tracking use new delete: example test delete "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Routines That Track Use of New and Delete</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Routines That Track Use of New and Delete"/>
8 <meta name="keywords" id="keywords" content=" routines that track use of new and delete memory Ndebug Cppad_track_new_vec Cppadtracknewvec Cppad_track_del_vec Cppadtrackdelvec Cppad_track_extend Cppadtrackextend Cppad_track_count thread multi deprecated 2007-07-23 syntax purpose include file line oldptr newlen head newptr ncopy tracknewvec macro previously trackdelvec trackextend trackcount multi-threading example "/>
8 <meta name="keywords" id="keywords" content=" routines that track use new delete memory Ndebug Cppad_track_new_vec Cppadtracknewvec Cppad_track_del_vec Cppadtrackdelvec Cppad_track_extend Cppadtrackextend Cppad_track_count thread multi deprecated 2007-07-23 syntax purpose include file line oldptr newlen head newptr ncopy tracknewvec macro previously trackdelvec trackextend trackcount multi-threading example "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>AD Unary Minus Operator: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="AD Unary Minus Operator: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" ad unary minus operator: example and test "/>
8 <meta name="keywords" id="keywords" content=" ad unary minus operator: example test "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>AD Unary Plus Operator: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="AD Unary Plus Operator: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" ad unary plus operator: example and test "/>
8 <meta name="keywords" id="keywords" content=" ad unary plus operator: example test "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Simulate a [0,1] Uniform Random Variate</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Simulate a [0,1] Uniform Random Variate"/>
8 <meta name="keywords" id="keywords" content=" simulate a [01] uniform random variate uniform_01 syntax purpose inclusion seed n x vector source code "/>
8 <meta name="keywords" id="keywords" content=" simulate [01] uniform random variate uniform_01 syntax purpose inclusion seed n x vector source code "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Simulate a [0,1] Uniform Random Variate</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Simulate a [0,1] Uniform Random Variate"/>
8 <meta name="keywords" id="keywords" content=" simulate a [01] uniform random variate syntax purpose seed n source code "/>
8 <meta name="keywords" id="keywords" content=" simulate [01] uniform random variate syntax purpose seed n source code "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
100100 </select>
101101 </td>
102102 </tr></table><br/>
103
104
105103 <center><b><big><big>Simulate a [0,1] Uniform Random Variate</big></big></b></center>
106104 <br/>
107105 <b><big><a name="Syntax" id="Syntax">Syntax</a></big></b>
178176
179177 <code><font color='blue'><pre style='display:inline'>
180178 void random_seed(size_t seed)
181 { srand(seed); }
179 { srand(seed); }
182180 void uniform_01(unsigned n, double* a)
183 { static double factor = 1. / (double) RAND_MAX;
184 while(n--)
185 a[n] = rand() * factor;
181 { static double factor = 1. / (double) RAND_MAX;
182 while(n--)
183 a[n] = rand() * factor;
186184 }
187185 </pre></font></code>
188
189186
190187 <hr/>Input File: compare_c/det_by_minor.c
191188
107107 <center><b><big><big>Some General Purpose Utilities</big></big></b></center>
108108 These routines can be include individually; for example,
109109 <code><font color='blue'><pre style='display:inline'>
110 # include &lt;cppad/utility/vector.hpp&gt;
110 # include &lt;cppad/utility/vector.hpp&gt;
111111 </pre></font></code>
112
113112 only includes the definitions necessary for the <code><font color="blue">CppAD::vector</font></code> class.
114113 They can also be included as a group, separate from the rest of CppAD, using
115114 <code><font color='blue'><pre style='display:inline'>
116 # include &lt;cppad/utility.hpp&gt;
115 # include &lt;cppad/utility.hpp&gt;
117116 </pre></font></code>
118
119117 They will also be included, along with the rest of CppAD, using
120118 <code><font color='blue'><pre style='display:inline'>
121 # include &lt;cppad/cppad.hpp&gt;
119 # include &lt;cppad/cppad.hpp&gt;
122120 </pre></font></code>
123
124
125
126
127 <br/>
128121 <br/>
129122 <b><big><a name="Testing" id="Testing">Testing</a></big></b>
130123 <br/>
55 <title>Convert From AD to its Base Type: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Convert From AD to its Base Type: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" convert from ad to its base type: example and test Value record "/>
8 <meta name="keywords" id="keywords" content=" convert from ad to its base type: example test Value record "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Convert From an AD Type to its Base Type</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Convert From an AD Type to its Base Type"/>
8 <meta name="keywords" id="keywords" content=" convert from an ad type to its base Value syntax see also purpose x b operation sequence restriction example "/>
8 <meta name="keywords" id="keywords" content=" convert from ad type to its base Value syntax see also purpose x b operation sequence restriction example "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Convert an AD Variable to a Parameter: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Convert an AD Variable to a Parameter: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" convert an ad variable to a parameter: example and test Var2par Value during taping "/>
8 <meta name="keywords" id="keywords" content=" convert ad variable to parameter: example test Var2par Value during taping "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Convert an AD Variable to a Parameter</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Convert an AD Variable to a Parameter"/>
8 <meta name="keywords" id="keywords" content=" convert an ad variable to a parameter Var2par from value_ obtain during taping syntax see also purpose x y example "/>
8 <meta name="keywords" id="keywords" content=" convert ad variable to parameter Var2par from value_ obtain during taping syntax see also purpose x y example "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>AD Vectors that Record Index Operations: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="AD Vectors that Record Index Operations: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" ad vectors that record index operations: example and test Vecad vec_ad.cpp "/>
8 <meta name="keywords" id="keywords" content=" ad vectors that record index operations: example test Vecad vec_ad.cpp "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>AD Vectors that Record Index Operations</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="AD Vectors that Record Index Operations"/>
8 <meta name="keywords" id="keywords" content=" ad vectors that record index operations Vecad tape reference Vecad&lt;base&gt; syntax purpose alternatives vecad&lt;base&gt;::reference exceptions constructor v n size size_t indexing i b x r example speed and memory "/>
8 <meta name="keywords" id="keywords" content=" ad vectors that record index operations Vecad tape reference Vecad&lt;base&gt; syntax purpose alternatives vecad&lt;base&gt;::reference exceptions constructor v n size size_t indexing i b x r example speed memory "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
585585 In the file <code><font color="blue">cppad/local/forward1sweep.h</font></code>,
586586 change the definition of <code><font color="blue">CPPAD_FORWARD1SWEEP_TRACE</font></code> to
587587 <code><font color='blue'><pre style='display:inline'>
588 # define CPPAD_FORWARD1SWEEP_TRACE 1
588 # define CPPAD_FORWARD1SWEEP_TRACE 1
589589 </pre></font></code>
590
591 </li><li>
592
590 </li><li>
593591 In the <code><font color="blue">Example</font></code> directory, execute the command
594592 <code><font color='blue'><pre style='display:inline'>
595 ./test_one.sh lu_vec_ad_ok.cpp lu_vec_ad.cpp -DNDEBUG &gt; lu_vec_ad_ok.log
593 ./test_one.sh lu_vec_ad_ok.cpp lu_vec_ad.cpp -DNDEBUG &gt; lu_vec_ad_ok.log
596594 </pre></font></code>
597
598595 This will write a trace of all the forward tape operations,
599596 for the test case <a href="lu_vec_ad_ok.cpp.xml" target="_top"><span style='white-space: nowrap'>lu_vec_ad_ok.cpp</span></a>
600597 ,
603600
604601 In the <code><font color="blue">Example</font></code> directory execute the commands
605602 <code><font color='blue'><pre style='display:inline'>
606 grep &quot;op=&quot; lu_vec_ad_ok.log | wc -l
607 grep &quot;op=Ld[vp]&quot; lu_vec_ad_ok.log | wc -l
608 grep &quot;op=St[vp][vp]&quot; lu_vec_ad_ok.log | wc -l
603 grep &quot;op=&quot; lu_vec_ad_ok.log | wc -l
604 grep &quot;op=Ld[vp]&quot; lu_vec_ad_ok.log | wc -l
605 grep &quot;op=St[vp][vp]&quot; lu_vec_ad_ok.log | wc -l
609606 </pre></font></code>
610
611607 The first command counts the number of operators in the tracing,
612608 the second counts the number of VecAD load operations,
613609 and the third counts the number of VecAD store operations.
55 <title>CppAD::vectorBool Class: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="CppAD::vectorBool Class: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" cppad::vectorbool class: example and test bool vectorbool Cppad "/>
8 <meta name="keywords" id="keywords" content=" cppad::vectorbool class: example test bool vectorbool Cppad "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Changes and Additions to CppAD</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Changes and Additions to CppAD"/>
8 <meta name="keywords" id="keywords" content=" changes and additions to cppad introduction this year previous years "/>
8 <meta name="keywords" id="keywords" content=" changes additions to cppad introduction this year previous years "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
107107 <br/>
108108 <b><big><a name="Introduction" id="Introduction">Introduction</a></big></b>
109109 <br/>
110 The sections listed below contain a list of the changes to CppAD
110 The sections listed below contain a list of the changes to CppAD
111111 in reverse order by date.
112112 The purpose of these sections is to
113113 assist you in learning about changes between various versions of CppAD.
55 <title>Changes and Additions to CppAD During 2003</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Changes and Additions to CppAD During 2003"/>
8 <meta name="keywords" id="keywords" content=" changes and additions to cppad during 2003 introduction 12-24 12-22 12-14 12-13 12-12 12-10 12-05 12-01 11-21 11-20 11-16 11-15 11-14 11-12 11-11 11-06 11-04 11-02 10-21 10-16 10-14 10-10 10-06 10-05 09-30 09-20 09-19 09-18 09-15 09-14 09-13 09-06 09-05 09-04 09-03 08-23 08-22 08-19 08-17 08-16 08-11 08-10 08-07 08-06 08-05 08-04 08-03 08-01 07-30 07-29 07-26 07-22 07-20 07-18 07-16 07-14 "/>
8 <meta name="keywords" id="keywords" content=" changes additions to cppad during 2003 introduction 12-24 12-22 12-14 12-13 12-12 12-10 12-05 12-01 11-21 11-20 11-16 11-15 11-14 11-12 11-11 11-06 11-04 11-02 10-21 10-16 10-14 10-10 10-06 10-05 09-30 09-20 09-19 09-18 09-15 09-14 09-13 09-06 09-05 09-04 09-03 08-23 08-22 08-19 08-17 08-16 08-11 08-10 08-07 08-06 08-05 08-04 08-03 08-01 07-30 07-29 07-26 07-22 07-20 07-18 07-16 07-14 "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
10341034 <br/>
10351035 Added a the compiler flag
10361036 <code><font color='blue'><pre style='display:inline'>
1037 AbsOfDoubleNotDefined
1037 AbsOfDoubleNotDefined
10381038 </pre></font></code>
1039
10401039 to the make files so that it could be removed on systems where the
10411040 function
10421041
55 <title>Changes and Additions to CppAD During 2004</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Changes and Additions to CppAD During 2004"/>
8 <meta name="keywords" id="keywords" content=" changes and additions to cppad during 2004 introduction 12-11 12-09 12-03 11-17 11-16 11-15 11-14 11-13 11-12 11-10 11-04 11-02 11-01 10-29 10-28 10-27 10-21 10-19 10-16 10-06 09-29 09-26 09-23 09-21 09-13 09-10 09-09 09-07 09-04 09-02 08-27 08-25 08-24 08-12 07-31 07-08 07-07 07-03 07-02 06-29 06-25 06-12 06-04 06-03 06-01 05-30 05-29 05-26 05-25 05-14 05-12 05-09 05-07 05-04 05-03 04-29 04-28 04-25 04-24 04-22 04-21 04-20 04-19 04-09 04-08 04-07 04-03 04-02 04-01 03-30 03-28 03-25 03-18 03-17 03-15 03-12 03-11 03-09 03-07 03-06 03-05 03-04 03-03 03-01 02-29 02-28 02-21 02-20 02-17 02-16 02-15 02-12 02-01 01-29 01-28 01-22 "/>
8 <meta name="keywords" id="keywords" content=" changes additions to cppad during 2004 introduction 12-11 12-09 12-03 11-17 11-16 11-15 11-14 11-13 11-12 11-10 11-04 11-02 11-01 10-29 10-28 10-27 10-21 10-19 10-16 10-06 09-29 09-26 09-23 09-21 09-13 09-10 09-09 09-07 09-04 09-02 08-27 08-25 08-24 08-12 07-31 07-08 07-07 07-03 07-02 06-29 06-25 06-12 06-04 06-03 06-01 05-30 05-29 05-26 05-25 05-14 05-12 05-09 05-07 05-04 05-03 04-29 04-28 04-25 04-24 04-22 04-21 04-20 04-19 04-09 04-08 04-07 04-03 04-02 04-01 03-30 03-28 03-25 03-18 03-17 03-15 03-12 03-11 03-09 03-07 03-06 03-05 03-04 03-03 03-01 02-29 02-28 02-21 02-20 02-17 02-16 02-15 02-12 02-01 01-29 01-28 01-22 "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
10141014 Note that if <code><font color="blue">/usr/local/cppad/</font></code> is no longer searched,
10151015 you will have to change
10161016 <code><font color='blue'><pre style='display:inline'>
1017 # include &quot;cppad.hpp&quot;
1017 # include &quot;cppad.hpp&quot;
10181018 </pre></font></code>
1019
10201019 to
10211020 <code><font color='blue'><pre style='display:inline'>
1022 # include &quot;cppad/cppad.hpp&quot;
1021 # include &quot;cppad/cppad.hpp&quot;
10231022 </pre></font></code>
10241023 .
10251024 <code><span style='white-space: nowrap'><br/>
55 <title>Changes and Additions to CppAD During 2005</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Changes and Additions to CppAD During 2005"/>
8 <meta name="keywords" id="keywords" content=" changes and additions to cppad during 2005 12-24 12-23 12-22 12-20 12-19 12-16 12-15 12-14 12-11 12-08 12-07 12-06 12-05 12-03 12-02 12-01 11-23 11-22 11-20 11-19 11-15 11-12 11-09 11-07 11-06 11-01 10-20 10-18 10-14 10-12 10-06 09-29 09-27 09-24 09-20 09-14 09-09 09-07 08-30 08-24 08-20 08-19 08-15 08-14 08-13 08-07 07-21 07-19 07-15 07-11 07-08 07-05 07-04 07-03 07-02 07-01 06-25 06-24 06-18 06-14 06-13 06-06 05-19 05-18 05-16 05-12 05-06 05-01 04-21 04-20 04-19 03-26 03-23 03-22 03-09 03-04 03-01 02-24 01-08 "/>
8 <meta name="keywords" id="keywords" content=" changes additions to cppad during 2005 12-24 12-23 12-22 12-20 12-19 12-16 12-15 12-14 12-11 12-08 12-07 12-06 12-05 12-03 12-02 12-01 11-23 11-22 11-20 11-19 11-15 11-12 11-09 11-07 11-06 11-01 10-20 10-18 10-14 10-12 10-06 09-29 09-27 09-24 09-20 09-14 09-09 09-07 08-30 08-24 08-20 08-19 08-15 08-14 08-13 08-07 07-21 07-19 07-15 07-11 07-08 07-05 07-04 07-03 07-02 07-01 06-25 06-24 06-18 06-14 06-13 06-06 05-19 05-18 05-16 05-12 05-06 05-01 04-21 04-20 04-19 03-26 03-23 03-22 03-09 03-04 03-01 02-24 01-08 "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
250250 resurfaced
251251 and the corresponding routine was changed as follows:
252252 <code><font color='blue'><pre style='display:inline'>
253 static ADTape&lt;Base&gt; *Tape(void)
254 { // If we return &amp;tape, instead of creating and returning ptr,
255 // there seems to be a bug in g++ with -O2 option.
256 static ADTape&lt;Base&gt; tape;
257 static ADTape&lt;Base&gt; *ptr = &amp;tape;
258 return ptr;
259 }
253 static ADTape&lt;Base&gt; *Tape(void)
254 { // If we return &amp;tape, instead of creating and returning ptr,
255 // there seems to be a bug in g++ with -O2 option.
256 static ADTape&lt;Base&gt; tape;
257 static ADTape&lt;Base&gt; *ptr = &amp;tape;
258 return ptr;
259 }
260260 </pre></font></code>
261
262
263 <br/>
264261 <br/>
265262 <b><big><a name="12-16" id="12-16">12-16</a></big></b>
266263 <br/>
471468 It appears that there is some sort of bug in the gcc compiler with
472469 the -O2 option whereby the following member function
473470 <code><font color='blue'><pre style='display:inline'>
474 static ADTape&lt;Base&gt; *Tape(void)
475 { static ADTape&lt;Base&gt; tape;
476 return &amp;tape;
477 }
471 static ADTape&lt;Base&gt; *Tape(void)
472 { static ADTape&lt;Base&gt; tape;
473 return &amp;tape;
474 }
478475 </pre></font></code>
479
480476 (in <code><font color="blue">cppad/local/AD.h</font></code>)
481477 would sometimes return a null value (during <a href="vecad.xml" target="_top"><span style='white-space: nowrap'>VecAD</span></a>
482478 operations).
12501246 For example,
12511247 here is part of the speed test output before this change:
12521248 <code><font color='blue'><pre style='display:inline'>
1253 Tape of Expansion by Minors Determinant: Length = 350, Memory = 6792
1254 size = 5 rate = 230
1255 size = 4 rate = 1,055
1256 size = 3 rate = 3,408
1257 size = 2 rate = 7,571
1258 size = 1 rate = 13,642
1249 Tape of Expansion by Minors Determinant: Length = 350, Memory = 6792
1250 size = 5 rate = 230
1251 size = 4 rate = 1,055
1252 size = 3 rate = 3,408
1253 size = 2 rate = 7,571
1254 size = 1 rate = 13,642
12591255 </pre></font></code>
1260
12611256 and here is the same output after this change:
12621257 <code><font color='blue'><pre style='display:inline'>
1263 Tape of Expansion by Minors Determinant: Length = 350, Memory = 6792
1264 size = 5 rate = 448
1265 size = 4 rate = 2,004
1266 size = 3 rate = 5,761
1267 size = 2 rate = 10,221
1268 size = 1 rate = 14,734
1258 Tape of Expansion by Minors Determinant: Length = 350, Memory = 6792
1259 size = 5 rate = 448
1260 size = 4 rate = 2,004
1261 size = 3 rate = 5,761
1262 size = 2 rate = 10,221
1263 size = 1 rate = 14,734
12691264 </pre></font></code>
1270
12711265 Note that your results will vary depending on operating system and machine.
12721266
12731267 <br/>
55 <title>Changes and Additions to CppAD During 2006</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Changes and Additions to CppAD During 2006"/>
8 <meta name="keywords" id="keywords" content=" changes and additions to cppad during 2006 aclocal introduction 12-24 12-23 12-22 12-21 12-19 12-18 12-17 12-15 12-13 12-12 12-11 12-10 12-09 12-07 12-05 12-03 12-02 12-01 11-30 11-29 11-28 11-23 11-18 11-12 11-08 11-06 11-05 11-04 11-02 11-01 10-31 10-29 10-28 10-27 10-26 10-25 10-18 10-16 10-10 09-30 08-17 07-14 07-12 06-29 06-22 06-19 06-17 06-18 06-15 06-09 06-07 06-05 06-02 05-31 05-29 05-27 05-03 04-29 04-28 04-26 04-25 04-19 04-18 04-17 04-15 04-14 04-13 04-08 04-06 04-05 04-04 04-03 04-02 04-01 03-31 03-30 03-29 03-28 03-27 03-26 03-24 03-23 03-22 03-18 03-17 03-16 03-15 03-11 03-10 03-09 03-07 03-05 02-28 02-25 02-24 02-23 02-21 02-15 02-14 02-13 02-11 02-10 02-04 01-20 01-18 01-08 01-07 01-02 01-05 "/>
8 <meta name="keywords" id="keywords" content=" changes additions to cppad during 2006 aclocal introduction 12-24 12-23 12-22 12-21 12-19 12-18 12-17 12-15 12-13 12-12 12-11 12-10 12-09 12-07 12-05 12-03 12-02 12-01 11-30 11-29 11-28 11-23 11-18 11-12 11-08 11-06 11-05 11-04 11-02 11-01 10-31 10-29 10-28 10-27 10-26 10-25 10-18 10-16 10-10 09-30 08-17 07-14 07-12 06-29 06-22 06-19 06-17 06-18 06-15 06-09 06-07 06-05 06-02 05-31 05-29 05-27 05-03 04-29 04-28 04-26 04-25 04-19 04-18 04-17 04-15 04-14 04-13 04-08 04-06 04-05 04-04 04-03 04-02 04-01 03-31 03-30 03-29 03-28 03-27 03-26 03-24 03-23 03-22 03-18 03-17 03-16 03-15 03-11 03-10 03-09 03-07 03-05 02-28 02-25 02-24 02-23 02-21 02-15 02-14 02-13 02-11 02-10 02-04 01-20 01-18 01-08 01-07 01-02 01-05 "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
908908 <br/>
909909 Some error message occurred while executing
910910 <code><font color='blue'><pre style='display:inline'>
911 valgrind --tool=memcheck example/example
912 valgrind --tool=memcheck TestMore/TestMore
911 valgrind --tool=memcheck example/example
912 valgrind --tool=memcheck TestMore/TestMore
913913
914914 </pre></font></code>
915
916915 These were not really bugs, but they have been fixed to avoid
917916 this conflict between CppAD and <a href="http://valgrind.org/" target="_top"><span style='white-space: nowrap'>valgrind</span></a>
918917 .
13391338 gave a compile error (this has been fixed).
13401339 Code example for this fix
13411340 <code><font color='blue'><pre style='display:inline'>
1342 VecAD&lt;double&gt; V(1);
1343 <a href="ad.xml" target="_top">AD</a>&lt;double&gt; zero = 0;
1344 V[zero] = 1.;
1345 static_cast&lt; <a href="ad.xml" target="_top">AD</a>&lt;double&gt; &gt; ( V[zero] );
1341 VecAD&lt;double&gt; V(1);
1342 <a href="ad.xml" target="_top">AD</a>&lt;double&gt; zero = 0;
1343 V[zero] = 1.;
1344 static_cast&lt; <a href="ad.xml" target="_top">AD</a>&lt;double&gt; &gt; ( V[zero] );
13461345 </pre></font></code>
1347
1348
1349
1350
1351
1352
1353 <br/>
13541346 <br/>
13551347 <b><big><a name="04-06" id="04-06">04-06</a></big></b>
13561348 <br/>
55 <title>Changes and Additions to CppAD During 2007</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Changes and Additions to CppAD During 2007"/>
8 <meta name="keywords" id="keywords" content=" changes and additions to cppad during 2007 introduction 12-29 12-25 12-21 12-08 12-05 12-04 12-03 12-02 11-29 11-23 11-18 11-06 11-05 11-04 11-03 11-02 11-01 10-30 10-27 10-23 10-22 10-16 10-13 10-05 10-02 09-06 08-09 08-07 07-30 07-29 07-28 07-26 07-25 07-23 07-22 07-21 07-20 07-19 07-18 07-14 07-13 06-22 06-20 06-14 05-26 05-25 05-24 05-22 05-08 05-05 04-19 04-17 04-14 04-11 04-10 04-07 04-06 04-05 03-31 03-30 03-29 03-20 03-15 03-14 03-13 03-09 03-28 02-27 02-22 02-17 02-16 02-15 02-06 02-04 02-03 02-02 02-01 01-29 "/>
8 <meta name="keywords" id="keywords" content=" changes additions to cppad during 2007 introduction 12-29 12-25 12-21 12-08 12-05 12-04 12-03 12-02 11-29 11-23 11-18 11-06 11-05 11-04 11-03 11-02 11-01 10-30 10-27 10-23 10-22 10-16 10-13 10-05 10-02 09-06 08-09 08-07 07-30 07-29 07-28 07-26 07-25 07-23 07-22 07-21 07-20 07-19 07-18 07-14 07-13 06-22 06-20 06-14 05-26 05-25 05-24 05-22 05-08 05-05 04-19 04-17 04-14 04-11 04-10 04-07 04-06 04-05 03-31 03-30 03-29 03-20 03-15 03-14 03-13 03-09 03-28 02-27 02-22 02-17 02-16 02-15 02-06 02-04 02-03 02-02 02-01 01-29 "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
396396 have changed.
397397 The user should now directly edit the file
398398 <code><font color='blue'><pre style='display:inline'>
399 trunk/configure
399 trunk/configure
400400 </pre></font></code>
401
402401 in order to set the correct date for the installation
403402 and to build the corresponding documentation.
404403 <code><span style='white-space: nowrap'><br/>
420419 have changed.
421420 The user must now execute the command
422421 <code><font color='blue'><pre style='display:inline'>
423 ./build.sh version
422 ./build.sh version
424423 </pre></font></code>
425
426424 in order to set the correct version number for her (or his) installation.
427425 <code><span style='white-space: nowrap'><br/>
428426 <br/>
13761374 The conditional include commands were missing on some include files;
13771375 for example
13781376 <code><font color='blue'><pre style='display:inline'>
1379 # ifndef CPPAD_BENDER_QUAD_HPP
1380 # define CPPAD_BENDER_QUAD_HPP
1377 # ifndef CPPAD_BENDER_QUAD_HPP
1378 # define CPPAD_BENDER_QUAD_HPP
13811379 </pre></font></code>
1382
13831380 was missing at the beginning of the <a href="benderquad.xml" target="_top"><span style='white-space: nowrap'>BenderQuad</span></a>
13841381 include file.
13851382 This has been fixed.
14341431 The include command in the <a href="speed_test.xml" target="_top"><span style='white-space: nowrap'>speed_test</span></a>
14351432 documentation was
14361433 <code><font color='blue'><pre style='display:inline'>
1437 # include &lt;speed/speed_test.hpp&gt;
1434 # include &lt;speed/speed_test.hpp&gt;
14381435 </pre></font></code>
1439
14401436 but it should have been
14411437 <code><font color='blue'><pre style='display:inline'>
1442 # include &lt;cppad/speed_test.hpp&gt;
1438 # include &lt;cppad/speed_test.hpp&gt;
14431439 </pre></font></code>
1444
14451440 This has been fixed.
14461441
14471442 <br/>
55 <title>Changes and Additions to CppAD During 2008</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Changes and Additions to CppAD During 2008"/>
8 <meta name="keywords" id="keywords" content=" changes and additions to cppad during 2008 erf ipopt_cppad_nlp introduction 12-19 12-14 12-04 11-22 11-21 11-20 10-27 10-17 10-16 09-30 09-26 09-18 09-17 09-16 09-12 09-10 09-09 09-07 09-06 09-05 09-04 09-03 09-01 08-29 08-19 08-08 07-02 06-18 06-15 06-11 06-10 05-08 05-03 04-20 04-18 04-10 04-06 04-04 03-27 02-05 02-03 01-26 01-24 01-21 01-20 01-11 01-08 "/>
8 <meta name="keywords" id="keywords" content=" changes additions to cppad during 2008 erf ipopt_cppad_nlp introduction 12-19 12-14 12-04 11-22 11-21 11-20 10-27 10-17 10-16 09-30 09-26 09-18 09-17 09-16 09-12 09-10 09-09 09-07 09-06 09-05 09-04 09-03 09-01 08-29 08-19 08-08 07-02 06-18 06-15 06-11 06-10 05-08 05-03 04-20 04-18 04-10 04-06 04-04 03-27 02-05 02-03 01-26 01-24 01-21 01-20 01-11 01-08 "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
462462 at the proper location. Here is the difference that occurred
463463 multiple places in the <code><font color="blue">ipopt_cppad/ipopt_cppad_nlp.cpp</font></code> source:
464464 <code><font color='blue'><pre style='display:inline'>
465 for(j = 0; j &lt; n_; j++)
466 - x_ad_vec[0] = x[j];
467 + x_ad_vec[j] = x[j];
465 for(j = 0; j &lt; n_; j++)
466 - x_ad_vec[0] = x[j];
467 + x_ad_vec[j] = x[j];
468468 </pre></font></code>
469
470469 This did not show up in testing because there currently is no test of
471470 <code><font color="blue">ipopt_cppad_nlp</font></code> where the operation sequence depends
472471 on the value of
55 <title>Changes and Additions to CppAD During 2009</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Changes and Additions to CppAD During 2009"/>
8 <meta name="keywords" id="keywords" content=" changes and additions to cppad during 2009 introduction 12-23 12-22 12-18 12-12 12-04 12-02 11-28 11-27 11-26 10-30 10-29 10-28 10-27 10-24 10-23 10-21 10-16 10-14 10-03 09-30 09-29 09-28 09-26 09-20 09-19 09-18 08-25 08-14 08_13 08-13 08-11 08-10 08-09 08-06 08-02 08-01 07-31 07-26 07-25 07-24 07-23 07-06 07-04 07-03 07-02 07-01 06-30 06-29 06-28 06-25 06-22 06-21 06-20 06-06 05-20 03-24 02-20 02-15 02-01 01-31 01-18 01-06 "/>
8 <meta name="keywords" id="keywords" content=" changes additions to cppad during 2009 introduction 12-23 12-22 12-18 12-12 12-04 12-02 11-28 11-27 11-26 10-30 10-29 10-28 10-27 10-24 10-23 10-21 10-16 10-14 10-03 09-30 09-29 09-28 09-26 09-20 09-19 09-18 08-25 08-14 08_13 08-13 08-11 08-10 08-09 08-06 08-02 08-01 07-31 07-26 07-25 07-24 07-23 07-06 07-04 07-03 07-02 07-01 06-30 06-29 06-28 06-25 06-22 06-21 06-20 06-06 05-20 03-24 02-20 02-15 02-01 01-31 01-18 01-06 "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
181181 <br/>
182182 <b><big><a name="12-23" id="12-23">12-23</a></big></b>
183183 <br/>
184 The
184 The
185185 <code><font color="blue">ADFun</font></code> <a href="funconstruct.xml#Assignment Operator" target="_top"><span style='white-space: nowrap'>assignment&#xA0;operator</span></a>
186186
187187 was changed so that it now copies forward mode
203203 <br/>
204204 <b><big><a name="12-22" id="12-22">12-22</a></big></b>
205205 <br/>
206 Convert the optimization of a sequence of additions from multiple operators
207 to one operator with a varying number of arguments. This improved the speed
206 Convert the optimization of a sequence of additions from multiple operators
207 to one operator with a varying number of arguments. This improved the speed
208208 for forward and reverse mode computations of an optimized tape.
209209
210210 <br/>
241241 <br/>
242242 Fix minor grammatical error in the Purpose heading
243243 for <a href="condexp.xml#Purpose" target="_top"><span style='white-space: nowrap'>conditional&#xA0;expressions</span></a>
244 .
245 <code><span style='white-space: nowrap'><br/>
246 <br/>
247 </span></code>Add the following functions:
244 .
245 <code><span style='white-space: nowrap'><br/>
246 <br/>
247 </span></code>Add the following functions:
248248 <a href="seq_property.xml#size_op" target="_top"><span style='white-space: nowrap'>size_op</span></a>
249249 ,
250250 <a href="seq_property.xml#size_op_arg" target="_top"><span style='white-space: nowrap'>size_op_arg</span></a>
252252 and
253253 <a href="seq_property.xml#size_op_seq" target="_top"><span style='white-space: nowrap'>size_op_seq</span></a>
254254 .
255 In addition, improve and extend the
255 In addition, improve and extend the
256256 <a href="seq_property.cpp.xml" target="_top"><span style='white-space: nowrap'>seq_property.cpp</span></a>
257 example.
257 example.
258258
259259 <br/>
260260 <br/>
293293 <br/>
294294 <b><big><a name="10-29" id="10-29">10-29</a></big></b>
295295 <br/>
296 Split out the
296 Split out the
297297 <a href="ipopt_nlp_ode_problem.xml" target="_top"><span style='white-space: nowrap'>ode&#xA0;inverse&#xA0;problem</span></a>
298298 ,
299299 <a href="ipopt_nlp_ode_simple.xml" target="_top"><span style='white-space: nowrap'>its&#xA0;simple&#xA0;representation</span></a>
308308 ,
309309 <a href="ipopt_nlp_ode_fast.hpp.xml" target="_top"><span style='white-space: nowrap'>ipopt_nlp_ode_fast.hpp</span></a>
310310 ,
311 and
311 and
312312 <a href="ipopt_nlp_ode_check.cpp.xml" target="_top"><span style='white-space: nowrap'>ipopt_nlp_ode_check.cpp</span></a>
313313 .
314314
317317 <b><big><a name="10-28" id="10-28">10-28</a></big></b>
318318 <br/>
319319 Improve the documentation for <a href="ipopt_nlp_ode_simple.xml" target="_top"><span style='white-space: nowrap'>ipopt_nlp_ode_simple</span></a>
320 and
320 and
321321 <a href="ipopt_nlp_ode_fast.xml" target="_top"><span style='white-space: nowrap'>ipopt_nlp_ode_fast</span></a>
322322 .
323323
329329 ,
330330 created the example <a href="ipopt_nlp_ode_simple.hpp.xml" target="_top"><span style='white-space: nowrap'>ipopt_nlp_ode_simple.hpp</span></a>
331331 ,
332 and split and <code><font color="blue">ipopt_cppad_ode.cpp</font></code>
332 and split and <code><font color="blue">ipopt_cppad_ode.cpp</font></code>
333333 into <a href="ipopt_nlp_ode_fast.hpp.xml" target="_top"><span style='white-space: nowrap'>ipopt_nlp_ode_fast.hpp</span></a>
334334 and <a href="ipopt_nlp_ode_check.cpp.xml" target="_top"><span style='white-space: nowrap'>ipopt_nlp_ode_check.cpp</span></a>
335335 .
341341 Added the <a href="funconstruct.xml#Assignment Operator" target="_top"><span style='white-space: nowrap'>assignment&#xA0;operator</span></a>
342342
343343 to the <code><font color="blue">ADFun</font></code> object class.
344 This makes a copy of the entire operation sequence in another
344 This makes a copy of the entire operation sequence in another
345345 function object.
346346 The intention is that the two functions objects can do calculations in
347347 parallel.
348348 In addition,
349 CppAD now check for the <code><font color="blue">ADFun</font></code>
349 CppAD now check for the <code><font color="blue">ADFun</font></code>
350350 <a href="funconstruct.xml#Copy Constructor" target="_top"><span style='white-space: nowrap'>copy&#xA0;constructor</span></a>
351351
352352 and generates an error message if it is used.
408408 <br/>
409409 <b><big><a name="10-03" id="10-03">10-03</a></big></b>
410410 <br/>
411 The Microsoft Visual Studio project files for
411 The Microsoft Visual Studio project files for
412412 examples and testing
413413 and for
414414 more correctness testing
456456 <br/>
457457 Changed <a href="revsparsehes.xml" target="_top"><span style='white-space: nowrap'>RevSparseHes</span></a>
458458 so that it uses a sparse
459 representation when the corresponding call to
459 representation when the corresponding call to
460460 <a href="forsparsejac.xml" target="_top"><span style='white-space: nowrap'>ForSparseJac</span></a>
461461 used a sparse representation.
462 This should have been included with the change on 09-26
462 This should have been included with the change on 09-26
463463 because Hessian sparsity patters after <code><font color="blue">ForSparseJac</font></code>
464464 with
465465 <code><i><font color="black"><span style='white-space: nowrap'>packed</span></font></i></code>
477477 If
478478 <code><i><font color="black"><span style='white-space: nowrap'>packed</span></font></i></code>
479479 is false,
480 a sparse instead of packed representation is used
480 a sparse instead of packed representation is used
481481 during the calculations of sparsity patterns.
482482 The sparse representation
483483 should be faster, and use less memory, for very large sparse Jacobians.
499499 <br/>
500500 <b><big><a name="09-19" id="09-19">09-19</a></big></b>
501501 <br/>
502 Some more memory allocation improvements (related to those
503 on 09-18) were made.
502 Some more memory allocation improvements (related to those
503 on 09-18) were made.
504504
505505 <br/>
506506 <br/>
537537 an operation sequence.
538538 <code><span style='white-space: nowrap'><br/>
539539 <br/>
540 </span></code><b>Begin Merge</b>
541 <code><span style='white-space: nowrap'><br/>
542 </span></code>of changes from the directory <code><font color="blue">branches/optimize</font></code>
540 </span></code><b>Begin Merge</b>
541 <code><span style='white-space: nowrap'><br/>
542 </span></code>of changes from the directory <code><font color="blue">branches/optimize</font></code>
543543 in the CppAD subversion repository.
544 The subheading dates below represent when the correspond change was made in
544 The subheading dates below represent when the correspond change was made in
545545 <code><font color="blue">branches/optimize</font></code>.
546546
547547 <br/>
553553 after each call to <a href="optimize.xml" target="_top"><span style='white-space: nowrap'>f.optimize()</span></a>
554554
555555 (this <a href="optimize.xml#Checking Optimization" target="_top"><span style='white-space: nowrap'>check</span></a>
556
556
557557 is skipped when <code><font color="blue">NDEBUG</font></code> is defined).
558558 In addition, all of the
559559 <code><font color="blue"><span style='white-space: nowrap'>speed/cppad/</span></font><i><font color="black"><span style='white-space: nowrap'>*</span></font></i><font color="blue"><span style='white-space: nowrap'>.cpp</span></font></code>
585585 now be trusted to work correctly.
586586 <code><span style='white-space: nowrap'><br/>
587587 <br/>
588 </span></code>The function
588 </span></code>The function
589589 <a href="seq_property.xml#size_VecAD" target="_top"><span style='white-space: nowrap'>size_VecAD</span></a>
590590 function was added
591 so that the user could see the <code><font color="blue">VecAD</font></code> vectors
591 so that the user could see the <code><font color="blue">VecAD</font></code> vectors
592592 and elements corresponding to an operation sequence.
593593
594594 <br/>
610610 <br/>
611611 Add hash table coding to reduce the number of copies of the same
612612 parameter value necessary in a tape recording.
613 In addition, add the function
613 In addition, add the function
614614 <a href="seq_property.xml#size_par" target="_top"><span style='white-space: nowrap'>size_par</span></a>
615615 was added
616616 so that the user could see the number of parameters
626626 objects.
627627 <code><span style='white-space: nowrap'><br/>
628628 <br/>
629 </span></code>Fix bug in overnight build where HTML version and entire documentation
629 </span></code>Fix bug in overnight build where HTML version and entire documentation
630630 as one page versions of documentation were not being built.
631631 <code><span style='white-space: nowrap'><br/>
632632 <br/>
633 </span></code>Fix missing new line under
633 </span></code>Fix missing new line under
634634 <a href="simplevector.xml#Element Access.Using Value" target="_top"><span style='white-space: nowrap'>Using&#xA0;Value</span></a>
635635
636636 heading for simple vector documentation.
642642 Fix bug in reverse mode Jacobian <a href="revsparsejac.xml" target="_top"><span style='white-space: nowrap'>sparsity</span></a>
643643
644644 for <a href="vecad.xml" target="_top"><span style='white-space: nowrap'>VecAD</span></a>
645 objects.
645 objects.
646646
647647 <br/>
648648 <br/>
688688 <code><span style='white-space: nowrap'><br/>
689689 <br/>
690690 </span></code>Improve the <a href="vec_ad.cpp.xml" target="_top"><span style='white-space: nowrap'>vec_ad.cpp</span></a>
691 user example.
691 user example.
692692
693693 <br/>
694694 <br/>
702702 <code><span style='white-space: nowrap'><br/>
703703 <br/>
704704 </span></code>Add developer documentation for tape evaluation of the
705 VecAD load operations
705 VecAD load operations
706706 (a load operation accesses an element of the vector but
707707 does not change it.)
708708 <code><span style='white-space: nowrap'><br/>
709709 <br/>
710 </span></code>Fix <code><font color="blue">isnan</font></code> undefined in <code><font color="blue">example/cond_exp.cpp</font></code> error
710 </span></code>Fix <code><font color="blue">isnan</font></code> undefined in <code><font color="blue">example/cond_exp.cpp</font></code> error
711711 introduced on 07-04 change.
712712
713713 <br/>
719719 operations during tape evaluation.
720720 <code><span style='white-space: nowrap'><br/>
721721 <br/>
722 </span></code><b>Begin Merge</b>
723 <code><span style='white-space: nowrap'><br/>
724 </span></code>of changes from the directory <code><font color="blue">branches/sweep</font></code>
722 </span></code><b>Begin Merge</b>
723 <code><span style='white-space: nowrap'><br/>
724 </span></code>of changes from the directory <code><font color="blue">branches/sweep</font></code>
725725 in the CppAD subversion repository.
726 The subheading dates below represent when the correspond change was made in
726 The subheading dates below represent when the correspond change was made in
727727 <code><font color="blue">branches/sweep</font></code>.
728728
729729 <br/>
739739 <br/>
740740 </span></code>A simpler and useful example was provided for
741741 <a href="condexp.xml" target="_top"><span style='white-space: nowrap'>conditional&#xA0;expressions</span></a>
742 ;
742 ;
743743 see <a href="cond_exp.cpp.xml" target="_top"><span style='white-space: nowrap'>cond_exp.cpp</span></a>
744744 .
745745
748748 <br/>
749749 <b><a name="07-04.07-03" id="07-04.07-03">07-03</a></b>
750750 <br/>
751 Some minor improvements were made to the documentation for
751 Some minor improvements were made to the documentation for
752752 <a href="condexp.xml" target="_top"><span style='white-space: nowrap'>CondExp</span></a>
753753 .
754754 To be specific, a newer OMhelp option was used to change the formatting
758758 <br/>
759759 <b><a name="07-04.07-02" id="07-04.07-02">07-02</a></b>
760760 <br/>
761 Add developer doxygen documentation of
761 Add developer doxygen documentation of
762762 tape evaluation for power (exponentiation) operators.
763763
764764 <br/>
765765 <br/>
766766 <b><a name="07-04.07-01" id="07-04.07-01">07-01</a></b>
767767 <br/>
768 Fix an example indexing error in
768 Fix an example indexing error in
769769 <code><font color="blue">introduction/exp_apx/exp_eps_for2.cpp</font></code> (found by valgrind).
770770 <code><span style='white-space: nowrap'><br/>
771771 <br/>
772 </span></code>Add developer doxygen documentation of
772 </span></code>Add developer doxygen documentation of
773773 tape evaluation for multiplication and division operators.
774774
775775 <br/>
776776 <br/>
777777 <b><a name="07-04.06-30" id="07-04.06-30">06-30</a></b>
778778 <br/>
779 Add developer doxygen documentation of
779 Add developer doxygen documentation of
780780 tape evaluation for addition and subtraction operators.
781781
782782 <br/>
783783 <br/>
784784 <b><a name="07-04.06-29" id="07-04.06-29">06-29</a></b>
785785 <br/>
786 Add developer doxygen documentation of
786 Add developer doxygen documentation of
787787 tape evaluation for sin, sinh, cos, and cosh.
788788
789789 <br/>
790790 <br/>
791791 <b><a name="07-04.06-28" id="07-04.06-28">06-28</a></b>
792792 <br/>
793 Add developer doxygen documentation of
793 Add developer doxygen documentation of
794794 tape evaluation for atan, asin, acos, sqrt, log.
795795 <code><span style='white-space: nowrap'><br/>
796796 </span></code><b>End Merge</b>
799799 <br/>
800800 <b><big><a name="06-25" id="06-25">06-25</a></big></b>
801801 <br/>
802 The tarball for most recent release (of the subversion trunk for CppAD)
803 was not being placed in the
802 The tarball for most recent release (of the subversion trunk for CppAD)
803 was not being placed in the
804804 <a href="http://www.coin-or.org/download/source/CppAD/" target="_top"><span style='white-space: nowrap'>download</span></a>
805
806 directory.
805
806 directory.
807807 This has been fixed.
808808
809809 <br/>
837837 <code><span style='white-space: nowrap'><br/>
838838 <br/>
839839 </span></code>Fix conflict between CppAD's use of config.h preprocessor symbols
840 and other packages use of the same symbol names.
840 and other packages use of the same symbol names.
841841
842842 <br/>
843843 <br/>
845845
846846 <ol type="1"><li>
847847 Using complex of an AD type (instead of AD of complex) was not working
848 correctly in <code><font color="blue">not_complex_ad.cpp</font></code> because the
848 correctly in <code><font color="blue">not_complex_ad.cpp</font></code> because the
849849 <a href="ad_ctor.xml" target="_top"><span style='white-space: nowrap'>default&#xA0;constructor</span></a>
850850 for an AD object has an unspecified value.
851851 This has been fixed for the complex type by changing the default constructor
852 to use value zero.
853 (The <code><font color="blue">not_complex_ad.cpp</font></code> example has been removed;
852 to use value zero.
853 (The <code><font color="blue">not_complex_ad.cpp</font></code> example has been removed;
854854 see <a href="faq.xml#Complex Types" target="_top"><span style='white-space: nowrap'>complex&#xA0;FAQ</span></a>
855855 .)
856856 </li><li>
861861 Now <code><font color="blue">valgrind</font></code> runs the CppAD <code><font color="blue">example/example</font></code> program
862862 with out any warning or error messages.
863863 In addition, a minor initialization error was fixed in the
864 <code><font color="blue">test_more/jacobian.cpp</font></code> routine so now
864 <code><font color="blue">test_more/jacobian.cpp</font></code> routine so now
865865 <code><font color="blue">valgrind</font></code> also runs the CppAD <code><font color="blue">test_more/test_more</font></code> program
866866 with out any warnings or error messages.
867867 </li></ol>
880880 <br/>
881881 <b><big><a name="03-24" id="03-24">03-24</a></big></b>
882882 <br/>
883 Added cross references in
883 Added cross references in
884884 the <a href="listallexamples.xml" target="_top"><span style='white-space: nowrap'>examples</span></a>
885885 to occurrence of the following tokens:
886886 <a href="ad.xml" target="_top"><span style='white-space: nowrap'>AD</span></a>
942942 <br/>
943943 Sometimes an error occurs while taping AD operations.
944944 The <a href="abort_recording.xml" target="_top"><span style='white-space: nowrap'>abort_recording</span></a>
945 function has been added
945 function has been added
946946 to make it easier to recover in such cases.
947947 <code><span style='white-space: nowrap'><br/>
948948 <br/>
953953 <code><span style='white-space: nowrap'><br/>
954954 <br/>
955955 </span></code>A discussion has been added to the documentation for <a href="jacobian.xml" target="_top"><span style='white-space: nowrap'>Jacobian</span></a>
956
956
957957 about its use of
958958 <a href="jacobian.xml#Forward or Reverse" target="_top"><span style='white-space: nowrap'>forward&#xA0;or&#xA0;reverse</span></a>
959959
963963 </span></code>A minor typo has been fixed in the description of
964964 <code><font color="blue">W(t, u)</font></code> in <a href="reverse_any.xml" target="_top"><span style='white-space: nowrap'>reverse_any</span></a>
965965 .
966 To be specific,
966 To be specific,
967967
968968 <math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow>
969969 <mi mathvariant='italic'>o</mi>
55 <title>Changes and Additions to CppAD During 2010</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Changes and Additions to CppAD During 2010"/>
8 <meta name="keywords" id="keywords" content=" changes and additions to cppad during 2010 introduction 12-31 11-27 09-26 09-22 08-21 07-14 07-11 06-01 04-28 04-26 04-24 04-01 03-11 03-10 03-09 03-03 02-11 02-08 02-06 02-05 02-03 01-26 01-24 01-23 01-20 01-18 01-04 "/>
8 <meta name="keywords" id="keywords" content=" changes additions to cppad during 2010 introduction 12-31 11-27 09-26 09-22 08-21 07-14 07-11 06-01 04-28 04-26 04-24 04-01 03-11 03-10 03-09 03-03 02-11 02-08 02-06 02-05 02-03 01-26 01-24 01-23 01-20 01-18 01-04 "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>Changes and Additions to CppAD During 2011</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="Changes and Additions to CppAD During 2011"/>
8 <meta name="keywords" id="keywords" content=" changes and additions to cppad during 2011 introduction 12-30 12-28 12-21 12-20 11-29 11-27 11-24 11-21 11-20 11-18 11-17 11-09 11-07 11-06 11-04 11-01 10-30 10-29 10-14 10-12 09-06 09-05 09-02 09-01 08-31 08-30 08-25 08-23 08-21 08-11 08-10 08-09 08-08 08-07 08-06 08-04 08-03 08-02 07-31 07-29 07-28 07-27 07-25 07-18 07-17 07-14 07-13 07-11 openmp/run.sh 07-10 07-09 07-07 06-23 06-21 06-18 05-29 05-28 05-26 05-22 05-11 05-03 04-29 04-20 04-19 03-19 03-11 03-05 02-22 02-19 02-17 02-15 02-09 02-06 02-02 02-01 01-19 01-16 01-09 "/>
8 <meta name="keywords" id="keywords" content=" changes additions to cppad during 2011 introduction 12-30 12-28 12-21 12-20 11-29 11-27 11-24 11-21 11-20 11-18 11-17 11-09 11-07 11-06 11-04 11-01 10-30 10-29 10-14 10-12 09-06 09-05 09-02 09-01 08-31 08-30 08-25 08-23 08-21 08-11 08-10 08-09 08-08 08-07 08-06 08-04 08-03 08-02 07-31 07-29 07-28 07-27 07-25 07-18 07-17 07-14 07-13 07-11 openmp/run.sh 07-10 07-09 07-07 06-23 06-21 06-18 05-29 05-28 05-26 05-22 05-11 05-03 04-29 04-20 04-19 03-19 03-11 03-05 02-22 02-19 02-17 02-15 02-09 02-06 02-02 02-01 01-19 01-16 01-09 "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
248248 code work with this
249249 change is to use the command
250250 <code><font color='blue'><pre style='display:inline'>
251 using namespace cppad_ipopt;
251 using namespace cppad_ipopt;
252252 </pre></font></code>
253
254
255 <br/>
256253 <br/>
257254 <b><big><a name="12-20" id="12-20">12-20</a></big></b>
258255
501498
502499 All of the make files were modified so that the command
503500 <code><font color='blue'><pre style='display:inline'>
504 make test
501 make test
505502 </pre></font></code>
506
507503 would run the tests for the current directory.
508504 </li><li>
509505
633629 Modify the CppAD trunk using the
634630 changes from svn revision 2060 to revision 2081 in the branch
635631 <code><font color='blue'><pre style='display:inline'>
636 https://projects.coin-or.org/svn/CppAD/branches/pthread
632 https://projects.coin-or.org/svn/CppAD/branches/pthread
637633 </pre></font></code>
638
639634 These changes are described below under the headings
640635 <a href="whats_new_11.xml#09-01.08-21" target="_top"><span style='white-space: nowrap'>08-21</span></a>
641636 through
789784 Modify the CppAD trunk using the
790785 changes from svn revision 2044 to revision 2056 in the branch
791786 <code><font color='blue'><pre style='display:inline'>
792 https://projects.coin-or.org/svn/CppAD/branches/base_require
787 https://projects.coin-or.org/svn/CppAD/branches/base_require
793788 </pre></font></code>
794
795789 These changes are described below under the headings
796790 <a href="whats_new_11.xml#08-11.08-04" target="_top"><span style='white-space: nowrap'>08-04</span></a>
797791 through
13601354 In addition, in the file <code><font color="blue">cppad/omp_alloc.hpp</font></code>,
13611355 suppress the following Microsoft Visual Studio warning
13621356 <code><font color='blue'><pre style='display:inline'>
1363 warning C4345: behavior change: an object of POD type constructed with
1364 an initializer of the form () will be default-initialized
1357 warning C4345: behavior change: an object of POD type constructed with
1358 an initializer of the form () will be default-initialized
13651359 </pre></font></code>
1366
1367
1368
1369 <br/>
13701360 <br/>
13711361 <b><big><a name="05-22" id="05-22">05-22</a></big></b>
13721362
55 <title>CppAD Changes and Additions During 2012</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="CppAD Changes and Additions During 2012"/>
8 <meta name="keywords" id="keywords" content=" cppad changes and additions during 2012 introduction 12-30 12-29 12-28 12-27 12-26 12-23 12-22 12-20 12-19 12-17 12-15 12-14 12-13 11-28 11-21 11-20 11-17 11-16 11-14 11-09 11-06 11-04 10-31 10-30 10-25 10-24 10-12 10-04 10-03 10-02 09-24 09-11 08-05 07-30 07-08 07-07 07-05 07-04 07-03 07-02 07-01 06-17 06-16 06-15 06-12 06-10 06-09 06-08 06-07 06-05 06-04 06-03 06-02 06-01 05-31 05-30 05-29 05-27 05-24 04-19 04-18 04-17 04-10 04-06 04-05 04-01 03-27 03-26 03-23 03-21 03-17 03-11 03-03 03-02 02-11 02-10 02-09 01-30 01-27 01-24 01-23 01-20 01-19 01-16 01-15 01-12 01-07 01-02 "/>
8 <meta name="keywords" id="keywords" content=" cppad changes additions during 2012 introduction 12-30 12-29 12-28 12-27 12-26 12-23 12-22 12-20 12-19 12-17 12-15 12-14 12-13 11-28 11-21 11-20 11-17 11-16 11-14 11-09 11-06 11-04 10-31 10-30 10-25 10-24 10-12 10-04 10-03 10-02 09-24 09-11 08-05 07-30 07-08 07-07 07-05 07-04 07-03 07-02 07-01 06-17 06-16 06-15 06-12 06-10 06-09 06-08 06-07 06-05 06-04 06-03 06-02 06-01 05-31 05-30 05-29 05-27 05-24 04-19 04-18 04-17 04-10 04-06 04-05 04-01 03-27 03-26 03-23 03-21 03-17 03-11 03-03 03-02 02-11 02-10 02-09 01-30 01-27 01-24 01-23 01-20 01-19 01-16 01-15 01-12 01-07 01-02 "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
820820 <a href="optimize.cpp.xml" target="_top"><span style='white-space: nowrap'>optimize.cpp</span></a>
821821 example:
822822 <code><font color='blue'><pre style='display:inline'>
823 ==6344== Conditional jump or move depends on uninitialised value(s)
823 ==6344== Conditional jump or move depends on uninitialised value(s)
824824 </pre></font></code>
825
826 </li><li>
827
825 </li><li>
828826 Fix mistake in <a href="old_tan.cpp.xml" target="_top"><span style='white-space: nowrap'>old_tan.cpp</span></a>
829827 where <code><font color="blue">w[2] = 0</font></code>
830828 was missing before the call
831829 <code><font color='blue'><pre style='display:inline'>
832 dw = F.<a href="reverse.xml" target="_top">Reverse</a>(1, w);
830 dw = F.<a href="reverse.xml" target="_top">Reverse</a>(1, w);
833831 </pre></font></code>
834
835 </li></ol>
836
837
838 <br/>
832 </li></ol>
839833 <br/>
840834 <b><big><a name="07-08" id="07-08">07-08</a></big></b>
841835
902896 y_taddr &gt; 0
903897 at line 262 in the file cppad/local/dependent.hpp
904898 </pre></font></code>
905
906
907 <br/>
908899 <br/>
909900 <b><big><a name="07-02" id="07-02">07-02</a></big></b>
910901 <br/>
13891380 If you then edited the file <code><font color="blue">work/multi_thread/makefile</font></code>
13901381 and changed
13911382 <code><font color='blue'><pre style='display:inline'>
1392 # AM_CXXFLAGS = -g $(CXX_FLAGS)
1393 AM_CXXFLAGS = -DNDEBUG -O2 $(CXX_FLAGS)
1383 # AM_CXXFLAGS = -g $(CXX_FLAGS)
1384 AM_CXXFLAGS = -DNDEBUG -O2 $(CXX_FLAGS)
13941385 </pre></font></code>
1395
13961386 to
13971387 <code><font color='blue'><pre style='display:inline'>
1398 AM_CXXFLAGS = -g $(CXX_FLAGS)
1399 # AM_CXXFLAGS = -DNDEBUG -O2 $(CXX_FLAGS)
1388 AM_CXXFLAGS = -g $(CXX_FLAGS)
1389 # AM_CXXFLAGS = -DNDEBUG -O2 $(CXX_FLAGS)
14001390 </pre></font></code>
1401
14021391 and then executed the commands
14031392 <code><font color='blue'><pre style='display:inline'>
1404 make clean
1405 make pthread_test
1406 valgrind --tool=helgrind ./pthread_test simple_ad
1393 make clean
1394 make pthread_test
1395 valgrind --tool=helgrind ./pthread_test simple_ad
14071396 </pre></font></code>
1408
14091397 The following error message would result:
14101398
14111399 <code><i><font color="black"><span style='white-space: nowrap'><br/>
18021790 <code><font color='blue'><pre style='display:inline'>
18031791 if( fabs( fcur ) &lt;= epsilon_ )
18041792 </pre></font></code>
1805
18061793 was removed from the routine <code><font color="blue">multi_newton_worker</font></code>, in the file
18071794 <a href="multi_newton_work.cpp.xml" target="_top"><span style='white-space: nowrap'>multi_newton_work.cpp</span></a>
18081795 .
18601847 <code><font color='blue'><pre style='display:inline'>
18611848 ./openmp_test multi_newton 1 32 1000 4800 10 true
18621849 </pre></font></code>
1863
18641850 improved from 0.0302 seconds to 0.0135 seconds.
18651851
18661852 </li><li>
55 <title>CppAD Changes and Additions During 2013</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="CppAD Changes and Additions During 2013"/>
8 <meta name="keywords" id="keywords" content=" cppad changes and additions during 2013 introduction 12-29 12-27 12-26 12-24 11-27 11-13 11-12 10-29 10-23 10-22 10-16 10-15 10-14 10-13 10-12 09-20 09-19 09-18 09-07 08-12 08-11 08-06 07-26 05-28 05-21 05-17 05-15 05-14 05-12 05-11 05-04 04-28 04-27 04-26 "/>
8 <meta name="keywords" id="keywords" content=" cppad changes additions during 2013 introduction 12-29 12-27 12-26 12-24 11-27 11-13 11-12 10-29 10-23 10-22 10-16 10-15 10-14 10-13 10-12 09-20 09-19 09-18 09-07 08-12 08-11 08-06 07-26 05-28 05-21 05-17 05-15 05-14 05-12 05-11 05-04 04-28 04-27 04-26 "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
286286 now handles nested conditional expressions.
287287 For example, give the code
288288 <code><font color='blue'><pre style='display:inline'>
289 x = CondExpLt(left_x, right_x, true_x, false_x)
290 y = CondExpGt(left_y, right_y, true_y, false_y)
291 z = CondExpEq(left_z, right_z, x, y)
289 x = CondExpLt(left_x, right_x, true_x, false_x)
290 y = CondExpGt(left_y, right_y, true_y, false_y)
291 z = CondExpEq(left_z, right_z, x, y)
292292 </pre></font></code>
293
294293 only two of the conditional expressions will be evaluated
295294 (one will be skipped depending on the result of <code><font color="blue">left_z == right_z</font></code>).
296295 For more details, see
410409 Check[i * n + j] |= F2[i * n + k] &amp; r[ k * n + j];
411410 ^
412411 </pre></font></code>
413
414 </li></ol>
415
416
417 <br/>
412 </li></ol>
418413 <br/>
419414 <b><big><a name="09-20" id="09-20">09-20</a></big></b>
420415
566561 <br/>
567562 Fix a case where the test <code><font color="blue">test_more/num_limits.cpp</font></code> failed because
568563 <code><font color='blue'><pre style='display:inline'>
569 double inf = std::numeric_limits&lt;double&gt;::infinity();
570 double check = std::complex&lt;double&gt;(inf) / std::complex&lt;float&gt;(1.)
564 double inf = std::numeric_limits&lt;double&gt;::infinity();
565 double check = std::complex&lt;double&gt;(inf) / std::complex&lt;float&gt;(1.)
571566 </pre></font></code>
572
573567 can result in the imaginary part of <code><font color="blue">check</font></code> being <code><font color="blue">- nan</font></code>.
574568
575569 <br/>
740734 matrix of <code><font color="blue">AD</font></code> elements.
741735 This has been fixed using a template partial specialization of
742736 <code><font color='blue'><pre style='display:inline'>
743 template&lt;typename Scalar, bool IsInteger&gt;
744 struct significant_decimals_default_impl
737 template&lt;typename Scalar, bool IsInteger&gt;
738 struct significant_decimals_default_impl
745739 </pre></font></code>
746
747740 because the original template requires definition of a implicit conversion
748741 from the scalar type to an <code><font color="blue">int</font></code> and this is dangerous for AD types
749742 (note that <a href="integer.xml" target="_top"><span style='white-space: nowrap'>Integer</span></a>
55 <title>CppAD Changes and Additions During 2014</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="CppAD Changes and Additions During 2014"/>
8 <meta name="keywords" id="keywords" content=" cppad changes and additions during 2014 introduction 12-30 12-29 12-28 12-27 12-26 12-25 12-23 12-22 12-17 12-16 12-15 11-28 11-27 09-28 09-27 09-25 09-21 05-28 05-27 05-23 05-22 05-20 05-19 05-16 05-14 03-18 03-17 03-09 03-05 03-02 03-01 02-28 02-27 02-26 02-23 02-22 02-17 02-15 01-26 01-21 01-10 "/>
8 <meta name="keywords" id="keywords" content=" cppad changes additions during 2014 introduction 12-30 12-29 12-28 12-27 12-26 12-25 12-23 12-22 12-17 12-16 12-15 11-28 11-27 09-28 09-27 09-25 09-21 05-28 05-27 05-23 05-22 05-20 05-19 05-16 05-14 03-18 03-17 03-09 03-05 03-02 03-01 02-28 02-27 02-26 02-23 02-22 02-17 02-15 01-26 01-21 01-10 "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
162162 whereby it would sometimes mistakenly
163163 exit with the error message
164164 <code><font color='blue'><pre style='display:inline'>
165 cppad_max_num_threads is not an integer greater than or equal 4
165 cppad_max_num_threads is not an integer greater than or equal 4
166166 </pre></font></code>
167
168167 This has been fixed.
169168
170169 <br/>
466465 results
467466 before this change:
468467 <code><font color='blue'><pre style='display:inline'>
469 cppad_sparse_jacobian_size = [ 100, 400, 900, 1600, 2500 ]
470 cppad_sparse_jacobian_rate = [ 2973, 431.94, 142.25, 78.64, 26.87 ]
468 cppad_sparse_jacobian_size = [ 100, 400, 900, 1600, 2500 ]
469 cppad_sparse_jacobian_rate = [ 2973, 431.94, 142.25, 78.64, 26.87 ]
471470 </pre></font></code>
472
473471 and after this change:
474472 <code><font color='blue'><pre style='display:inline'>
475 cppad_sparse_jacobian_size = [ 100, 400, 900, 1600, 2500 ]
476 cppad_sparse_jacobian_rate = [ 6389, 954.26, 314.04, 180.06, 56.95 ]
473 cppad_sparse_jacobian_size = [ 100, 400, 900, 1600, 2500 ]
474 cppad_sparse_jacobian_rate = [ 6389, 954.26, 314.04, 180.06, 56.95 ]
477475 </pre></font></code>
478
479476 Due to the success of this change,
480477 <code><font color="blue">multiple direction</font></code> items were added to the wish list
481478 (they were later removed).
55 <title>CppAD Changes and Additions During 2015</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="CppAD Changes and Additions During 2015"/>
8 <meta name="keywords" id="keywords" content=" cppad changes and additions during 2015 introduction 12-29 12-28 12-08 12-01 11-30 11-25 11-24 11-14 11-08 11-06 10-21 10-16 10-06 10-04 10-03 10-02 09-28 09-27 09-25 09-24 09-23 09-21 09-20 09-19 09-16 09-03 09-02 08-31 08-30 08-29 08-28 08-26 08-25 08-20 08-17 08-16 08-09 08-06 07-31 06-16 06-11 06-09 06-07 05-26 cond_exp_1 cond_exp_2 05-11 05-10 05-09 05-08 05-07 05-05 04-18 03-13 03-06 02-28 02-18 02-16 02-14 02-11 02-10 02-09 02-07 02-06 02-04 02-03 02-02 01-30 01-29 01-26 01-23 01-21 01-20 01-09 01-07 01-02 "/>
8 <meta name="keywords" id="keywords" content=" cppad changes additions during 2015 introduction 12-29 12-28 12-08 12-01 11-30 11-25 11-24 11-14 11-08 11-06 10-21 10-16 10-06 10-04 10-03 10-02 09-28 09-27 09-25 09-24 09-23 09-21 09-20 09-19 09-16 09-03 09-02 08-31 08-30 08-29 08-28 08-26 08-25 08-20 08-17 08-16 08-09 08-06 07-31 06-16 06-11 06-09 06-07 05-26 cond_exp_1 cond_exp_2 05-11 05-10 05-09 05-08 05-07 05-05 04-18 03-13 03-06 02-28 02-18 02-16 02-14 02-11 02-10 02-09 02-07 02-06 02-04 02-03 02-02 01-30 01-29 01-26 01-23 01-21 01-20 01-09 01-07 01-02 "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
274274 .
275275 For example,
276276 <code><font color='blue'><pre style='display:inline'>
277 # include &lt;cppad/runge_45.hpp&gt;
277 # include &lt;cppad/runge_45.hpp&gt;
278278 </pre></font></code>
279
280279 You should us the utility include instead; i.e.,
281280 <code><font color='blue'><pre style='display:inline'>
282 # include &lt;cppad/utility.hpp&gt;
281 # include &lt;cppad/utility.hpp&gt;
283282 </pre></font></code>
284
285 </li><li>
286
283 </li><li>
287284 The <a href="numeric_ad.xml" target="_top"><span style='white-space: nowrap'>numeric_ad</span></a>
288285 routines where moved from the <code><font color="blue">library</font></code>
289286 the a separate documentation section.
311308 <ol type="1"><li>
312309 CppAD now installs the object library
313310 <code><font color='blue'><pre style='display:inline'>
314 -lcppad_lib
311 -lcppad_lib
315312 </pre></font></code>
316
317313 to be included when linking.
318314 Currently, it is only required when
319315 <a href="colpack_prefix.xml" target="_top"><span style='white-space: nowrap'>colpack_prefix</span></a>
324320
325321 It is no longer necessary to compile and link the file
326322 <code><font color='blue'><pre style='display:inline'>
327 cppad_colpack.cpp
323 cppad_colpack.cpp
328324 </pre></font></code>
329
330325 when <a href="colpack_prefix.xml" target="_top"><span style='white-space: nowrap'>colpack_prefix</span></a>
331326
332327 is specified during the install process; see
12601255 case that is not used.
12611256 For example, if
12621257 <code><font color='blue'><pre style='display:inline'>
1263 <a href="independent.xml" target="_top">Independent</a>(ax);
1264 <a href="ad.xml" target="_top">AD</a>&lt;double&gt; aeps = 1e-10;
1265 ay[0] = CondExpGt( ax[0], aeps, 1.0/ax[0], 1.0/aeps );
1266 <a href="funconstruct.xml" target="_top">ADFun</a>&lt;double&gt; f(ax, ay);
1258 <a href="independent.xml" target="_top">Independent</a>(ax);
1259 <a href="ad.xml" target="_top">AD</a>&lt;double&gt; aeps = 1e-10;
1260 ay[0] = CondExpGt( ax[0], aeps, 1.0/ax[0], 1.0/aeps );
1261 <a href="funconstruct.xml" target="_top">ADFun</a>&lt;double&gt; f(ax, ay);
12671262 </pre></font></code>
1268
12691263 The corresponding reverse mode calculation,
12701264 at <code><font color="blue">x[0] = 0.0</font></code>, would result in
12711265 <code><font color='blue'><pre style='display:inline'>
1272 Error detected by false result for
1273 ! ( hasnan(value) &amp;&amp; check_for_nan_ )
1266 Error detected by false result for
1267 ! ( hasnan(value) &amp;&amp; check_for_nan_ )
12741268 </pre></font></code>
1275
12761269 This has been fixed so that only the conditional expression case that is used
12771270 affects the reverse mode results.
12781271 The example <a href="cond_exp.cpp.xml" target="_top"><span style='white-space: nowrap'>cond_exp.cpp</span></a>
13211314 is not defined, one could get
13221315 an assert with the message:
13231316 <code><font color='blue'><pre style='display:inline'>
1324 Error detected by false result for
1325 var_index_ &gt;= NumRes(op_)
1317 Error detected by false result for
1318 var_index_ &gt;= NumRes(op_)
13261319 </pre></font></code>
1327
1328
1329 <br/>
13301320 <br/>
13311321 <b><big><a name="02-10" id="02-10">02-10</a></big></b>
13321322 <br/>
55 <title>The CppAD Wish List</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="The CppAD Wish List"/>
8 <meta name="keywords" id="keywords" content=" the cppad wish list base requirements printfor optimization checkpoint machine epsilon in examples adolc optimizing nested conditional expressions forward mode recomputation iterator interface compilation speed operation sequence comparison changes and software guidelines tracing atan2 benderquad "/>
8 <meta name="keywords" id="keywords" content=" the cppad wish list base requirements printfor optimization checkpoint machine epsilon examples adolc optimizing nested conditional expressions forward mode recomputation iterator interface compilation speed operation sequence comparison changes software guidelines tracing atan2 benderquad "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
155155 If one <a href="optimize.xml" target="_top"><span style='white-space: nowrap'>optimizes</span></a>
156156 the code
157157 <code><font color='blue'><pre style='display:inline'>
158 x = CondExpLt(left_x, right_x, true_x, false_x)
159 y = CondExpGt(left_y, right_y, true_y, false_y)
160 z = CondExpEq(left_z, right_z, x, y)
158 x = CondExpLt(left_x, right_x, true_x, false_x)
159 y = CondExpGt(left_y, right_y, true_y, false_y)
160 z = CondExpEq(left_z, right_z, x, y)
161161 </pre></font></code>
162
163162 only two of the expressions
164163 <code><font color="blue">true_x</font></code>, <code><font color="blue">false_x</font></code>, <code><font color="blue">true_y</font></code>, <code><font color="blue">false_y</font></code>
165164 will be evaluated
267266 Currently, CppAD uses a tabs stops at column multiples of 5.
268267 Five columns were chosen to avoid high levels of indenting and to allow for
269268 <code><font color='blue'><pre style='display:inline'>
270 if( expression )
271 statement
272 else statement
269 if( expression )
270 statement
271 else statement
273272 </pre></font></code>
274
275273 with a tab after the else.
276274 Automatic conversion to actual spaces should be easy.
277275
286284 Tracing the operation sequence is currently done by changing the CppAD
287285 source code. Use the command
288286 <code><font color='blue'><pre style='display:inline'>
289 grep '^# *define *CPPAD_.*_TRACE' cppad/local/*.hpp
287 grep '^# *define *CPPAD_.*_TRACE' cppad/local/*.hpp
290288 </pre></font></code>
291
292289 to find all the possible tracing flags.
293290
294291
55 <title>zdouble: Example and Test</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="zdouble: Example and Test"/>
8 <meta name="keywords" id="keywords" content=" zdouble: example and test "/>
8 <meta name="keywords" id="keywords" content=" zdouble: example test "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
55 <title>zdouble: An AD Base Type With Absolute Zero</title>
66 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
77 <meta name="description" id="description" content="zdouble: An AD Base Type With Absolute Zero"/>
8 <meta name="keywords" id="keywords" content=" zdouble: an ad base type with absolute zero deprecated 2015-09-26 syntax constructor and assignment comparison operators arithmetic standard math nan motivation general cppad requirements example "/>
8 <meta name="keywords" id="keywords" content=" zdouble: ad base type with absolute zero deprecated 2015-09-26 syntax constructor assignment comparison operators arithmetic standard math nan motivation general cppad requirements example "/>
99 <style type='text/css'>
1010 body { color : black }
1111 body { background-color : white }
116116 </select>
117117 </td>
118118 </tr></table><br/>
119
120
121119 <center><b><big><big>zdouble: An AD Base Type With Absolute Zero</big></big></b></center>
122120 <br/>
123121 <b><big><a name="Deprecated 2015-09-26" id="Deprecated 2015-09-26">Deprecated 2015-09-26</a></big></b>
0 $Id: doc.omh 3772 2015-12-31 14:01:01Z bradbell $
0 $Id: doc.omh 3786 2016-02-08 13:14:26Z bradbell $
11 /* --------------------------------------------------------------------------
22 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33
9090
9191 $comment bin/version assumes that : follows cppad version number here$$
9292 $section
93 cppad-20160000.0: A Package for Differentiation of C++ Algorithms
93 cppad-20160000.1: A Package for Differentiation of C++ Algorithms
9494 $$
9595 $mindex AD algorithmic differentiation automatic C++ algorithm derivative CppAD version cppad.hpp$$
9696
0 # $Id: CMakeLists.txt 3768 2015-12-28 18:58:35Z bradbell $
0 # $Id: CMakeLists.txt 3785 2016-02-08 12:53:06Z bradbell $
11 # -----------------------------------------------------------------------------
22 # CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33 #
214214
215215 # List of libraries to be linked into the specified target
216216 TARGET_LINK_LIBRARIES(example
217 cppad_lib
217 ${cppad_lib}
218218 ${adolc_libs}
219219 ${colpack_libs}
220220 ${eigen_libs}
0 # $Id: CMakeLists.txt 3754 2015-11-26 22:23:05Z bradbell $
0 # $Id: CMakeLists.txt 3785 2016-02-08 12:53:06Z bradbell $
11 # -----------------------------------------------------------------------------
22 # CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33 #
3838 # libraries to be linked into the specified target,
3939 # as determined by pkg-config for ipopt
4040 TARGET_LINK_LIBRARIES(example_ipopt_solve
41 cppad_lib
41 ${cppad_lib}
4242 ${ipopt_LIBRARIES}
4343 ${colpack_libs}
4444 )
0 # $Id: makefile.am 2661 2012-12-28 16:23:17Z bradbell $
0 # $Id: makefile.am 3785 2016-02-08 12:53:06Z bradbell $
11 # -----------------------------------------------------------------------------
2 # CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-12 Bradley M. Bell
2 # CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33 #
44 # CppAD is distributed under multiple licenses. This distribution is under
5 # the terms of the
5 # the terms of the
66 # GNU General Public License Version 3.
77 #
88 # A copy of this license is included in the COPYING file of this distribution.
1515 #
1616 check_PROGRAMS = solve
1717 #
18 AM_CXXFLAGS = -g $(CXX_FLAGS)
18 AM_CXXFLAGS = -g $(CXX_FLAGS)
1919 #
2020 AM_CPPFLAGS = -I. \
2121 -I$(top_srcdir) \
0 /* $Id: exp_2.cpp 2506 2012-10-24 19:36:49Z bradbell $ */
0 // $Id: exp_2.cpp 3785 2016-02-08 12:53:06Z bradbell $
11 /* --------------------------------------------------------------------------
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-12 Bradley M. Bell
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33
44 CppAD is distributed under multiple licenses. This distribution is under
5 the terms of the
5 the terms of the
66 GNU General Public License Version 3.
77
88 A copy of this license is included in the COPYING file of this distribution.
1313 # include "exp_2.hpp" // definition of exp_2 algorithm
1414 bool exp_2(void)
1515 { double x = .5;
16 double check = 1 + x + x * x / 2.;
17 bool ok = std::fabs( exp_2(x) - check ) <= 1e-10;
16 double check = 1 + x + x * x / 2.;
17 bool ok = std::fabs( exp_2(x) - check ) <= 1e-10;
1818 return ok;
1919 }
2020 // END C++
0 /* $Id: exp_2_cppad.cpp 2506 2012-10-24 19:36:49Z bradbell $ */
0 // $Id: exp_2_cppad.cpp 3785 2016-02-08 12:53:06Z bradbell $
11 /* --------------------------------------------------------------------------
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-07 Bradley M. Bell
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33
44 CppAD is distributed under multiple licenses. This distribution is under
5 the terms of the
5 the terms of the
66 GNU General Public License Version 3.
77
88 A copy of this license is included in the COPYING file of this distribution.
3838 Use CppAD forward and reverse modes to compute the
3939 partial derivative with respect to $latex x$$,
4040 at the point $latex x = .5$$,
41 of the function
41 of the function
4242 $codei%
4343 exp_2(%x%)
4444 %$$
4848 $list number$$
4949 Create and test a modified version of the routine below that computes
5050 the same order derivatives with respect to $latex x$$,
51 at the point $latex x = .1$$
52 of the function
51 at the point $latex x = .1$$
52 of the function
5353 $codei%
5454 exp_2(%x%)
5555 %$$
5757 Create a routine called
5858 $codei%
5959 exp_3(%x%)
60 %$$
60 %$$
6161 that evaluates the function
6262 $latex \[
6363 f(x) = 1 + x^2 / 2 + x^3 / 6
6868 $lend
6969 $codep */
7070
71 # include <cppad/cppad.hpp> // http://www.coin-or.org/CppAD/
71 # include <cppad/cppad.hpp> // http://www.coin-or.org/CppAD/
7272 # include "exp_2.hpp" // second order exponential approximation
7373 bool exp_2_cppad(void)
7474 { bool ok = true;
8686
8787 // evaluate our exponential approximation
8888 AD<double> x = X[0];
89 AD<double> apx = exp_2(x);
89 AD<double> apx = exp_2(x);
9090
9191 // range space vector
9292 size_t m = 1; // dimension of the range space
9494 Y[0] = apx; // variable that represents only range space component
9595
9696 // Create f: X -> Y corresponding to this operation sequence
97 // and stop recording. This also executes a zero order forward
97 // and stop recording. This also executes a zero order forward
9898 // sweep using values in X for x.
9999 CppAD::ADFun<double> f(X, Y);
100100
117117
118118 // second order forward sweep that computes
119119 // second partial of exp_2(x) with respect to x
120 vector<double> x2(n); // second order Taylor coefficients
121 vector<double> y2(m);
120 vector<double> x2(n); // second order Taylor coefficients
121 vector<double> y2(m);
122122 x2[0] = 0.; // evaluate second partial .w.r.t. x
123123 y2 = f.Forward(2, x2);
124 check = 0.5 * 1.; // Taylor coef is 1/2 second derivative
124 check = 0.5 * 1.; // Taylor coef is 1/2 second derivative
125125 ok &= NearEqual(y2[0], check, 1e-10, 1e-10);
126126
127127 // second order reverse sweep that computes
0 /* $Id: exp_eps.cpp 2506 2012-10-24 19:36:49Z bradbell $ */
0 // $Id: exp_eps.cpp 3785 2016-02-08 12:53:06Z bradbell $
11 /* --------------------------------------------------------------------------
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-12 Bradley M. Bell
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33
44 CppAD is distributed under multiple licenses. This distribution is under
5 the terms of the
5 the terms of the
66 GNU General Public License Version 3.
77
88 A copy of this license is included in the COPYING file of this distribution.
1515 { double x = .5;
1616 double epsilon = .2;
1717 double check = 1 + .5 + .125; // include 1 term less than epsilon
18 bool ok = std::fabs( exp_eps(x, epsilon) - check ) <= 1e-10;
18 bool ok = std::fabs( exp_eps(x, epsilon) - check ) <= 1e-10;
1919 return ok;
2020 }
2121 // END C++
0 /* $Id: exp_eps_cppad.cpp 2506 2012-10-24 19:36:49Z bradbell $ */
0 // $Id: exp_eps_cppad.cpp 3785 2016-02-08 12:53:06Z bradbell $
11 /* --------------------------------------------------------------------------
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-07 Bradley M. Bell
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33
44 CppAD is distributed under multiple licenses. This distribution is under
5 the terms of the
5 the terms of the
66 GNU General Public License Version 3.
77
88 A copy of this license is included in the COPYING file of this distribution.
3939 Use CppAD forward and reverse modes to compute the
4040 partial derivative with respect to $latex x$$,
4141 at the point $latex x = .5$$ and $latex \varepsilon = .2$$,
42 of the function
42 of the function
4343 $codei%
4444 exp_eps(%x%, %epsilon%)
4545 %$$
5050 Create and test a modified version of the routine below that computes
5151 the same order derivatives with respect to $latex x$$,
5252 at the point $latex x = .1$$ and $latex \varepsilon = .2$$,
53 of the function
53 of the function
5454 $codei%
5555 exp_eps(%x%, %epsilon%)
5656 %$$
5858 Create and test a modified version of the routine below that computes
5959 partial derivative with respect to $latex x$$,
6060 at the point $latex x = .1$$ and $latex \varepsilon = .2$$,
61 of the function corresponding to the operation sequence
61 of the function corresponding to the operation sequence
6262 for $latex x = .5$$ and $latex \varepsilon = .2$$.
6363 Hint: you could define a vector u with two components and use
6464 $codei%
6969 $icode f$$ was recorded.
7070 $lend
7171 $codep */
72 # include <cppad/cppad.hpp> // http://www.coin-or.org/CppAD/
72 # include <cppad/cppad.hpp> // http://www.coin-or.org/CppAD/
7373 # include "exp_eps.hpp" // our example exponential function approximation
7474 bool exp_eps_cppad(void)
7575 { bool ok = true;
8989 // evaluate our exponential approximation
9090 AD<double> x = U[0];
9191 AD<double> epsilon = U[1];
92 AD<double> apx = exp_eps(x, epsilon);
92 AD<double> apx = exp_eps(x, epsilon);
9393
9494 // range space vector
9595 size_t m = 1; // dimension of the range space
9797 Y[0] = apx; // variable that represents only range space component
9898
9999 // Create f: U -> Y corresponding to this operation sequence
100 // and stop recording. This also executes a zero order forward
100 // and stop recording. This also executes a zero order forward
101101 // mode sweep using values in U for x and e.
102102 CppAD::ADFun<double> f(U, Y);
103103
113113 // first order reverse mode sweep that computes the derivative
114114 vector<double> w(m); // weights for components of the range
115115 vector<double> dw(n); // derivative of the weighted function
116 w[0] = 1.; // there is only one weight
116 w[0] = 1.; // there is only one weight
117117 dw = f.Reverse(1, w); // derivative of w[0] * exp_eps(x, epsilon)
118118 check = 1.5; // partial w.r.t. x
119119 ok &= NearEqual(dw[0], check, 1e-10, 1e-10);
0 # $Id: makefile.am 2541 2012-11-06 16:32:36Z bradbell $
0 # $Id: makefile.am 3785 2016-02-08 12:53:06Z bradbell $
11 # -----------------------------------------------------------------------------
2 # CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-12 Bradley M. Bell
2 # CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33 #
44 # CppAD is distributed under multiple licenses. This distribution is under
5 # the terms of the
5 # the terms of the
66 # GNU General Public License Version 3.
77 #
88 # A copy of this license is included in the COPYING file of this distribution.
1818 exp_2.omh \
1919 exp_eps.omh
2020 #
21 check_PROGRAMS = exp_apx
21 check_PROGRAMS = exp_apx
2222 #
2323 AM_CPPFLAGS = -I. -I$(top_srcdir) $(BOOST_INCLUDE) $(EIGEN_INCLUDE)
2424 AM_CXXFLAGS = -g $(CXX_FLAGS)
0 # $Id: makefile.am 2541 2012-11-06 16:32:36Z bradbell $
0 # $Id: makefile.am 3785 2016-02-08 12:53:06Z bradbell $
11 # -----------------------------------------------------------------------------
2 # CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-12 Bradley M. Bell
2 # CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33 #
44 # CppAD is distributed under multiple licenses. This distribution is under
5 # the terms of the
5 # the terms of the
66 # GNU General Public License Version 3.
77 #
88 # A copy of this license is included in the COPYING file of this distribution.
1414 # CppAD pusts all it's preprocessor definitions in the cppad/configure.hpp
1515 DEFS =
1616 #
17 check_PROGRAMS = get_started
17 check_PROGRAMS = get_started
1818 #
1919 AM_CPPFLAGS = -I. -I$(top_srcdir) $(BOOST_INCLUDE) $(EIGEN_INCLUDE)
2020 AM_CXXFLAGS = -g $(CXX_FLAGS)
0 # $Id: makefile.am 2556 2012-11-10 00:53:00Z bradbell $
0 # $Id: makefile.am 3785 2016-02-08 12:53:06Z bradbell $
11 # -----------------------------------------------------------------------------
2 # CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-12 Bradley M. Bell
2 # CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33 #
44 # CppAD is distributed under multiple licenses. This distribution is under
5 # the terms of the
5 # the terms of the
66 # GNU General Public License Version 3.
77 #
88 # A copy of this license is included in the COPYING file of this distribution.
1616 if CppAD_OPENMP
1717 OPENMP_TEST = openmp_test
1818 else
19 OPENMP_TEST =
19 OPENMP_TEST =
2020 endif
2121 #
2222 if CppAD_BTHREAD
2727 endif
2828 else
2929 # BTHREAD_LIB empty in this case
30 BTHREAD_TEST =
31 BOOST_LIB =
30 BTHREAD_TEST =
31 BOOST_LIB =
3232 endif
3333 #
3434 if CppAD_PTHREAD
3535 PTHREAD_TEST = pthread_test
3636 else
37 PTHREAD_TEST =
37 PTHREAD_TEST =
3838 endif
3939 #
40 check_PROGRAMS = $(OPENMP_TEST) $(BTHREAD_TEST) $(PTHREAD_TEST)
40 check_PROGRAMS = $(OPENMP_TEST) $(BTHREAD_TEST) $(PTHREAD_TEST)
4141 #
4242 if CppAD_MS_COMPILER
43 # AM_CXXFLAGS = -EHsc -g $(CXX_FLAGS)
44 AM_CXXFLAGS = -EHsc -DNDEBUG -O2 $(CXX_FLAGS)
43 # AM_CXXFLAGS = -EHsc -g $(CXX_FLAGS)
44 AM_CXXFLAGS = -EHsc -DNDEBUG -O2 $(CXX_FLAGS)
4545 else
4646 # AM_CXXFLAGS = -g $(CXX_FLAGS)
4747 AM_CXXFLAGS = -DNDEBUG -O2 $(CXX_FLAGS)
6767 team_example.cpp team_example.hpp \
6868 harmonic_time.cpp harmonic_time.hpp \
6969 harmonic.cpp harmonic.hpp \
70 harmonic_work.cpp harmonic_work.hpp
70 harmonic_work.cpp harmonic_work.hpp
7171 #
7272 bthread_test_SOURCES = \
7373 $(SHARED_SRC) \
7979 $(SHARED_SRC) \
8080 openmp/team_openmp.cpp \
8181 openmp/a11c_openmp.cpp \
82 openmp/simple_ad_openmp.cpp
82 openmp/simple_ad_openmp.cpp
8383 #
8484 pthread_test_SOURCES = \
8585 $(SHARED_SRC) \
8686 pthread/team_pthread.cpp \
8787 pthread/a11c_pthread.cpp \
88 pthread/simple_ad_pthread.cpp
88 pthread/simple_ad_pthread.cpp
8989 #
9090 dist_noinst_SCRIPTS = test.sh
9191 #
0 # $Id: makefile.am 2506 2012-10-24 19:36:49Z bradbell $
0 # $Id: makefile.am 3785 2016-02-08 12:53:06Z bradbell $
11 # -----------------------------------------------------------------------------
2 # CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-12 Bradley M. Bell
2 # CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33 #
44 # CppAD is distributed under multiple licenses. This distribution is under
5 # the terms of the
5 # the terms of the
66 # GNU General Public License Version 3.
77 #
88 # A copy of this license is included in the COPYING file of this distribution.
1616 if CppAD_OPENMP
1717 TEST_OPENMP_FLAG = -DCPPAD_TEST_OPENMP
1818 else
19 TEST_OPENMP_FLAG =
19 TEST_OPENMP_FLAG =
2020 endif
2121 #
2222 check_PROGRAMS = test_multi
3434 #
3535 test_multi_SOURCES = \
3636 test_multi.cpp \
37 user_atomic.cpp
37 user_atomic.cpp
3838
3939 test: check
4040 ./test_multi
0 /* $Id: user_atomic.cpp 2506 2012-10-24 19:36:49Z bradbell $ */
0 // $Id: user_atomic.cpp 3785 2016-02-08 12:53:06Z bradbell $
11 /* --------------------------------------------------------------------------
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-12 Bradley M. Bell
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33
44 CppAD is distributed under multiple licenses. This distribution is under
5 the terms of the
5 the terms of the
66 GNU General Public License Version 3.
77
88 A copy of this license is included in the COPYING file of this distribution.
2727 size_t thread_number(void)
2828 { return static_cast<size_t>( omp_get_thread_num() ); }
2929 # endif
30
30
3131 // y[0] = x[0] + x[1]
3232 bool user_atomic_forward(
3333 size_t id ,
34 size_t k ,
34 size_t k ,
3535 size_t n ,
3636 size_t m ,
3737 const CppAD::vector<bool>& vx ,
3838 CppAD::vector<bool>& vy ,
39 const CppAD::vector<double>& tx ,
39 const CppAD::vector<double>& tx ,
4040 CppAD::vector<double>& ty )
4141 { assert(n >= 3 && m == 2);
42 if( k > 0 )
42 if( k > 0 )
4343 return false;
4444
4545 ty[0] = tx[0] + tx[1];
4646 ty[1] = tx[1] + tx[2];
47
47
4848 if( vy.size() > 0 )
4949 { vy[0] = (vx[0] | vx[1]);
5050 vy[1] = (vx[1] | vx[2]);
5151 }
52 return true;
52 return true;
5353 }
5454
5555 bool user_atomic_reverse(
5656 size_t id ,
57 size_t k ,
58 size_t n ,
59 size_t m ,
60 const CppAD::vector<double>& tx ,
57 size_t k ,
58 size_t n ,
59 size_t m ,
60 const CppAD::vector<double>& tx ,
6161 const CppAD::vector<double>& ty ,
6262 CppAD::vector<double>& px ,
6363 const CppAD::vector<double>& py )
101101 user_atomic_reverse ,
102102 user_atomic_for_jac_sparse ,
103103 user_atomic_rev_jac_sparse ,
104 user_atomic_rev_hes_sparse
104 user_atomic_rev_hes_sparse
105105 )
106106
107107 bool user_atomic(int call_index)
116116 for(j = 0; j < n; j++)
117117 ax[j] = AD<double>(j + 1);
118118 CppAD::Independent(ax);
119
119
120120 // use user atomic function
121121 size_t id = 0;
122122 my_user_atomic(id, ax, ay);
123
123
124124 // create function
125125 CppAD::ADFun<double> g(ax, ay);
126
126
127127 // now use the tape with the user atomic function
128128 vector<double> x(n), y(m);
129129 for(j = 0; j < n; j++)
133133 ok &= (y[0] == x[0] + x[1]);
134134 // y[1] = x[1] + x[2]
135135 ok &= (y[0] == x[0] + x[1]);
136
136
137137 return ok;
138138 }
139139 }
181181 ok &= ok_all[call_index];
182182
183183 // --------------------------------------------------------------------
184 // Free all temporary work space associated with user_atomic objects.
185 // (If there are future calls to user atomic functions, they will
184 // Free all temporary work space associated with user_atomic objects.
185 // (If there are future calls to user atomic functions, they will
186186 // create new temporary work space.)
187187 CppAD::user_atomic<double>::clear();
188188
0 $Id: bib.omh 2506 2012-10-24 19:36:49Z bradbell $
0 $Id: bib.omh 3785 2016-02-08 12:53:06Z bradbell $
11 // BEGIN SHORT COPYRIGHT
22 /* --------------------------------------------------------------------------
3 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-06 Bradley M. Bell
3 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
44
55 CppAD is distributed under multiple licenses. This distribution is under
6 the terms of the
6 the terms of the
77 GNU General Public License Version 3.
88
99 A copy of this license is included in the COPYING file of this distribution.
4242 $head Evaluating Derivatives$$
4343 Evaluating Derivatives: Principles and Techniques of
4444 Algorithmic Differentiation,
45 Andreas Griewank,
46 SIAM,
45 Andreas Griewank,
46 SIAM,
4747 Philadelphia,
4848 2000
4949
0 /* $Id: forward.omh 3607 2015-01-20 16:20:41Z bradbell $ */
0 // $Id: forward.omh 3785 2016-02-08 12:53:06Z bradbell $
11 /* --------------------------------------------------------------------------
22 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33
44 CppAD is distributed under multiple licenses. This distribution is under
5 the terms of the
5 the terms of the
66 GNU General Public License Version 3.
77
88 A copy of this license is included in the COPYING file of this distribution.
0 /* $Id: size_order.omh 3214 2014-03-18 20:50:38Z bradbell $ */
0 // $Id: size_order.omh 3785 2016-02-08 12:53:06Z bradbell $
11 /* --------------------------------------------------------------------------
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-14 Bradley M. Bell
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33
44 CppAD is distributed under multiple licenses. This distribution is under
5 the terms of the
5 the terms of the
66 GNU General Public License Version 3.
77
88 A copy of this license is included in the COPYING file of this distribution.
2525
2626 $head Purpose$$
2727 Determine the number of Taylor coefficient orders, per variable,direction,
28 currently calculated and stored in the ADFun object $icode f$$.
29 See the discussion under
28 currently calculated and stored in the ADFun object $icode f$$.
29 See the discussion under
3030 $cref/Constructor/size_order/Constructor/$$,
3131 $cref/Forward/size_order/Forward/$$, and
3232 $cref/capacity_order/size_order/capacity_order/$$
4444 $codei%
4545 size_t %s%
4646 %$$
47 and is the number of Taylor coefficient orders,
47 and is the number of Taylor coefficient orders,
4848 per variable,direction in the AD operation sequence,
4949 currently calculated and stored in the ADFun object $icode f$$.
5050
6363 $codei%
6464 %f%.Forward(%q%, %x_q%)
6565 %$$
66 the value of $icode s$$ returned by $code size_order$$
66 the value of $icode s$$ returned by $code size_order$$
6767 would be $latex q + 1$$.
6868 The call to $code Forward$$ above
69 uses the lower order Taylor coefficients to compute and store
69 uses the lower order Taylor coefficients to compute and store
7070 the $th q$$ order Taylor coefficients for all
7171 the variables in the operation sequence corresponding to $icode f$$.
7272 Thus there are $latex q + 1$$ (order zero through $icode q$$)
7676
7777 $head capacity_order$$
7878 If the number of Taylor coefficient orders
79 currently stored in $icode f$$ is less than or equal $icode c$$,
79 currently stored in $icode f$$ is less than or equal $icode c$$,
8080 a call to $cref capacity_order$$ with the syntax
8181 $codei%
8282 %f%.capacity_order(%c%)
8585 Otherwise,
8686 the value $icode s$$ returned by $code size_order$$
8787 is equal to $icode c$$
88 (only Taylor coefficients of order zero through $latex c-1$$
88 (only Taylor coefficients of order zero through $latex c-1$$
8989 have been retained).
9090
9191 $head Example$$
0 $Id: download.omh 3772 2015-12-31 14:01:01Z bradbell $
0 $Id: download.omh 3786 2016-02-08 13:14:26Z bradbell $
11 /* --------------------------------------------------------------------------
22 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33
6464 $bold version$$ $pre $$ $cnext $bold license$$ $pre $$ $cnext $bold link$$
6565 $rnext
6666 current $cnext EPL $cnext $href%
67 http://www.coin-or.org/download/source/CppAD/cppad-20160000.0.epl.tgz%
68 cppad-20160000.0.epl.tgz%$$
67 http://www.coin-or.org/download/source/CppAD/cppad-20160000.1.epl.tgz%
68 cppad-20160000.1.epl.tgz%$$
6969 $rnext
7070 current $cnext GPL $cnext $href%
71 http://www.coin-or.org/download/source/CppAD/cppad-20160000.0.gpl.tgz%
72 cppad-20160000.0.gpl.tgz%$$
71 http://www.coin-or.org/download/source/CppAD/cppad-20160000.1.gpl.tgz%
72 cppad-20160000.1.gpl.tgz%$$
7373 $rnext
7474 old $cnext Both $cnext
7575 $href%http://www.coin-or.org/download/source/CppAD/%CppAD download page%$$
0 $Id: license.omh 2506 2012-10-24 19:36:49Z bradbell $
0 $Id: license.omh 3785 2016-02-08 12:53:06Z bradbell $
11 /* --------------------------------------------------------------------------
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-06 Bradley M. Bell
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33
44 CppAD is distributed under multiple licenses. This distribution is under
5 the terms of the
5 the terms of the
66 GNU General Public License Version 3.
77
88 A copy of this license is included in the COPYING file of this distribution.
0 $Id: new_feature.omh 2506 2012-10-24 19:36:49Z bradbell $
0 $Id: new_feature.omh 3785 2016-02-08 12:53:06Z bradbell $
11 // BEGIN SHORT COPYRIGHT
22 /* --------------------------------------------------------------------------
3 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-06 Bradley M. Bell
3 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
44
55 CppAD is distributed under multiple licenses. This distribution is under
6 the terms of the
6 the terms of the
77 GNU General Public License Version 3.
88
99 A copy of this license is included in the COPYING file of this distribution.
2626 $section Adding a New Feature to the CppAD Distribution$$
2727
2828 $head Overview$$
29 Suppose that you add a new feature to CppAD and the
29 Suppose that you add a new feature to CppAD and the
3030 corresponding include file is $icode%Name%.h%$$.
31 You should check each of the following steps:
31 You should check each of the following steps:
3232
3333 $list number$$
3434 Add the new file $icode%Name%.h%$$ to the cvs repository.
3535
3636 $lnext
37 Add a test file called $codei%example/%Name%.cpp%$$ that check
37 Add a test file called $codei%example/%Name%.cpp%$$ that check
3838 for correct results (and run the test to make sure it works).
3939
4040 $lnext
4444 Add a call to the new test in the file $code example/example.cpp$$.
4545
4646 $lnext
47 Add the file $icode%Name%.cpp%$$ to the list of
47 Add the file $icode%Name%.cpp%$$ to the list of
4848 $code Example_SOURCES$$ in the file $code example/Makefile.am$$.
4949
5050 $lnext
5252 corresponding to the Microsoft C++ project file $code example/Example.dsp$$.
5353
5454 $lnext
55 Add the file $icode%Name%.h%$$ to the list of
55 Add the file $icode%Name%.h%$$ to the list of
5656 $code nobase_include_HEADERS$$ in the file $code Makefile.am$$.
5757
5858 $lnext
0 /* $Id: reverse.omh 3301 2014-05-24 05:20:21Z bradbell $ */
0 // $Id: reverse.omh 3785 2016-02-08 12:53:06Z bradbell $
11 /* --------------------------------------------------------------------------
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-14 Bradley M. Bell
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33
44 CppAD is distributed under multiple licenses. This distribution is under
5 the terms of the
5 the terms of the
66 GNU General Public License Version 3.
77
88 A copy of this license is included in the COPYING file of this distribution.
0 $Id: reverse_identity.omh 3169 2014-03-09 13:37:59Z bradbell $
0 $Id: reverse_identity.omh 3785 2016-02-08 12:53:06Z bradbell $
11 /* --------------------------------------------------------------------------
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-14 Bradley M. Bell
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33
44 CppAD is distributed under multiple licenses. This distribution is under
5 the terms of the
5 the terms of the
66 GNU General Public License Version 3.
77
88 A copy of this license is included in the COPYING file of this distribution.
5050 where $latex x^{(j)}$$ is the $th j$$ column of $latex x \in B^{n \times p}$$.
5151 The theorem below implies that
5252 $latex \[
53 \D{ W_j }{ x^{(i)} } (x) = \D{ W_{j-i} }{ x^{(0)} } (x)
53 \D{ W_j }{ x^{(i)} } (x) = \D{ W_{j-i} }{ x^{(0)} } (x)
5454 \] $$
5555 A $cref/general reverse sweep/reverse_any/$$ calculates the values
5656 $latex \[
6565 $head Theorem$$
6666 Suppose that $latex F : B^n \rightarrow B^m$$ is a $latex p$$ times
6767 continuously differentiable function.
68 Define the functions
68 Define the functions
6969 $latex Z : B \times B^{n \times p} \rightarrow B^n$$,
7070 $latex Y : B \times B^{n \times p }\rightarrow B^m$$,
7171 and
7676 \\
7777 Y(t, x) & = & F [ Z(t, x) ]
7878 \\
79 y^{(j)} (x) & = & \frac{1}{j !} \Dpow{j}{t} Y(0, x)
79 y^{(j)} (x) & = & \frac{1}{j !} \Dpow{j}{t} Y(0, x)
8080 \end{array}
8181 \] $$
82 where $latex x^{(j)}$$ denotes the $th j$$ column of
82 where $latex x^{(j)}$$ denotes the $th j$$ column of
8383 $latex x \in B^{n \times p}$$.
8484 It follows that
8585 for all $latex i, j$$ such that $latex i \leq j < p$$,
9595 $latex \[
9696 \begin{array}{rclr}
9797 \D{ y^{(j)} }{ x^{(i)} } (x)
98 & = &
99 \frac{1}{j ! } \D{ }{ x^{(i)} }
98 & = &
99 \frac{1}{j ! } \D{ }{ x^{(i)} }
100100 \left[ \Dpow{j}{t} (F \circ Z) (t, x) \right]_{t=0}
101101 \\
102102 & = &
103 \frac{1}{j ! } \left[ \Dpow{j}{t}
104 \D{ }{ x^{(i)} } (F \circ Z) (t, x)
103 \frac{1}{j ! } \left[ \Dpow{j}{t}
104 \D{ }{ x^{(i)} } (F \circ Z) (t, x)
105105 \right]_{t=0}
106106 \\
107107 & = &
108 \frac{1}{j ! } \left\{
109 \Dpow{j}{t} \left[ t^i ( F^{(1)} \circ Z ) (t, x) \right]
108 \frac{1}{j ! } \left\{
109 \Dpow{j}{t} \left[ t^i ( F^{(1)} \circ Z ) (t, x) \right]
110110 \right\}_{t=0}
111111 \end{array}
112112 \] $$
113 For $latex k > i$$, the $th k$$
113 For $latex k > i$$, the $th k$$
114114 partial of $latex t^i$$ with respect to $latex t$$ is zero.
115115 Thus, the partial with respect to $latex t$$ is given by
116116 $latex \[
117117 \begin{array}{rcl}
118 \Dpow{j}{t} \left[ t^i ( F^{(1)} \circ Z ) (t, x) \right]
118 \Dpow{j}{t} \left[ t^i ( F^{(1)} \circ Z ) (t, x) \right]
119119 & = &
120 \sum_{k=0}^i
120 \sum_{k=0}^i
121121 \left( \begin{array}{c} j \\ k \end{array} \right)
122 \frac{ i ! }{ (i - k) ! } t^{i-k} \;
122 \frac{ i ! }{ (i - k) ! } t^{i-k} \;
123123 \Dpow{j-k}{t} ( F^{(1)} \circ Z ) (t, x)
124124 \\
125 \left\{
126 \Dpow{j}{t} \left[ t^i ( F^{(1)} \circ Z ) (t, x) \right]
125 \left\{
126 \Dpow{j}{t} \left[ t^i ( F^{(1)} \circ Z ) (t, x) \right]
127127 \right\}_{t=0}
128128 & = &
129129 \left( \begin{array}{c} j \\ i \end{array} \right)
134134 \Dpow{j-i}{t} ( F^{(1)} \circ Z ) (t, x)
135135 \\
136136 \D{ y^{(j)} }{ x^{(i)} } (x)
137 & = &
137 & = &
138138 \frac{ 1 }{ (j - i) ! }
139139 \Dpow{j-i}{t} ( F^{(1)} \circ Z ) (t, x)
140140 \end{array}
0 $Id: reverse_theory.omh 3495 2014-12-24 01:16:15Z bradbell $
0 $Id: reverse_theory.omh 3785 2016-02-08 12:53:06Z bradbell $
11 /* --------------------------------------------------------------------------
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-14 Bradley M. Bell
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33
44 CppAD is distributed under multiple licenses. This distribution is under
5 the terms of the
5 the terms of the
66 GNU General Public License Version 3.
77
88 A copy of this license is included in the COPYING file of this distribution.
1818 $section The Theory of Reverse Mode$$
1919
2020 $head Taylor Notation$$
21 In Taylor notation, each variable corresponds to
21 In Taylor notation, each variable corresponds to
2222 a function of a single argument which we denote by $icode t$$
2323 (see Section 10.2 of
2424 $cref/Evaluating Derivatives/Bib/Evaluating Derivatives/$$).
2525 Here and below
26 $latex X(t)$$, $latex Y(t)$$, and $icode Z(t)$$ are scalar valued functions
26 $latex X(t)$$, $latex Y(t)$$, and $icode Z(t)$$ are scalar valued functions
2727 and the corresponding $th p$$ order Taylor coefficients row vectors are
2828 $latex x$$, $latex y$$ and $latex z$$; i.e.,
2929 $latex \[
3030 \begin{array}{lcr}
3131 X(t) & = & x^{(0)} + x^{(1)} * t + \cdots + x^{(p)} * t^p + O( t^{p+1} ) \\
3232 Y(t) & = & y^{(0)} + y^{(1)} * t + \cdots + y^{(p)} * t^p + O( t^{p+1} ) \\
33 Z(t) & = & z^{(0)} + z^{(1)} * t + \cdots + z^{(p)} * t^p + O( t^{p+1} )
33 Z(t) & = & z^{(0)} + z^{(1)} * t + \cdots + z^{(p)} * t^p + O( t^{p+1} )
3434 \end{array}
3535 \] $$
3636 For the purposes of this discussion,
3737 we are given the $th p$$ order Taylor coefficient row vectors
3838 $latex x$$, $latex y$$, and $latex z$$.
39 In addition, we are given the partial derivatives of a scalar valued function
39 In addition, we are given the partial derivatives of a scalar valued function
4040 $latex \[
4141 G ( z^{(j)} , \ldots , z^{(0)}, x, y)
4242 \] $$
4343 We need to compute the partial derivatives of the scalar valued function
4444 $latex \[
45 H ( z^{(j-1)} , \ldots , z^{(0)}, x, y) =
45 H ( z^{(j-1)} , \ldots , z^{(0)}, x, y) =
4646 G ( z^{(j)}, z^{(j-1)} , \ldots , z^{(0)}, x , y )
4747 \] $$
48 where $latex z^{(j)}$$ is expressed as a function of the
48 where $latex z^{(j)}$$ is expressed as a function of the
4949 $th j-1$$ order Taylor coefficient row
5050 vector for $latex Z$$ and the vectors $latex x$$, $latex y$$; i.e.,
5151 $latex z^{(j)}$$ above is a shorthand for
7272 \D{G}{ x^{(k)} } + \D{G}{ z^{(k)} } \\
7373 \\
7474 \D{H}{ y^{(k)} } & = &
75 \D{G}{ y^{(k)} } + \D{G}{ z^{(k)} }
75 \D{G}{ y^{(k)} } + \D{G}{ z^{(k)} }
7676 \\
77 \D{H}{ z^{(l)} } & = & \D{G}{ z^{(l)} }
78 \end{array}
77 \D{H}{ z^{(l)} } & = & \D{G}{ z^{(l)} }
78 \end{array}
7979 \] $$
8080
8181 $subhead Subtraction$$
9191 \D{G}{ x^{(k)} } - \D{G}{ z^{(k)} } \\
9292 \\
9393 \D{H}{ y^{(k)} } & = &
94 \D{G}{ y^{(k)} } - \D{G}{ z^{(k)} }
95 \end{array}
94 \D{G}{ y^{(k)} } - \D{G}{ z^{(k)} }
95 \end{array}
9696 \] $$
9797
9898 $subhead Multiplication$$
107107 \begin{array}{rcl}
108108 \D{H}{ x^{(j-k)} } & = &
109109 \D{G}{ x^{(j-k)} } +
110 \sum_{k=0}^j \D{G}{ z^{(j)} } y^{(k)}
110 \sum_{k=0}^j \D{G}{ z^{(j)} } y^{(k)}
111111 \\
112112 \D{H}{ y^{(k)} } & = &
113113 \D{G}{ y^{(k)} } +
114 \sum_{k=0}^j \D{G}{ z^{(j)} } x^{(j-k)}
115 \end{array}
114 \sum_{k=0}^j \D{G}{ z^{(j)} } x^{(j-k)}
115 \end{array}
116116 \] $$
117117
118118 $subhead Division$$
119119 The forward mode formula for
120120 $cref/division/ForwardTheory/Binary Operators/Division/$$ is
121121 $latex \[
122 z^{(j)} =
123 \frac{1}{y^{(0)}}
124 \left(
125 x^{(j)} - \sum_{k=1}^j z^{(j-k)} y^{(k)}
122 z^{(j)} =
123 \frac{1}{y^{(0)}}
124 \left(
125 x^{(j)} - \sum_{k=1}^j z^{(j-k)} y^{(k)}
126126 \right)
127127 \] $$
128128 If follows that for $latex k = 1 , \ldots , j$$
129129 $latex \[
130130 \begin{array}{rcl}
131131 \D{H}{ x^{(j)} } & = &
132 \D{G}{ x^{(j)} } + \D{G}{ z^{(j)} } \frac{1}{y^{(0)}}
132 \D{G}{ x^{(j)} } + \D{G}{ z^{(j)} } \frac{1}{y^{(0)}}
133133 \\
134134 \D{H}{ z^{(j-k)} } & = &
135135 \D{G}{ z^{(j-k)} } - \D{G}{ z^{(j)} } \frac{1}{y^{(0)}} y^{(k)}
138138 \D{G}{ y^{(k)} } - \D{G}{ z^{(j)} } \frac{1}{y^{(0)}} z^{(j-k)}
139139 \\
140140 \D{H}{ y^{(0)} } & = &
141 \D{G}{ y^{(0)} } - \D{G}{ z^{(j)} } \frac{1}{y^{(0)}} \frac{1}{y^{(0)}}
142 \left(
143 x^{(j)} - \sum_{k=1}^j z^{(j-k)} y^{(k)}
141 \D{G}{ y^{(0)} } - \D{G}{ z^{(j)} } \frac{1}{y^{(0)}} \frac{1}{y^{(0)}}
142 \left(
143 x^{(j)} - \sum_{k=1}^j z^{(j-k)} y^{(k)}
144144 \right)
145145 \\
146146 & = &
150150
151151 $head Standard Math Functions$$
152152 The standard math functions have only one argument.
153 Hence we are given the partial derivatives of a scalar valued function
153 Hence we are given the partial derivatives of a scalar valued function
154154 $latex \[
155155 G ( z^{(j)} , \ldots , z^{(0)}, x)
156156 \] $$
157157 We need to compute the partial derivatives of the scalar valued function
158158 $latex \[
159 H ( z^{(j-1)} , \ldots , z^{(0)}, x) =
159 H ( z^{(j-1)} , \ldots , z^{(0)}, x) =
160160 G ( z^{(j)}, z^{(j-1)} , \ldots , z^{(0)}, x)
161161 \] $$
162 where $latex z^{(j)}$$ is expressed as a function of the
162 where $latex z^{(j)}$$ is expressed as a function of the
163163 $th j-1$$ order Taylor coefficient row
164164 vector for $latex Z$$ and the vector $latex x$$; i.e.,
165165 $latex z^{(j)}$$ above is a shorthand for
0 $Id: theory.omh 3169 2014-03-09 13:37:59Z bradbell $
0 $Id: theory.omh 3785 2016-02-08 12:53:06Z bradbell $
11 /* --------------------------------------------------------------------------
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-14 Bradley M. Bell
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33
44 CppAD is distributed under multiple licenses. This distribution is under
5 the terms of the
5 the terms of the
66 GNU General Public License Version 3.
77
88 A copy of this license is included in the COPYING file of this distribution.
0 $Id: whats_new.omh 3552 2015-01-03 12:41:46Z bradbell $
0 $Id: whats_new.omh 3785 2016-02-08 12:53:06Z bradbell $
11 /* --------------------------------------------------------------------------
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-14 Bradley M. Bell
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33
44 CppAD is distributed under multiple licenses. This distribution is under
5 the terms of the
5 the terms of the
66 GNU General Public License Version 3.
77
88 A copy of this license is included in the COPYING file of this distribution.
1717 $section Changes and Additions to CppAD$$
1818
1919 $head Introduction$$
20 The sections listed below contain a list of the changes to CppAD
20 The sections listed below contain a list of the changes to CppAD
2121 in reverse order by date.
2222 The purpose of these sections is to
2323 assist you in learning about changes between various versions of CppAD.
0 $Id: whats_new_09.omh 3627 2015-01-30 15:49:51Z bradbell $
0 $Id: whats_new_09.omh 3785 2016-02-08 12:53:06Z bradbell $
11 /* --------------------------------------------------------------------------
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-14 Bradley M. Bell
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33
44 CppAD is distributed under multiple licenses. This distribution is under
5 the terms of the
5 the terms of the
66 GNU General Public License Version 3.
77
88 A copy of this license is included in the COPYING file of this distribution.
6161 trying to read and understand the CppAD source code.)
6262
6363 $head 12-23$$
64 The
64 The
6565 $code ADFun$$ $cref/assignment operator/FunConstruct/Assignment Operator/$$
6666 was changed so that it now copies forward mode
6767 Taylor coefficients and sparsity pattern information.
7575 $cref/size_forward_set/ForSparseJac/f/size_forward_set/$$.
7676
7777 $head 12-22$$
78 Convert the optimization of a sequence of additions from multiple operators
79 to one operator with a varying number of arguments. This improved the speed
78 Convert the optimization of a sequence of additions from multiple operators
79 to one operator with a varying number of arguments. This improved the speed
8080 for forward and reverse mode computations of an optimized tape.
8181
8282 $head 12-18$$
9898
9999 $head 12-02$$
100100 Fix minor grammatical error in the Purpose heading
101 for $cref/conditional expressions/CondExp/Purpose/$$.
102 $pre
103
104 $$
105 Add the following functions:
101 for $cref/conditional expressions/CondExp/Purpose/$$.
102 $pre
103
104 $$
105 Add the following functions:
106106 $cref/size_op/seq_property/size_op/$$,
107107 $cref/size_op_arg/seq_property/size_op_arg/$$,
108108 and
109109 $cref/size_op_seq/seq_property/size_op_seq/$$.
110 In addition, improve and extend the
111 $cref seq_property.cpp$$ example.
110 In addition, improve and extend the
111 $cref seq_property.cpp$$ example.
112112
113113 $head 11-28$$
114114 Fix bug in tape optimization with $cref VecAD$$ objects.
128128 Add the speed testing problem $code ipopt_cppad/ipopt_ode_speed.cpp$$.
129129
130130 $head 10-29$$
131 Split out the
131 Split out the
132132 $cref/ode inverse problem/ipopt_nlp_ode_problem/$$,
133133 $cref/its simple representation/ipopt_nlp_ode_simple/$$,
134134 and
137137 $cref ipopt_nlp_ode_problem.hpp$$,
138138 $cref ipopt_nlp_ode_simple.hpp$$,
139139 $cref ipopt_nlp_ode_fast.hpp$$,
140 and
140 and
141141 $cref ipopt_nlp_ode_check.cpp$$.
142142
143143 $head 10-28$$
144 Improve the documentation for $cref ipopt_nlp_ode_simple$$ and
144 Improve the documentation for $cref ipopt_nlp_ode_simple$$ and
145145 $cref ipopt_nlp_ode_fast$$.
146146
147147 $head 10-27$$
148148 Moved old $code ipopt_cppad_simple.cpp$$ to $cref ipopt_nlp_get_started.cpp$$,
149149 created the example $cref ipopt_nlp_ode_simple.hpp$$,
150 and split and $code ipopt_cppad_ode.cpp$$
150 and split and $code ipopt_cppad_ode.cpp$$
151151 into $cref ipopt_nlp_ode_fast.hpp$$ and $cref ipopt_nlp_ode_check.cpp$$.
152152
153153 $head 10-24$$
154154 Added the $cref/assignment operator/FunConstruct/Assignment Operator/$$
155155 to the $code ADFun$$ object class.
156 This makes a copy of the entire operation sequence in another
156 This makes a copy of the entire operation sequence in another
157157 function object.
158158 The intention is that the two functions objects can do calculations in
159159 parallel.
160160 In addition,
161 CppAD now check for the $code ADFun$$
161 CppAD now check for the $code ADFun$$
162162 $cref/copy constructor/FunConstruct/Copy Constructor/$$
163163 and generates an error message if it is used.
164164
191191 (see $cref/sparsity patterns/glossary/Sparsity Pattern/$$).
192192
193193 $head 10-03$$
194 The Microsoft Visual Studio project files for
194 The Microsoft Visual Studio project files for
195195 examples and testing
196196 and for
197197 more correctness testing
211211
212212 $head 09-28$$
213213 Changed $cref RevSparseHes$$ so that it uses a sparse
214 representation when the corresponding call to
214 representation when the corresponding call to
215215 $cref ForSparseJac$$ used a sparse representation.
216 This should have been included with the change on 09-26
216 This should have been included with the change on 09-26
217217 because Hessian sparsity patters after $code ForSparseJac$$
218218 with $icode packed$$ did not work.
219219 Thus, this could be considered a bug fix.
222222 Added the $code packed$$ parameter to
223223 $cref ForSparseJac$$ and $cref RevSparseJac$$.
224224 If $icode packed$$ is false,
225 a sparse instead of packed representation is used
225 a sparse instead of packed representation is used
226226 during the calculations of sparsity patterns.
227227 The sparse representation
228228 should be faster, and use less memory, for very large sparse Jacobians.
236236 that included use of $cref VecAD$$ objects.
237237
238238 $head 09-19$$
239 Some more memory allocation improvements (related to those
240 on 09-18) were made.
239 Some more memory allocation improvements (related to those
240 on 09-18) were made.
241241
242242 $head 09-18$$
243243 A bug was found in all the $cref/Sparsity/Sparse/$$ calculations.
257257 Add an option to $cref optimize$$ an operation sequence.
258258 $pre
259259
260 $$
261 $bold Begin Merge$$
262 $pre
263 $$
264 of changes from the directory $code branches/optimize$$
260 $$
261 $bold Begin Merge$$
262 $pre
263 $$
264 of changes from the directory $code branches/optimize$$
265265 in the CppAD subversion repository.
266 The subheading dates below represent when the correspond change was made in
266 The subheading dates below represent when the correspond change was made in
267267 $code branches/optimize$$.
268268
269269 $subhead 08-13$$
270270 An automatic check of the $cref forward_zero$$ results was added
271271 after each call to $cref/f.optimize()/optimize/$$
272 (this $cref/check/optimize/Checking Optimization/$$
272 (this $cref/check/optimize/Checking Optimization/$$
273273 is skipped when $code NDEBUG$$ is defined).
274274 In addition, all of the $codei%speed/cppad/%*%.cpp%$$ tests
275275 now check and use the speed test
291291 $pre
292292
293293 $$
294 The function
294 The function
295295 $cref/size_VecAD/seq_property/size_VecAD/$$ function was added
296 so that the user could see the $code VecAD$$ vectors
296 so that the user could see the $code VecAD$$ vectors
297297 and elements corresponding to an operation sequence.
298298
299299 $subhead 08-09$$
309309 $head 08-06$$
310310 Add hash table coding to reduce the number of copies of the same
311311 parameter value necessary in a tape recording.
312 In addition, add the function
312 In addition, add the function
313313 $cref/size_par/seq_property/size_par/$$ was added
314314 so that the user could see the number of parameters
315315 corresponding to an operation sequence.
320320 $pre
321321
322322 $$
323 Fix bug in overnight build where HTML version and entire documentation
323 Fix bug in overnight build where HTML version and entire documentation
324324 as one page versions of documentation were not being built.
325325 $pre
326326
327327 $$
328 Fix missing new line under
328 Fix missing new line under
329329 $cref/Using Value/SimpleVector/Element Access/Using Value/$$
330330 heading for simple vector documentation.
331331
332332 $head 08-01$$
333333 Fix bug in reverse mode Jacobian $cref/sparsity/RevSparseJac/$$
334 for $cref VecAD$$ objects.
334 for $cref VecAD$$ objects.
335335
336336 $head 07-31$$
337337 The $cref/forward/ForSparseJac/$$ and $cref/reverse/RevSparseJac/$$
355355 $pre
356356
357357 $$
358 Improve the $cref vec_ad.cpp$$ user example.
358 Improve the $cref vec_ad.cpp$$ user example.
359359
360360 $subhead 07-06$$
361361 Fixed a bug in second or higher order reverse mode calculations
366366
367367 $$
368368 Add developer documentation for tape evaluation of the
369 VecAD load operations
369 VecAD load operations
370370 (a load operation accesses an element of the vector but
371371 does not change it.)
372372 $pre
373373
374374 $$
375 Fix $code isnan$$ undefined in $code example/cond_exp.cpp$$ error
375 Fix $code isnan$$ undefined in $code example/cond_exp.cpp$$ error
376376 introduced on 07-04 change.
377377
378378 $head 07-04$$
380380 $cref CompareChange$$ operations during tape evaluation.
381381 $pre
382382
383 $$
384 $bold Begin Merge$$
385 $pre
386 $$
387 of changes from the directory $code branches/sweep$$
383 $$
384 $bold Begin Merge$$
385 $pre
386 $$
387 of changes from the directory $code branches/sweep$$
388388 in the CppAD subversion repository.
389 The subheading dates below represent when the correspond change was made in
389 The subheading dates below represent when the correspond change was made in
390390 $code branches/sweep$$.
391391
392392 $subhead 07-04$$
398398
399399 $$
400400 A simpler and useful example was provided for
401 $cref/conditional expressions/CondExp/$$;
401 $cref/conditional expressions/CondExp/$$;
402402 see $cref cond_exp.cpp$$.
403403
404404
405405 $subhead 07-03$$
406 Some minor improvements were made to the documentation for
406 Some minor improvements were made to the documentation for
407407 $cref CondExp$$.
408408 To be specific, a newer OMhelp option was used to change the formatting
409409 of the syntax, some of the argument names were changed to be more descriptive.
410410
411411 $subhead 07-02$$
412 Add developer doxygen documentation of
412 Add developer doxygen documentation of
413413 tape evaluation for power (exponentiation) operators.
414414
415415 $subhead 07-01$$
416 Fix an example indexing error in
416 Fix an example indexing error in
417417 $code introduction/exp_apx/exp_eps_for2.cpp$$ (found by valgrind).
418418 $pre
419419
420420 $$
421 Add developer doxygen documentation of
421 Add developer doxygen documentation of
422422 tape evaluation for multiplication and division operators.
423423
424424 $subhead 06-30$$
425 Add developer doxygen documentation of
425 Add developer doxygen documentation of
426426 tape evaluation for addition and subtraction operators.
427427
428428 $subhead 06-29$$
429 Add developer doxygen documentation of
429 Add developer doxygen documentation of
430430 tape evaluation for sin, sinh, cos, and cosh.
431431
432432 $subhead 06-28$$
433 Add developer doxygen documentation of
433 Add developer doxygen documentation of
434434 tape evaluation for atan, asin, acos, sqrt, log.
435435 $pre
436436 $$
437437 $bold End Merge$$
438438
439439 $head 06-25$$
440 The tarball for most recent release (of the subversion trunk for CppAD)
441 was not being placed in the
442 $href%http://www.coin-or.org/download/source/CppAD/%download%$$
443 directory.
440 The tarball for most recent release (of the subversion trunk for CppAD)
441 was not being placed in the
442 $href%http://www.coin-or.org/download/source/CppAD/%download%$$
443 directory.
444444 This has been fixed.
445445
446446 $head 06-22$$
465465
466466 $$
467467 Fix conflict between CppAD's use of config.h preprocessor symbols
468 and other packages use of the same symbol names.
468 and other packages use of the same symbol names.
469469
470470 $head 06-06$$
471471 $list number$$
472472 Using complex of an AD type (instead of AD of complex) was not working
473 correctly in $code not_complex_ad.cpp$$ because the
473 correctly in $code not_complex_ad.cpp$$ because the
474474 $cref/default constructor/ad_ctor/$$ for an AD object has an unspecified value.
475475 This has been fixed for the complex type by changing the default constructor
476 to use value zero.
477 (The $code not_complex_ad.cpp$$ example has been removed;
476 to use value zero.
477 (The $code not_complex_ad.cpp$$ example has been removed;
478478 see $cref/complex FAQ/Faq/Complex Types/$$.)
479479 $lnext
480480 Fixing the $code not_complex_ad.cpp$$ problem above also fixed a warning
482482 Now $code valgrind$$ runs the CppAD $code example/example$$ program
483483 with out any warning or error messages.
484484 In addition, a minor initialization error was fixed in the
485 $code test_more/jacobian.cpp$$ routine so now
485 $code test_more/jacobian.cpp$$ routine so now
486486 $code valgrind$$ also runs the CppAD $code test_more/test_more$$ program
487487 with out any warnings or error messages.
488488 $lend
493493 This was has been fixed (revision 1362).
494494
495495 $head 03-24$$
496 Added cross references in
496 Added cross references in
497497 the $cref/examples/ListAllExamples/$$ to occurrence of the following tokens:
498498 $cref AD$$,
499499 $cref/ADFun/FunConstruct/$$,
528528
529529 $head 01-18$$
530530 Sometimes an error occurs while taping AD operations.
531 The $cref abort_recording$$ function has been added
531 The $cref abort_recording$$ function has been added
532532 to make it easier to recover in such cases.
533533 $pre
534534
542542 $pre
543543
544544 $$
545 A discussion has been added to the documentation for $cref Jacobian$$
545 A discussion has been added to the documentation for $cref Jacobian$$
546546 about its use of
547547 $cref/forward or reverse/Jacobian/Forward or Reverse/$$
548548 mode depending on which it estimates is more efficient.
551551 $$
552552 A minor typo has been fixed in the description of
553553 $code W(t, u)$$ in $cref reverse_any$$.
554 To be specific,
554 To be specific,
555555 $latex o ( t^{p-1} ) * t^{1-p} \rightarrow 0$$
556556 has been replaced by
557557 $latex o ( t^{p-1} ) / t^{1-p} \rightarrow 0$$.
0 # $Id: makefile.am 2541 2012-11-06 16:32:36Z bradbell $
0 # $Id: makefile.am 3785 2016-02-08 12:53:06Z bradbell $
11 # -----------------------------------------------------------------------------
2 # CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-12 Bradley M. Bell
2 # CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33 #
44 # CppAD is distributed under multiple licenses. This distribution is under
5 # the terms of the
5 # the terms of the
66 # GNU General Public License Version 3.
77 #
88 # A copy of this license is included in the COPYING file of this distribution.
2424 endif
2525 #
2626 # Microsoft project files
27 EXTRA_DIST = test.sh
27 EXTRA_DIST = test.sh
2828 #
2929 check_PROGRAMS = print_for
3030 #
0 # $Id: CMakeLists.txt 3754 2015-11-26 22:23:05Z bradbell $
0 # $Id: CMakeLists.txt 3785 2016-02-08 12:53:06Z bradbell $
11 # -----------------------------------------------------------------------------
22 # CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33 #
4747 # List of libraries to be linked into the specified target
4848 TARGET_LINK_LIBRARIES(speed_adolc
4949 speed_src
50 cppad_lib
50 ${cppad_lib}
5151 adolc
5252 ${colpack_libs}
5353 )
0 # $Id: makefile.am 3481 2014-12-17 23:39:47Z bradbell $
0 # $Id: makefile.am 3785 2016-02-08 12:53:06Z bradbell $
11 # -----------------------------------------------------------------------------
2 # CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-14 Bradley M. Bell
2 # CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33 #
44 # CppAD is distributed under multiple licenses. This distribution is under
5 # the terms of the
5 # the terms of the
66 # GNU General Public License Version 3.
77 #
88 # A copy of this license is included in the COPYING file of this distribution.
1818 # CppAD pusts all it's preprocessor definitions in the cppad/configure.hpp
1919 DEFS =
2020 #
21 check_PROGRAMS = speed_adolc
21 check_PROGRAMS = speed_adolc
2222 #
2323 AM_CPPFLAGS = \
2424 -I$(top_srcdir) \
0 # $Id: CMakeLists.txt 3754 2015-11-26 22:23:05Z bradbell $
0 # $Id: CMakeLists.txt 3785 2016-02-08 12:53:06Z bradbell $
11 # -----------------------------------------------------------------------------
22 # CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33 #
3939 # List of libraries to be linked into the specified target
4040 TARGET_LINK_LIBRARIES(speed_cppad
4141 speed_src
42 cppad_lib
42 ${cppad_lib}
4343 ${colpack_libs}
4444 )
4545
0 # $Id: makefile.am 3481 2014-12-17 23:39:47Z bradbell $
0 # $Id: makefile.am 3785 2016-02-08 12:53:06Z bradbell $
11 # -----------------------------------------------------------------------------
2 # CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-14 Bradley M. Bell
2 # CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33 #
44 # CppAD is distributed under multiple licenses. This distribution is under
5 # the terms of the
5 # the terms of the
66 # GNU General Public License Version 3.
77 #
88 # A copy of this license is included in the COPYING file of this distribution.
1717 # CppAD pusts all it's preprocessor definitions in the cppad/configure.hpp
1818 DEFS =
1919 #
20 check_PROGRAMS = speed_cppad
20 check_PROGRAMS = speed_cppad
2121 #
2222 AM_CPPFLAGS = -I$(top_srcdir) $(BOOST_INCLUDE) $(EIGEN_INCLUDE)
2323 #
0 # $Id: makefile.am 3481 2014-12-17 23:39:47Z bradbell $
0 # $Id: makefile.am 3785 2016-02-08 12:53:06Z bradbell $
11 # -----------------------------------------------------------------------------
2 # CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-14 Bradley M. Bell
2 # CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33 #
44 # CppAD is distributed under multiple licenses. This distribution is under
5 # the terms of the
5 # the terms of the
66 # GNU General Public License Version 3.
77 #
88 # A copy of this license is included in the COPYING file of this distribution.
1717 # CppAD pusts all it's preprocessor definitions in the cppad/configure.hpp
1818 DEFS =
1919 #
20 check_PROGRAMS = speed_double
20 check_PROGRAMS = speed_double
2121 #
2222 AM_CPPFLAGS = -I$(top_srcdir) $(BOOST_INCLUDE) $(EIGEN_INCLUDE)
2323 #
0 # $Id: makefile.am 3481 2014-12-17 23:39:47Z bradbell $
0 # $Id: makefile.am 3785 2016-02-08 12:53:06Z bradbell $
11 # -----------------------------------------------------------------------------
2 # CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-13 Bradley M. Bell
2 # CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33 #
44 # CppAD is distributed under multiple licenses. This distribution is under
5 # the terms of the
5 # the terms of the
66 # GNU General Public License Version 3.
77 #
88 # A copy of this license is included in the COPYING file of this distribution.
1616 EXTRA_DIST = \
1717 speed_program.cpp
1818 #
19 check_PROGRAMS = speed_example
19 check_PROGRAMS = speed_example
2020 #
2121 AM_CPPFLAGS = -I. -I$(top_srcdir) $(BOOST_INCLUDE) $(EIGEN_INCLUDE)
2222 #
3636 sparse_jac_fun.cpp \
3737 speed_test.cpp \
3838 time_test.cpp \
39 ../src/microsoft_timer.cpp
39 ../src/microsoft_timer.cpp
4040
4141 test: check
4242 ./speed_example
0 # $Id: makefile.am 3481 2014-12-17 23:39:47Z bradbell $
0 # $Id: makefile.am 3785 2016-02-08 12:53:06Z bradbell $
11 # -----------------------------------------------------------------------------
2 # CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-14 Bradley M. Bell
2 # CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33 #
44 # CppAD is distributed under multiple licenses. This distribution is under
5 # the terms of the
5 # the terms of the
66 # GNU General Public License Version 3.
77 #
88 # A copy of this license is included in the COPYING file of this distribution.
1818 # CppAD pusts all it's preprocessor definitions in the cppad/configure.hpp
1919 DEFS =
2020 #
21 check_PROGRAMS = speed_fadbad
21 check_PROGRAMS = speed_fadbad
2222 #
2323 AM_CPPFLAGS = \
2424 -I$(top_srcdir) \
0 # $Id: CMakeLists.txt 3754 2015-11-26 22:23:05Z bradbell $
0 # $Id: CMakeLists.txt 3785 2016-02-08 12:53:06Z bradbell $
11 # -----------------------------------------------------------------------------
22 # CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33 #
5050 # profile builds it own copy of src/speed library (see ADD_EXECUTABLE above)
5151 # TARGET_LINK_LIBRARIES(speed_profile speed_src )
5252 TARGET_LINK_LIBRARIES(speed_profile
53 cppad_lib
53 ${cppad_lib}
5454 ${colpack_libs}
5555 )
5656
0 # $Id: makefile.am 3481 2014-12-17 23:39:47Z bradbell $
0 # $Id: makefile.am 3785 2016-02-08 12:53:06Z bradbell $
11 # -----------------------------------------------------------------------------
2 # CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-14 Bradley M. Bell
2 # CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33 #
44 # CppAD is distributed under multiple licenses. This distribution is under
5 # the terms of the
5 # the terms of the
66 # GNU General Public License Version 3.
77 #
88 # A copy of this license is included in the COPYING file of this distribution.
6868 EXTRA_DIST = \
6969 gprof.sed
7070 #
71 check_PROGRAMS = speed_profile
71 check_PROGRAMS = speed_profile
7272 #
7373 AM_CPPFLAGS = -I$(top_srcdir) $(BOOST_INCLUDE) $(EIGEN_INCLUDE)
7474 #
0 # $Id: makefile.am 2529 2012-10-31 17:37:50Z bradbell $
0 # $Id: makefile.am 3785 2016-02-08 12:53:06Z bradbell $
11 # -----------------------------------------------------------------------------
2 # CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-12 Bradley M. Bell
2 # CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33 #
44 # CppAD is distributed under multiple licenses. This distribution is under
5 # the terms of the
5 # the terms of the
66 # GNU General Public License Version 3.
77 #
88 # A copy of this license is included in the COPYING file of this distribution.
1818 # END OPTIMIZE
1919 #
2020 # BEGIN DEBUG
21 # AM_CXXFLAGS = -g $(CXX_FLAGS)
21 # AM_CXXFLAGS = -g $(CXX_FLAGS)
2222 # END DEBUG
2323 #
2424 AM_CPPFLAGS = \
0 # $Id: CMakeLists.txt 3768 2015-12-28 18:58:35Z bradbell $
0 # $Id: CMakeLists.txt 3785 2016-02-08 12:53:06Z bradbell $
11 # -----------------------------------------------------------------------------
22 # CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33 #
160160
161161 # List of libraries to be linked into the specified target
162162 TARGET_LINK_LIBRARIES(test_more
163 cppad_lib
163 ${cppad_lib}
164164 ${adolc_libs}
165165 ${ipopt_libs}
166166 ${eigen_libs}
0 /* $Id: abs.cpp 2506 2012-10-24 19:36:49Z bradbell $ */
0 // $Id: abs.cpp 3785 2016-02-08 12:53:06Z bradbell $
11 /* --------------------------------------------------------------------------
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-12 Bradley M. Bell
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33
44 CppAD is distributed under multiple licenses. This distribution is under
5 the terms of the
5 the terms of the
66 GNU General Public License Version 3.
77
88 A copy of this license is included in the COPYING file of this distribution.
0 /* $Id: add.cpp 2506 2012-10-24 19:36:49Z bradbell $ */
0 // $Id: add.cpp 3785 2016-02-08 12:53:06Z bradbell $
11 /* --------------------------------------------------------------------------
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-12 Bradley M. Bell
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33
44 CppAD is distributed under multiple licenses. This distribution is under
5 the terms of the
5 the terms of the
66 GNU General Public License Version 3.
77
88 A copy of this license is included in the COPYING file of this distribution.
3939 // dependent variable values
4040 Z[x] = U[s] + U[t]; // AD<double> + AD<double>
4141 Z[y] = Z[x] + 1.; // AD<double> + double
42 Z[z] = 1. + Z[y]; // double + AD<double>
42 Z[z] = 1. + Z[y]; // double + AD<double>
4343
4444 // create f: U -> Z and vectors used for derivative calculations
4545 ADFun<double> f(U, Z);
7979 // independent variable vector
8080 double u0 = .5;
8181 CPPAD_TESTVECTOR(AD<double>) U(1);
82 U[0] = u0;
82 U[0] = u0;
8383 Independent(U);
8484
8585 AD<double> a = U[0] + 1.; // AD<double> + double
8686 AD<double> b = a + 2; // AD<double> + int
87 AD<double> c = 3. + b; // double + AD<double>
88 AD<double> d = 4 + c; // int + AD<double>
87 AD<double> c = 3. + b; // double + AD<double>
88 AD<double> d = 4 + c; // int + AD<double>
8989
90 // dependent variable vector
90 // dependent variable vector
9191 CPPAD_TESTVECTOR(AD<double>) Z(1);
92 Z[0] = d + U[0]; // AD<double> + AD<double>
92 Z[0] = d + U[0]; // AD<double> + AD<double>
9393
9494 // create f: U -> Z and vectors used for derivative calculations
95 ADFun<double> f(U, Z);
95 ADFun<double> f(U, Z);
9696 CPPAD_TESTVECTOR(double) v(1);
9797 CPPAD_TESTVECTOR(double) w(1);
9898
99 // check value
99 // check value
100100 ok &= NearEqual(Z[0] , 2 * u0 + 10, 1e-10 , 1e-10);
101101
102102 // forward computation of partials w.r.t. u
107107 v[0] = 1.;
108108 for(j = 1; j < p; j++)
109109 { jfac *= j;
110 w = f.Forward(j, v);
110 w = f.Forward(j, v);
111111 ok &= NearEqual(jfac*w[0], value, 1e-10 , 1e-10); // d^jz/du^j
112112 v[0] = 0.;
113113 value = 0.;
114114 }
115115
116116 // reverse computation of partials of Taylor coefficients
117 CPPAD_TESTVECTOR(double) r(p);
117 CPPAD_TESTVECTOR(double) r(p);
118118 w[0] = 1.;
119119 r = f.Reverse(p, w);
120120 jfac = 1.;
133133 bool Add(void)
134134 { bool ok = true;
135135 ok &= AddTestOne();
136 ok &= AddTestTwo();
136 ok &= AddTestTwo();
137137 return ok;
138138 }
0 /* $Id: add_eq.cpp 2506 2012-10-24 19:36:49Z bradbell $ */
0 // $Id: add_eq.cpp 3785 2016-02-08 12:53:06Z bradbell $
11 /* --------------------------------------------------------------------------
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-12 Bradley M. Bell
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33
44 CppAD is distributed under multiple licenses. This distribution is under
5 the terms of the
5 the terms of the
66 GNU General Public License Version 3.
77
88 A copy of this license is included in the COPYING file of this distribution.
4040 Z[y] = U[t];
4141 Z[x] += U[s]; // parameter += variable
4242 Z[x] += U[t]; // variable += variable
43 Z[y] += .5; // variable += double
43 Z[y] += .5; // variable += double
4444 // use .5 because it is represented exactly in binary and
4545 // because it makes sure that += does not slice the double to an int
4646
7979 // independent variable vector
8080 double u0 = .5;
8181 CPPAD_TESTVECTOR(AD<double>) U(1);
82 U[0] = u0;
82 U[0] = u0;
8383 Independent(U);
8484
85 // dependent variable vector
85 // dependent variable vector
8686 CPPAD_TESTVECTOR(AD<double>) Z(1);
8787 Z[0] = U[0]; // initial value
8888 Z[0] += 2; // AD<double> += int
8989 Z[0] += 4.; // AD<double> += double
90 Z[0] += U[0]; // AD<double> += AD<double>
90 Z[0] += U[0]; // AD<double> += AD<double>
9191
9292 // create f: U -> Z and vectors used for derivative calculations
93 ADFun<double> f(U, Z);
93 ADFun<double> f(U, Z);
9494 CPPAD_TESTVECTOR(double) v(1);
9595 CPPAD_TESTVECTOR(double) w(1);
9696
97 // check value
97 // check value
9898 ok &= NearEqual(Z[0] , u0+2+4+u0, 1e-10 , 1e-10);
9999
100100 // forward computation of partials w.r.t. u
105105 v[0] = 1.;
106106 for(j = 1; j < p; j++)
107107 { jfac *= j;
108 w = f.Forward(j, v);
108 w = f.Forward(j, v);
109109 ok &= NearEqual(jfac*w[0], value, 1e-10 , 1e-10); // d^jz/du^j
110110 v[0] = 0.;
111111 value = 0.;
112112 }
113113
114114 // reverse computation of partials of Taylor coefficients
115 CPPAD_TESTVECTOR(double) r(p);
115 CPPAD_TESTVECTOR(double) r(p);
116116 w[0] = 1.;
117117 r = f.Reverse(p, w);
118118 jfac = 1.;
0 /* $Id: add_zero.cpp 2506 2012-10-24 19:36:49Z bradbell $ */
0 // $Id: add_zero.cpp 3785 2016-02-08 12:53:06Z bradbell $
11 /* --------------------------------------------------------------------------
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-12 Bradley M. Bell
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33
44 CppAD is distributed under multiple licenses. This distribution is under
5 the terms of the
5 the terms of the
66 GNU General Public License Version 3.
77
88 A copy of this license is included in the COPYING file of this distribution.
1919 typedef CppAD::AD< ADdouble > ADDdouble;
2020
2121 bool AddZero(void)
22 {
22 {
2323 using namespace CppAD;
2424
2525 bool ok = true;
0 /* $Id: adfun_copy.cpp 3519 2014-12-28 16:22:57Z bradbell $ */
0 // $Id: adfun_copy.cpp 3785 2016-02-08 12:53:06Z bradbell $
11 /* --------------------------------------------------------------------------
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-10 Bradley M. Bell
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33
44 CppAD is distributed under multiple licenses. This distribution is under
5 the terms of the
5 the terms of the
66 GNU General Public License Version 3.
77
88 A copy of this license is included in the COPYING file of this distribution.
0 /* $Id: alloc_openmp.cpp 2506 2012-10-24 19:36:49Z bradbell $ */
0 // $Id: alloc_openmp.cpp 3785 2016-02-08 12:53:06Z bradbell $
11 /* --------------------------------------------------------------------------
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-12 Bradley M. Bell
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33
44 CppAD is distributed under multiple licenses. This distribution is under
5 the terms of the
5 the terms of the
66 GNU General Public License Version 3.
77
88 A copy of this license is included in the COPYING file of this distribution.
4646 // Test routine called by the master thread (thread_num = 0).
4747 bool alloc_openmp(void)
4848 { bool ok = true;
49
49
5050 int num_threads = NUMBER_THREADS;
5151
5252 // call setup for using thread_alloc in parallel mode.
5353 thread_alloc::parallel_setup(
5454 size_t(num_threads), in_parallel, thread_number
5555 );
56
56
5757 // Execute the worker function in parallel
5858 int thread_num;
5959 # pragma omp parallel for
6060 for(thread_num = 0; thread_num < num_threads; thread_num++)
6161 worker();
6262 // end omp parallel for
63
63
6464 // now inform CppAD that there is only one thread
6565 thread_alloc::parallel_setup(1, CPPAD_NULL, CPPAD_NULL);
6666
6868 { // check calculations by this thread in parallel model
6969 ok &= thread_all_[thread_num].x[0] == static_cast<double>(thread_num);
7070
71 // test having master thread (thread number zero)
71 // test having master thread (thread number zero)
7272 // free memory that was allocated by thread number thread_num.
7373 thread_all_[thread_num].x.clear();
7474 }
0 /* $Id: assign.cpp 2506 2012-10-24 19:36:49Z bradbell $ */
0 // $Id: assign.cpp 3785 2016-02-08 12:53:06Z bradbell $
11 /* --------------------------------------------------------------------------
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-12 Bradley M. Bell
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33
44 CppAD is distributed under multiple licenses. This distribution is under
5 the terms of the
5 the terms of the
66 GNU General Public License Version 3.
77
88 A copy of this license is included in the COPYING file of this distribution.
2727
2828 // declare independent variables and start tape recording
2929 CppAD::Independent(x);
30
31 // range space vector
30
31 // range space vector
3232 size_t m = 3;
3333 CPPAD_TESTVECTOR(AD<double>) y(m);
3434
3535 // assign an AD<Base> object equal to an independent variable
3636 // (choose the first independent variable to check a special case)
3737 // use the value returned by the assignment (for another assignment)
38 y[0] = y[1] = x[0];
38 y[0] = y[1] = x[0];
3939
40 // assign an AD<Base> object equal to an expression
40 // assign an AD<Base> object equal to an expression
4141 y[1] = x[1] + 1.;
4242 y[2] = x[2] + 2.;
4343
0 /* $Id: atan2.cpp 3083 2014-01-10 18:35:07Z bradbell $ */
0 // $Id: atan2.cpp 3785 2016-02-08 12:53:06Z bradbell $
11 /* --------------------------------------------------------------------------
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-14 Bradley M. Bell
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33
44 CppAD is distributed under multiple licenses. This distribution is under
5 the terms of the
5 the terms of the
66 GNU General Public License Version 3.
77
88 A copy of this license is included in the COPYING file of this distribution.
4444
4545 // a temporary values
4646 AD<double> x = cos(U[0]);
47 AD<double> y = sin(U[0]);
47 AD<double> y = sin(U[0]);
4848
49 // dependent variable vector
49 // dependent variable vector
5050 CPPAD_TESTVECTOR(AD<double>) Z(1);
51 Z[0] = atan2(y, x);
51 Z[0] = atan2(y, x);
5252
5353 // create f: U -> Z and vectors used for derivative calculations
54 ADFun<double> f(U, Z);
54 ADFun<double> f(U, Z);
5555 CPPAD_TESTVECTOR(double) v(1);
5656 CPPAD_TESTVECTOR(double) w(1);
5757
8181 v[0] = 1.;
8282 for(j = 1; j < p; j++)
8383 { jfac *= j;
84 w = f.Forward(j, v);
84 w = f.Forward(j, v);
8585 ok &= NearEqual(jfac*w[0], value, 1e-10 , 1e-10); // d^jz/du^j
8686 v[0] = 0.;
8787 value = 0.;
8888 }
8989
9090 // reverse computation of partials of Taylor coefficients
91 CPPAD_TESTVECTOR(double) r(p);
91 CPPAD_TESTVECTOR(double) r(p);
9292 w[0] = 1.;
9393 r = f.Reverse(p, w);
9494 jfac = 1.;
0 /* $Id: base_adolc.cpp 2794 2013-05-02 08:20:30Z bradbell $ */
0 // $Id: base_adolc.cpp 3785 2016-02-08 12:53:06Z bradbell $
11 /* --------------------------------------------------------------------------
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-13 Bradley M. Bell
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33
44 CppAD is distributed under multiple licenses. This distribution is under
55 the terms of the
1212 # include <adolc/taping.h>
1313 # include <adolc/interfaces.h>
1414
15 // adouble definitions not in Adolc distribution and
15 // adouble definitions not in Adolc distribution and
1616 // required in order to use CppAD::AD<adouble>
1717 # include <cppad/example/base_adolc.hpp>
1818
1919 # include <cppad/cppad.hpp>
2020
21 bool base_adolc(void)
21 bool base_adolc(void)
2222 { bool ok = true; // initialize test result
2323
2424 typedef adouble ADdouble; // for first level of taping
3838 for(j = 0; j < n; j++)
3939 aa_x[j] = a_x[j]; // track how aa_x depends on a_x
4040 CppAD::Independent(aa_x); // aa_x is independent for ADDdouble
41
41
4242
4343 // compute function
4444 size_t m = 5;
0 /* $Id: base_alloc.cpp 2506 2012-10-24 19:36:49Z bradbell $ */
0 // $Id: base_alloc.cpp 3785 2016-02-08 12:53:06Z bradbell $
11 /* --------------------------------------------------------------------------
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-12 Bradley M. Bell
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33
44 CppAD is distributed under multiple licenses. This distribution is under
55 the terms of the
2828 size_t i, N = 50;
2929 for(i = 0; i < N; i++)
3030 a_y[0] += double(i);
31
31
3232 CppAD::ADFun<base_alloc> f(a_x, a_y);
3333
3434 return ok;
0 /* $Id: check_simple_vector.cpp 2506 2012-10-24 19:36:49Z bradbell $ */
0 // $Id: check_simple_vector.cpp 3785 2016-02-08 12:53:06Z bradbell $
11 /* --------------------------------------------------------------------------
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-12 Bradley M. Bell
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33
44 CppAD is distributed under multiple licenses. This distribution is under
5 the terms of the
5 the terms of the
66 GNU General Public License Version 3.
77
88 A copy of this license is included in the COPYING file of this distribution.
1818 template <class Scalar>
1919 void Case(const Scalar& x, const Scalar& y)
2020 { using CppAD::CheckSimpleVector;
21
21
2222 CheckSimpleVector<Scalar, CppAD::vector<Scalar> > (x, y);
2323 CheckSimpleVector<Scalar, std::vector<Scalar> > (x, y);
2424 CheckSimpleVector<Scalar, std::valarray<Scalar> > (x, y);
0 /* $Id: compare.cpp 2506 2012-10-24 19:36:49Z bradbell $ */
0 // $Id: compare.cpp 3785 2016-02-08 12:53:06Z bradbell $
11 /* --------------------------------------------------------------------------
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-06 Bradley M. Bell
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33
44 CppAD is distributed under multiple licenses. This distribution is under
5 the terms of the
5 the terms of the
66 GNU General Public License Version 3.
77
88 A copy of this license is included in the COPYING file of this distribution.
1414 */
1515 # include <cppad/cppad.hpp>
1616
17 namespace {
17 namespace {
1818 template <class Type>
1919 bool Compare(void)
2020 { bool ok = true;
2121 using CppAD::AD;
22
22
2323 Type middle = 4;
2424 AD<double> three = 3;
2525 AD<double> four = 4;
2626 AD<double> five = 5;
27
27
2828 // AD<double> > Type
29 ok &= ! (three > middle);
30 ok &= ! (four > middle);
31 ok &= (five > middle);
32 // Type > AD<double>
33 ok &= (middle > three );
34 ok &= ! (middle > four );
35 ok &= ! (middle > five );
36
29 ok &= ! (three > middle);
30 ok &= ! (four > middle);
31 ok &= (five > middle);
32 // Type > AD<double>
33 ok &= (middle > three );
34 ok &= ! (middle > four );
35 ok &= ! (middle > five );
36
3737 // AD<double> >= Type
38 ok &= ! (three >= middle);
39 ok &= (four >= middle);
40 ok &= (five >= middle);
41 // Type > AD<double>
42 ok &= (middle >= three );
43 ok &= (middle >= four );
44 ok &= ! (middle >= five );
45
38 ok &= ! (three >= middle);
39 ok &= (four >= middle);
40 ok &= (five >= middle);
41 // Type > AD<double>
42 ok &= (middle >= three );
43 ok &= (middle >= four );
44 ok &= ! (middle >= five );
45
4646 // AD<double> < Type
47 ok &= (three < middle);
48 ok &= ! (four < middle);
49 ok &= ! (five < middle);
50 // Type > AD<double>
51 ok &= ! (middle < three );
52 ok &= ! (middle < four );
53 ok &= (middle < five );
54
47 ok &= (three < middle);
48 ok &= ! (four < middle);
49 ok &= ! (five < middle);
50 // Type > AD<double>
51 ok &= ! (middle < three );
52 ok &= ! (middle < four );
53 ok &= (middle < five );
54
5555 // AD<double> <= Type
56 ok &= (three <= middle);
57 ok &= (four <= middle);
58 ok &= ! (five <= middle);
59 // Type > AD<double>
60 ok &= ! (middle <= three );
61 ok &= (middle <= four );
62 ok &= (middle <= five );
63
56 ok &= (three <= middle);
57 ok &= (four <= middle);
58 ok &= ! (five <= middle);
59 // Type > AD<double>
60 ok &= ! (middle <= three );
61 ok &= (middle <= four );
62 ok &= (middle <= five );
63
6464 return ok;
6565 }
6666 }
0 /* $Id: cond_exp_ad.cpp 2506 2012-10-24 19:36:49Z bradbell $ */
0 // $Id: cond_exp_ad.cpp 3785 2016-02-08 12:53:06Z bradbell $
11 /* --------------------------------------------------------------------------
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-12 Bradley M. Bell
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33
44 CppAD is distributed under multiple licenses. This distribution is under
5 the terms of the
5 the terms of the
66 GNU General Public License Version 3.
77
88 A copy of this license is included in the COPYING file of this distribution.
7676 // create fa: Xaa -> Yaa function object
7777 ADFun< ADdouble > fa(Xaa, Yaa);
7878
79 // function values
79 // function values
8080 CPPAD_TESTVECTOR( ADdouble ) Ya(m);
8181 Ya = fa.Forward(0, Xa);
8282
226226 // create fa: Xaa -> Yaa function object
227227 ADFun< ADdouble > fa(Xaa, Yaa);
228228
229 // function values
229 // function values
230230 CPPAD_TESTVECTOR( ADdouble ) Ya(m);
231231 Ya = fa.Forward(0, Xa);
232232
0 /* $Id: cos.cpp 2506 2012-10-24 19:36:49Z bradbell $ */
0 // $Id: cos.cpp 3785 2016-02-08 12:53:06Z bradbell $
11 /* --------------------------------------------------------------------------
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-12 Bradley M. Bell
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33
44 CppAD is distributed under multiple licenses. This distribution is under
5 the terms of the
5 the terms of the
66 GNU General Public License Version 3.
77
88 A copy of this license is included in the COPYING file of this distribution.
2626 U[0] = 1.;
2727 Independent(U);
2828
29 // dependent variable vector
29 // dependent variable vector
3030 CPPAD_TESTVECTOR(AD<double>) Z(1);
31 Z[0] = cos(U[0]);
31 Z[0] = cos(U[0]);
3232
3333 // create f: U -> Z and vectors used for derivative calculations
34 ADFun<double> f(U, Z);
34 ADFun<double> f(U, Z);
3535 CPPAD_TESTVECTOR(double) v(1);
3636 CPPAD_TESTVECTOR(double) w(1);
3737
38 // check value
38 // check value
3939 double sin_u = sin( Value(U[0]) );
4040 double cos_u = cos( Value(U[0]) );
4141
4747 double jfac = 1.;
4848 v[0] = 1.;
4949 for(j = 1; j < p; j++)
50 { w = f.Forward(j, v);
50 { w = f.Forward(j, v);
5151
5252 double value;
5353 if( j % 4 == 1 )
6464 }
6565
6666 // reverse computation of partials of Taylor coefficients
67 CPPAD_TESTVECTOR(double) r(p);
67 CPPAD_TESTVECTOR(double) r(p);
6868 w[0] = 1.;
6969 r = f.Reverse(p, w);
7070 jfac = 1.;
0 /* $Id: cosh.cpp 2506 2012-10-24 19:36:49Z bradbell $ */
0 // $Id: cosh.cpp 3785 2016-02-08 12:53:06Z bradbell $
11 /* --------------------------------------------------------------------------
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-12 Bradley M. Bell
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33
44 CppAD is distributed under multiple licenses. This distribution is under
5 the terms of the
5 the terms of the
66 GNU General Public License Version 3.
77
88 A copy of this license is included in the COPYING file of this distribution.
2626 U[0] = 1.;
2727 Independent(U);
2828
29 // dependent variable vector
29 // dependent variable vector
3030 CPPAD_TESTVECTOR(AD<double>) Z(1);
31 Z[0] = cosh(U[0]);
31 Z[0] = cosh(U[0]);
3232
3333 // create f: U -> Z and vectors used for derivative calculations
34 ADFun<double> f(U, Z);
34 ADFun<double> f(U, Z);
3535 CPPAD_TESTVECTOR(double) v(1);
3636 CPPAD_TESTVECTOR(double) w(1);
3737
38 // check value
38 // check value
3939 double sinh_u = sinh( Value(U[0]) );
4040 double cosh_u = cosh( Value(U[0]) );
4141
4747 double jfac = 1.;
4848 v[0] = 1.;
4949 for(j = 1; j < p; j++)
50 { w = f.Forward(j, v);
50 { w = f.Forward(j, v);
5151
5252 double value;
5353 if( j % 2 == 1 )
6060 }
6161
6262 // reverse computation of partials of Taylor coefficients
63 CPPAD_TESTVECTOR(double) r(p);
63 CPPAD_TESTVECTOR(double) r(p);
6464 w[0] = 1.;
6565 r = f.Reverse(p, w);
6666 jfac = 1.;
0 /* $Id: dbl_epsilon.cpp 2506 2012-10-24 19:36:49Z bradbell $ */
0 // $Id: dbl_epsilon.cpp 3785 2016-02-08 12:53:06Z bradbell $
11 /* --------------------------------------------------------------------------
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-08 Bradley M. Bell
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33
44 CppAD is distributed under multiple licenses. This distribution is under
5 the terms of the
5 the terms of the
66 GNU General Public License Version 3.
77
88 A copy of this license is included in the COPYING file of this distribution.
1010 -------------------------------------------------------------------------- */
1111
1212 /*
13 Check the value of machine epsilon is accurate enough for the correctness tests
13 Check the value of machine epsilon is accurate enough for the correctness tests
1414 */
1515
1616 # include <cfloat>
0 /* $Id: div_zero_one.cpp 2506 2012-10-24 19:36:49Z bradbell $ */
0 // $Id: div_zero_one.cpp 3785 2016-02-08 12:53:06Z bradbell $
11 /* --------------------------------------------------------------------------
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-12 Bradley M. Bell
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33
44 CppAD is distributed under multiple licenses. This distribution is under
5 the terms of the
5 the terms of the
66 GNU General Public License Version 3.
77
88 A copy of this license is included in the COPYING file of this distribution.
1919 typedef CppAD::AD< ADdouble > ADDdouble;
2020
2121 bool DivZeroOne(void)
22 {
22 {
2323 using namespace CppAD;
2424
2525 bool ok = true;
0 /* $Id: exp.cpp 2506 2012-10-24 19:36:49Z bradbell $ */
0 // $Id: exp.cpp 3785 2016-02-08 12:53:06Z bradbell $
11 /* --------------------------------------------------------------------------
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-12 Bradley M. Bell
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33
44 CppAD is distributed under multiple licenses. This distribution is under
5 the terms of the
5 the terms of the
66 GNU General Public License Version 3.
77
88 A copy of this license is included in the COPYING file of this distribution.
5858 v = f.Reverse(1,w);
5959 ok &= NearEqual(v[s], Z[y] * Z[x], 1e-10 , 1e-10); // dy/ds
6060
61 // forward computation of second partials w.r.t s
61 // forward computation of second partials w.r.t s
6262 v[s] = 1.;
6363 w = f.Forward(1, v);
6464 v[s] = 0.;
6565 w = f.Forward(2, v);
6666 ok &= NearEqual( // d^2 y / (ds ds)
67 2. * w[y] ,
67 2. * w[y] ,
6868 Z[y] * Z[x] * Z[x] + Z[y] * Z[x],
6969 1e-10 ,
70 1e-10
71 );
70 1e-10
71 );
7272
7373 // reverse computation of second partials of y
7474 CPPAD_TESTVECTOR(double) r( f.Domain() * 2 );
7676 w[y] = 1.;
7777 r = f.Reverse(2, w);
7878 ok &= NearEqual( // d^2 y / (ds ds)
79 r[2 * s + 1] ,
79 r[2 * s + 1] ,
8080 Z[y] * Z[x] * Z[x] + Z[y] * Z[x],
8181 1e-10 ,
82 1e-10
83 );
82 1e-10
83 );
8484
8585 return ok;
8686 }
9595 U[0] = 1.;
9696 Independent(U);
9797
98 // dependent variable vector
98 // dependent variable vector
9999 CPPAD_TESTVECTOR(AD<double>) Z(1);
100 Z[0] = exp(U[0]);
100 Z[0] = exp(U[0]);
101101
102102 // create f: U -> Z and vectors used for derivative calculations
103 ADFun<double> f(U, Z);
103 ADFun<double> f(U, Z);
104104 CPPAD_TESTVECTOR(double) v(1);
105105 CPPAD_TESTVECTOR(double) w(1);
106106
107 // check value
107 // check value
108108 double exp_u = exp( Value(U[0]) );
109109 ok &= NearEqual(exp_u, Value(Z[0]), 1e-10 , 1e-10);
110110
114114 double jfac = 1.;
115115 v[0] = 1.;
116116 for(j = 1; j < p; j++)
117 { w = f.Forward(j, v);
117 { w = f.Forward(j, v);
118118 jfac *= j;
119119 ok &= NearEqual(jfac*w[0], exp_u, 1e-10 , 1e-10); // d^jz/du^j
120120 v[0] = 0.;
121121 }
122122
123123 // reverse computation of partials of Taylor coefficients
124 CPPAD_TESTVECTOR(double) r(p);
124 CPPAD_TESTVECTOR(double) r(p);
125125 w[0] = 1.;
126126 r = f.Reverse(p, w);
127127 jfac = 1.;
138138 bool Exp(void)
139139 { bool ok = true;
140140 ok &= ExpTestOne();
141 ok &= ExpTestTwo();
141 ok &= ExpTestTwo();
142142 return ok;
143143 }
0 /* $Id: extern_value.cpp 2756 2013-02-27 18:49:28Z bradbell $ */
0 // $Id: extern_value.cpp 3785 2016-02-08 12:53:06Z bradbell $
11 /* --------------------------------------------------------------------------
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-13 Bradley M. Bell
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33
44 CppAD is distributed under multiple licenses. This distribution is under
5 the terms of the
5 the terms of the
66 GNU General Public License Version 3.
77
88 A copy of this license is included in the COPYING file of this distribution.
1414
1515 # define INSTANTIATE(Type) template class extern_value< Type >
1616
17 template <class Type>
17 template <class Type>
1818 extern_value<Type>::extern_value(Type value)
1919 { value_ = value; }
2020
21 template <class Type>
21 template <class Type>
2222 void extern_value<Type>::set(Type value)
2323 { value_ = value; }
2424
25 template <class Type>
25 template <class Type>
2626 Type extern_value<Type>::get(void)
2727 { return value_; }
2828
0 /* $Id: for_hess.cpp 2506 2012-10-24 19:36:49Z bradbell $ */
0 // $Id: for_hess.cpp 3785 2016-02-08 12:53:06Z bradbell $
11 /* --------------------------------------------------------------------------
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-12 Bradley M. Bell
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33
44 CppAD is distributed under multiple licenses. This distribution is under
5 the terms of the
5 the terms of the
66 GNU General Public License Version 3.
77
88 A copy of this license is included in the COPYING file of this distribution.
3737 // define the function
3838 CPPAD_TESTVECTOR(AD<double>) Y(2);
3939 Y[0] = U[0] * exp( U[1] );
40 Y[1] = U[1] * sin( U[2] );
40 Y[1] = U[1] * sin( U[2] );
4141
4242 // create the function y = F(u)
4343 ADFun<double> F(U, Y);
4444
45 // formulas for the upper triangle of Hessian of F_0
45 // formulas for the upper triangle of Hessian of F_0
4646 CPPAD_TESTVECTOR(double) H0(9);
4747 H0[0] = 0.; // d^2 y[0] / d_u[0] d_u[0]
4848 H0[1] = exp( u0[1] ); // d^2 y[0] / d_u[0] d_u[1]
8686 F.Forward(1, u1);
8787 CPPAD_TESTVECTOR(double) Cij = F.Forward(2, u2);
8888
89 // diagonal of Hessian in j-th coordinate direction
89 // diagonal of Hessian in j-th coordinate direction
9090 u1[i] = 0.;
9191 F.Forward(1, u1);
9292 CPPAD_TESTVECTOR(double) Dj = F.Forward(2, u2);
0 /* $Id: for_sparse_jac.cpp 2859 2013-05-28 06:03:21Z bradbell $ */
0 // $Id: for_sparse_jac.cpp 3785 2016-02-08 12:53:06Z bradbell $
11 /* --------------------------------------------------------------------------
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-13 Bradley M. Bell
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33
44 CppAD is distributed under multiple licenses. This distribution is under
5 the terms of the
5 the terms of the
66 GNU General Public License Version 3.
77
88 A copy of this license is included in the COPYING file of this distribution.
7474 using namespace CppAD;
7575
7676 // dimension of the domain space
77 size_t n = 3;
77 size_t n = 3;
7878
7979 // dimension of the range space
8080 size_t m = (4 + 11 + 1) * 3 + 4;
8181
82 // independent variable vector
82 // independent variable vector
8383 CPPAD_TESTVECTOR(AD<double>) X(n);
84 X[0] = .1;
84 X[0] = .1;
8585 X[1] = .2;
8686 X[2] = .3;
8787 Independent(X);
165165 for(i = 0; i < m; i++)
166166 { for(j = 0; j < n; j++)
167167 ok &= (Py[i * n + j] == Check[i * n + j]);
168 }
168 }
169169
170170 // ---------------------------------------------------------
171171 // dependency matrix for the identity function W(x) = x
186186 { found = Sy[i].find(j) != Sy[i].end();
187187 ok &= (found == Check[i * n + j]);
188188 }
189 }
189 }
190190
191191 return ok;
192192 }
196196 using namespace CppAD;
197197
198198 // dimension of the domain space
199 size_t n = 3;
199 size_t n = 3;
200200
201201 // dimension of the range space
202202 size_t m = 3;
207207 for(k = 0; k < n-1; k++)
208208 Z[k] = 0.;
209209
210 // independent variable vector
210 // independent variable vector
211211 CPPAD_TESTVECTOR(AD<double>) X(n);
212 X[0] = 0.;
212 X[0] = 0.;
213213 X[1] = 1.;
214214 X[2] = 2.;
215215 Independent(X);
216216
217217 // VecAD vector is going to depend on X[1] and X[2]
218218 Z[ X[0] ] = X[1];
219 Z[ X[1] ] = X[2];
219 Z[ X[1] ] = X[2];
220220
221221 // dependent variable vector
222222 CPPAD_TESTVECTOR(AD<double>) Y(m);
273273 for(i = 0; i < m; i++)
274274 { for(j = 0; j < n; j++)
275275 ok &= (Py[i * n + j] == Check[i * n + j]);
276 }
276 }
277277
278278 // ---------------------------------------------------------
279279 // dependency matrix for the identity function W(x) = x
294294 { found = Sy[i].find(j) != Sy[i].end();
295295 ok &= (found == Check[i * n + j]);
296296 }
297 }
297 }
298298
299299 return ok;
300300 }
304304 using namespace CppAD;
305305
306306 // dimension of the domain space
307 size_t n = 2;
307 size_t n = 2;
308308
309309 // dimension of the range space
310310 size_t m = 3;
311311
312 // independent variable vector
312 // independent variable vector
313313 CPPAD_TESTVECTOR(AD<double>) X(n);
314 X[0] = 2.;
314 X[0] = 2.;
315315 X[1] = 3.;
316316 Independent(X);
317317
366366 for(i = 0; i < m; i++)
367367 { for(j = 0; j < n; j++)
368368 ok &= (Py[i * n + j] == Check[i * n + j]);
369 }
369 }
370370
371371 // ---------------------------------------------------------
372 // dependency matrix for the identity function
372 // dependency matrix for the identity function
373373 CPPAD_TESTVECTOR(std::set<size_t>) Sx(n);
374374 for(i = 0; i < n; i++)
375375 { assert( Sx[i].empty() );
387387 { found = Sy[i].find(j) != Sy[i].end();
388388 ok &= (found == Check[i * n + j]);
389389 }
390 }
390 }
391391
392392 return ok;
393393 }
397397 using namespace CppAD;
398398
399399 // dimension of the domain space
400 size_t n = 2;
400 size_t n = 2;
401401
402402 // dimension of the range space
403403 size_t m = 3;
404404
405 // independent variable vector
405 // independent variable vector
406406 CPPAD_TESTVECTOR(AD<double>) X(n);
407 X[0] = 2.;
407 X[0] = 2.;
408408 X[1] = 3.;
409409 Independent(X);
410410
460460 for(i = 0; i < m; i++)
461461 { for(j = 0; j < n; j++)
462462 ok &= (Py[j * m + i] == Check[i * n + j]);
463 }
463 }
464464
465465 // ---------------------------------------------------------
466 // dependency matrix for the identity function
466 // dependency matrix for the identity function
467467 CPPAD_TESTVECTOR(std::set<size_t>) Sx(n);
468468 for(i = 0; i < n; i++)
469469 { assert( Sx[i].empty() );
481481 { found = Sy[j].find(i) != Sy[j].end();
482482 ok &= (found == Check[i * n + j]);
483483 }
484 }
484 }
485485
486486 return ok;
487487 }
0 /* $Id: forward_order.cpp 3214 2014-03-18 20:50:38Z bradbell $ */
0 // $Id: forward_order.cpp 3785 2016-02-08 12:53:06Z bradbell $
11 /* --------------------------------------------------------------------------
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-14 Bradley M. Bell
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33
44 CppAD is distributed under multiple licenses. This distribution is under
5 the terms of the
5 the terms of the
66 GNU General Public License Version 3.
77
88 A copy of this license is included in the COPYING file of this distribution.
8787 size_t p = 2, p1 = p+1;
8888 CPPAD_TESTVECTOR(double) x(n), x_p(n * p1), y_p(m * p1);
8989 for(j = 0; j < n; j++)
90 { x[j] = double(j) / double(n);
90 { x[j] = double(j) / double(n);
9191 x_p[j * p1 + 0] = x[j]; // order 0
9292 x_p[j * p1 + 1] = 1.; // order 1
9393 x_p[j * p1 + 2] = 0.; // order 2
0 /* $Id: from_base.cpp 2506 2012-10-24 19:36:49Z bradbell $ */
0 // $Id: from_base.cpp 3785 2016-02-08 12:53:06Z bradbell $
11 /* --------------------------------------------------------------------------
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-06 Bradley M. Bell
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33
44 CppAD is distributed under multiple licenses. This distribution is under
5 the terms of the
5 the terms of the
66 GNU General Public License Version 3.
77
88 A copy of this license is included in the COPYING file of this distribution.
2020
2121 using namespace CppAD;
2222
23 // construct directly form Base where Base = double
24 AD<double> x(1.);
23 // construct directly form Base where Base = double
24 AD<double> x(1.);
2525 AD<double> y = 2.;
2626
27 // construct from a type that can be converted to Base
27 // construct from a type that can be converted to Base
2828 // where Base = AD<double>
29 AD< AD<double> > X(1.);
29 AD< AD<double> > X(1.);
3030 AD< AD<double> > Y(2);
3131
3232 // check that resulting objects are parameters
0 /* $Id: fun_check.cpp 3214 2014-03-18 20:50:38Z bradbell $ */
0 // $Id: fun_check.cpp 3785 2016-02-08 12:53:06Z bradbell $
11 /* --------------------------------------------------------------------------
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-14 Bradley M. Bell
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33
44 CppAD is distributed under multiple licenses. This distribution is under
5 the terms of the
5 the terms of the
66 GNU General Public License Version 3.
77
88 A copy of this license is included in the COPYING file of this distribution.
3131 size_t i;
3232 for(i = 0; i < n; i++)
3333 { // This operaiton sequence depends on x
34 if( x[i] >= 0 )
34 if( x[i] >= 0 )
3535 y[i] = exp(x[i]);
3636 else y[i] = exp(-x[i]);
3737 }
3838 return y;
39 }
39 }
4040 };
4141 // template function FunCheckCases<Vector, ADVector> in empty namespace
4242 template <class Vector, class ADVector>
7373 // create function object to use with double
7474 Fun<double, Vector> g(n);
7575
76 // function values should agree when the independent variable
76 // function values should agree when the independent variable
7777 // values are the same as during recording
7878 Vector x(n);
7979 size_t j;
8080 for(j = 0; j < n; j++)
8181 x[j] = Value(X[j]);
82 double r = 1e-10;
82 double r = 1e-10;
8383 double a = 1e-10;
8484 ok &= FunCheck(f, g, x, a, r);
8585
104104
105105 return ok;
106106 }
107 } // End empty namespace
107 } // End empty namespace
108108 # include <vector>
109109 # include <valarray>
110110 bool FunCheck(void)
116116 typedef std::valarray<double> Vector3;
117117 typedef std::valarray< CppAD::AD<double> > ADVector3;
118118 // Run with Vector and ADVector equal to three different cases
119 // all of which are Simple Vectors with elements of type
119 // all of which are Simple Vectors with elements of type
120120 // double and AD<double> respectively.
121121 ok &= FunCheckCases< Vector1, ADVector2 >();
122122 ok &= FunCheckCases< Vector2, ADVector3 >();
0 /* $Id: jacobian.cpp 2506 2012-10-24 19:36:49Z bradbell $ */
0 // $Id: jacobian.cpp 3785 2016-02-08 12:53:06Z bradbell $
11 /* --------------------------------------------------------------------------
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-12 Bradley M. Bell
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33
44 CppAD is distributed under multiple licenses. This distribution is under
5 the terms of the
5 the terms of the
66 GNU General Public License Version 3.
77
88 A copy of this license is included in the COPYING file of this distribution.
4343 }
4444
4545
46 } // End empty namespace
46 } // End empty namespace
4747
4848 bool jacobian(void)
4949 { bool ok = true;
7272 for(k = 0; k < m *n; k++)
7373 ok &= CppAD::NearEqual(jac_g[k], check[k], 1e-10, 1e-10);
7474
75 // one argument sparse jacobian
75 // one argument sparse jacobian
7676 jac_g = fun_g.SparseJacobian(x);
7777 for(k = 0; k < m *n; k++)
7878 ok &= CppAD::NearEqual(jac_g[k], check[k], 1e-10, 1e-10);
0 /* $Id: mul.cpp 2506 2012-10-24 19:36:49Z bradbell $ */
0 // $Id: mul.cpp 3785 2016-02-08 12:53:06Z bradbell $
11 /* --------------------------------------------------------------------------
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-12 Bradley M. Bell
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33
44 CppAD is distributed under multiple licenses. This distribution is under
5 the terms of the
5 the terms of the
66 GNU General Public License Version 3.
77
88 A copy of this license is included in the COPYING file of this distribution.
4444 // assign the dependent variables
4545 Z[x] = U[s] * U[t]; // AD<double> * AD<double>
4646 Z[y] = Z[x] * 4.; // AD<double> * double
47 Z[z] = 4. * Z[y]; // double * AD<double>
47 Z[z] = 4. * Z[y]; // double * AD<double>
4848 Z[u] = one * Z[z]; // multiplication by parameter equal to one
4949 Z[v] = zero * Z[z]; // multiplication by parameter equal to zero
5050
7070 q[s] = 1.;
7171 q[t] = 0.;
7272 r = f.Forward(1, q);
73 ok &= ( r[x] == U[t] ); // dx/ds
73 ok &= ( r[x] == U[t] ); // dx/ds
7474 ok &= ( r[y] == U[t] * 4. ); // dy/ds
7575 ok &= ( r[z] == 4. * U[t] * 4. ); // dz/ds
7676 ok &= ( r[u] == r[z] ); // du/ds
105105
106106 AD<double> a = U[0] * 1.; // AD<double> * double
107107 AD<double> b = a * 2; // AD<double> * int
108 AD<double> c = 3. * b; // double * AD<double>
109 AD<double> d = 4 * c; // int * AD<double>
108 AD<double> c = 3. * b; // double * AD<double>
109 AD<double> d = 4 * c; // int * AD<double>
110110
111 // dependent variable vector
111 // dependent variable vector
112112 CPPAD_TESTVECTOR(AD<double>) Z(1);
113113 Z[0] = U[0] * d; // AD<double> * AD<double>
114114
115115 // create f: U -> Z and vectors used for derivative calculations
116 ADFun<double> f(U, Z);
116 ADFun<double> f(U, Z);
117117 CPPAD_TESTVECTOR(double) v(1);
118118 CPPAD_TESTVECTOR(double) w(1);
119119
120 // check value
120 // check value
121121 ok &= NearEqual(Value(Z[0]) , u0*4*3*2*u0, 1e-10 , 1e-10);
122122
123123 // forward computation of partials w.r.t. u
134134 else value = 0.;
135135
136136 jfac *= j;
137 w = f.Forward(j, v);
137 w = f.Forward(j, v);
138138 ok &= NearEqual(jfac*w[0], value, 1e-10 , 1e-10); // d^jz/du^j
139139 v[0] = 0.;
140140 }
141141
142142 // reverse computation of partials of Taylor coefficients
143 CPPAD_TESTVECTOR(double) r(p);
143 CPPAD_TESTVECTOR(double) r(p);
144144 w[0] = 1.;
145145 r = f.Reverse(p, w);
146146 jfac = 1.;
164164 bool Mul(void)
165165 { bool ok = true;
166166 ok &= MulTestOne();
167 ok &= MulTestTwo();
167 ok &= MulTestTwo();
168168 return ok;
169169 }
0 /* $Id: mul_eq.cpp 2506 2012-10-24 19:36:49Z bradbell $ */
0 // $Id: mul_eq.cpp 3785 2016-02-08 12:53:06Z bradbell $
11 /* --------------------------------------------------------------------------
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-12 Bradley M. Bell
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33
44 CppAD is distributed under multiple licenses. This distribution is under
5 the terms of the
5 the terms of the
66 GNU General Public License Version 3.
77
88 A copy of this license is included in the COPYING file of this distribution.
8686 // independent variable vector
8787 double u0 = .5;
8888 CPPAD_TESTVECTOR(AD<double>) U(1);
89 U[0] = u0;
89 U[0] = u0;
9090 Independent(U);
9191
92 // dependent variable vector
92 // dependent variable vector
9393 CPPAD_TESTVECTOR(AD<double>) Z(1);
9494 Z[0] = U[0]; // initial value
9595 Z[0] *= 2; // AD<double> *= int
9696 Z[0] *= 4.; // AD<double> *= double
97 Z[0] *= U[0]; // AD<double> *= AD<double>
97 Z[0] *= U[0]; // AD<double> *= AD<double>
9898
9999 // create f: U -> Z and vectors used for derivative calculations
100 ADFun<double> f(U, Z);
100 ADFun<double> f(U, Z);
101101 CPPAD_TESTVECTOR(double) v(1);
102102 CPPAD_TESTVECTOR(double) w(1);
103103
104 // check value
104 // check value
105105 ok &= NearEqual(Z[0] , u0*2*4*u0, 1e-10 , 1e-10);
106106
107107 // forward computation of partials w.r.t. u
118118 else value = 0.;
119119
120120 jfac *= j;
121 w = f.Forward(j, v);
121 w = f.Forward(j, v);
122122 ok &= NearEqual(jfac*w[0], value, 1e-10 , 1e-10); // d^jz/du^j
123123 v[0] = 0.;
124124 }
125125
126126 // reverse computation of partials of Taylor coefficients
127 CPPAD_TESTVECTOR(double) r(p);
127 CPPAD_TESTVECTOR(double) r(p);
128128 w[0] = 1.;
129129 r = f.Reverse(p, w);
130130 jfac = 1.;
148148 bool MulEq(void)
149149 { bool ok = true;
150150 ok &= MulEqTestOne();
151 ok &= MulEqTestTwo();
151 ok &= MulEqTestTwo();
152152 return ok;
153153 }
0 /* $Id: mul_level.cpp 3071 2014-01-01 04:02:27Z bradbell $ */
0 // $Id: mul_level.cpp 3785 2016-02-08 12:53:06Z bradbell $
11 /* --------------------------------------------------------------------------
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-13 Bradley M. Bell
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33
44 CppAD is distributed under multiple licenses. This distribution is under
5 the terms of the
5 the terms of the
66 GNU General Public License Version 3.
77
88 A copy of this license is included in the COPYING file of this distribution.
1414 # include <adolc/adouble.h>
1515 # include <adolc/taping.h>
1616 # include <adolc/interfaces.h>
17 // adouble definitions not in Adolc distribution and
17 // adouble definitions not in Adolc distribution and
1818 // required in order to use CppAD::AD<adouble>
1919 # include <cppad/example/base_adolc.hpp>
2020 # endif
2424
2525 namespace { // BEGIN empty namespace
2626
27 bool One(void)
27 bool One(void)
2828 { bool ok = true; // initialize test result
2929 using CppAD::NearEqual;
3030 double eps = 10. * std::numeric_limits<double>::epsilon();
9393 sum += x[i] * x[i];
9494
9595 // check computed assignment AD< AD<double> > -= int
96 sum -= 1;
97
98 // check double * AD< AD<double> >
96 sum -= 1;
97
98 // check double * AD< AD<double> >
9999 return .5 * sum;
100 }
101
102 bool Two(void)
100 }
101
102 bool Two(void)
103103 { bool ok = true; // initialize test result
104104
105105 typedef CppAD::AD<double> ADdouble; // for one level of taping
126126 // declare inner function (corresponding to ADDdouble calculation)
127127 CppAD::ADFun<ADdouble> a_F(aa_x, aa_f);
128128
129 // compute f'(x)
129 // compute f'(x)
130130 size_t p = 1; // order of derivative of a_F
131131 CPPAD_TESTVECTOR(ADdouble) a_w(1); // weight vector for a_F
132132 CPPAD_TESTVECTOR(ADdouble) a_df(n); // value of derivative
154154
155155 # ifdef CPPAD_ADOLC_TEST
156156
157 bool adolc(void)
157 bool adolc(void)
158158 { bool ok = true; // initialize test result
159159
160160 typedef adouble ADdouble; // for first level of taping
185185 // declare inner function (corresponding to ADDdouble calculation)
186186 CppAD::ADFun<ADdouble> a_F(aa_x, aa_f);
187187
188 // compute f'(x)
188 // compute f'(x)
189189 size_t p = 1; // order of derivative of a_F
190190 CPPAD_TESTVECTOR(ADdouble) a_w(1); // weight vector for a_F
191191 CPPAD_TESTVECTOR(ADdouble) a_df(n); // value of derivative
192192 a_w[0] = 1; // weighted function same as a_F
193193 a_df = a_F.Reverse(p, a_w); // gradient of f
194194
195 // declare outter function
195 // declare outter function
196196 // (corresponding to the tape of adouble operations)
197197 double df_j;
198198 for(j = 0; j < n; j++)
250250 ay = af.Forward(0, ax);
251251 ADFun<double> g(ax, ay);
252252
253 // evaluate h(x) = g(x)
253 // evaluate h(x) = g(x)
254254 x[0] = 1.;
255255 y = g.Forward(0, x);
256256
0 /* $Id: mul_zero_one.cpp 2506 2012-10-24 19:36:49Z bradbell $ */
0 // $Id: mul_zero_one.cpp 3785 2016-02-08 12:53:06Z bradbell $
11 /* --------------------------------------------------------------------------
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-12 Bradley M. Bell
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33
44 CppAD is distributed under multiple licenses. This distribution is under
5 the terms of the
5 the terms of the
66 GNU General Public License Version 3.
77
88 A copy of this license is included in the COPYING file of this distribution.
1919 typedef CppAD::AD< ADdouble > ADDdouble;
2020
2121 bool MulZeroOne(void)
22 {
22 {
2323 using namespace CppAD;
2424
2525 bool ok = true;
0 /* $Id: near_equal_ext.cpp 2506 2012-10-24 19:36:49Z bradbell $ */
0 // $Id: near_equal_ext.cpp 3785 2016-02-08 12:53:06Z bradbell $
11 /* --------------------------------------------------------------------------
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-06 Bradley M. Bell
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33
44 CppAD is distributed under multiple licenses. This distribution is under
5 the terms of the
5 the terms of the
66 GNU General Public License Version 3.
77
88 A copy of this license is included in the COPYING file of this distribution.
2121 using CppAD::AD;
2222 using CppAD::NearEqual;
2323
24 // double
24 // double
2525 double x = 1.00000;
2626 double y = 1.00001;
2727 double a = .00005;
2828 double r = .00005;
29 double zero = 0.;
29 double zero = 0.;
3030 double inf = 1. / zero;
3131 double nan = 0. / zero;
3232
33 // AD<double>
33 // AD<double>
3434 AD<double> X(x);
3535 AD<double> Y(y);
3636 AD<double> Inf(inf);
0 /* $Id: neg.cpp 2506 2012-10-24 19:36:49Z bradbell $ */
0 // $Id: neg.cpp 3785 2016-02-08 12:53:06Z bradbell $
11 /* --------------------------------------------------------------------------
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-12 Bradley M. Bell
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33
44 CppAD is distributed under multiple licenses. This distribution is under
5 the terms of the
5 the terms of the
66 GNU General Public License Version 3.
77
88 A copy of this license is included in the COPYING file of this distribution.
3434 size_t x = 0;
3535
3636 // dependent variable values
37 Z[x] = - U[t]; // - AD<double>
37 Z[x] = - U[t]; // - AD<double>
3838
3939 // create f: U -> Z and vectors used for derivative calculations
4040 ADFun<double> f(U, Z);
6262 r = f.Reverse(2, w);
6363 ok &= ( r[2 * s + 1] == 0. ); // d^2 x / (ds ds)
6464 ok &= ( r[2 * t + 1] == 0. ); // d^2 x / (ds dt)
65
65
6666 return ok;
6767 }
6868 // END C++
0 /* $Id: parameter.cpp 2506 2012-10-24 19:36:49Z bradbell $ */
0 // $Id: parameter.cpp 3785 2016-02-08 12:53:06Z bradbell $
11 /* --------------------------------------------------------------------------
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-12 Bradley M. Bell
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33
44 CppAD is distributed under multiple licenses. This distribution is under
5 the terms of the
5 the terms of the
66 GNU General Public License Version 3.
77
88 A copy of this license is included in the COPYING file of this distribution.
3030 size_t j, n = n_parameter * n_repeat;
3131 CPPAD_TESTVECTOR(AD<Float>) ax(n);
3232 for(j = 0; j < n; j++)
33 ax[j] = Float(j);
33 ax[j] = Float(j);
3434 Independent(ax);
3535
3636 // dependent variable vector and indices
3737 size_t i, m = n;
3838 CPPAD_TESTVECTOR(AD<Float>) ay(m);
3939 for(i = 0; i < m; i++)
40 { // must avoid Float(k) = 0 because it would get optimized out
41 size_t k = (i % n_parameter);
40 { // must avoid Float(k) = 0 because it would get optimized out
41 size_t k = (i % n_parameter);
4242 k = k * k * 10 + 1;
4343 j = i;
4444 ay[i] = ax[j] + Float(k);
4545 }
4646
47 // create f: ax -> ay
47 // create f: ax -> ay
4848 ADFun<Float> f(ax, ay);
4949
5050 ok = f.size_par() == n_parameter;
5757 bool parameter(void)
5858 { bool ok = true;
5959 ok &= test<double>();
60 ok &= test<float>();
60 ok &= test<float>();
6161 return ok;
6262 }
0 /* $Id: poly.cpp 2506 2012-10-24 19:36:49Z bradbell $ */
0 // $Id: poly.cpp 3785 2016-02-08 12:53:06Z bradbell $
11 /* --------------------------------------------------------------------------
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-12 Bradley M. Bell
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33
44 CppAD is distributed under multiple licenses. This distribution is under
5 the terms of the
5 the terms of the
66 GNU General Public License Version 3.
77
88 A copy of this license is included in the COPYING file of this distribution.
4141 Z[0] = 3.; // value of independent variable
4242 Independent(Z); // declare independent variable
4343
44 // dependent variables
44 // dependent variables
4545 CPPAD_TESTVECTOR(AD<double>) P(1); // one dependent variable
4646 P[0] = Poly(0, A, Z[0]); // value of polynomial at Z[0]
4747
48 // define f : Z -> P as a function mapping independent to dependent
48 // define f : Z -> P as a function mapping independent to dependent
4949 ADFun<double> f(Z, P); // ADFun corresponding to polynomial
5050
5151 // compute derivative of polynomial
0 /* $Id: pow.cpp 2506 2012-10-24 19:36:49Z bradbell $ */
0 // $Id: pow.cpp 3785 2016-02-08 12:53:06Z bradbell $
11 /* --------------------------------------------------------------------------
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-12 Bradley M. Bell
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33
44 CppAD is distributed under multiple licenses. This distribution is under
5 the terms of the
5 the terms of the
66 GNU General Public License Version 3.
77
88 A copy of this license is included in the COPYING file of this distribution.
3333 // declare independent variables and start tape recording
3434 CppAD::Independent(XY);
3535
36 // range space vector
36 // range space vector
3737 size_t m = 3;
3838 CPPAD_TESTVECTOR(AD<double>) Z(m);
3939 Z[0] = CppAD::pow(XY[0], XY[1]); // pow(variable, variable)
4141 Z[2] = CppAD::pow(x, XY[1]); // pow(parameter, variable)
4242
4343 // create f: XY -> Z and stop tape recording
44 CppAD::ADFun<double> f(XY, Z);
45
46 // check value
44 CppAD::ADFun<double> f(XY, Z);
45
46 // check value
4747 double check = std::pow(x, y);
4848 size_t i;
4949 for(i = 0; i < m; i++)
151151 w = f.Forward(1, v);
152152 ok &= ( w[y] == U[s] * u * Z[y] ); // dy/dt
153153
154 // forward computation of second Taylor coefficient w.r.t. t
154 // forward computation of second Taylor coefficient w.r.t. t
155155 v[t] = 1.;
156156 w = f.Forward(1, v);
157157 v[t] = 0.;
158158 CPPAD_TESTVECTOR(double) f_tt = f.Forward(2, v);
159159
160 // forward computation of second Taylor coefficient w.r.t. s
160 // forward computation of second Taylor coefficient w.r.t. s
161161 v[s] = 1.;
162162 w = f.Forward(1, v);
163163 v[s] = 0.;
164164 CPPAD_TESTVECTOR(double) f_ss = f.Forward(2, v);
165165
166 // second Taylor coefficient w.r.t. direction r = (s,t)
166 // second Taylor coefficient w.r.t. direction r = (s,t)
167167 v[s] = 1.;
168168 v[t] = 1.;
169169 w = f.Forward(1, v);
173173
174174 // check second order partial of y
175175 ok &= NearEqual(
176 f_rr[y] - f_ss[y] - f_tt[y],
177 (1. + U[s]) * u * Z[y] +
176 f_rr[y] - f_ss[y] - f_tt[y],
177 (1. + U[s]) * u * Z[y] +
178178 (1. + U[s]) * U[t] * u * U[s] * u * Z[y],
179179 1e-10 ,
180 1e-10
181 );
180 1e-10
181 );
182182
183183 return ok;
184184 }
197197 // declare independent variables and start tape recording
198198 CppAD::Independent(x);
199199
200 // range space vector
200 // range space vector
201201 size_t m = 4;
202202 CPPAD_TESTVECTOR(AD<double>) y(m);
203203
208208 y[3] = pow(1., x[0]);
209209
210210 // create f: x -> y and stop tape recording
211 CppAD::ADFun<double> f(x, y);
211 CppAD::ADFun<double> f(x, y);
212212
213213 // check function values
214214 ok &= (Value(y[0]) == 1.);
226226 ok &= NearEqual(dy[2], 1., 1e-10, 1e-10);
227227 ok &= (dy[3] == 0.);
228228
229 // reverse mode computation of derivative of y[0]+y[1]+y[2]+y[3]
229 // reverse mode computation of derivative of y[0]+y[1]+y[2]+y[3]
230230 CPPAD_TESTVECTOR(double) w(m);
231231 CPPAD_TESTVECTOR(double) dw(n);
232232 w[0] = 1.;
236236 dw = f.Reverse(1, w);
237237 ok &= NearEqual(dw[0], 1., 1e-10, 1e-10);
238238
239 return ok;
239 return ok;
240240 }
241241
242242 bool PowTestFour(void)
254254 // declare independent variables and start tape recording
255255 CppAD::Independent(x);
256256
257 // range space vector
257 // range space vector
258258 size_t m = 5;
259259 CPPAD_TESTVECTOR(AD<double>) y(m);
260260
261261 // some special cases (skip zero raised to a negative power)
262262 y[0] = pow(1., x[0]);
263263 size_t i;
264 for(i = 1; i < m; i++)
264 for(i = 1; i < m; i++)
265265 y[i] = pow(x[0], i-1); // pow(AD<double>, int)
266266
267267 // create f: x -> y and stop tape recording
268 CppAD::ADFun<double> f(x, y);
268 CppAD::ADFun<double> f(x, y);
269269
270270 ok &= (Value(y[0]) == 1.);
271271 double check;
297297 dw = f.Reverse(1, w);
298298 ok &= NearEqual(dw[0], sum, 1e-10, 1e-10);
299299
300 return ok;
300 return ok;
301301 }
302302 bool PowTestFive(void)
303303 { bool ok = true;
314314 // declare independent variables and start tape recording
315315 CppAD::Independent(x);
316316
317 // range space vector
317 // range space vector
318318 size_t m = 1;
319319 CPPAD_TESTVECTOR(AD<double>) y(m);
320320
323323 y[0] = pow(x[0], int(e)); // use pow(AD<double>, int)
324324
325325 // create f: x -> y and stop tape recording
326 CppAD::ADFun<double> f(x, y);
326 CppAD::ADFun<double> f(x, y);
327327
328328 // check function value
329329 ok &= (Value(y[0]) == pow(x0, e) );
336336 dy = f.Forward(1, dx);
337337 ok &= NearEqual(dy[0], d1, 1e-10, 1e-10);
338338
339 // reverse mode computation of second partials
339 // reverse mode computation of second partials
340340 // x.r.t. x[1],x[0] and x[1], x[1]
341341 double d2 = e * (e-1) * pow(x0, (e-2));
342342 CPPAD_TESTVECTOR(double) w(m);
346346 ok &= NearEqual(ddw[0], d1, 1e-10, 1e-10);
347347 ok &= NearEqual(ddw[1], d2, 1e-10, 1e-10);
348348
349 return ok;
349 return ok;
350350 }
351351 bool PowTestSix(void)
352352 { bool ok = true;
367367 // declare independent variables and start tape recording
368368 CppAD::Independent(X);
369369
370 // range space vector
370 // range space vector
371371 size_t m = 1;
372372 CPPAD_TESTVECTOR(AD< AD<double> >) Y(m);
373373
374374 // case of AD< AD<double> > raised to a double power
375375 double e = 2.5;
376 Y[0] = pow(X[0], e);
376 Y[0] = pow(X[0], e);
377377
378378 // create F: X -> Y and stop tape recording
379 CppAD::ADFun< AD<double> > F(X, Y);
379 CppAD::ADFun< AD<double> > F(X, Y);
380380
381381 // check function value
382382 ok &= (Value( Value(Y[0]) ) == pow(x0, e) );
389389 dy = F.Forward(1, dx);
390390 ok &= NearEqual(dy[0], d1, 1e-10, 1e-10);
391391
392 // reverse mode computation of second partials
392 // reverse mode computation of second partials
393393 // x.r.t. x[1],x[0] and x[1], x[1]
394394 double d2 = e * (e-1) * pow(x0, (e-2));
395395 CPPAD_TESTVECTOR(AD<double>) w(m);
399399 ok &= NearEqual(ddw[0], d1, 1e-10, 1e-10);
400400 ok &= NearEqual(ddw[1], d2, 1e-10, 1e-10);
401401
402 return ok;
402 return ok;
403403 }
404404
405405 } // END empty namespace
406
406
407407 bool Pow(void)
408408 { bool ok = true;
409409 ok &= PowTestOne();
0 /* $Id: pow_int.cpp 2506 2012-10-24 19:36:49Z bradbell $ */
0 // $Id: pow_int.cpp 3785 2016-02-08 12:53:06Z bradbell $
11 /* --------------------------------------------------------------------------
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-12 Bradley M. Bell
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33
44 CppAD is distributed under multiple licenses. This distribution is under
5 the terms of the
5 the terms of the
66 GNU General Public License Version 3.
77
88 A copy of this license is included in the COPYING file of this distribution.
5151 ok &= NearEqual(Z[0] , exp( log(u) * 5.), 1e-10 , 1e-10);
5252 ok &= NearEqual(Z[1] , exp( - log(u) * 5.), 1e-10 , 1e-10);
5353
54 // forward computation of partials
54 // forward computation of partials
5555 v[0] = 1.;
5656 w = f.Forward(1, v);
5757 ok &= NearEqual(w[0] , 5. * exp( log(u) * 4.), 1e-10 , 1e-10);
0 /* $Id: print_for.cpp 2506 2012-10-24 19:36:49Z bradbell $ */
0 // $Id: print_for.cpp 3785 2016-02-08 12:53:06Z bradbell $
11 /* --------------------------------------------------------------------------
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-12 Bradley M. Bell
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33
44 CppAD is distributed under multiple licenses. This distribution is under
5 the terms of the
5 the terms of the
66 GNU General Public License Version 3.
77
88 A copy of this license is included in the COPYING file of this distribution.
1212 // modified version of test that used to be in ../print_for/print_for.cpp
1313 # include <cppad/cppad.hpp>
1414
15 namespace {
15 namespace {
1616 using std::endl;
1717 using CppAD::AD;
1818
2525 PrintFor(y, "check_log: y == ", y , " which is <= 0\n");
2626
2727 return log(y);
28 }
28 }
2929 }
3030
3131 bool print_for(void)
4545 CppAD::VecAD<double> av(1);
4646 AD<double> Zero(0);
4747 av[Zero] = 0.;
48 PrintFor("v[0] = ", av[Zero]);
48 PrintFor("v[0] = ", av[Zero]);
4949 string_check += "v[0] = 0"; // v[0] == 0 during Forward(0, x)
5050
5151 // Print a newline to separate this from previous output,
5252 // then print an AD<double> object that is a variable.
53 PrintFor("\nv[0] + x[0] = ", av[0] + ax[0]);
54 string_check += "\nv[0] + x[0] = 2"; // x[0] == 2 during Forward(0, x)
53 PrintFor("\nv[0] + x[0] = ", av[0] + ax[0]);
54 string_check += "\nv[0] + x[0] = 2"; // x[0] == 2 during Forward(0, x)
5555
5656 // A conditional print that will not generate output when x[0] = 2.
5757 PrintFor(ax[0], "\n 2. + x[0] = ", 2. + ax[0], "\n");
6565 AD<double> log_var = check_log(var);
6666 string_check += "check_log: y == 0 which is <= 0\n";
6767
68 // dependent variable vector
68 // dependent variable vector
6969 size_t m = 2;
7070 CPPAD_TESTVECTOR(AD<double>) ay(m);
7171 ay[0] = av[Zero] + ax[0];
7272
7373 // define f: x -> y and stop tape recording
74 CppAD::ADFun<double> f(ax, ay);
74 CppAD::ADFun<double> f(ax, ay);
7575
76 // zero order forward with x[0] = 2
76 // zero order forward with x[0] = 2
7777 CPPAD_TESTVECTOR(double) x(n);
7878 x[0] = 2.;
79 f.Forward(0, x, stream_out);
79 f.Forward(0, x, stream_out);
8080
8181 std::string string_out = stream_out.str();
82 ok &= string_out == string_check;
82 ok &= string_out == string_check;
8383 return ok;
8484 }
0 /* $Id: rev_sparse_hes.cpp 2935 2013-10-12 19:40:01Z bradbell $ */
0 // $Id: rev_sparse_hes.cpp 3785 2016-02-08 12:53:06Z bradbell $
11 /* --------------------------------------------------------------------------
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-13 Bradley M. Bell
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33
44 CppAD is distributed under multiple licenses. This distribution is under
5 the terms of the
5 the terms of the
66 GNU General Public License Version 3.
77
88 A copy of this license is included in the COPYING file of this distribution.
1111
1212
1313 # include <cppad/cppad.hpp>
14
14
1515 namespace { // Begin empty namespace
1616
1717 bool case_one()
1919 using namespace CppAD;
2020
2121 // dimension of the domain space
22 size_t n = 10;
22 size_t n = 10;
2323
2424 // dimension of the range space
2525 size_t m = 2;
3232 for(j = 0; j < n * n; j++)
3333 Check[j] = false;
3434
35 // independent variable vector
35 // independent variable vector
3636 CPPAD_TESTVECTOR(AD<double>) X(n);
3737 for(j = 0; j < n; j++)
3838 X[j] = AD<double>(j);
5353 sum += CondExpLt(X[1], X[2], sin(X[6]), cos(X[7]) );
5454 Check[6 * n + 6] = true;
5555 Check[7 * n + 7] = true;
56
56
5757 // pow(variable, variable)
5858 sum += pow(X[8], X[9]);
5959 Check[8 * n + 8] = Check[8 * n + 9] = true;
8181 // compute sparsity pattern for Jacobian of F(U(x))
8282 F.ForSparseJac(n, Px);
8383
84 // compute sparsity pattern for Hessian of F_0 ( U(x) )
84 // compute sparsity pattern for Hessian of F_0 ( U(x) )
8585 CPPAD_TESTVECTOR(bool) Py(m);
8686 Py[0] = true;
8787 Py[1] = false;
108108 // compute sparsity pattern for Jacobian of F(U(x))
109109 F.ForSparseJac(n, Sx);
110110
111 // compute sparsity pattern for Hessian of F_0 ( U(x) )
111 // compute sparsity pattern for Hessian of F_0 ( U(x) )
112112 CPPAD_TESTVECTOR(std::set<size_t>) Sy(1);
113113 Sy[0].insert(0);
114114 CPPAD_TESTVECTOR(std::set<size_t>) Sxx(n);
141141 using namespace CppAD;
142142
143143 // dimension of the domain space
144 size_t n = 4;
144 size_t n = 4;
145145
146146 // dimension of the range space
147147 size_t m = 1;
154154 for(j = 0; j < n * n; j++)
155155 Check[j] = false;
156156
157 // independent variable vector
157 // independent variable vector
158158 CPPAD_TESTVECTOR(AD<double>) X(n);
159159 for(j = 0; j < n; j++)
160160 X[j] = AD<double>(j);
161161 Independent(X);
162162
163163 // Test the case where dependent variable is a non-linear function
164 // of the result of a conditional expression.
164 // of the result of a conditional expression.
165165 CPPAD_TESTVECTOR(AD<double>) Y(m);
166166 Y[0] = CondExpLt(X[0], X[1], X[2], X[3]);
167167 Y[0] = cos(Y[0]) + X[0] + X[1];
172172 // inefficiency of the conditional expression operator).
173173 Check[2 * n + 2] = Check[ 2 * n + 3 ] = true;
174174 Check[3 * n + 2] = Check[ 3 * n + 3 ] = true;
175
175
176176 // create function object F : X -> Y
177177 ADFun<double> F(X, Y);
178178
188188 // compute sparsity pattern for Jacobian of F(U(x))
189189 F.ForSparseJac(n, Px);
190190
191 // compute sparsity pattern for Hessian of F_0 ( U(x) )
191 // compute sparsity pattern for Hessian of F_0 ( U(x) )
192192 CPPAD_TESTVECTOR(bool) Py(m);
193193 Py[0] = true;
194194 CPPAD_TESTVECTOR(bool) Pxx(n * n);
207207 // compute sparsity pattern for Jacobian of F(U(x))
208208 F.ForSparseJac(n, Sx);
209209
210 // compute sparsity pattern for Hessian of F_0 ( U(x) )
210 // compute sparsity pattern for Hessian of F_0 ( U(x) )
211211 CPPAD_TESTVECTOR(std::set<size_t>) Sy(1);
212212 Sy[0].insert(0);
213213 CPPAD_TESTVECTOR(std::set<size_t>) Sxx(n);
229229 using CppAD::AD;
230230
231231 // domain space vector
232 size_t n = 1;
232 size_t n = 1;
233233 CPPAD_TESTVECTOR(AD<double>) X(n);
234 X[0] = 0.;
234 X[0] = 0.;
235235
236236 // declare independent variables and start recording
237237 CppAD::Independent(X);
280280 // compute sparsity pattern for Jacobian of F(U(x))
281281 f.ForSparseJac(n, Sx);
282282
283 // compute sparsity pattern for Hessian of F_0 ( U(x) )
283 // compute sparsity pattern for Hessian of F_0 ( U(x) )
284284 CPPAD_TESTVECTOR(std::set<size_t>) Sy(1);
285285 Sy[0].insert(0);
286286 CPPAD_TESTVECTOR(std::set<size_t>) Sxx(n);
298298 using namespace CppAD;
299299
300300 // dimension of the domain space
301 size_t n = 3;
301 size_t n = 3;
302302
303303 // dimension of the range space
304304 size_t m = 1;
309309 for(k = 0; k < n-1; k++)
310310 Z[k] = 0.;
311311
312 // independent variable vector
312 // independent variable vector
313313 CPPAD_TESTVECTOR(AD<double>) X(n);
314 X[0] = 0.;
314 X[0] = 0.;
315315 X[1] = 1.;
316316 X[2] = 2.;
317317 Independent(X);
319319 // VecAD vector z depends on both x[1] and x[2]
320320 // (component indices do not matter because they can change).
321321 Z[ X[0] ] = X[1] * X[2];
322 Z[ X[1] ] = 0.;
322 Z[ X[1] ] = 0.;
323323
324324 // dependent variable vector
325325 CPPAD_TESTVECTOR(AD<double>) Y(m);
365365 for(i = 0; i < n; i++)
366366 { for(j = 0; j < n; j++)
367367 ok &= (h[i * n + j] == Check[i * n + j]);
368 }
368 }
369369
370370 // ------------------------------------------------------------------
371371 // sparsity pattern for the identity function U(x) = x
376376 // compute sparsity pattern for Jacobian of F(U(x))
377377 F.ForSparseJac(n, Sx);
378378
379 // compute sparsity pattern for Hessian of F_0 ( U(x) )
379 // compute sparsity pattern for Hessian of F_0 ( U(x) )
380380 CPPAD_TESTVECTOR(std::set<size_t>) Sy(1);
381381 Sy[0].insert(0);
382382 CPPAD_TESTVECTOR(std::set<size_t>) Sxx(n);
399399 size_t i, j, k;
400400
401401 size_t n = 2;
402 CPPAD_TESTVECTOR(AD<double>) X(n);
402 CPPAD_TESTVECTOR(AD<double>) X(n);
403403 X[0] = 1.;
404404 X[1] = 2.;
405405 CppAD::Independent(X);
421421 // compute sparsity pattern for Jacobian of F(U(x))
422422 F.ForSparseJac(n, Px);
423423
424 // compute sparsity pattern for Hessian of F_k ( U(x) )
424 // compute sparsity pattern for Hessian of F_k ( U(x) )
425425 CPPAD_TESTVECTOR(bool) Py(m);
426426 CPPAD_TESTVECTOR(bool) Pxx(n * n);
427427 for(k = 0; k < m; k++)
444444 using namespace CppAD;
445445
446446 // dimension of the domain space
447 size_t n = 3;
447 size_t n = 3;
448448
449449 // dimension of the range space
450450 size_t m = 1;
451451
452 // independent variable vector
452 // independent variable vector
453453 CPPAD_TESTVECTOR(AD<double>) X(n);
454 X[0] = 0.;
454 X[0] = 0.;
455455 X[1] = 1.;
456456 X[2] = 2.;
457457 Independent(X);
511511 for(i = 0; i < n; i++)
512512 { for(j = 0; j < n; j++)
513513 ok &= (h[i * n + j] == Check[i * n + j]);
514 }
514 }
515515
516516 // compute the reverse Hessian sparsity pattern for R^T * F^2
517517 transpose = false;
521521 for(i = 0; i < n; i++)
522522 { for(j = 0; j < n; j++)
523523 ok &= (h[j * n + i] == Check[i * n + j]);
524 }
524 }
525525
526526 return ok;
527527 }
0 /* $Id: reverse.cpp 2859 2013-05-28 06:03:21Z bradbell $ */
0 // $Id: reverse.cpp 3785 2016-02-08 12:53:06Z bradbell $
11 /* --------------------------------------------------------------------------
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-13 Bradley M. Bell
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33
44 CppAD is distributed under multiple licenses. This distribution is under
5 the terms of the
5 the terms of the
66 GNU General Public License Version 3.
77
88 A copy of this license is included in the COPYING file of this distribution.
2121
2222 using namespace CppAD;
2323
24 // independent variable vector
24 // independent variable vector
2525 CPPAD_TESTVECTOR(AD<double>) U(3);
2626 U[0] = 0.; U[1] = 1.; U[2] = 2.;
2727 Independent(U);
3535 Prod *= U[i];
3636 }
3737
38 // dependent variable vector
38 // dependent variable vector
3939 CPPAD_TESTVECTOR(AD<double>) V(2);
4040 V[0] = Sum;
4141 V[1] = Prod;
6060
6161 // compare values
6262 for(i = 0; i < 3; i++)
63 { ok &= NearEqual(r1[i] ,
63 { ok &= NearEqual(r1[i] ,
6464 v[0] * g0[i] + v[1] * g1[i], 1e-10, 1e-10);
6565 }
6666
8484
8585 // check derivative of the zero order term
8686 for(i = 0; i < 3; i++)
87 { ok &= NearEqual(r2[p * i + 0] ,
87 { ok &= NearEqual(r2[p * i + 0] ,
8888 v[0] * g0[i] + v[1] * g1[i], 1e-10, 1e-10);
8989 }
9090
9191 /*
92 The j-th component of the first order term is
92 The j-th component of the first order term is
9393 d/dt z_j(0, u0, u1) = f_j^{(1)} (u0) * u1
9494 We use ei to denote the vector with its i-th component one and all
9595 the other components zero. The partial derivative of the j-th
96 component of the first order term with respect u0[i] is
96 component of the first order term with respect u0[i] is
9797 ei * f_j^{(2)} ( u0 ) * u1
9898 */
9999
120120 }
121121
122122 // define the template function reverse_any_cases<Vector> in empty namespace
123 template <typename Vector>
123 template <typename Vector>
124124 bool reverse_any_cases(void)
125125 { bool ok = true;
126126 using CppAD::AD;
129129 // domain space vector
130130 size_t n = 3;
131131 CPPAD_TESTVECTOR(AD<double>) X(n);
132 X[0] = 0.;
132 X[0] = 0.;
133133 X[1] = 1.;
134134 X[2] = 2.;
135135
217217
218218 $index composition, example$$
219219 $index example, composition$$
220 $index test, composition$$
220 $index test, composition$$
221221
222222 $head Purpose$$
223 Break a derivative computation into pieces and only store values at the
223 Break a derivative computation into pieces and only store values at the
224224 interface of the pieces.
225 In actual applications, there may be many functions, but
225 In actual applications, there may be many functions, but
226226 for this example there are only two.
227 The functions
228 $latex F : \B{R}^2 \rightarrow \B{R}^2$$
227 The functions
228 $latex F : \B{R}^2 \rightarrow \B{R}^2$$
229229 and
230 $latex G : \B{R}^2 \rightarrow \B{R}^2$$
230 $latex G : \B{R}^2 \rightarrow \B{R}^2$$
231231 defined by
232232 $latex \[
233 F(x) = \left( \begin{array}{c} x_0 x_1 \\ x_1 - x_0 \end{array} \right)
233 F(x) = \left( \begin{array}{c} x_0 x_1 \\ x_1 - x_0 \end{array} \right)
234234 \; , \;
235 G(y) = \left( \begin{array}{c} y_0 - y_1 \\ y_1 y_0 \end{array} \right)
235 G(y) = \left( \begin{array}{c} y_0 - y_1 \\ y_1 y_0 \end{array} \right)
236236 \] $$
237237 Another difference is that in actual applications,
238238 the memory corresponding to function objects not currently being used
244244 is defined by
245245 $latex \[
246246 \begin{array}{rcl}
247 H(x)
248 & = & G_0 [ F(x) ] + G_1 [ F(x) ]
249 \\
250 & = & x_0 x_1 - ( x_1 - x_0 ) + x_0 x_1 ( x_1 - x_0 )
247 H(x)
248 & = & G_0 [ F(x) ] + G_1 [ F(x) ]
249 \\
250 & = & x_0 x_1 - ( x_1 - x_0 ) + x_0 x_1 ( x_1 - x_0 )
251251 \\
252252 & = & x_0 x_1 ( 1 - x_0 + x_1 ) - x_1 + x_0
253253 \end{array}
254 \] $$
255 Given the zero and first order Taylor coefficients
254 \] $$
255 Given the zero and first order Taylor coefficients
256256 $latex x^{(0)} $$ and $latex x^{(1)}$$,
257257 we use $latex X(t)$$, $latex Y(t)$$ and $latex Z(t)$$
258258 for the corresponding functions; i.e.,
259259 $latex \[
260260 \begin{array}{rcl}
261 X(t) & = & x^{(0)} + x^{(1)} t
261 X(t) & = & x^{(0)} + x^{(1)} t
262262 \\
263263 Y(t) & = & F[X(t)] = y^{(0)} + y^{(1)} t + O(t^2)
264264 \\
271271 \] $$
272272 Here are the processing steps:
273273 $list number$$
274 Use forward mode on $latex F(x)$$ to compute
275 $latex y^{(0)}$$ and $latex y^{(1)}$$
274 Use forward mode on $latex F(x)$$ to compute
275 $latex y^{(0)}$$ and $latex y^{(1)}$$
276276 $lnext
277 Use forward mode on $latex G(y)$$ to compute
278 $latex z^{(0)}$$ and $latex z^{(1)}$$
277 Use forward mode on $latex G(y)$$ to compute
278 $latex z^{(0)}$$ and $latex z^{(1)}$$
279279 $lnext
280 Use reverse mode on $latex G(y)$$ to compute the derivative of
280 Use reverse mode on $latex G(y)$$ to compute the derivative of
281281 $latex h^{(k)}$$ with respect to
282282 $latex y^{(0)}$$ and $latex y^{(1)}$$.
283283 $lnext
387387 w[0*p+0] = 1.; // coefficient for z^0_0
388388 w[1*p+0] = 1.; // coefficient for z^0_1
389389 w[0*p+1] = 0.; // coefficient for z^1_0
390 w[1*p+1] = 0.; // coefficient for z^1_1
390 w[1*p+1] = 0.; // coefficient for z^1_1
391391 dw = g.Reverse(p, w);
392392
393 // dv^0 = dw^0 * \partial_x^0 y^0 (x) + dw^1 * \partial_x^0 y^1 (x)
394 // dv^1 = dw^0 * \partial_x^1 y^0 (x) + dw^1 * \partial_x^1 y^1 (x)
393 // dv^0 = dw^0 * \partial_x^0 y^0 (x) + dw^1 * \partial_x^0 y^1 (x)
394 // dv^1 = dw^0 * \partial_x^1 y^0 (x) + dw^1 * \partial_x^1 y^1 (x)
395395 CPPAD_TESTVECTOR(double) dv(n*p);
396 dv = f.Reverse(p, dw);
396 dv = f.Reverse(p, dw);
397397
398398 // check partial of h^0 w.r.t x^0_0
399399 check = x0[1] * (1. - x0[0] + x0[1]) + 1.;
416416 w[0*p+0] = 0.; // coefficient for z^0_0
417417 w[1*p+0] = 0.; // coefficient for z^0_1
418418 w[0*p+1] = 1.; // coefficient for z^1_0
419 w[1*p+1] = 1.; // coefficient for z^1_1
419 w[1*p+1] = 1.; // coefficient for z^1_1
420420 dw = g.Reverse(p, w);
421421
422 // dv^0 = dw^0 * \partial_x^0 y^0 (x) + dw^1 * \partial_x^0 y^1 (x)
423 // dv^1 = dw^0 * \partial_x^1 y^0 (x) + dw^1 * \partial_x^1 y^1 (x)
424 dv = f.Reverse(p, dw);
422 // dv^0 = dw^0 * \partial_x^0 y^0 (x) + dw^1 * \partial_x^0 y^1 (x)
423 // dv^1 = dw^0 * \partial_x^1 y^0 (x) + dw^1 * \partial_x^1 y^1 (x)
424 dv = f.Reverse(p, dw);
425425
426426 // check partial of h^1 w.r.t x^0_0
427427 check = x0[1] * (- x1[0] + x1[1]);
431431
432432 // check partial of h^1 w.r.t x^0_1
433433 check = x0[0] * (- x1[0] + x1[1]);
434 check += x1[0] * (1. - x0[0] + x0[1]) + x1[0] * x0[1];
434 check += x1[0] * (1. - x0[0] + x0[1]) + x1[0] * x0[1];
435435 check += x0[0] * x1[1];
436436 ok &= NearEqual(dv[1*p+0], check, eps, eps);
437437
450450 return ok;
451451 }
452452 // ----------------------------------------------------------------------------
453 } // End empty namespace
453 } // End empty namespace
454454
455455 # include <vector>
456456 # include <valarray>
0 /* $Id: rosen_34.cpp 2506 2012-10-24 19:36:49Z bradbell $ */
0 // $Id: rosen_34.cpp 3785 2016-02-08 12:53:06Z bradbell $
11 /* --------------------------------------------------------------------------
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-12 Bradley M. Bell
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33
44 CppAD is distributed under multiple licenses. This distribution is under
5 the terms of the
5 the terms of the
66 GNU General Public License Version 3.
77
88 A copy of this license is included in the COPYING file of this distribution.
2222 /*
2323 Case where
2424 x[0](0) = 1, x[0]'(t) = - w[0] * x[0](t)
25 x[1](0) = 1, x[1]'(t) = - w[1] * x[1](t)
25 x[1](0) = 1, x[1]'(t) = - w[1] * x[1](t)
2626 x[2](0) = 0, x[2]'(t) = w[2] * t
2727
2828 x[0](t) = exp( - w[0] * t )
3838 w = w_;
3939 }
4040 void Ode(
41 const CppAD::AD<double> &t,
42 const CPPAD_TESTVECTOR(CppAD::AD<double>) &x,
43 CPPAD_TESTVECTOR(CppAD::AD<double>) &f)
41 const CppAD::AD<double> &t,
42 const CPPAD_TESTVECTOR(CppAD::AD<double>) &x,
43 CPPAD_TESTVECTOR(CppAD::AD<double>) &f)
4444 {
4545 f[0] = - w[0] * x[0];
4646 f[1] = - w[1] * x[1];
4747 f[2] = w[2] * t;
48
48
4949 }
50
50
5151 void Ode_ind(
52 const CppAD::AD<double> &t,
53 const CPPAD_TESTVECTOR(CppAD::AD<double>) &x,
54 CPPAD_TESTVECTOR(CppAD::AD<double>) &f_t)
52 const CppAD::AD<double> &t,
53 const CPPAD_TESTVECTOR(CppAD::AD<double>) &x,
54 CPPAD_TESTVECTOR(CppAD::AD<double>) &f_t)
5555 {
5656 f_t[0] = 0.;
5757 f_t[1] = 0.;
5858 f_t[2] = w[2];
59
59
6060 }
61
61
6262 void Ode_dep(
63 const CppAD::AD<double> &t,
64 const CPPAD_TESTVECTOR(CppAD::AD<double>) &x,
65 CPPAD_TESTVECTOR(CppAD::AD<double>) &f_x)
63 const CppAD::AD<double> &t,
64 const CPPAD_TESTVECTOR(CppAD::AD<double>) &x,
65 CPPAD_TESTVECTOR(CppAD::AD<double>) &f_x)
6666 {
6767 f_x[0] = - w[0]; f_x[1] = 0.; f_x[2] = 0.;
6868 f_x[3] = 0.; f_x[4] = - w[1]; f_x[5] = 0.;
6969 f_x[6] = 0.; f_x[7] = 0.; f_x[8] = 0.;
70
70
7171 }
72
72
7373 private:
7474 CPPAD_TESTVECTOR(CppAD::AD<double>) w;
7575 };
9595
9696 // construct the function object using the independent variables
9797 TestFun fun(w);
98
98
9999 // initial value of x
100100 CPPAD_TESTVECTOR(AD<double>) xini(3);
101101 xini[0] = 1.;
102102 xini[1] = 1.;
103103 xini[2] = 0.;
104
104
105105
106106 // integrate the differential equation
107107 x = Rosen34(fun, nstep, t0, t1, xini);
0 /* $Id: runge_45.cpp 2506 2012-10-24 19:36:49Z bradbell $ */
0 // $Id: runge_45.cpp 3785 2016-02-08 12:53:06Z bradbell $
11 /* --------------------------------------------------------------------------
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-12 Bradley M. Bell
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33
44 CppAD is distributed under multiple licenses. This distribution is under
5 the terms of the
5 the terms of the
66 GNU General Public License Version 3.
77
88 A copy of this license is included in the COPYING file of this distribution.
2525 w = w_;
2626 }
2727 void Ode(
28 const CppAD::AD<double> &t,
29 const CPPAD_TESTVECTOR(CppAD::AD<double>) &x,
30 CPPAD_TESTVECTOR(CppAD::AD<double>) &f)
28 const CppAD::AD<double> &t,
29 const CPPAD_TESTVECTOR(CppAD::AD<double>) &x,
30 CPPAD_TESTVECTOR(CppAD::AD<double>) &f)
3131 {
3232 using CppAD::exp;
33
33
3434 size_t n = x.size();
35
35
3636 size_t i;
3737 f[0] = 0.;
3838 for(i = 1; i < n-1; i++)
3939 f[i] = w[i] * x[i-1];
40
40
4141 f[n-1] = x[0] * x[1];
4242 }
4343 private:
116116 { // check partial of x[i] w.r.t w[j]
117117 if (j == 0 )
118118 ok &= NearEqual(q[j], x[i], 1e-14, 1e-14);
119 else if( j <= i )
119 else if( j <= i )
120120 ok &= NearEqual(
121121 q[j], x[i]/w[j], 1e-14, 1e-14);
122122 else ok &= NearEqual(q[j], 0., 1e-14, 1e-14);
134134 { // check partial of x[n-1] w.r.t w[j]
135135 if (j == 0 )
136136 ok &= NearEqual(q[j], 2.*x[i], 1e-14, 1e-14);
137 else if( j == 1 )
137 else if( j == 1 )
138138 ok &= NearEqual(
139139 q[j], x[i]/w[1], 1e-14, 1e-14);
140140 else ok &= NearEqual(q[j], 0., 1e-14, 1e-14);
0 /* $Id: sin.cpp 2506 2012-10-24 19:36:49Z bradbell $ */
0 // $Id: sin.cpp 3785 2016-02-08 12:53:06Z bradbell $
11 /* --------------------------------------------------------------------------
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-12 Bradley M. Bell
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33
44 CppAD is distributed under multiple licenses. This distribution is under
5 the terms of the
5 the terms of the
66 GNU General Public License Version 3.
77
88 A copy of this license is included in the COPYING file of this distribution.
2626 U[0] = 1.;
2727 Independent(U);
2828
29 // dependent variable vector
29 // dependent variable vector
3030 CPPAD_TESTVECTOR(AD<double>) Z(1);
31 Z[0] = sin(U[0]);
31 Z[0] = sin(U[0]);
3232
3333 // create f: U -> Z and vectors used for derivative calculations
34 ADFun<double> f(U, Z);
34 ADFun<double> f(U, Z);
3535 CPPAD_TESTVECTOR(double) v(1);
3636 CPPAD_TESTVECTOR(double) w(1);
3737
38 // check value
38 // check value
3939 double sin_u = sin( Value(U[0]) );
4040 double cos_u = cos( Value(U[0]) );
4141
4747 double jfac = 1.;
4848 v[0] = 1.;
4949 for(j = 1; j < p; j++)
50 { w = f.Forward(j, v);
50 { w = f.Forward(j, v);
5151
5252 double value;
5353 if( j % 4 == 1 )
6464 }
6565
6666 // reverse computation of partials of Taylor coefficients
67 CPPAD_TESTVECTOR(double) r(p);
67 CPPAD_TESTVECTOR(double) r(p);
6868 w[0] = 1.;
6969 r = f.Reverse(p, w);
7070 jfac = 1.;
0 /* $Id: sin_cos.cpp 2506 2012-10-24 19:36:49Z bradbell $ */
0 // $Id: sin_cos.cpp 3785 2016-02-08 12:53:06Z bradbell $
11 /* --------------------------------------------------------------------------
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-12 Bradley M. Bell
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33
44 CppAD is distributed under multiple licenses. This distribution is under
5 the terms of the
5 the terms of the
66 GNU General Public License Version 3.
77
88 A copy of this license is included in the COPYING file of this distribution.
3333 X[1] = y;
3434 Independent(X);
3535
36 // dependent variable vector
36 // dependent variable vector
3737 CPPAD_TESTVECTOR(AD<double>) Z(1);
3838 AD<double> U = X[0] * X[1];
39 Z[0] = sin( U );
39 Z[0] = sin( U );
4040
4141 // create f: X -> Z and vectors used for derivative calculations
4242 // f(x, y) = sin(x, y)
43 ADFun<double> f(X, Z);
43 ADFun<double> f(X, Z);
4444 CPPAD_TESTVECTOR(double) v( 2 );
4545 CPPAD_TESTVECTOR(double) w( 1 );
4646
47 // check value
47 // check value
4848 double sin_u = sin( Value(U) );
4949 double cos_u = cos( Value(U) );
5050
5858 v[1] = 0; // differential w.r.t. y
5959 double yj = 1; // y^j
6060 for(j = 1; j < p; j++)
61 { w = f.Forward(j, v);
61 { w = f.Forward(j, v);
6262
6363 // compute j-th power of y
6464 yj *= y ;
7676 jfac *= j;
7777
7878 // check j-th derivative of z w.r.t x
79 ok &= NearEqual(jfac*w[0], sinj * yj, 1e-10 , 1e-10);
79 ok &= NearEqual(jfac*w[0], sinj * yj, 1e-10 , 1e-10);
8080
8181 v[0] = 0.;
8282 }
8383
8484 // reverse computation of partials of Taylor coefficients
85 CPPAD_TESTVECTOR(double) r( 2 * p);
85 CPPAD_TESTVECTOR(double) r( 2 * p);
8686 w[0] = 1.;
8787 r = f.Reverse(p, w);
8888 jfac = 1.;
130130 X[1] = y;
131131 Independent(X);
132132
133 // dependent variable vector
133 // dependent variable vector
134134 CPPAD_TESTVECTOR(AD<double>) Z(1);
135135 AD<double> U = X[0] * X[1];
136 Z[0] = cos( U );
136 Z[0] = cos( U );
137137
138138 // create f: X -> Z and vectors used for derivative calculations
139139 // f(x, y) = cos(x, y)
140 ADFun<double> f(X, Z);
140 ADFun<double> f(X, Z);
141141 CPPAD_TESTVECTOR(double) v( 2 );
142142 CPPAD_TESTVECTOR(double) w( 1 );
143143
144 // check value
144 // check value
145145 double sin_u = sin( Value(U) );
146146 double cos_u = cos( Value(U) );
147147
155155 v[1] = 0; // differential w.r.t. y
156156 double yj = 1; // y^j
157157 for(j = 1; j < p; j++)
158 { w = f.Forward(j, v);
158 { w = f.Forward(j, v);
159159
160160 // compute j-th power of y
161161 yj *= y ;
173173 jfac *= j;
174174
175175 // check j-th derivative of z w.r.t x
176 ok &= NearEqual(jfac*w[0], cosj * yj, 1e-10 , 1e-10);
176 ok &= NearEqual(jfac*w[0], cosj * yj, 1e-10 , 1e-10);
177177
178178 v[0] = 0.;
179179 }
180180
181181 // reverse computation of partials of Taylor coefficients
182 CPPAD_TESTVECTOR(double) r( 2 * p);
182 CPPAD_TESTVECTOR(double) r( 2 * p);
183183 w[0] = 1.;
184184 r = f.Reverse(p, w);
185185 jfac = 1.;
227227 X[1] = y;
228228 Independent(X);
229229
230 // dependent variable vector
230 // dependent variable vector
231231 CPPAD_TESTVECTOR(AD<double>) Z(1);
232232 AD<double> U = X[0] * X[1];
233 Z[0] = cosh( U );
233 Z[0] = cosh( U );
234234
235235 // create f: X -> Z and vectors used for derivative calculations
236236 // f(x, y) = cosh(x, y)
237 ADFun<double> f(X, Z);
237 ADFun<double> f(X, Z);
238238 CPPAD_TESTVECTOR(double) v( 2 );
239239 CPPAD_TESTVECTOR(double) w( 1 );
240240
241 // check value
241 // check value
242242 double sinh_u = sinh( Value(U) );
243243 double cosh_u = cosh( Value(U) );
244244
252252 v[1] = 0; // differential w.r.t. y
253253 double yj = 1; // y^j
254254 for(j = 1; j < p; j++)
255 { w = f.Forward(j, v);
255 { w = f.Forward(j, v);
256256
257257 // compute j-th power of y
258258 yj *= y ;
266266 jfac *= j;
267267
268268 // check j-th derivative of z w.r.t x
269 ok &= NearEqual(jfac*w[0], coshj * yj, 1e-10 , 1e-10);
269 ok &= NearEqual(jfac*w[0], coshj * yj, 1e-10 , 1e-10);
270270
271271 v[0] = 0.;
272272 }
273273
274274 // reverse computation of partials of Taylor coefficients
275 CPPAD_TESTVECTOR(double) r( 2 * p);
275 CPPAD_TESTVECTOR(double) r( 2 * p);
276276 w[0] = 1.;
277277 r = f.Reverse(p, w);
278278 jfac = 1.;
316316 X[1] = y;
317317 Independent(X);
318318
319 // dependent variable vector
319 // dependent variable vector
320320 CPPAD_TESTVECTOR(AD<double>) Z(1);
321321 AD<double> U = X[0] * X[1];
322 Z[0] = sinh( U );
322 Z[0] = sinh( U );
323323
324324 // create f: X -> Z and vectors used for derivative calculations
325325 // f(x, y) = sinh(x, y)
326 ADFun<double> f(X, Z);
326 ADFun<double> f(X, Z);
327327 CPPAD_TESTVECTOR(double) v( 2 );
328328 CPPAD_TESTVECTOR(double) w( 1 );
329329
330 // check value
330 // check value
331331 double sinh_u = sinh( Value(U) );
332332 double cosh_u = cosh( Value(U) );
333333
341341 v[1] = 0; // differential w.r.t. y
342342 double yj = 1; // y^j
343343 for(j = 1; j < p; j++)
344 { w = f.Forward(j, v);
344 { w = f.Forward(j, v);
345345
346346 // compute j-th power of y
347347 yj *= y ;
355355 jfac *= j;
356356
357357 // check j-th derivative of z w.r.t x
358 ok &= NearEqual(jfac*w[0], sinhj * yj, 1e-10 , 1e-10);
358 ok &= NearEqual(jfac*w[0], sinhj * yj, 1e-10 , 1e-10);
359359
360360 v[0] = 0.;
361361 }
362362
363363 // reverse computation of partials of Taylor coefficients
364 CPPAD_TESTVECTOR(double) r( 2 * p);
364 CPPAD_TESTVECTOR(double) r( 2 * p);
365365 w[0] = 1.;
366366 r = f.Reverse(p, w);
367367 jfac = 1.;
396396 { bool ok = Sin() & Cos() & Cosh() & Sinh();
397397 return ok;
398398 }
399
399
0 /* $Id: sinh.cpp 2506 2012-10-24 19:36:49Z bradbell $ */
0 // $Id: sinh.cpp 3785 2016-02-08 12:53:06Z bradbell $
11 /* --------------------------------------------------------------------------
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-12 Bradley M. Bell
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33
44 CppAD is distributed under multiple licenses. This distribution is under
5 the terms of the
5 the terms of the
66 GNU General Public License Version 3.
77
88 A copy of this license is included in the COPYING file of this distribution.
2626 U[0] = 1.;
2727 Independent(U);
2828
29 // dependent variable vector
29 // dependent variable vector
3030 CPPAD_TESTVECTOR(AD<double>) Z(1);
31 Z[0] = sinh(U[0]);
31 Z[0] = sinh(U[0]);
3232
3333 // create f: U -> Z and vectors used for derivative calculations
34 ADFun<double> f(U, Z);
34 ADFun<double> f(U, Z);
3535 CPPAD_TESTVECTOR(double) v(1);
3636 CPPAD_TESTVECTOR(double) w(1);
3737
38 // check value
38 // check value
3939 double sin_u = sinh( Value(U[0]) );
4040 double cos_u = cosh( Value(U[0]) );
4141
4747 double jfac = 1.;
4848 v[0] = 1.;
4949 for(j = 1; j < p; j++)
50 { w = f.Forward(j, v);
50 { w = f.Forward(j, v);
5151
5252 double value;
5353 if( j % 2 == 1 )
6060 }
6161
6262 // reverse computation of partials of Taylor coefficients
63 CPPAD_TESTVECTOR(double) r(p);
63 CPPAD_TESTVECTOR(double) r(p);
6464 w[0] = 1.;
6565 r = f.Reverse(p, w);
6666 jfac = 1.;
0 /* $Id: sparse_hessian.cpp 2506 2012-10-24 19:36:49Z bradbell $ */
0 // $Id: sparse_hessian.cpp 3785 2016-02-08 12:53:06Z bradbell $
11 /* --------------------------------------------------------------------------
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-12 Bradley M. Bell
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33
44 CppAD is distributed under multiple licenses. This distribution is under
5 the terms of the
5 the terms of the
66 GNU General Public License Version 3.
77
88 A copy of this license is included in the COPYING file of this distribution.
3737 check[ell] = 0.0;
3838
3939 for(i = 0; i < m; i++)
40 { AD<double> diff = a_x[i+1] - a_x[i];
41 a_y[i] = 0.5 * diff * diff / double(i+2);
40 { AD<double> diff = a_x[i+1] - a_x[i];
41 a_y[i] = 0.5 * diff * diff / double(i+2);
4242 w[i] = double(i+1);
4343 ell = i * n + i;
4444 check[ell] += w[i] / double(i+2);
5252
5353 // create f: x -> y
5454 CppAD::ADFun<double> f(a_x, a_y);
55
55
5656 // determine the sparsity pattern p for Hessian of w^T f
5757 typedef CppAD::vector< std::set<size_t> > VectorSet;
5858 VectorSet p_r(n);
8080 c[k] = i+1;
8181 k++;
8282 }
83 }
83 }
8484 ok &= k == K;
8585
8686 // test computing sparse Hessian
9898 }
9999
100100
101 template <class VectorBase, class VectorBool>
101 template <class VectorBase, class VectorBool>
102102 bool bool_case()
103103 { bool ok = true;
104104 using CppAD::AD;
126126 for(i = 0; i < n; i++)
127127 x[i] = double(i);
128128
129 // second derivative of y[1]
129 // second derivative of y[1]
130130 VectorBase w(m);
131131 w[0] = 1.;
132132 VectorBase h( n * n );
164164
165165 return ok;
166166 }
167 template <class VectorBase, class VectorSet>
167 template <class VectorBase, class VectorSet>
168168 bool set_case()
169169 { bool ok = true;
170170 using CppAD::AD;
192192 for(i = 0; i < n; i++)
193193 x[i] = double(i);
194194
195 // second derivative of y[1]
195 // second derivative of y[1]
196196 VectorBase w(m);
197197 w[0] = 1.;
198198 VectorBase h( n * n );
228228
229229 return ok;
230230 }
231 } // End empty namespace
231 } // End empty namespace
232232 # include <vector>
233233 # include <valarray>
234234 bool sparse_hessian(void)
0 /* $Id: sparse_vec_ad.cpp 2506 2012-10-24 19:36:49Z bradbell $ */
0 // $Id: sparse_vec_ad.cpp 3785 2016-02-08 12:53:06Z bradbell $
11 /* --------------------------------------------------------------------------
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-12 Bradley M. Bell
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33
44 CppAD is distributed under multiple licenses. This distribution is under
5 the terms of the
5 the terms of the
66 GNU General Public License Version 3.
77
88 A copy of this license is included in the COPYING file of this distribution.
1717 using namespace CppAD;
1818
1919 // dimension of the domain space
20 size_t n = 3;
20 size_t n = 3;
2121
2222 size_t i, j;
2323
24 // independent variable vector
24 // independent variable vector
2525 CPPAD_TESTVECTOR(AD<double>) X(n);
2626 for(j = 0; j < n; j++)
27 X[j] = AD<double>(j);
27 X[j] = AD<double>(j);
2828 Independent(X);
2929
3030 // dependent variable vector
6060 { for(i = 0; i < m; i++)
6161 Check[ i * m + j ] = (j <= i);
6262 }
63
63
6464 // create function object F : X -> Y
6565 ADFun<double> F(X, Y);
6666
7979 for(i = 0; i < m; i++)
8080 { for(j = 0; j < n; j++)
8181 ok &= (Px[i * m + j] == Check[i * m + j]);
82 }
82 }
8383
8484 // evaluate the dependency matrix for F(Identity(x))
8585 CPPAD_TESTVECTOR( bool ) Py(m * n);
8989 for(i = 0; i < m; i++)
9090 { for(j = 0; j < n; j++)
9191 ok &= (Py[i * m + j] == Check[i * m + j]);
92 }
92 }
9393
94 // test sparsity pattern for Hessian of F_2 ( Identity(x) )
94 // test sparsity pattern for Hessian of F_2 ( Identity(x) )
9595 CPPAD_TESTVECTOR(bool) Hy(m);
9696 for(i = 0; i < m; i++)
9797 Hy[i] = false;
103103 ok &= (Pxx[i * n + j] == false );
104104 }
105105
106 // test sparsity pattern for Hessian of F_1 ( Identity(x) )
106 // test sparsity pattern for Hessian of F_1 ( Identity(x) )
107107 for(i = 0; i < m; i++)
108108 Hy[i] = false;
109109 Hy[1] = true;
0 /* $Id: sqrt.cpp 2506 2012-10-24 19:36:49Z bradbell $ */
0 // $Id: sqrt.cpp 3785 2016-02-08 12:53:06Z bradbell $
11 /* --------------------------------------------------------------------------
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-12 Bradley M. Bell
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33
44 CppAD is distributed under multiple licenses. This distribution is under
5 the terms of the
5 the terms of the
66 GNU General Public License Version 3.
77
88 A copy of this license is included in the COPYING file of this distribution.
5858 v = f.Reverse(1,w);
5959 ok &= NearEqual(v[s], .25 * pow(4., -.75), 1e-10 , 1e-10); // dy/ds
6060
61 // forward computation of second partials w.r.t s
61 // forward computation of second partials w.r.t s
6262 v[s] = 1.;
6363 w = f.Forward(1, v);
6464 v[s] = 0.;
6565 w = f.Forward(2, v);
6666 ok &= NearEqual( // d^2 y / (ds ds)
67 2. * w[y] ,
67 2. * w[y] ,
6868 -.75 * .25 * pow(4., -1.75),
6969 1e-10 ,
70 1e-10
71 );
70 1e-10
71 );
7272
7373 // reverse computation of second partials of y
7474 CPPAD_TESTVECTOR(double) r( f.Domain() * 2 );
7676 w[y] = 1.;
7777 r = f.Reverse(2, w);
7878 ok &= NearEqual( // d^2 y / (ds ds)
79 r[2 * s + 1] ,
79 r[2 * s + 1] ,
8080 -.75 * .25 * pow(4., -1.75),
8181 1e-10 ,
82 1e-10
83 );
82 1e-10
83 );
8484
8585 return ok;
8686
9595 Independent(U);
9696
9797 // a temporary values
98 AD<double> x = U[0] * U[0];
99
100 // dependent variable vector
98 AD<double> x = U[0] * U[0];
99
100 // dependent variable vector
101101 CPPAD_TESTVECTOR(AD<double>) Z(1);
102102 Z[0] = sqrt( x ); // z = sqrt( u * u )
103103
104104 // create f: U -> Z and vectors used for derivative calculations
105 ADFun<double> f(U, Z);
105 ADFun<double> f(U, Z);
106106 CPPAD_TESTVECTOR(double) v(1);
107107 CPPAD_TESTVECTOR(double) w(1);
108108
109 // check value
109 // check value
110110 ok &= NearEqual(U[0] , Z[0], 1e-10 , 1e-10);
111111
112112 // forward computation of partials w.r.t. u
117117 v[0] = 1.;
118118 for(j = 1; j < p; j++)
119119 { jfac *= j;
120 w = f.Forward(j, v);
120 w = f.Forward(j, v);
121121 ok &= NearEqual(jfac*w[0], value, 1e-10 , 1e-10); // d^jz/du^j
122122 v[0] = 0.;
123123 value = 0.;
124124 }
125125
126126 // reverse computation of partials of Taylor coefficients
127 CPPAD_TESTVECTOR(double) r(p);
127 CPPAD_TESTVECTOR(double) r(p);
128128 w[0] = 1.;
129129 r = f.Reverse(p, w);
130130 jfac = 1.;
162162 CPPAD_TESTVECTOR(double) y1( f.Range() );
163163 x1[0] = 1.;
164164 y1 = f.Forward(1, x1);
165 ok &= NearEqual(y1[0], exp(x/2.)/2., 1e-10 , 1e-10);
165 ok &= NearEqual(y1[0], exp(x/2.)/2., 1e-10 , 1e-10);
166166
167167 // forward computation of second Taylor coefficient
168168 CPPAD_TESTVECTOR(double) x2( f.Domain() );
169169 CPPAD_TESTVECTOR(double) y2( f.Range() );
170170 x2[0] = 0.;
171171 y2 = f.Forward(2, x2);
172 ok &= NearEqual(2.*y2[0] , exp(x/2.)/4., 1e-10 , 1e-10 );
172 ok &= NearEqual(2.*y2[0] , exp(x/2.)/4., 1e-10 , 1e-10 );
173173
174174 // forward computation of third Taylor coefficient
175175 CPPAD_TESTVECTOR(double) x3( f.Domain() );
176176 CPPAD_TESTVECTOR(double) y3( f.Range() );
177177 x3[0] = 0.;
178178 y3 = f.Forward(3, x3);
179 ok &= NearEqual(6.*y3[0] , exp(x/2.)/8., 1e-10 , 1e-10 );
179 ok &= NearEqual(6.*y3[0] , exp(x/2.)/8., 1e-10 , 1e-10 );
180180
181181 // reverse computation of deritavitve of Taylor coefficients
182182 CPPAD_TESTVECTOR(double) r( f.Domain() * 4 );
183183 CPPAD_TESTVECTOR(double) w(1);
184184 w[0] = 1.;
185185 r = f.Reverse(4, w);
186 ok &= NearEqual(r[0], exp(x/2.)/2., 1e-10 , 1e-10);
187 ok &= NearEqual(r[1], exp(x/2.)/4., 1e-10 , 1e-10 );
188 ok &= NearEqual(2.*r[2], exp(x/2.)/8., 1e-10 , 1e-10 );
189 ok &= NearEqual(6.*r[3], exp(x/2.)/16., 1e-10 , 1e-10 );
186 ok &= NearEqual(r[0], exp(x/2.)/2., 1e-10 , 1e-10);
187 ok &= NearEqual(r[1], exp(x/2.)/4., 1e-10 , 1e-10 );
188 ok &= NearEqual(2.*r[2], exp(x/2.)/8., 1e-10 , 1e-10 );
189 ok &= NearEqual(6.*r[3], exp(x/2.)/16., 1e-10 , 1e-10 );
190190
191191 return ok;
192192
197197 bool Sqrt(void)
198198 { bool ok = true;
199199 ok &= SqrtTestOne();
200 ok &= SqrtTestTwo();
201 ok &= SqrtTestThree();
202 return ok;
203 }
200 ok &= SqrtTestTwo();
201 ok &= SqrtTestThree();
202 return ok;
203 }
0 /* $Id: std_math.cpp 3060 2013-12-27 20:38:57Z bradbell $ */
0 // $Id: std_math.cpp 3785 2016-02-08 12:53:06Z bradbell $
11 /* --------------------------------------------------------------------------
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-13 Bradley M. Bell
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33
44 CppAD is distributed under multiple licenses. This distribution is under
5 the terms of the
5 the terms of the
66 GNU General Public License Version 3.
77
88 A copy of this license is included in the COPYING file of this distribution.
1919 typedef CppAD::AD< ADdouble > ADDdouble;
2020
2121 bool std_math(void)
22 { using CppAD::NearEqual;
22 { using CppAD::NearEqual;
2323 bool ok = true;
2424 ADDdouble half(.5);
2525 ADDdouble one(1.);
0 /* $Id: sub.cpp 2506 2012-10-24 19:36:49Z bradbell $ */
0 // $Id: sub.cpp 3785 2016-02-08 12:53:06Z bradbell $
11 /* --------------------------------------------------------------------------
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-12 Bradley M. Bell
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33
44 CppAD is distributed under multiple licenses. This distribution is under
5 the terms of the
5 the terms of the
66 GNU General Public License Version 3.
77
88 A copy of this license is included in the COPYING file of this distribution.
4040 // dependent variable values
4141 Z[x] = U[s] - U[t]; // AD<double> - AD<double>
4242 Z[y] = Z[x] - 1.; // AD<double> - double
43 Z[z] = 1. - Z[y]; // double - AD<double>
43 Z[z] = 1. - Z[y]; // double - AD<double>
4444
4545 // create f: U -> Z and vectors used for derivative calculations
4646 ADFun<double> f(U, Z);
8686
8787 AD<double> a = 2. * U[0] - 1.; // AD<double> - double
8888 AD<double> b = a - 2; // AD<double> - int
89 AD<double> c = 3. - b; // double - AD<double>
90 AD<double> d = 4 - c; // int - AD<double>
89 AD<double> c = 3. - b; // double - AD<double>
90 AD<double> d = 4 - c; // int - AD<double>
9191
92 // dependent variable vector
92 // dependent variable vector
9393 CPPAD_TESTVECTOR(AD<double>) Z(1);
9494 Z[0] = U[0] - d; // AD<double> - AD<double>
9595
9696 // create f: U -> Z and vectors used for derivative calculations
97 ADFun<double> f(U, Z);
97 ADFun<double> f(U, Z);
9898 CPPAD_TESTVECTOR(double) v(1);
9999 CPPAD_TESTVECTOR(double) w(1);
100100
101 // check value
101 // check value
102102 ok &= NearEqual(Value(Z[0]) , u0-4+3-2*u0+1+2, 1e-10 , 1e-10);
103103
104104 // forward computation of partials w.r.t. u
109109 v[0] = 1.;
110110 for(j = 1; j < p; j++)
111111 { jfac *= j;
112 w = f.Forward(j, v);
112 w = f.Forward(j, v);
113113 ok &= NearEqual(jfac*w[0], value, 1e-10 , 1e-10); // d^jz/du^j
114114 v[0] = 0.;
115115 value = 0.;
116116 }
117117
118118 // reverse computation of partials of Taylor coefficients
119 CPPAD_TESTVECTOR(double) r(p);
119 CPPAD_TESTVECTOR(double) r(p);
120120 w[0] = 1.;
121121 r = f.Reverse(p, w);
122122 jfac = 1.;
134134 { bool ok = true;
135135 using namespace CppAD;
136136
137 // special cases where tests above check OK and SubpvOp
138 // implementation is known to be worng.
137 // special cases where tests above check OK and SubpvOp
138 // implementation is known to be worng.
139139 // Probably two minuses make a plus.
140140 size_t n = 1;
141141 CPPAD_TESTVECTOR(AD<double>) X(n);
144144 size_t m = 1;
145145 CPPAD_TESTVECTOR(AD<double>) Y(m);
146146 Y[0] = 1. - X[0];
147 ADFun<double> f(X, Y);
148
147 ADFun<double> f(X, Y);
148
149149 CPPAD_TESTVECTOR(double) w(m), dw(n);
150150 w[0] = 1.;
151151 dw = f.Reverse(1, w);
169169 if( 0. < X[0] && X[0] < 10. )
170170 Y[0] = X[0] - 2.;
171171 else Y[0] = X[0] - 2.;
172 ADFun<double> f(X, Y);
173
172 ADFun<double> f(X, Y);
173
174174 CPPAD_TESTVECTOR(double) y(m), x(n);
175175 x[0] = 1.;
176176 y = f.Forward(0, x);
177177 ok &= (y[0] == -1.);
178
178
179179 CPPAD_TESTVECTOR(double) dy(m), dx(n);
180180 dx[0] = 1.;
181181 dy = f.Forward(1, dx);
190190 bool Sub(void)
191191 { bool ok = true;
192192 ok &= One();
193 ok &= Two();
194 ok &= Three();
193 ok &= Two();
194 ok &= Three();
195195 ok &= Four();
196196 return ok;
197197 }
0 /* $Id: sub_eq.cpp 2506 2012-10-24 19:36:49Z bradbell $ */
0 // $Id: sub_eq.cpp 3785 2016-02-08 12:53:06Z bradbell $
11 /* --------------------------------------------------------------------------
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-12 Bradley M. Bell
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33
44 CppAD is distributed under multiple licenses. This distribution is under
5 the terms of the
5 the terms of the
66 GNU General Public License Version 3.
77
88 A copy of this license is included in the COPYING file of this distribution.
3535 size_t y = 1;
3636
3737 // dependent variable values
38 Z[x] = U[s];
38 Z[x] = U[s];
3939 Z[y] = U[t];
40 Z[x] -= U[t]; // AD<double> -= AD<double>
41 Z[y] -= 5.; // AD<double> -= double
40 Z[x] -= U[t]; // AD<double> -= AD<double>
41 Z[y] -= 5.; // AD<double> -= double
4242
4343 // create f: U -> Z and vectors used for derivative calculations
4444 ADFun<double> f(U, Z);
7575 // independent variable vector
7676 double u0 = .5;
7777 CPPAD_TESTVECTOR(AD<double>) U(1);
78 U[0] = u0;
78 U[0] = u0;
7979 Independent(U);
8080
81 // dependent variable vector
81 // dependent variable vector
8282 CPPAD_TESTVECTOR(AD<double>) Z(1);
8383 Z[0] = U[0]; // initial value
8484 Z[0] -= 2; // AD<double> -= int
8585 Z[0] -= 4.; // AD<double> -= double
86 Z[0] -= 2 * U[0]; // AD<double> -= AD<double>
86 Z[0] -= 2 * U[0]; // AD<double> -= AD<double>
8787
8888 // create f: U -> Z and vectors used for derivative calculations
89 ADFun<double> f(U, Z);
89 ADFun<double> f(U, Z);
9090 CPPAD_TESTVECTOR(double) v(1);
9191 CPPAD_TESTVECTOR(double) w(1);
9292
93 // check value
93 // check value
9494 ok &= NearEqual(Z[0] , u0-2-4-2*u0, 1e-10 , 1e-10);
9595
9696 // forward computation of partials w.r.t. u
101101 v[0] = 1.;
102102 for(j = 1; j < p; j++)
103103 { jfac *= j;
104 w = f.Forward(j, v);
104 w = f.Forward(j, v);
105105 ok &= NearEqual(jfac*w[0], value, 1e-10 , 1e-10); // d^jz/du^j
106106 v[0] = 0.;
107107 value = 0.;
108108 }
109109
110110 // reverse computation of partials of Taylor coefficients
111 CPPAD_TESTVECTOR(double) r(p);
111 CPPAD_TESTVECTOR(double) r(p);
112112 w[0] = 1.;
113113 r = f.Reverse(p, w);
114114 jfac = 1.;
127127 bool SubEq(void)
128128 { bool ok = true;
129129 ok &= SubEqTestOne();
130 ok &= SubEqTestTwo();
130 ok &= SubEqTestTwo();
131131 return ok;
132132 }
0 /* $Id: sub_zero.cpp 2506 2012-10-24 19:36:49Z bradbell $ */
0 // $Id: sub_zero.cpp 3785 2016-02-08 12:53:06Z bradbell $
11 /* --------------------------------------------------------------------------
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-12 Bradley M. Bell
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33
44 CppAD is distributed under multiple licenses. This distribution is under
5 the terms of the
5 the terms of the
66 GNU General Public License Version 3.
77
88 A copy of this license is included in the COPYING file of this distribution.
1919 typedef CppAD::AD< ADdouble > ADDdouble;
2020
2121 bool SubZero(void)
22 {
22 {
2323 using namespace CppAD;
2424
2525 bool ok = true;
0 /* $Id: test_vector.cpp 2506 2012-10-24 19:36:49Z bradbell $ */
0 // $Id: test_vector.cpp 3785 2016-02-08 12:53:06Z bradbell $
11 /* --------------------------------------------------------------------------
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-12 Bradley M. Bell
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33
44 CppAD is distributed under multiple licenses. This distribution is under
5 the terms of the
5 the terms of the
66 GNU General Public License Version 3.
77
88 A copy of this license is included in the COPYING file of this distribution.
2424 size_t n = 1;
2525 double x0 = 0.5;
2626 CPPAD_TEST_VECTOR< AD<double> > x(n);
27 x[0] = x0;
27 x[0] = x0;
2828
2929 // declare independent variables and start tape recording
3030 CppAD::Independent(x);
3232 // some binary addition operations
3333 AD<double> a = x[0] + 1.; // AD<double> + double
3434 AD<double> b = a + 2; // AD<double> + int
35 AD<double> c = 3. + b; // double + AD<double>
36 AD<double> d = 4 + c; // int + AD<double>
35 AD<double> c = 3. + b; // double + AD<double>
36 AD<double> d = 4 + c; // int + AD<double>
3737
38 // range space vector
38 // range space vector
3939 size_t m = 1;
4040 CPPAD_TEST_VECTOR< AD<double> > y(m);
41 y[0] = d + x[0]; // AD<double> + AD<double>
41 y[0] = d + x[0]; // AD<double> + AD<double>
4242
4343 // create f: x -> y and stop tape recording
44 CppAD::ADFun<double> f(x, y);
44 CppAD::ADFun<double> f(x, y);
4545
46 // check value
46 // check value
4747 ok &= NearEqual(y[0] , 2. * x0 + 10, 1e-10 , 1e-10);
4848
4949 // forward computation of partials w.r.t. x[0]
0 /* $Id: value.cpp 2506 2012-10-24 19:36:49Z bradbell $ */
0 // $Id: value.cpp 3785 2016-02-08 12:53:06Z bradbell $
11 /* --------------------------------------------------------------------------
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-12 Bradley M. Bell
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33
44 CppAD is distributed under multiple licenses. This distribution is under
5 the terms of the
5 the terms of the
66 GNU General Public License Version 3.
77
88 A copy of this license is included in the COPYING file of this distribution.
0 /* $Id: vec_ad.cpp 2506 2012-10-24 19:36:49Z bradbell $ */
0 // $Id: vec_ad.cpp 3785 2016-02-08 12:53:06Z bradbell $
11 /* --------------------------------------------------------------------------
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-12 Bradley M. Bell
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33
44 CppAD is distributed under multiple licenses. This distribution is under
5 the terms of the
5 the terms of the
66 GNU General Public License Version 3.
77
88 A copy of this license is included in the COPYING file of this distribution.
4747
4848 // check array values (while not taping)
4949 for(i = 0; i < n; i++)
50 ok &= ( V[i] == 2. * double(n - i) );
51
52 // independent variable
50 ok &= ( V[i] == 2. * double(n - i) );
51
52 // independent variable
5353 CPPAD_TESTVECTOR(AD<double>) X(1);
5454 X[0] = double(n - 1);
5555 Independent(X);
8585 x[0] = double(i);
8686 z = f.Forward(0, x);
8787 vx = double(n - i);
88 ok &= NearEqual(z[0], sin(x[0]) * vx, 1e-10, 1e-10);
88 ok &= NearEqual(z[0], sin(x[0]) * vx, 1e-10, 1e-10);
8989
9090 // note that derivative of v[x] w.r.t. x is zero
9191 dx[0] = 1.;
9292 dz = f.Forward(1, dx);
93 ok &= NearEqual(dz[0], cos(x[0]) * vx, 1e-10, 1e-10);
93 ok &= NearEqual(dz[0], cos(x[0]) * vx, 1e-10, 1e-10);
9494
9595 // reverse mode calculation of same value
9696 dz[0] = 1.;
9797 dx = f.Reverse(1, dz);
98 ok &= NearEqual(dx[0], cos(x[0]) * vx, 1e-10, 1e-10);
99 }
100
101
102 return ok;
103 }
104
105 // create the discrete function AD<double> Floor(const AD<double> &X)
98 ok &= NearEqual(dx[0], cos(x[0]) * vx, 1e-10, 1e-10);
99 }
100
101
102 return ok;
103 }
104
105 // create the discrete function AD<double> Floor(const AD<double> &X)
106106 double Floor(const double &x)
107 { return std::floor(x); }
107 { return std::floor(x); }
108108 CPPAD_DISCRETE_FUNCTION(double, Floor)
109109
110110 bool VecADTestTwo(void)
111111 { bool ok = true;
112112 using namespace CppAD;
113
113
114114 double pi = 4. * CppAD::atan(1.);
115115 size_t nx = 10; // number of x grid point
116116 double xLow = 0; // minimum value for x
122122 VecAD<double> Data(nx);
123123 size_t i;
124124 for(i = 0; i < nx; i++)
125 { xCur = xLow + double(i) * xStep;
125 { xCur = xLow + double(i) * xStep;
126126 // use size_t indexing of Data while not taping
127 Data[i] = CppAD::sin(xCur);
128 }
129
130 // declare independent variable
127 Data[i] = CppAD::sin(xCur);
128 }
129
130 // declare independent variable
131131 CPPAD_TESTVECTOR(AD<double>) X(1);
132132 X[0] = 2.;
133133 Independent(X);
173173
174174 # include <limits>
175175 bool SecondOrderReverse(void)
176 { // Bradley M. Bell 2009-07-06
176 { // Bradley M. Bell 2009-07-06
177177 // Reverse mode for LdpOp was only modifying the highest order partial
178178 // This test demonstrated the bug
179179 bool ok = true;
197197 // The LdvOp instruction corresponds to the index being a variable.
198198 AD<double> one = X[0] - 1; // one in a variable here
199199 Z[one] = X[0] + 1.;
200
200
201201
202202 // Compute a function where the second order partial for y
203203 // depends on the first order partials for z
224224
225225 // check first derivative in dw
226226 double check = 2. * (Value( X[0] ) + 1.);
227 ok &= NearEqual(dw[0], check, eps, eps);
227 ok &= NearEqual(dw[0], check, eps, eps);
228228
229229 // check second derivative in dw
230230 check = 2.;
231 ok &= NearEqual(dw[1], check, eps, eps);
231 ok &= NearEqual(dw[1], check, eps, eps);
232232
233233 // Test LdvOp
234234 // second order reverse (test exp_if_true case)
239239
240240 // check first derivative in dw
241241 check = 2. * (Value( X[0] ) + 1.);
242 ok &= NearEqual(dw[0], check, eps, eps);
242 ok &= NearEqual(dw[0], check, eps, eps);
243243
244244 // check second derivative in dw
245245 check = 2.;
246 ok &= NearEqual(dw[1], check, eps, eps);
246 ok &= NearEqual(dw[1], check, eps, eps);
247247
248248 return ok;
249249 }
253253 bool VecAD(void)
254254 { bool ok = true;
255255 ok &= VecADTestOne();
256 ok &= VecADTestTwo();
256 ok &= VecADTestTwo();
257257 ok &= SecondOrderReverse();
258258 return ok;
259259 }
0 /* $Id: vec_ad_par.cpp 2506 2012-10-24 19:36:49Z bradbell $ */
0 // $Id: vec_ad_par.cpp 3785 2016-02-08 12:53:06Z bradbell $
11 /* --------------------------------------------------------------------------
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-12 Bradley M. Bell
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33
44 CppAD is distributed under multiple licenses. This distribution is under
5 the terms of the
5 the terms of the
66 GNU General Public License Version 3.
77
88 A copy of this license is included in the COPYING file of this distribution.
1919 typedef CppAD::AD< ADdouble > ADDdouble;
2020
2121 bool VecADPar(void)
22 {
22 {
2323 using namespace CppAD;
2424
2525 bool ok = true;
3636 VecAD< ADdouble > v(2);
3737 ADDdouble zero(0);
3838 ADDdouble one(1);
39 v[zero] = x[0]; // these two parameter values are equal,
39 v[zero] = x[0]; // these two parameter values are equal,
4040 v[one] = x[1]; // but they are not identically equal
4141
4242 CPPAD_TESTVECTOR( ADDdouble ) z(1);
0 /* $Id: vec_unary.cpp 2506 2012-10-24 19:36:49Z bradbell $ */
0 // $Id: vec_unary.cpp 3785 2016-02-08 12:53:06Z bradbell $
11 /* --------------------------------------------------------------------------
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-12 Bradley M. Bell
2 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
33
44 CppAD is distributed under multiple licenses. This distribution is under
5 the terms of the
5 the terms of the
66 GNU General Public License Version 3.
77
88 A copy of this license is included in the COPYING file of this distribution.
1717
1818
1919 bool VecUnary(void)
20 {
20 {
2121 using namespace CppAD;
2222 using CppAD::abs;
2323 using CppAD::sin;
4343 AD<double> j;
4444
4545 j = 0.;
46 Y[j] = X[0];
46 Y[j] = X[0];
4747 Z[0] = -Y[j];
4848
4949 j = 1.;
50 Y[j] = X[1];
50 Y[j] = X[1];
5151 Z[1] = sin( Y[j] );
5252
5353 j = 2.;
54 Y[j] = X[2];
54 Y[j] = X[2];
5555 Z[2] = abs( Y[j] );
5656
5757 j = 3.;
58 Y[j] = X[3];
58 Y[j] = X[3];
5959 Z[3] = atan( Y[j] );
6060
6161 j = 4.;
62 Y[j] = X[4];
62 Y[j] = X[4];
6363 Z[4] = cos( Y[j] );
6464
6565 j = 5.;
66 Y[j] = X[5];
66 Y[j] = X[5];
6767 Z[5] = exp( Y[j] );
6868
6969 j = 6.;
70 Y[j] = X[6];
70 Y[j] = X[6];
7171 Z[6] = log( Y[j] );
7272
7373 j = 7.;
74 Y[j] = X[7];
74 Y[j] = X[7];
7575 Z[7] = sqrt( Y[j] );
7676
77
77
7878 ADFun<double> f(X, Z);
7979 CPPAD_TESTVECTOR(double) x(n);
8080 CPPAD_TESTVECTOR(double) z(n);