Changeset 2057


Ignore:
Timestamp:
Aug 11, 2011 10:07:11 AM (9 years ago)
Author:
bradbell
Message:

merge branches/base_require into trunk, see bin/svn_merge.sh

Location:
trunk
Files:
3 deleted
74 edited
11 copied

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/AUTHORS

    r2037 r2057  
    22             ===========================================
    33
    4 To date, 2011-07-31, Bradley M. Bell is the sole author of CppAD.
     4To date, 2011-08-11, Bradley M. Bell is the sole author of CppAD.
    55While Bradley M. Bell worked for the University of Washington during
    66the development of CppAD, the following are also true:
  • trunk/bin/svn_merge.sh

    r1986 r2057  
    3030#
    3131# Name of the directory where the changes have been committed
    32 from_branch=branches/memory
     32from_branch=branches/base_require
    3333#
    3434# Version of the repository corresponding to from_branch just before changes
    35 Start=1963
     35Start=2044
    3636#
    3737# Version of the repository corresponding to from_branch after the changes
    38 End=1983
     38End=2056
    3939#
    4040# the svn merge command
  • trunk/build.sh

    r2040 r2057  
    276276then
    277277        # ----------------------------------------------------------------------
    278         # Things to do in the distribution directory
     278        # Things to do in the original source directory
    279279        # ----------------------------------------------------------------------
    280280        echo "Only include the *.xml version of the documentation in distribution"
     
    301301        echo "mv doc.omh.save doc.omh"
    302302              mv doc.omh.save doc.omh
     303        #
     304        # Run automated checking of file names in original source directory
     305        list="
     306                check_example.sh
     307                check_if_0.sh
     308                check_include_def.sh
     309                check_include_file.sh
     310                check_include_omh.sh
     311                check_makefile.sh
     312                check_op_code.sh
     313                check_svn_id.sh
     314        "
     315        for check in $list
     316        do
     317                echo "bin/$check"
     318                      bin/$check
     319        done
    303320        # ----------------------------------------------------------------------
    304321        # Things to do in the work directory
     
    450467        echo "date > $log_file"
    451468              date > $log_dir/$log_file
    452         #
    453         # Run automated checking of file names in original source directory
    454         #
    455         list="
    456                 check_example.sh
    457                 check_if_0.sh
    458                 check_include_def.sh
    459                 check_include_file.sh
    460                 check_include_omh.sh
    461                 check_makefile.sh
    462                 check_op_code.sh
    463                 check_svn_id.sh
    464         "
    465         for check in $list
    466         do
    467                 echo "bin/$check >> $log_file"
    468                       bin/$check >> $log_dir/$log_file
    469         done
    470         # add a new line after last file check
    471         echo ""             >> $log_dir/$log_file
    472469        # ----------------------------------------------------------------------
    473470        # Things to do in the work directory
  • trunk/configure

    r2037 r2057  
    11#! /bin/sh
    22# Guess values for system-dependent variables and create Makefiles.
    3 # Generated by GNU Autoconf 2.66 for CppAD 20110731.
     3# Generated by GNU Autoconf 2.66 for CppAD 20110811.
    44#
    55# Report bugs to <cppad@list.coin-or.org>.
     
    553553PACKAGE_NAME='CppAD'
    554554PACKAGE_TARNAME='cppad'
    555 PACKAGE_VERSION='20110731'
    556 PACKAGE_STRING='CppAD 20110731'
     555PACKAGE_VERSION='20110811'
     556PACKAGE_STRING='CppAD 20110811'
    557557PACKAGE_BUGREPORT='cppad@list.coin-or.org'
    558558PACKAGE_URL=''
     
    13161316  # This message is too long to be a string in the A/UX 3.1 sh.
    13171317  cat <<_ACEOF
    1318 \`configure' configures CppAD 20110731 to adapt to many kinds of systems.
     1318\`configure' configures CppAD 20110811 to adapt to many kinds of systems.
    13191319
    13201320Usage: $0 [OPTION]... [VAR=VALUE]...
     
    13821382if test -n "$ac_init_help"; then
    13831383  case $ac_init_help in
    1384      short | recursive ) echo "Configuration of CppAD 20110731:";;
     1384     short | recursive ) echo "Configuration of CppAD 20110811:";;
    13851385   esac
    13861386  cat <<\_ACEOF
     
    14971497if $ac_init_version; then
    14981498  cat <<\_ACEOF
    1499 CppAD configure 20110731
     1499CppAD configure 20110811
    15001500generated by GNU Autoconf 2.66
    15011501
     
    20752075running configure, to aid debugging if configure makes a mistake.
    20762076
    2077 It was created by CppAD $as_me 20110731, which was
     2077It was created by CppAD $as_me 20110811, which was
    20782078generated by GNU Autoconf 2.66.  Invocation command line was
    20792079
     
    46994699# Define the identity of the package.
    47004700 PACKAGE='cppad'
    4701  VERSION='20110731'
     4701 VERSION='20110811'
    47024702
    47034703
     
    69286928# values after options handling.
    69296929ac_log="
    6930 This file was extended by CppAD $as_me 20110731, which was
     6930This file was extended by CppAD $as_me 20110811, which was
    69316931generated by GNU Autoconf 2.66.  Invocation command line was
    69326932
     
    69856985ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
    69866986ac_cs_version="\\
    6987 CppAD config.status 20110731
     6987CppAD config.status 20110811
    69886988configured by $0, generated by GNU Autoconf 2.66,
    69896989  with options \\"\$ac_cs_config\\"
  • trunk/configure.ac

    r2037 r2057  
    1313dnl Process this file with autoconf to produce a configure script.
    1414dnl   package   version              bug-report
    15 AC_INIT(CppAD, 20110731, cppad@list.coin-or.org)
     15AC_INIT(CppAD, 20110811, cppad@list.coin-or.org)
    1616AC_SUBST(PACKAGE_URL, "http://www.coin-or.org/CppAD")
    1717AC_SUBST(PACKAGE_DESCRIPTION, "Differentiation of C++ Algorithms")
  • trunk/cppad/configure.hpp

    r2037 r2057  
    4343cppad-yyyymmdd as a C string where yyyy is year, mm is month, and dd is day.
    4444*/
    45 # define CPPAD_PACKAGE_STRING "cppad-20110731"
     45# define CPPAD_PACKAGE_STRING "cppad-20110811"
    4646
    4747/*!
  • trunk/cppad/cppad.hpp

    r1949 r2057  
    2020*/
    2121
    22 # include <cppad/declare.hpp>            // forward declarations need by user
    23 // ---------------------------------------------------------------------------
    24 # include <cppad/local/base_complex.hpp> // allow form complex Base types
     22# include <cppad/base_require.hpp> // all base type requirements
    2523// ---------------------------------------------------------------------------
    2624// CppAD general purpose library routines (can be included separately)
  • trunk/cppad/local/ad.hpp

    r2038 r2057  
    5959        friend bool LessThanZero      <Base> (const AD<Base> &x);
    6060        friend bool LessThanOrZero    <Base> (const AD<Base> &x);
     61        friend bool abs_geq           <Base>
     62                (const AD<Base>& x, const AD<Base>& y);
    6163
    6264        // The identical property functions, see identical.hpp
  • trunk/cppad/local/ad_fun.hpp

    r1999 r2057  
    259259        /// forward mode sweep
    260260        template <typename VectorBase>
    261         VectorBase Forward(size_t p, const VectorBase &u);
     261        VectorBase Forward(size_t p, const VectorBase& x, std::ostream& s);
    262262
    263263        /// reverse mode sweep
  • trunk/cppad/local/base_complex.hpp

    r2000 r2057  
    1212Please visit http://www.coin-or.org/CppAD/ for information on other licenses.
    1313-------------------------------------------------------------------------- */
     14# include <limits>
     15# include <complex>
     16
    1417/*
    1518$begin base_complex.hpp$$
    1619$spell
    17         omp_alloc
     20        eps
     21        abs_geq
     22        Rel
     23        Lt Le Eq Ge Gt
    1824        imag
    1925        gcc
     
    5965complex arithmetic where the function is not complex differentiable.
    6066
    61 $head Include File$$
     67$head Include Order$$
    6268This file is included before $code <cppad/cppad.hpp>$$
    6369so it is necessary to define the error handler
    6470in addition to including
    65 $cref/declare.hpp/base_require/declare.hpp/$$
     71$cref/base_require.hpp/base_require/Include Order/$$
    6672$codep */
    6773# include <limits>
    6874# include <complex>
    69 # include <cppad/declare.hpp>
    70 # include <cppad/error_handler.hpp>
    71 # include <cppad/omp_alloc.hpp>
     75# include <cppad/base_require.hpp>
    7276# include <cppad/local/cppad_assert.hpp>
    73 /* $$
    74 
    75 $head isnan$$
    76 The gcc 4.1.1 complier defines the function
    77 $codei%
    78         int std::complex<double>::isnan( std::complex<double> %z% )
    79 %$$
    80 (which is not specified in the C++ 1998 standard ISO/IEC 14882).
    81 This causes an ambiguity between the function above and the CppAD
    82 $cref/isnan/nan/$$ template function.
    83 We avoid this ambiguity by defining a non-template version of
    84 this function in the CppAD namespace.
    85 $codep */
    86 namespace CppAD {
    87         inline bool isnan(const std::complex<double>& z)
    88         {       CPPAD_ASSERT_FIRST_CALL_NOT_PARALLEL;   
    89                 static const double nan = std::numeric_limits<double>::quiet_NaN();
    90                 return (z != z) | (z.real() == nan) | (z.imag() == nan);
    91         }
    92 }
    9377
    9478/* $$
     
    118102/* $$
    119103
     104$head CondExpRel$$
     105The following macro invocation
     106$codep */
     107namespace CppAD {
     108        CPPAD_COND_EXP_REL( std::complex<double> )
     109}
     110/* $$
     111used $code CondExpOp$$ above to
     112define $codei%CondExp%Rel%$$ for $code std::complex<double>$$ arguments
     113and $icode%Rel%$$ equal to
     114$code Lt$$, $code Le$$, $code Eq$$, $code Ge$$, and $code Gt$$.
     115
    120116$head EqualOpSeq$$
    121117Complex numbers do not carry operation sequence information.
     
    149145
    150146$head Ordered$$
    151 
    152 $codep */
    153 namespace CppAD {
    154         inline bool GreaterThanZero(const std::complex<double> &x)
    155         {       CppAD::ErrorHandler::Call(
    156                         true     , __LINE__ , __FILE__ ,
    157                         "GreaterThanZero(x)",
    158                         "Error: cannot use GreaterThanZero with complex"
    159                 );
    160                 return false;
    161         }
    162         inline bool GreaterThanOrZero(const std::complex<double> &x)
    163         {       CppAD::ErrorHandler::Call(
    164                         true     , __LINE__ , __FILE__ ,
    165                         "GreaterThanZero(x)",
    166                         "Error: cannot use GreaterThanZero with complex"
    167                 );
    168                 return false;
    169         }
    170         inline bool LessThanZero(const std::complex<double> &x)
    171         {       CppAD::ErrorHandler::Call(
    172                         true     , __LINE__ , __FILE__ ,
    173                         "LessThanZero(x)",
    174                         "Error: cannot use LessThanZero with complex"
    175                 );
    176                 return false;
    177         }
    178         inline bool LessThanOrZero(const std::complex<double> &x)
    179         {       CppAD::ErrorHandler::Call(
    180                         true     , __LINE__ , __FILE__ ,
    181                         "LessThanZero(x)",
    182                         "Error: cannot use LessThanZero with complex"
    183                 );
    184                 return false;
    185         }
     147Complex types do not support comparison operators,
     148$codep */
     149# undef  CPPAD_USER_MACRO
     150# define CPPAD_USER_MACRO(Fun)                                     \
     151inline bool Fun(const std::complex<double>& x)                     \
     152{      CppAD::ErrorHandler::Call(                                  \
     153               true     , __LINE__ , __FILE__ ,                    \
     154               #Fun"(x)",                                          \
     155               "Error: cannot use " #Fun " with x complex<double> " \
     156       );                                                          \
     157       return false;                                               \
     158}
     159namespace CppAD {
     160        CPPAD_USER_MACRO(LessThanZero)
     161        CPPAD_USER_MACRO(LessThanOrZero)
     162        CPPAD_USER_MACRO(GreaterThanOrZero)
     163        CPPAD_USER_MACRO(GreaterThanZero)
     164        inline bool abs_geq(
     165                const std::complex<double>& x ,
     166                const std::complex<double>& y )
     167        {       return std::abs(x) >= std::abs(y); }
    186168}
    187169/* $$
     
    196178        {       return static_cast<int>( x.real() ); }
    197179}
    198 /* $$
    199 
    200 $head Standard Functions$$
    201 
    202 $subhead Valid Complex Functions$$
    203 The following standard math functions,
    204 that are required by $cref/base_require/$$,
    205 are defined by
    206 $code std::complex$$:
    207 $code cos$$,
    208 $code cosh$$,
    209 $code exp$$,
    210 $code log$$,
    211 $code pow$$,
    212 $code sin$$,
    213 $code sinh$$,
    214 $code sqrt$$.
    215 $codep */
    216 # define CPPAD_USER_MACRO(function)                                   \
    217 inline std::complex<double> function(const std::complex<double> &x)   \
    218 {       return std::function(x); }
    219 
    220 namespace CppAD {
    221         CPPAD_USER_MACRO(cos)
    222         CPPAD_USER_MACRO(cosh)
    223         CPPAD_USER_MACRO(exp)
    224         CPPAD_USER_MACRO(log)
     180/*$$
     181
     182$head epsilon$$
     183The standard double complex machine epsilon in a double,
     184hence we must convert it to a complex to meet the prototype
     185for the CppAD machine epsilon function.
     186$codep */
     187namespace CppAD {
     188        template <>
     189        inline std::complex<double> epsilon< std::complex<double> >(void)
     190        {       double eps = std::numeric_limits<double>::epsilon();
     191                return std::complex<double>(eps, 0.);
     192        }
     193}
     194/* $$
     195
     196$head isnan$$
     197The gcc 4.1.1 complier defines the function
     198$codei%
     199        int std::complex<double>::isnan( std::complex<double> %z% )
     200%$$
     201(which is not specified in the C++ 1998 standard ISO/IEC 14882).
     202This causes an ambiguity between the function above and the CppAD
     203$cref/isnan/nan/$$ template function.
     204We avoid this ambiguity by defining a non-template version of
     205this function in the CppAD namespace.
     206$codep */
     207namespace CppAD {
     208        inline bool isnan(const std::complex<double>& z)
     209        {       CPPAD_ASSERT_FIRST_CALL_NOT_PARALLEL;   
     210                static const double nan = std::numeric_limits<double>::quiet_NaN();
     211                return (z != z) | (z.real() == nan) | (z.imag() == nan);
     212        }
     213}
     214/* $$
     215
     216$head Unary Standard Math$$
     217The following macro invocations define unary standard math functions
     218required to use $code AD< std::complex<double> >$$
     219and that are valid with complex arguments:
     220$codep */
     221namespace CppAD {
     222        CPPAD_STANDARD_MATH_UNARY(std::complex<double>, cos)
     223        CPPAD_STANDARD_MATH_UNARY(std::complex<double>, cosh)
     224        CPPAD_STANDARD_MATH_UNARY(std::complex<double>, exp)
     225        CPPAD_STANDARD_MATH_UNARY(std::complex<double>, log)
     226        CPPAD_STANDARD_MATH_UNARY(std::complex<double>, sin)
     227        CPPAD_STANDARD_MATH_UNARY(std::complex<double>, sinh)
     228        CPPAD_STANDARD_MATH_UNARY(std::complex<double>, sqrt)
     229}
     230/* $$
     231The following macro definition and invocations
     232define unary standard math functions
     233required to use $code AD< std::complex<double> >$$
     234and that are invalid with complex arguments:
     235$codep */
     236# undef  CPPAD_USER_MACRO
     237# define CPPAD_USER_MACRO(Fun)                                     \
     238inline std::complex<double> Fun(const std::complex<double>& x)     \
     239{      CppAD::ErrorHandler::Call(                                  \
     240               true     , __LINE__ , __FILE__ ,                    \
     241               #Fun"(x)",                                          \
     242               "Error: cannot use " #Fun " with x complex<double> " \
     243       );                                                          \
     244       return std::complex<double>(0);                             \
     245}
     246namespace CppAD {
     247        CPPAD_USER_MACRO(abs)
     248        CPPAD_USER_MACRO(acos)
     249        CPPAD_USER_MACRO(asin)
     250        CPPAD_USER_MACRO(atan)
     251}
     252/* $$
     253
     254$head pow $$
     255The following defines a $code CppAD::pow$$ function that
     256is required to use $code AD< std::complex<double> >$$:
     257$codep */
     258namespace CppAD {
    225259        inline std::complex<double> pow(
    226260                const std::complex<double> &x ,
    227261                const std::complex<double> &y )
    228262        {       return std::pow(x, y); }
    229         CPPAD_USER_MACRO(sin)
    230         CPPAD_USER_MACRO(sinh)
    231         CPPAD_USER_MACRO(sqrt)
    232 }
    233 /* $$
    234 
    235 $subhead Invalid Complex Functions$$
    236 The other standard math functions,
    237 (and $code abs$$) required by $cref/base_require/$$
    238 are not defined for complex types
    239 (see $cref/abs/abs/Complex Types/$$).
    240 Hence we make it an error to use them.
    241 (Note that the standard math functions are not defined in the CppAD namespace.)
    242 $codep */
    243 # undef  CPPAD_USER_MACRO
    244 # define CPPAD_USER_MACRO(function)                                          \
    245 inline std::complex<double> function(const std::complex<double> &x)          \
    246 {      CppAD::ErrorHandler::Call(                                            \
    247                true     , __LINE__ , __FILE__ ,                              \
    248                "std::complex<double>",                                       \
    249                "Error: cannot use " #function " with complex<double> "       \
    250        );                                                                    \
    251        return std::complex<double>(0);                                       \
    252 }
    253 
    254 namespace CppAD {
    255         CPPAD_USER_MACRO(acos)
    256         CPPAD_USER_MACRO(asin)
    257         CPPAD_USER_MACRO(atan)
    258263}
    259264/* $$
    260265$end
    261266*/
    262 # define CPPAD_VALID_COMPLEX_CASE(function)                           \
    263 inline std::complex<float> function(const std::complex<float> &x)     \
    264 {       return std::function(x); }
    265 
    266 # define CPPAD_INVALID_COMPLEX_CASE(function)                                 \
    267 inline std::complex<float> function(const std::complex<float> &x)             \
    268 {       CppAD::ErrorHandler::Call(                                            \
    269                 true     , __LINE__ , __FILE__ ,                              \
    270                 "std::complex<float>",                                        \
    271                 "Error: cannot use " #function " with a complex type"         \
    272         );                                                                    \
    273         return std::complex<float>(0);                                        \
     267# undef  CPPAD_USER_MACRO_ONE
     268# define CPPAD_USER_MACRO_ONE(Fun)                                 \
     269inline bool Fun(const std::complex<float>& x)                      \
     270{      CppAD::ErrorHandler::Call(                                  \
     271               true     , __LINE__ , __FILE__ ,                    \
     272               #Fun"(x)",                                          \
     273               "Error: cannot use " #Fun " with x complex<float> " \
     274       );                                                          \
     275       return false;                                               \
     276}
     277# undef  CPPAD_USER_MACRO_TWO
     278# define CPPAD_USER_MACRO_TWO(Fun)                                 \
     279inline std::complex<float> Fun(const std::complex<float>& x)       \
     280{      CppAD::ErrorHandler::Call(                                  \
     281               true     , __LINE__ , __FILE__ ,                    \
     282               #Fun"(x)",                                          \
     283               "Error: cannot use " #Fun " with x complex<float> " \
     284       );                                                          \
     285       return std::complex<float>(0);                              \
    274286}
    275287namespace CppAD {
     
    288300                return std::complex<float>(0);
    289301        }
     302        // CondExpRel --------------------------------------------------------
     303        CPPAD_COND_EXP_REL( std::complex<float> )
    290304        // EqualOpSeq -----------------------------------------------------
    291305        inline bool EqualOpSeq(
     
    305319        {       return (x == y); }
    306320        // Ordered --------------------------------------------------------
    307         inline bool GreaterThanZero(const std::complex<float> &x)
    308         {       CppAD::ErrorHandler::Call(
    309                         true     , __LINE__ , __FILE__ ,
    310                         "GreaterThanZero(x)",
    311                         "Error: cannot use GreaterThanZero with complex"
    312                 );
    313                 return false;
    314         }
    315         inline bool GreaterThanOrZero(const std::complex<float> &x)
    316         {       CppAD::ErrorHandler::Call(
    317                         true     , __LINE__ , __FILE__ ,
    318                         "GreaterThanOrZero(x)",
    319                         "Error: cannot use GreaterThanOrZero with complex"
    320                 );
    321                 return false;
    322         }
    323         inline bool LessThanZero(const std::complex<float> &x)
    324         {       CppAD::ErrorHandler::Call(
    325                         true     , __LINE__ , __FILE__ ,
    326                         "LessThanZero(x)",
    327                         "Error: cannot use LessThanZero with complex"
    328                 );
    329                 return false;
    330         }
    331         inline bool LessThanOrZero(const std::complex<float> &x)
    332         {       CppAD::ErrorHandler::Call(
    333                         true     , __LINE__ , __FILE__ ,
    334                         "LessThanOrZero(x)",
    335                         "Error: cannot use LessThanOrZero with complex"
    336                 );
    337                 return false;
    338         }
     321        CPPAD_USER_MACRO_ONE(LessThanZero)
     322        CPPAD_USER_MACRO_ONE(LessThanOrZero)
     323        CPPAD_USER_MACRO_ONE(GreaterThanOrZero)
     324        CPPAD_USER_MACRO_ONE(GreaterThanZero)
     325        inline bool abs_geq(
     326                const std::complex<float>& x ,
     327                const std::complex<float>& y )
     328        {       return std::abs(x) >= std::abs(y); }
    339329        // Integer ------------------------------------------------------
    340330        inline int Integer(const std::complex<float> &x)
    341331        {       return static_cast<int>( x.real() ); }
     332        // epsilon -------------------------------------------------------
     333        template <>
     334        inline std::complex<float> epsilon< std::complex<float> >(void)
     335        {       float eps = std::numeric_limits<float>::epsilon();
     336                return std::complex<float>(eps, 0.);
     337        }
     338        // isnan -------------------------------------------------------------
     339        inline bool isnan(const std::complex<float>& z)
     340        {       CPPAD_ASSERT_FIRST_CALL_NOT_PARALLEL;   
     341                static const float nan = std::numeric_limits<float>::quiet_NaN();
     342                return (z != z) | (z.real() == nan) | (z.imag() == nan);
     343        }
    342344        // Valid standard math functions --------------------------------
    343         CPPAD_VALID_COMPLEX_CASE(cos)
    344         CPPAD_VALID_COMPLEX_CASE(cosh)
    345         CPPAD_VALID_COMPLEX_CASE(exp)
    346         CPPAD_VALID_COMPLEX_CASE(log)
     345        CPPAD_STANDARD_MATH_UNARY(std::complex<float>, cos)
     346        CPPAD_STANDARD_MATH_UNARY(std::complex<float>, cosh)
     347        CPPAD_STANDARD_MATH_UNARY(std::complex<float>, exp)
     348        CPPAD_STANDARD_MATH_UNARY(std::complex<float>, log)
     349        CPPAD_STANDARD_MATH_UNARY(std::complex<float>, sin)
     350        CPPAD_STANDARD_MATH_UNARY(std::complex<float>, sinh)
     351        CPPAD_STANDARD_MATH_UNARY(std::complex<float>, sqrt)
     352        // Invalid standrd math functions -------------------------------
     353        CPPAD_USER_MACRO_TWO(abs)
     354        CPPAD_USER_MACRO_TWO(acos)
     355        CPPAD_USER_MACRO_TWO(asin)
     356        CPPAD_USER_MACRO_TWO(atan)
     357        // The pow function
    347358        inline std::complex<float> pow(
    348359                const std::complex<float> &x ,
    349360                const std::complex<float> &y )
    350361        {       return std::pow(x, y); }
    351         CPPAD_VALID_COMPLEX_CASE(sin)
    352         CPPAD_VALID_COMPLEX_CASE(sinh)
    353         CPPAD_VALID_COMPLEX_CASE(sqrt)
    354         // Invalid standrd math functions -------------------------------
    355         CPPAD_INVALID_COMPLEX_CASE(abs)
    356         CPPAD_INVALID_COMPLEX_CASE(acos)
    357         CPPAD_INVALID_COMPLEX_CASE(asin)
    358         CPPAD_INVALID_COMPLEX_CASE(atan)
    359         CPPAD_INVALID_COMPLEX_CASE(erf)
    360 }
    361 
    362 // preprocessor symbols that are local to this file
    363 # undef CPPAD_USER_MACRO
    364 # undef CPPAD_VALID_COMPLEX_CASE
    365 # undef CPPAD_INVALID_COMPLEX_CASE
     362}
    366363
    367364# endif
  • trunk/cppad/local/cond_exp.hpp

    r1986 r2057  
    7373        $cnext $code >$$
    7474$tend
    75 If $icode f$$ is the $xref/ADFun/$$ object corresponding to the
     75If $icode f$$ is the $cref/ADFun/$$ object corresponding to the
    7676AD operation sequence,
    7777the assignment choice for $icode result$$
    7878in an AD conditional expression is made each time
    79 $xref/Forward//f.Forward/$$ is used to evaluate the zero order Taylor
     79$cref/f.Forward/Forward/$$ is used to evaluate the zero order Taylor
    8080coefficients with new values for the
    8181$cref/independent variables/glossary/Tape/Independent Variable/$$.
    82 This is in contrast to the $xref/Compare//AD comparison operators/$$
     82This is in contrast to the $cref/AD comparison operators/Compare/$$
    8383which are boolean valued and not included in the AD operation sequence.
    8484
     
    9999The argument $icode left$$ has prototype
    100100$codei%
    101         const %Type% &%left%
     101        const %Type%& %left%
    102102%$$
    103103It specifies the value for the left side of the comparison operator.
     
    106106The argument $icode right$$ has prototype
    107107$codei%
    108         const %Type% &%right%
     108        const %Type%& %right%
    109109%$$
    110110It specifies the value for the right side of the comparison operator.
     
    113113The argument $icode exp_if_true$$ has prototype
    114114$codei%
    115         const %Type% &%exp_if_true%
     115        const %Type%& %exp_if_true%
    116116%$$
    117117It specifies the return value if the result of the comparison is true.
     
    120120The argument $icode exp_if_false$$ has prototype
    121121$codei%
    122         const %Type% &%exp_if_false%
     122        const %Type%& %exp_if_false%
    123123%$$
    124124It specifies the return value if the result of the comparison is false.
     
    127127The $icode result$$ has prototype
    128128$codei%
    129         %Type% &%exp_if_false%
     129        %Type%& %exp_if_false%
    130130%$$
    131131
     
    157157%$$
    158158The file
    159 $xref/CondExp.cpp/$$
     159$cref/CondExp.cpp/$$
    160160contains an example and test of this function.   
    161161It returns true if it succeeds and false otherwise.
     
    163163$head Atan2$$
    164164The following implementation of the
    165 AD $xref/atan2/$$ function is a more complex
     165AD $cref/atan2/$$ function is a more complex
    166166example of using conditional expressions:
    167167$code
     
    175175//  BEGIN CppAD namespace
    176176namespace CppAD {
    177 
    178 // ------------ CondExpOp(cop, left, right, exp_if_true, exp_if_false) --------------
    179 // CompareType and ResultType are different for the forward and reverse
    180 // sparese calculations.
    181 template <class CompareType, class ResultType>
    182 CPPAD_INLINE ResultType CondExpTemplate(
    183         enum  CompareOp            cop ,
    184         const CompareType        &left ,
    185         const CompareType       &right ,
    186         const ResultType     &exp_if_true ,
    187         const ResultType    &exp_if_false )
    188 {       ResultType returnValue;
    189         switch( cop )
    190         {
    191                 case CompareLt:
    192                 if( left < right )
    193                         returnValue = exp_if_true;
    194                 else    returnValue = exp_if_false;
    195                 break;
    196 
    197                 case CompareLe:
    198                 if( left <= right )
    199                         returnValue = exp_if_true;
    200                 else    returnValue = exp_if_false;
    201                 break;
    202 
    203                 case CompareEq:
    204                 if( left == right )
    205                         returnValue = exp_if_true;
    206                 else    returnValue = exp_if_false;
    207                 break;
    208 
    209                 case CompareGe:
    210                 if( left >= right )
    211                         returnValue = exp_if_true;
    212                 else    returnValue = exp_if_false;
    213                 break;
    214 
    215                 case CompareGt:
    216                 if( left > right )
    217                         returnValue = exp_if_true;
    218                 else    returnValue = exp_if_false;
    219                 break;
    220 
    221                 default:
    222                 CPPAD_ASSERT_UNKNOWN(0);
    223                 returnValue = exp_if_true;
    224         }
    225         return returnValue;
    226 }
    227 
    228 inline float CondExpOp(
    229         enum CompareOp     cop ,
    230         const float      &left ,
    231         const float     &right ,
    232         const float  &exp_if_true ,
    233         const float &exp_if_false )
    234 {       return CondExpTemplate(cop, left, right, exp_if_true, exp_if_false);
    235 }
    236 
    237 inline double CondExpOp(
    238         enum CompareOp     cop ,
    239         const double      &left ,
    240         const double     &right ,
    241         const double  &exp_if_true ,
    242         const double &exp_if_false )
    243 {       return CondExpTemplate(cop, left, right, exp_if_true, exp_if_false);
    244 }
    245177
    246178template <class Base>
     
    419351
    420352# undef CPPAD_COND_EXP
    421 # define CPPAD_COND_EXP(Name, Op, Type)                             \
    422         inline Type CondExp##Name(                                  \
    423                 const Type &left      ,                             \
    424                 const Type &right     ,                             \
    425                 const Type &exp_if_true  ,                             \
    426                 const Type &exp_if_false )                             \
    427         {       Type returnValue;                                   \
    428                 if( left Op right )                                 \
    429                         returnValue = exp_if_true;                     \
    430                 else    returnValue = exp_if_false;                    \
    431                 return returnValue;                                 \
    432         }
    433 
    434 // float
    435 CPPAD_COND_EXP(Lt,  <, float)
    436 CPPAD_COND_EXP(Le, <=, float)
    437 CPPAD_COND_EXP(Eq, ==, float)
    438 CPPAD_COND_EXP(Ge, >=, float)
    439 CPPAD_COND_EXP(Gt,  >, float)
    440 inline float CondExp(
    441         const float &flag      ,
    442         const float &exp_if_true  ,
    443         const float &exp_if_false )
    444 {       
    445         return CondExpGt(flag, float(0), exp_if_true, exp_if_false);
    446 }
    447 
    448 // double
    449 CPPAD_COND_EXP(Lt,  <, double)
    450 CPPAD_COND_EXP(Le, <=, double)
    451 CPPAD_COND_EXP(Eq, ==, double)
    452 CPPAD_COND_EXP(Ge, >=, double)
    453 CPPAD_COND_EXP(Gt,  >, double)
    454 inline double CondExp(
    455         const double &flag      ,
    456         const double &exp_if_true  ,
    457         const double &exp_if_false )
    458 {       
    459         return CondExpGt(flag, 0., exp_if_true, exp_if_false);
    460 }
    461 
    462 # undef CPPAD_COND_EXP
    463 
    464353} // END CppAD namespace
    465354
  • trunk/cppad/local/equal_op_seq.hpp

    r1369 r2057  
    44
    55/* --------------------------------------------------------------------------
    6 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-08 Bradley M. Bell
     6CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-11 Bradley M. Bell
    77
    88CppAD is distributed under multiple licenses. This distribution is under
     
    2828$index equal, operation sequence$$
    2929
    30 $section Check if Equal and Correspond to Same Operation Sequence$$
     30$section Check if Two Value are Identically Equal$$
    3131
    3232$head Syntax$$
     
    3434
    3535$head Purpose$$
    36 Determine if two $italic x$$ and $italic y$$ are equal, and
     36Determine if two $italic x$$ and $italic y$$ are identically equal; i.e.,
     37not only is $icode%x% == %y%$$ true, but
    3738if they are $cref/variables/glossary/Variable/$$,
    38 determine if they correspond to the same
     39they correspond have the same
    3940$cref/operation sequence/glossary/Operation/Sequence/$$.
    4041
     
    103104
    104105namespace CppAD {
    105         inline bool EqualOpSeq(const float &x, const float &y)
    106         {       return x == y; }
    107         inline bool EqualOpSeq(const double &x, const double &y)
    108         {       return x == y; }
    109106        template <class Base>
    110107        CPPAD_INLINE bool EqualOpSeq(const AD<Base> &x, const AD<Base> &y)
  • trunk/cppad/local/forward.hpp

    r1948 r2057  
    3232# include <cppad/local/cap_taylor.hpp>
    3333
    34 // BEGIN CppAD namespace
    35 namespace CppAD {
     34CPPAD_BEGIN_NAMESPACE
     35/*!
     36\file forward.hpp
     37User interface to forward mode computations
     38*/
     39
     40/*!
     41Compute arbitrary order forward mode Taylor coefficieints.
     42
     43\tparam Base
     44The type used during the forward mode computations; i.e., the corresponding
     45recording of operations used the type \c AD<Base>.
     46
     47\tparam Vector
     48is a Simple Vector class with eleements of type \c Base.
     49
     50\param p
     51is the order for this forward mode computation; i.e., the number
     52of Taylor coefficient is <code>p+1</code>.
     53
     54\param x_p
     55Is the \c p th order Taylor coefficient vector for the independent variables.
     56
     57\param s
     58Is the stream where output corresponding to \c PriOp operations will written.
     59*/
    3660
    3761template <typename Base>
    3862template <typename Vector>
    39 Vector ADFun<Base>::Forward(size_t p, const Vector &up)
     63Vector ADFun<Base>::Forward(
     64        size_t p                    ,
     65        const Vector& x_p           ,
     66        std::ostream& s = std::cout )
    4067{       // temporary indices
    4168        size_t i, j;
     
    5178
    5279        CPPAD_ASSERT_KNOWN(
    53                 up.size() == n,
     80                x_p.size() == n,
    5481                "Second argument to Forward does not have length equal to\n"
    5582                "the dimension of the domain for the corresponding ADFun."
     
    74101
    75102                // It is also variable taddr for j-th independent variable
    76                 taylor_[ind_taddr_[j] * taylor_col_dim_ + p] = up[j];
     103                taylor_[ind_taddr_[j] * taylor_col_dim_ + p] = x_p[j];
    77104        }
    78105
     
    81108        {
    82109# if CPPAD_USE_FORWARD0SWEEP
    83                 compare_change_ = forward0sweep(
    84                         true, n, total_num_var_, &play_, taylor_col_dim_, taylor_.data()
     110                compare_change_ = forward0sweep(s, true,
     111                        n, total_num_var_, &play_, taylor_col_dim_, taylor_.data()
    85112                );
    86113# else
    87                 compare_change_ = forward_sweep(
    88                 true, p, n, total_num_var_, &play_, taylor_col_dim_, taylor_.data()
     114                compare_change_ = forward_sweep(s, true,
     115                        n, total_num_var_, &play_, taylor_col_dim_, taylor_.data()
    89116                );
    90117# endif
    91118        }
    92         else forward_sweep(
    93                 true, p, n, total_num_var_, &play_, taylor_col_dim_, taylor_.data()
     119        else forward_sweep(s, false,
     120                p, n, total_num_var_, &play_, taylor_col_dim_, taylor_.data()
    94121        );
    95122
    96123        // return the p-th order taylor_ coefficients for dependent variables
    97         Vector vp(m);
     124        Vector y_p(m);
    98125        for(i = 0; i < m; i++)
    99126        {       CPPAD_ASSERT_UNKNOWN( dep_taddr_[i] < total_num_var_ );
    100                 vp[i] = taylor_[dep_taddr_[i] * taylor_col_dim_ + p];
     127                y_p[i] = taylor_[dep_taddr_[i] * taylor_col_dim_ + p];
    101128        }
    102129# ifndef NDEBUG
    103         if( hasnan(vp) )
     130        if( hasnan(y_p) )
    104131        {       if( p == 0 )
    105132                {       CPPAD_ASSERT_KNOWN(false,
    106                                 "y_p = f.Forward(p, x_p): has a nan in y_p for p = 0."
     133                                "y = f.Forward(0, x): has a nan in y."
    107134                        ); 
    108135                }
    109136                else
    110137                {       CPPAD_ASSERT_KNOWN(false,
    111                                 "y_p = f.Forward(p, x_p): has a nan in y_p for p > 0\n"
     138                                "y_p = f.Forward(p, x_p): has a nan in y_p for p > 0, "
    112139                                "but not for p = 0."
    113140                        );
     
    120147        taylor_per_var_ = p + 1;
    121148
    122         return vp;
     149        return y_p;
    123150}
    124151
    125 } // END CppAD namespace
    126 
    127 
     152CPPAD_END_NAMESPACE
    128153# endif
  • trunk/cppad/local/forward0sweep.hpp

    r2037 r2057  
    3333
    3434\tparam Base
    35 base type for the operator; i.e., this operation was recorded
    36 using AD< \a Base > and computations by this routine are done using type
    37 \a Base.
     35The type used during the forward mode computations; i.e., the corresponding
     36recording of operations used the type \c AD<Base>.
     37
     38\param s_out
     39Is the stream where output corresponding to \c PriOp operations will
     40be written.
    3841
    3942\param print
    4043If \a print is false,
    41 suppress the output that is otherwise generated by the PriOp instructions.
     44suppress the output that is otherwise generated by the c PriOp instructions.
    4245
    4346\param n
     
    9699template <class Base>
    97100size_t forward0sweep(
     101        std::ostream&         s_out,
    98102        bool                  print,
    99103        size_t                n,
     
    376380
    377381                        case PriOp:
    378                         if( print ) forward_pri_0(
     382                        if( print ) forward_pri_0(s_out,
    379383                                i_var, arg, num_text, text, num_par, parameter, J, Taylor
    380384                        );
  • trunk/cppad/local/forward_sweep.hpp

    r2037 r2057  
    3636\a Base.
    3737
     38\param s_out
     39Is the stream where output corresponding to \c PriOp operations will
     40be written.
     41
    3842\param print
    3943If \a print is false,
    40 suppress the output that is otherwise generated by the PriOp instructions.
     44suppress the output that is otherwise generated by the PriOp instructions
     45(must be false when \c d is nonzero).
    4146
    4247\param d
     
    101106template <class Base>
    102107size_t forward_sweep(
     108        std::ostream&         s_out,
    103109        bool                  print,
    104110        size_t                d,
     
    120126        size_t        i_var;
    121127
     128        CPPAD_ASSERT_UNKNOWN( d == 0 || ! print );
    122129# if CPPAD_USE_FORWARD0SWEEP
    123130        CPPAD_ASSERT_UNKNOWN( d > 0 );
     
    411418                        case PriOp:
    412419# if ! CPPAD_USE_FORWARD0SWEEP
    413                         if( print && ( d == 0 ) ) forward_pri_0(
     420                        if( print ) forward_pri_0(s_out
    414421                                arg, num_text, text, num_par, parameter
    415422                        );
  • trunk/cppad/local/fun_construct.hpp

    r1986 r2057  
    446446        // use independent variable values to fill in values for others
    447447# if CPPAD_USE_FORWARD0SWEEP
    448         compare_change_ = forward0sweep(
    449                 false, n, total_num_var_, &play_, taylor_col_dim_, taylor_.data()
     448        compare_change_ = forward0sweep(std::cout, false,
     449                n, total_num_var_, &play_, taylor_col_dim_, taylor_.data()
    450450        );
    451451# else
    452452        size_t p = 0;
    453         compare_change_ = forward_sweep(
    454                 false, p, n, total_num_var_, &play_, taylor_col_dim_, taylor_.data()
     453        compare_change_ = forward_sweep(std::cout, false,
     454                p, n, total_num_var_, &play_, taylor_col_dim_, taylor_.data()
    455455        );
    456456# endif
  • trunk/cppad/local/identical.hpp

    r1826 r2057  
    2222*/
    2323
    24 // Parameter ==============================================================
    25 /*!
    26 return true, used by <tt>IdenticalPar(AD<float>)</tt>.
    27 
    28 \param x
    29 not used.
    30 
    31 \return
    32 returns true.
    33 */
    34 inline bool IdenticalPar(const float &x)
    35 {       return true; }
    36 // ---------------------------------------------------------------------------
    37 /*!
    38 return true, used by <tt>IdenticalPar(AD<double>)</tt>.
    39 
    40 \param x
    41 not used.
    42 
    43 \return
    44 returns true.
    45 */
    46 inline bool IdenticalPar(const double &x)
    47 {       return true; }
    4824// ---------------------------------------------------------------------------
    4925/*!
     
    7046// Zero ==============================================================
    7147/*!
    72 Check if a float is equal to zero, used by <tt>IdenticalZero(AD<float>)</tt>.
    73 
    74 \param x
    75 value we are checking.
    76 
    77 \return
    78 returns true iff the argument equals zero.
    79 */
    80 inline bool IdenticalZero(const float &x)
    81 {       return (x == 0.); }
    82 // --------------------------------------------------------------------------
    83 /*!
    84 Check if a double is equal to zero, used by <tt>IdenticalZero(AD<double>)</tt>.
    85 
    86 \param x
    87 value we are checking.
    88 
    89 \return
    90 returns true iff the argument equals zero.
    91 */
    92 inline bool IdenticalZero(const double &x)
    93 {       return (x == 0.); }
    94 // --------------------------------------------------------------------------
    95 /*!
    9648Determine if an AD<Base> is equal to zero,
    9749and must be equal zero during any tape playback.
     
    10961// One ==============================================================
    11062/*!
    111 Check if a float is equal to one, used by <tt>IdenticalOne(AD<float>)</tt>.
    112 
    113 \param x
    114 value we are checking.
    115 
    116 \return
    117 returns true iff the argument equals one.
    118 */
    119 inline bool IdenticalOne(const float &x)
    120 {       return (x == 1.); }
    121 // --------------------------------------------------------------------------
    122 /*!
    123 Check if a double is equal to one, used by <tt>IdenticalOne(AD<double>)</tt>.
    124 
    125 \param x
    126 value we are checking.
    127 
    128 \return
    129 returns true iff the argument equals one.
    130 */
    131 inline bool IdenticalOne(const double &x)
    132 {       return (x == 1.); }
    133 // --------------------------------------------------------------------------
    134 /*!
    13563Determine if an AD<Base> is equal to one,
    13664and must be equal one during any tape playback.
     
    14775{       return Parameter(x) && IdenticalOne(x.value_); }
    14876// Equal ===================================================================
    149 /*!
    150 Check if two floats are equal,
    151 used by <tt>IdenticalEqualPar(AD<float>, AD<float>)</tt>.
    152 
    153 \param x
    154 first float we are checking.
    155 
    156 \param y
    157 second float we are checking.
    158 
    159 \return
    160 returns true iff the arugments are equal.
    161 */
    162 inline bool IdenticalEqualPar(const float &x, const float &y)
    163 {       return (x == y); }
    164 // --------------------------------------------------------------------------
    165 /*!
    166 Check if two doubles are equal,
    167 used by <tt>IdenticalEqualPar(AD<double>, AD<double>)</tt>.
    168 
    169 \param x
    170 first double we are checking.
    171 
    172 \param y
    173 second double we are checking.
    174 
    175 \return
    176 returns true iff the arugments are equal.
    177 */
    178 inline bool IdenticalEqualPar(const double &x, const double &y)
    179 {       return (x == y); }
    180 // --------------------------------------------------------------------------
    18177/*!
    18278Determine if two AD<Base> objects are equal,
  • trunk/cppad/local/integer.hpp

    r1369 r2057  
    44
    55/* --------------------------------------------------------------------------
    6 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-08 Bradley M. Bell
     6CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-11 Bradley M. Bell
    77
    88CppAD is distributed under multiple licenses. This distribution is under
     
    103103namespace CppAD {
    104104
    105         inline int Integer(const float &x)
    106         {       return static_cast<int>(x); }
    107 
    108         inline int Integer(const double &x)
    109         {       return static_cast<int>(x); }
    110 
    111105        template <class Base>
    112106        CPPAD_INLINE int Integer(const AD<Base> &x)
  • trunk/cppad/local/math_other.hpp

    r1369 r2057  
    44
    55/* --------------------------------------------------------------------------
    6 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-06 Bradley M. Bell
     6CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-11 Bradley M. Bell
    77
    88CppAD is distributed under multiple licenses. This distribution is under
     
    1919        atan
    2020$$
    21 
    22 $index atan2, AD$$
    23 
    2421$index other, AD math$$
    2522$index math, AD other$$
     23$index AD, other math$$
    2624
    2725$section Other AD Math Functions$$
    2826
    29 $children%
     27$childtable%
    3028        cppad/local/abs.hpp%
    3129        cppad/local/atan2.hpp%
     30        cppad/local/epsilon.hpp%
    3231        cppad/local/erf.hpp%
    3332        cppad/local/pow.hpp
    3433%$$
    35 $table
    36 $rref abs$$
    37 $rref atan2$$
    38 $rref erf$$
    39 $rref  pow$$
    40 $tend
    41        
    4234
    4335$end
     
    4638# include <cppad/local/abs.hpp>
    4739# include <cppad/local/atan2.hpp>
     40# include <cppad/local/epsilon.hpp>
    4841# include <cppad/local/erf.hpp>
    4942# include <cppad/local/pow.hpp>
  • trunk/cppad/local/optimize.hpp

    r2037 r2057  
    16731673        CppAD::vector<Base> x(n), y(m), check(m);
    16741674        bool check_zero_order = taylor_per_var_ > 0;
     1675        Base max_taylor(0);
    16751676        if( check_zero_order )
    16761677        {       // zero order coefficients for independent vars
     
    16851686                        y[i] = taylor_[ dep_taddr_[i] * taylor_col_dim_ + 0];
    16861687                }
     1688                // maximum zero order coefficient
     1689                for(i = 0; i < total_num_var_; i++)
     1690                {       if(  abs_geq(taylor_[i*taylor_col_dim_+0] , max_taylor) )
     1691                                max_taylor = taylor_[i*taylor_col_dim_+0];
     1692                }
    16871693        }
    16881694# endif
     
    17141720
    17151721                // check results
     1722                Base eps = 10. * epsilon<Base>();
    17161723                for(i = 0; i < m; i++) CPPAD_ASSERT_KNOWN(
    1717                         check[i] == y[i] ,
     1724                        abs_geq( eps * max_taylor , check[i] - y[i] ) ,
    17181725                        "Error during check of f.optimize()."
    17191726                );
  • trunk/cppad/local/ordered.hpp

    r1828 r2057  
    2525// GreaterThanZero ============================================================
    2626/*!
    27 Check if a float is greater than zero,
    28 used by <tt>GreaterThanZero(AD<float>)</tt>.
    29 
    30 \param x
    31 value we are checking.
    32 
    33 \return
    34 returns true iff the \c x is greater than zero.
    35 */
    36 inline bool GreaterThanZero(const float &x)
    37 {       return x > 0.; }
    38 // ---------------------------------------------------------------------------
    39 /*!
    40 Check if a double is greater than zero,
    41 used by <tt>GreaterThanZero(AD<double>)</tt>.
    42 
    43 \param x
    44 value we are checking.
    45 
    46 \return
    47 returns true iff the \c x is greater than zero.
    48 */
    49 inline bool GreaterThanZero(const double &x)
    50 {       return x > 0.; }
    51 // ---------------------------------------------------------------------------
    52 /*!
    5327Check if an AD<Base> is greater than zero.
    5428
     
    6034*/
    6135template <class Base>
    62 CPPAD_INLINE bool GreaterThanZero(const AD<Base> &x)
     36inline bool GreaterThanZero(const AD<Base> &x)
    6337{       return GreaterThanZero(x.value_); }
    6438// GreaterThanOrZero =========================================================
    65 /*!
    66 Check if a float is greater than or equal zero,
    67 used by <tt>GreaterThanOrZero(AD<float>)</tt>.
    68 
    69 \param x
    70 value we are checking.
    71 
    72 \return
    73 returns true iff the \c x is greater than or equal zero.
    74 */
    75 inline bool GreaterThanOrZero(const float &x)
    76 {       return x >= 0.; }
    77 // ---------------------------------------------------------------------------
    78 /*!
    79 Check if a double is greater than or equal zero,
    80 used by <tt>GreaterThanOrZero(AD<double>)</tt>.
    81 
    82 \param x
    83 value we are checking.
    84 
    85 \return
    86 returns true iff the \c x is greater than or equal zero.
    87 */
    88 inline bool GreaterThanOrZero(const double &x)
    89 {       return x >= 0.; }
    90 // ---------------------------------------------------------------------------
    9139/*!
    9240Check if an AD<Base> is greater than or equal zero.
     
    9947*/
    10048template <class Base>
    101 CPPAD_INLINE bool GreaterThanOrZero(const AD<Base> &x)
     49inline bool GreaterThanOrZero(const AD<Base> &x)
    10250{       return GreaterThanOrZero(x.value_); }
    10351// LessThanZero ============================================================
    104 /*!
    105 Check if a float is less than zero,
    106 used by <tt>LessThanZero(AD<float>)</tt>.
    107 
    108 \param x
    109 value we are checking.
    110 
    111 \return
    112 returns true iff the \c x is less than zero.
    113 */
    114 inline bool LessThanZero(const float &x)
    115 {       return x < 0.; }
    116 // ---------------------------------------------------------------------------
    117 /*!
    118 Check if a double is less than zero,
    119 used by <tt>LessThanZero(AD<double>)</tt>.
    120 
    121 \param x
    122 value we are checking.
    123 
    124 \return
    125 returns true iff the \c x is less than zero.
    126 */
    127 inline bool LessThanZero(const double &x)
    128 {       return x < 0.; }
    129 // ---------------------------------------------------------------------------
    13052/*!
    13153Check if an AD<Base> is less than zero.
     
    13860*/
    13961template <class Base>
    140 CPPAD_INLINE bool LessThanZero(const AD<Base> &x)
     62inline bool LessThanZero(const AD<Base> &x)
    14163{       return LessThanZero(x.value_); }
    14264// LessThanOrZero =========================================================
    143 /*!
    144 Check if a float is less than or equal zero,
    145 used by <tt>LessThanOrZero(AD<float>)</tt>.
    146 
    147 \param x
    148 value we are checking.
    149 
    150 \return
    151 returns true iff the \c x is less than or equal zero.
    152 */
    153 inline bool LessThanOrZero(const float &x)
    154 {       return x <= 0.; }
    155 // ---------------------------------------------------------------------------
    156 /*!
    157 Check if a double is less than or equal zero,
    158 used by <tt>LessThanOrZero(AD<double>)</tt>.
    159 
    160 \param x
    161 value we are checking.
    162 
    163 \return
    164 returns true iff the \c x is less than or equal zero.
    165 */
    166 inline bool LessThanOrZero(const double &x)
    167 {       return x <= 0.; }
    168 // ---------------------------------------------------------------------------
    16965/*!
    17066Check if an AD<Base> is less than or equal zero.
     
    17773*/
    17874template <class Base>
    179 CPPAD_INLINE bool LessThanOrZero(const AD<Base> &x)
     75inline bool LessThanOrZero(const AD<Base> &x)
    18076{       return LessThanOrZero(x.value_); }
     77// abs_geq =========================================================
     78/*!
     79Check if absolute value of one AD<Base> is greater or equal another.
     80
     81\param x
     82value we are checking if it is greater than or equal other.
     83
     84\param y
     85value we are checking if it is less than other.
     86
     87\return
     88returns true iff the absolute value of \c x is greater than or equal
     89absolute value of \c y.
     90*/
     91template <class Base>
     92inline bool abs_geq(const AD<Base>& x, const AD<Base>& y)
     93{       return abs_geq(x.value_, y.value_); }
    18194// ============================================================================
    18295CPPAD_END_NAMESPACE
  • trunk/cppad/local/pow.hpp

    r1986 r2057  
    108108namespace CppAD {
    109109 
    110 // copy of standard functions in CppAD namespace
    111 inline float pow(const float &x, const float &y)
    112 { return std::pow(x, y); }
    113 
    114 inline double pow(const double &x, const double &y)
    115 { return std::pow(x, y); }
    116 
    117110// case where x and y are AD<Base> -----------------------------------------
    118111template <class Base> AD<Base>
  • trunk/cppad/local/print_for.hpp

    r2041 r2057  
    103103       
    104104$head Discussion$$
    105 This is can be helpful for understanding why tape evaluations
     105This is helpful for understanding why tape evaluations
    106106have trouble.
    107107For example, if one of the operations in $icode f$$ is
     
    116116$head Example$$
    117117$children%
    118         print_for/print_for.cpp
     118        print_for/print_for.cpp%
     119        example/print_for.cpp
    119120%$$
    120121The program
    121 $cref/print_for.cpp/$$
    122 is an example and test of this operation.
     122$cref/print_for_cout.cpp/$$
     123is an example and test that prints to standard output.
    123124The output of this program
    124125states the conditions for passing and failing the test.
     126The function
     127$cref/print_for_string.cpp/$$
     128is an example and test that prints to an standard string stream.
     129This function automatically check for correct output.
    125130
    126131$end
  • trunk/cppad/local/print_op.hpp

    r2041 r2057  
    2828and the print occurs during the zero order forward mode computation.
    2929
    30 \par std::cout
    31 the results are printed on the C++ standard output stream.
    32 
    3330\tparam Base
    3431base type for the operator; i.e., this operation was recorded
    3532using AD< \a Base > and computations by this routine are done using type
    3633\a Base .
     34
     35\param s_out
     36the results are printed on this output stream.
    3737
    3838\param i_z
     
    106106template <class Base>
    107107inline void forward_pri_0(
     108        std::ostream& s_out       ,
    108109        size_t        i_z         ,
    109110        const addr_t* arg         ,
     
    148149
    149150        if( ! GreaterThanZero( pos ) )
    150                 std::cout << before << var << after;
     151                s_out << before << var << after;
    151152}
    152153
  • trunk/cppad/local/prototype_op.hpp

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • trunk/cppad/local/sparse_pack.hpp

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • trunk/cppad/local/sparse_set.hpp

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • trunk/cppad/local/sparse_unary_op.hpp

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • trunk/cppad/local/std_math_ad.hpp

    r2031 r2057  
    248248*/
    249249
    250 # include <cppad/std_math_unary.hpp>
    251 
    252250# define CPPAD_STANDARD_MATH_UNARY_AD(Name, Op)                   \
    253251    template <class Base>                                         \
  • trunk/cppad/local/user_ad.hpp

    r1369 r2057  
    44
    55/* --------------------------------------------------------------------------
    6 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-09 Bradley M. Bell
     6CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-11 Bradley M. Bell
    77
    88CppAD is distributed under multiple licenses. This distribution is under
     
    5757        cppad/local/bool_valued.hpp%
    5858        cppad/local/vec_ad.hpp%
    59         omh/base_require.omh
     59        cppad/base_require.hpp
    6060%$$
    6161
  • trunk/cppad/lu_solve.hpp

    r1370 r2057  
    44
    55/* --------------------------------------------------------------------------
    6 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-07 Bradley M. Bell
     6CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-11 Bradley M. Bell
    77
    88CppAD is distributed under multiple licenses. This distribution is under
     
    249249
    250250// link exp for float and double cases
    251 # include <cppad/std_math_unary.hpp>
     251# include <cppad/base_require.hpp>
    252252
    253253# include <cppad/local/cppad_assert.hpp>
  • trunk/cppad/ode_err_control.hpp

    r1370 r2057  
    44
    55/* --------------------------------------------------------------------------
    6 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-07 Bradley M. Bell
     6CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-11 Bradley M. Bell
    77
    88CppAD is distributed under multiple licenses. This distribution is under
     
    419419
    420420// link exp and log for float and double
    421 # include <cppad/std_math_unary.hpp>
     421# include <cppad/base_require.hpp>
    422422
    423423# include <cppad/local/cppad_assert.hpp>
  • trunk/cppad/ode_gear_control.hpp

    r1370 r2057  
    44
    55/* --------------------------------------------------------------------------
    6 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-07 Bradley M. Bell
     6CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-11 Bradley M. Bell
    77
    88CppAD is distributed under multiple licenses. This distribution is under
     
    370370
    371371// link exp and log for float and double
    372 # include <cppad/std_math_unary.hpp>
     372# include <cppad/base_require.hpp>
    373373
    374374# include <cppad/ode_gear.hpp>
  • trunk/cppad_ipopt/example/get_started.cpp

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • trunk/cppad_ipopt/example/ode_check.cpp

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • trunk/example/abort_recording.cpp

    r1370 r2057  
    11/* $Id$ */
    22/* --------------------------------------------------------------------------
    3 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-09 Bradley M. Bell
     3CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-11 Bradley M. Bell
    44
    55CppAD is distributed under multiple licenses. This distribution is under
     
    3737bool abort_recording(void)
    3838{       bool ok = true;
    39         double eps = 10. * std::numeric_limits<double>::epsilon();
     39        double eps = 10. * CppAD::epsilon<double>();
    4040
    4141        using CppAD::AD;
  • trunk/example/base_adolc.hpp

    r1888 r2057  
    1515$begin base_adolc.hpp$$
    1616$spell
     17        eps
     18        std
     19        abs_geq
     20        fabs
    1721        cppad.hpp
    1822        undef
     
    7175
    7276$head Include File$$
    73 This file is included before $code <cppad/cppad.hpp>$$
    74 so it is necessary to define the error handler
    75 in addition to including
    76 $cref/declare.hpp/base_require/declare.hpp/$$
    77 $codep */
    78 # include <cppad/declare.hpp>
    79 # include <cppad/error_handler.hpp>
    80 
    81 /* $$
    82 
    83 $head Standard Math Functions Defined by Adolc Package$$
    84 The following $cref/required/base_require/$$
    85 functions are defined by the Adolc package:
    86 $pre
    87 $$
    88 $code acos$$,
    89 $code asin$$,
    90 $code atan$$,
    91 $code cos$$,
    92 $code cosh$$,
    93 $code exp$$,
    94 $code log$$,
    95 $code pow$$,
    96 $code sin$$,
    97 $code sinh$$,
    98 $code sqrt$$,
    99 $code tan$$.
     77This file $code base_adolc.hpp$$ requires $code adouble$$ to be defined.
     78In addition it is included before $code <cppad/cppad.hpp>$$,
     79but it is to include parts of CppAD that are used by this file.
     80This is done with the following include command:
     81$codep */
     82# include <adolc/adouble.h>
     83# include <cppad/base_require.hpp>
     84
     85/* $$
    10086
    10187$head CondExpOp$$
     
    192178/* $$
    193179
     180$head Integer$$
     181$codep */
     182        inline int Integer(const adouble &x)
     183        {    return static_cast<int>( x.getValue() ); }
     184/*$$
     185
     186$head epsilon$$
     187$codep */
     188namespace CppAD {
     189        template <>
     190        inline adouble epsilon<adouble>(void)
     191        {       double eps = std::numeric_limits<double>::epsilon();
     192                return adouble( eps );
     193        }
     194}
     195/* $$
     196
    194197$head Ordered$$
    195198$codep */
     
    202205        inline bool LessThanOrZero(const adouble &x)
    203206        {    return (x <= 0); }
    204 /* $$
    205 
    206 $head Integer$$
    207 $codep */
    208         inline int Integer(const adouble &x)
    209         {    return static_cast<int>( x.getValue() ); }
    210 /* $$
     207        inline bool abs_geq(const adouble& x, const adouble& y)
     208        {       return fabs(x) >= fabs(y); }
     209/* $$
     210
     211$head Unary Standard Math$$
     212The following $cref/required/base_require/$$ functions
     213are defined by the Adolc package for the $code adouble$$ base case:
     214$pre
     215$$
     216$code abs$$,
     217$code acos$$,
     218$code asin$$,
     219$code atan$$,
     220$code cos$$,
     221$code cosh$$,
     222$code exp$$,
     223$code log$$,
     224$code sin$$,
     225$code sinh$$,
     226$code sqrt$$,
     227$code tan$$.
     228
     229$head pow$$
     230This $cref/required/base_require/$$ function
     231is defined by the Adolc package for the $code adouble$$ base case.
     232
    211233$end
    212234*/
    213235# endif
     236
  • trunk/example/bender_quad.cpp

    r1771 r2057  
    202202
    203203        // accuracy for checks
    204         double eps = 10. * std::numeric_limits<double>::epsilon();
     204        double eps = 10. * CppAD::epsilon<double>();
    205205
    206206        // check Jacobian
  • trunk/example/checkpoint.cpp

    r1662 r2057  
    11/* $Id$ */
    22/* --------------------------------------------------------------------------
    3 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-10 Bradley M. Bell
     3CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-11 Bradley M. Bell
    44
    55CppAD is distributed under multiple licenses. This distribution is under
     
    147147        bool checkpoint_case(bool free_all)
    148148        {       bool ok = true;
    149         double eps = 10. * std::numeric_limits<double>::epsilon();
     149        double eps = 10. * CppAD::epsilon<double>();
    150150
    151151                using CppAD::AD;
  • trunk/example/cond_exp.cpp

    r1454 r2057  
    11/* $Id$ */
    22/* --------------------------------------------------------------------------
    3 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-09 Bradley M. Bell
     3CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-11 Bradley M. Bell
    44
    55CppAD is distributed under multiple licenses. This distribution is under
     
    5858        using CppAD::log;
    5959        using CppAD::abs;
    60         double eps  = 100. * std::numeric_limits<double>::epsilon();
     60        double eps  = 100. * CppAD::epsilon<double>();
    6161        double fmax = std::numeric_limits<double>::max();
    6262
  • trunk/example/erf.cpp

    r1370 r2057  
    11/* $Id$ */
    22/* --------------------------------------------------------------------------
    3 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-08 Bradley M. Bell
     3CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-11 Bradley M. Bell
    44
    55CppAD is distributed under multiple licenses. This distribution is under
     
    4141        using CppAD::AD;
    4242        using CppAD::NearEqual;
    43         double eps = 10. * std::numeric_limits<double>::epsilon();
     43        double eps = 10. * CppAD::epsilon<double>();
    4444
    4545        // domain space vector
  • trunk/example/example.cpp

    r2035 r2057  
    8383extern bool Div(void);
    8484extern bool DivEq(void);
     85extern bool epsilon(void);
    8586extern bool Eq(void);
    8687extern bool EqualOpSeq(void);
     
    139140extern bool Pow(void);
    140141extern bool pow_int(void);
     142extern bool print_for(void);
    141143extern bool reverse_any(void);
    142144extern bool reverse_one(void);
     
    233235        ok &= Run( Div,               "Div"              );
    234236        ok &= Run( DivEq,             "DivEq"            );
     237        ok &= Run( epsilon,           "epsilon"          );
     238        ok &= Run( Eq,                "Eq"               );
    235239        ok &= Run( EqualOpSeq,        "EqualOpSeq"       );
    236240        ok &= Run( Erf,               "Erf"              );
  • trunk/example/example.vcproj

    r2035 r2057  
    291291                        </File>
    292292                        <File
     293                                RelativePath=".\epsilon.cpp"
     294                                >
     295                        </File>
     296                        <File
    293297                                RelativePath=".\eq.cpp"
    294298                                >
     
    516520                        <File
    517521                                RelativePath=".\pow_int.cpp"
     522                                >
     523                        </File>
     524                        <File
     525                                RelativePath=".\print_for.cpp"
    518526                                >
    519527                        </File>
  • trunk/example/fun_assign.cpp

    r1614 r2057  
    11/* $Id$ */
    22/* --------------------------------------------------------------------------
    3 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-09 Bradley M. Bell
     3CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-11 Bradley M. Bell
    44
    55CppAD is distributed under multiple licenses. This distribution is under
     
    3737
    3838        // ten times machine percision
    39         double eps = 10. * std::numeric_limits<double>::epsilon();
     39        double eps = 10. * CppAD::epsilon<double>();
    4040
    4141        // two ADFun<double> objects
  • trunk/example/hes_minor_det.cpp

    r1370 r2057  
    11/* $Id$ */
    22/* --------------------------------------------------------------------------
    3 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-07 Bradley M. Bell
     3CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-11 Bradley M. Bell
    44
    55CppAD is distributed under multiple licenses. This distribution is under
     
    4242// ----------------------------------------------------------------------------
    4343
    44 bool HesMinorDet()
     44bool HesMinorDet(void)
    4545{       bool ok = true;
    4646
  • trunk/example/hes_times_dir.cpp

    r1370 r2057  
    11/* $Id$ */
    22/* --------------------------------------------------------------------------
    3 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-07 Bradley M. Bell
     3CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-11 Bradley M. Bell
    44
    55CppAD is distributed under multiple licenses. This distribution is under
     
    4444}
    4545
    46 bool HesTimesDir()
     46bool HesTimesDir(void)
    4747{       bool ok = true;                   // initialize test result
    4848        size_t j;                         // a domain variable variable
  • trunk/example/jac_lu_det.cpp

    r1370 r2057  
    11/* $Id$ */
    22/* --------------------------------------------------------------------------
    3 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-07 Bradley M. Bell
     3CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-11 Bradley M. Bell
    44
    55CppAD is distributed under multiple licenses. This distribution is under
     
    3636# include <cppad/speed/det_by_lu.hpp>
    3737
    38 bool JacLuDet()
     38bool JacLuDet(void)
    3939{       bool ok = true;
    4040
  • trunk/example/jac_minor_det.cpp

    r1370 r2057  
    11/* $Id$ */
    22/* --------------------------------------------------------------------------
    3 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-07 Bradley M. Bell
     3CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-11 Bradley M. Bell
    44
    55CppAD is distributed under multiple licenses. This distribution is under
     
    4343// ----------------------------------------------------------------------------
    4444
    45 bool JacMinorDet()
     45bool JacMinorDet(void)
    4646{       bool ok = true;
    4747
  • trunk/example/makefile.am

    r2035 r2057  
    9292        div.cpp \
    9393        div_eq.cpp \
     94        epsilon.cpp \
    9495        eq.cpp \
    9596        equal_op_seq.cpp \
     
    149150        pow.cpp \
    150151        pow_int.cpp \
     152        print_for.cpp \
    151153        reverse_any.cpp \
    152154        reverse_one.cpp \
  • trunk/example/makefile.in

    r2035 r2057  
    5050        compare.cpp compare_change.cpp complex_poly.cpp cond_exp.cpp \
    5151        conj_grad.cpp copy_ad.cpp copy_base.cpp cos.cpp cosh.cpp \
    52         cppad_vector.cpp default.cpp div.cpp div_eq.cpp eq.cpp \
    53         equal_op_seq.cpp erf.cpp error_handler.cpp exp.cpp for_one.cpp \
    54         for_two.cpp forward.cpp for_sparse_jac.cpp fun_assign.cpp \
    55         fun_check.cpp hes_lagrangian.cpp hes_lu_det.cpp \
     52        cppad_vector.cpp default.cpp div.cpp div_eq.cpp epsilon.cpp \
     53        eq.cpp equal_op_seq.cpp erf.cpp error_handler.cpp exp.cpp \
     54        for_one.cpp for_two.cpp forward.cpp for_sparse_jac.cpp \
     55        fun_assign.cpp fun_check.cpp hes_lagrangian.cpp hes_lu_det.cpp \
    5656        hes_minor_det.cpp hessian.cpp hes_times_dir.cpp \
    5757        independent.cpp integer.cpp interface_2c.cpp \
     
    6565        ode_gear.cpp ode_gear_control.cpp ode_stiff.cpp ode_taylor.cpp \
    6666        omp_alloc.cpp opt_val_hes.cpp optimize.cpp output.cpp \
    67         par_var.cpp poly.cpp pow.cpp pow_int.cpp reverse_any.cpp \
    68         reverse_one.cpp reverse_three.cpp reverse_two.cpp rev_one.cpp \
    69         rev_sparse_hes.cpp rev_sparse_jac.cpp rev_two.cpp \
    70         romberg_mul.cpp romberg_one.cpp rosen_34.cpp runge_45_1.cpp \
    71         runge_45_2.cpp seq_property.cpp simple_vector.cpp sin.cpp \
    72         sinh.cpp sparse_hessian.cpp sparse_jacobian.cpp sqrt.cpp \
    73         stack_machine.cpp sub.cpp sub_eq.cpp tan.cpp tanh.cpp \
    74         tape_index.cpp unary_minus.cpp unary_plus.cpp user_tan.cpp \
    75         value.cpp var_2par.cpp vec_ad.cpp
     67        par_var.cpp poly.cpp pow.cpp pow_int.cpp print_for.cpp \
     68        reverse_any.cpp reverse_one.cpp reverse_three.cpp \
     69        reverse_two.cpp rev_one.cpp rev_sparse_hes.cpp \
     70        rev_sparse_jac.cpp rev_two.cpp romberg_mul.cpp romberg_one.cpp \
     71        rosen_34.cpp runge_45_1.cpp runge_45_2.cpp seq_property.cpp \
     72        simple_vector.cpp sin.cpp sinh.cpp sparse_hessian.cpp \
     73        sparse_jacobian.cpp sqrt.cpp stack_machine.cpp sub.cpp \
     74        sub_eq.cpp tan.cpp tanh.cpp tape_index.cpp unary_minus.cpp \
     75        unary_plus.cpp user_tan.cpp value.cpp var_2par.cpp vec_ad.cpp
    7676@CppAD_ADOLC_TRUE@am__objects_1 = mul_level_adolc.$(OBJEXT) \
    7777@CppAD_ADOLC_TRUE@      ode_taylor_adolc.$(OBJEXT)
     
    8787        copy_ad.$(OBJEXT) copy_base.$(OBJEXT) cos.$(OBJEXT) \
    8888        cosh.$(OBJEXT) cppad_vector.$(OBJEXT) default.$(OBJEXT) \
    89         div.$(OBJEXT) div_eq.$(OBJEXT) eq.$(OBJEXT) \
     89        div.$(OBJEXT) div_eq.$(OBJEXT) epsilon.$(OBJEXT) eq.$(OBJEXT) \
    9090        equal_op_seq.$(OBJEXT) erf.$(OBJEXT) error_handler.$(OBJEXT) \
    9191        exp.$(OBJEXT) for_one.$(OBJEXT) for_two.$(OBJEXT) \
     
    110110        optimize.$(OBJEXT) output.$(OBJEXT) par_var.$(OBJEXT) \
    111111        poly.$(OBJEXT) pow.$(OBJEXT) pow_int.$(OBJEXT) \
    112         reverse_any.$(OBJEXT) reverse_one.$(OBJEXT) \
    113         reverse_three.$(OBJEXT) reverse_two.$(OBJEXT) \
    114         rev_one.$(OBJEXT) rev_sparse_hes.$(OBJEXT) \
    115         rev_sparse_jac.$(OBJEXT) rev_two.$(OBJEXT) \
    116         romberg_mul.$(OBJEXT) romberg_one.$(OBJEXT) rosen_34.$(OBJEXT) \
    117         runge_45_1.$(OBJEXT) runge_45_2.$(OBJEXT) \
     112        print_for.$(OBJEXT) reverse_any.$(OBJEXT) \
     113        reverse_one.$(OBJEXT) reverse_three.$(OBJEXT) \
     114        reverse_two.$(OBJEXT) rev_one.$(OBJEXT) \
     115        rev_sparse_hes.$(OBJEXT) rev_sparse_jac.$(OBJEXT) \
     116        rev_two.$(OBJEXT) romberg_mul.$(OBJEXT) romberg_one.$(OBJEXT) \
     117        rosen_34.$(OBJEXT) runge_45_1.$(OBJEXT) runge_45_2.$(OBJEXT) \
    118118        seq_property.$(OBJEXT) simple_vector.$(OBJEXT) sin.$(OBJEXT) \
    119119        sinh.$(OBJEXT) sparse_hessian.$(OBJEXT) \
     
    349349        div.cpp \
    350350        div_eq.cpp \
     351        epsilon.cpp \
    351352        eq.cpp \
    352353        equal_op_seq.cpp \
     
    406407        pow.cpp \
    407408        pow_int.cpp \
     409        print_for.cpp \
    408410        reverse_any.cpp \
    409411        reverse_one.cpp \
     
    516518@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/div.Po@am__quote@
    517519@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/div_eq.Po@am__quote@
     520@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/epsilon.Po@am__quote@
    518521@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eq.Po@am__quote@
    519522@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/equal_op_seq.Po@am__quote@
     
    574577@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pow.Po@am__quote@
    575578@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pow_int.Po@am__quote@
     579@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/print_for.Po@am__quote@
    576580@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rev_one.Po@am__quote@
    577581@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rev_sparse_hes.Po@am__quote@
  • trunk/example/omp_alloc.cpp

    r2035 r2057  
    4040        using CppAD::omp_alloc;
    4141
    42         // check not in parallel mode
    43         ok &= omp_alloc::in_parallel() == false;
    44 
    4542        // check initial memory values
    4643        size_t thread;
    47         for(thread = 0; thread < CPPAD_MAX_NUM_THREADS; thread++)
     44        for(thread = 0; thread < omp_alloc::get_max_num_threads(); thread++)
    4845        {       // how much memory is inuse
    4946                ok &= omp_alloc::inuse(thread) == 0;
     
    5552        // (should be zero because not in parallel mode)
    5653        thread = omp_alloc::get_thread_num();
    57         ok    &= thread == 0;
    5854
    5955        // repeatedly allocate enough memory for at least two size_t values.
     
    155151        ok   &= omp_alloc::available(thread) - check < sizeof(my_char);
    156152
    157         // free the memory for use by any thread
     153        // free the memory for use by this thread
    158154        omp_alloc::free_available(thread);
    159155        ok &= omp_alloc::inuse(thread) == 0;
     
    166162bool omp_alloc(void)
    167163{       bool ok  = true;
     164        using CppAD::omp_alloc;
    168165
    169166        // check initial state of allocator
    170         ok      &= CppAD::omp_alloc::get_max_num_threads() == 1;
     167        ok  &= omp_alloc::get_max_num_threads() == 1;
    171168
    172169        // set the maximum number of threads greater than one
    173170        // so that omp_alloc holds onto memory
    174171        CppAD::omp_alloc::set_max_num_threads(2);
    175         ok      &= CppAD::omp_alloc::get_max_num_threads() == 2;
     172        ok  &= omp_alloc::get_max_num_threads() == 2;
     173        size_t thread;
     174        for(thread = 0; thread < 2; thread++)
     175        {       ok &= omp_alloc::inuse(thread) == 0;
     176                ok &= omp_alloc::available(thread) == 0;
     177        }
    176178
    177179        // now use memory allocatore in state where it holds onto memory
    178         ok      &= omp_alloc_bytes();
    179         ok      &= omp_alloc_array();
     180        ok   &= omp_alloc_bytes();
     181        ok   &= omp_alloc_array();
     182
     183        // check that the tests have not held onto memory
     184        for(thread = 0; thread < 2; thread++)
     185        {       ok &= omp_alloc::inuse(thread) == 0;
     186                ok &= omp_alloc::available(thread) == 0;
     187        }
    180188
    181189        // set the maximum number of threads back to one
  • trunk/example/opt_val_hes.cpp

    r1643 r2057  
    11/* $Id$ */
    22/* --------------------------------------------------------------------------
    3 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-10 Bradley M. Bell
     3CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-11 Bradley M. Bell
    44
    55CppAD is distributed under multiple licenses. This distribution is under
     
    179179
    180180        // accuracy for checks
    181         double eps = 10. * std::numeric_limits<double>::epsilon();
     181        double eps = 10. * CppAD::epsilon<double>();
    182182
    183183        // check Jacobian
  • trunk/example/reverse_any.cpp

    r1662 r2057  
    11/* $Id$ */
    22/* --------------------------------------------------------------------------
    3 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-10 Bradley M. Bell
     3CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-11 Bradley M. Bell
    44
    55CppAD is distributed under multiple licenses. This distribution is under
     
    149149bool reverse_any(void)
    150150{       bool ok = true;
    151      double eps = 10. * std::numeric_limits<double>::epsilon();
     151     double eps = 10. * CppAD::epsilon<double>();
    152152
    153153        using CppAD::AD;
  • trunk/example/reverse_three.cpp

    r1662 r2057  
    11/* $Id$ */
    22/* --------------------------------------------------------------------------
    3 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-10 Bradley M. Bell
     3CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-11 Bradley M. Bell
    44
    55CppAD is distributed under multiple licenses. This distribution is under
     
    5151bool cases(void)
    5252{       bool ok    = true;
    53         double eps = 10. * std::numeric_limits<double>::epsilon();
     53        double eps = 10. * CppAD::epsilon<double>();
    5454        using CppAD::AD;
    5555        using CppAD::NearEqual;
  • trunk/example/runge_45_2.cpp

    r1370 r2057  
    11/* $Id$ */
    22/* --------------------------------------------------------------------------
    3 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-09 Bradley M. Bell
     3CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-11 Bradley M. Bell
    44
    55CppAD is distributed under multiple licenses. This distribution is under
     
    127127        double term  = 1;
    128128        double sum   = 0;
    129         double eps   = 10. * std::numeric_limits<double>::epsilon();
     129        double eps   = 10. * CppAD::epsilon<double>();
    130130        for(j = 0; j < n; j++)
    131131        {       sum += term;
  • trunk/example/tanh.cpp

    r1370 r2057  
    11/* $Id$ */
    22/* --------------------------------------------------------------------------
    3 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-08 Bradley M. Bell
     3CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-11 Bradley M. Bell
    44
    55CppAD is distributed under multiple licenses. This distribution is under
     
    4040        using CppAD::AD;
    4141        using CppAD::NearEqual;
    42         double eps = 10. * std::numeric_limits<double>::epsilon();
     42        double eps = 10. * CppAD::epsilon<double>();
    4343
    4444        // domain space vector
  • trunk/example/user_tan.cpp

    r2032 r2057  
    277277        using CppAD::AD;
    278278        using CppAD::NearEqual;
    279         float eps = 10.f * std::numeric_limits<float>::epsilon();
     279        float eps = 10.f * CppAD::epsilon<float>();
    280280
    281281        // domain space vector
  • trunk/makefile.am

    r2031 r2057  
    105105        cppad/TrackNewDel.h \
    106106        \
     107        cppad/base_require.hpp \
    107108        cppad/check_numeric_type.hpp \
    108109        cppad/check_simple_vector.hpp \
    109110        cppad/configure.hpp \
    110111        cppad/cppad.hpp \
    111         cppad/declare.hpp \
    112112        cppad/elapsed_seconds.hpp \
    113113        cppad/error_handler.hpp \
     
    130130        cppad/local/atan_op.hpp \
    131131        cppad/local/base_complex.hpp \
     132        cppad/local/base_cond_exp.hpp \
     133        cppad/local/base_double.hpp \
     134        cppad/local/base_float.hpp \
     135        cppad/local/base_std_math.hpp \
    132136        cppad/local/bender_quad.hpp \
    133137        cppad/local/bool_fun.hpp \
     
    154158        cppad/local/div_op.hpp \
    155159        cppad/local/drivers.hpp \
     160        cppad/local/epsilon.hpp \
    156161        cppad/local/equal_op_seq.hpp \
    157162        cppad/local/erf.hpp \
     
    261266        cppad/speed_test.hpp \
    262267        cppad/speed/uniform_01.hpp \
    263         cppad/std_math_unary.hpp \
    264268        cppad/track_new_del.hpp \
    265269        cppad/vector.hpp
  • trunk/makefile.in

    r2031 r2057  
    353353        cppad/TrackNewDel.h \
    354354        \
     355        cppad/base_require.hpp \
    355356        cppad/check_numeric_type.hpp \
    356357        cppad/check_simple_vector.hpp \
    357358        cppad/configure.hpp \
    358359        cppad/cppad.hpp \
    359         cppad/declare.hpp \
    360360        cppad/elapsed_seconds.hpp \
    361361        cppad/error_handler.hpp \
     
    378378        cppad/local/atan_op.hpp \
    379379        cppad/local/base_complex.hpp \
     380        cppad/local/base_cond_exp.hpp \
     381        cppad/local/base_double.hpp \
     382        cppad/local/base_float.hpp \
     383        cppad/local/base_std_math.hpp \
    380384        cppad/local/bender_quad.hpp \
    381385        cppad/local/bool_fun.hpp \
     
    402406        cppad/local/div_op.hpp \
    403407        cppad/local/drivers.hpp \
     408        cppad/local/epsilon.hpp \
    404409        cppad/local/equal_op_seq.hpp \
    405410        cppad/local/erf.hpp \
     
    509514        cppad/speed_test.hpp \
    510515        cppad/speed/uniform_01.hpp \
    511         cppad/std_math_unary.hpp \
    512516        cppad/track_new_del.hpp \
    513517        cppad/vector.hpp
  • trunk/omh/example_list.omh

    r2035 r2057  
    109109$rref Div.cpp$$
    110110$rref DivEq.cpp$$
     111$rref epsilon.cpp$$
    111112$rref Eq.cpp$$
    112113$rref EqualOpSeq.cpp$$
     
    180181$rref Pow.cpp$$
    181182$rref pow_int.cpp$$
    182 $rref print_for.cpp$$
     183$rref print_for_cout.cpp$$
     184$rref print_for_string.cpp$$
    183185$rref RevOne.cpp$$
    184186$rref RevSparseHes.cpp$$
  • trunk/omh/forward.omh

    r1598 r2057  
    11$Id$
    22/* --------------------------------------------------------------------------
    3 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-09 Bradley M. Bell
     3CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-11 Bradley M. Bell
    44
    55CppAD is distributed under multiple licenses. This distribution is under
     
    1313$begin ForwardZero$$
    1414$spell
     15        std::cout
     16        ostream
    1517        const
    1618        Taylor
     
    1820        Jacobian
    1921$$
    20 
    2122$index Forward, order zero$$
    2223$index zero, order Forward$$
     
    2627
    2728$head Syntax$$
    28 $syntax%%y% = %f%.Forward(0, %x%)%$$
    29 
    30 
     29$icode%y% = %f%.Forward(0, %x%)
     30%$$
     31$icode%y% = %f%.Forward(x, %x%, %s%)%$$
    3132
    3233$head Purpose$$
    3334We use $latex F : B^n \rightarrow B^m$$ to denote the
    34 $xref/glossary/AD Function/AD function/$$ corresponding to $italic f$$.
     35$cref/AD function/glossary/AD Function/$$ corresponding to $icode f$$.
    3536The result of the syntax above is
    3637$latex \[
    3738        y = F(x)
    3839\] $$
    39 (See the $xref/FunCheck/Discussion/FunCheck discussion/$$ for
     40(See the $cref/FunCheck discussion/FunCheck/Discussion/$$ for
    4041possible differences between $latex F(x)$$ and the algorithm that defined
    4142the operation sequence.)
    4243
    4344$head f$$
    44 The object $italic f$$ has prototype
    45 $syntax%
     45The object $icode f$$ has prototype
     46$codei%
    4647        ADFun<%Base%> %f%
    4748%$$
    48 Note that the $xref/ADFun/$$ object $italic f$$ is not $code const$$.
     49Note that the $cref/ADFun/$$ object $icode f$$ is not $code const$$.
    4950After this call to $code Forward$$, the value returned by
    50 $syntax%
     51$codei%
    5152        %f%.size_taylor()
    5253%$$
    53 will be equal to one (see $xref/size_taylor/$$).
     54will be equal to one (see $cref/size_taylor/$$).
    5455
    5556$head x$$
    56 The argument $italic x$$ has prototype
    57 $syntax%
    58         const %Vector% &%x%
    59 %$$
    60 (see $xref/ForwardZero/Vector/Vector/$$ below)
     57The argument $icode x$$ has prototype
     58$codei%
     59        const %Vector%& %x%
     60%$$
     61(see $cref/Vector/ForwardZero/Vector/$$ below)
    6162and its size
    62 must be equal to $italic n$$, the dimension of the
    63 $xref/seq_property/Domain/domain/$$ space for $italic f$$.
     63must be equal to $icode n$$, the dimension of the
     64$cref/domain/seq_property/Domain/$$ space for $icode f$$.
     65
     66$head s$$
     67If the argument $icode s$$ is not present, $code std::cout$$
     68is used in its place.
     69Otherwise, this argument has prototype
     70$codei%
     71        std::ostream& %s%
     72%$$
     73It specifies where the output corresponding to $cref PrintFor$$,
     74and this zero order forward mode call, will be written.
    6475
    6576$head y$$
    66 The result $italic y$$ has prototype
    67 $syntax%
     77The result $icode y$$ has prototype
     78$codei%
    6879        %Vector% %y%
    6980%$$
    70 (see $xref/ForwardZero/Vector/Vector/$$ below)
     81(see $cref/Vector/ForwardZero/Vector/$$ below)
    7182and its value is $latex F(x)$$.
    72 The size of $italic y$$
    73 is equal to $italic m$$, the dimension of the
    74 $xref/seq_property/Range/range/$$ space for $italic f$$.
     83The size of $icode y$$
     84is equal to $icode m$$, the dimension of the
     85$cref/range/seq_property/Range/$$ space for $icode f$$.
    7586
    7687$head Vector$$
    77 The type $italic Vector$$ must be a $xref/SimpleVector/$$ class with
    78 $xref/SimpleVector/Elements of Specified Type/elements of type/$$
    79 $italic Base$$.
    80 The routine $xref/CheckSimpleVector/$$ will generate an error message
     88The type $icode Vector$$ must be a $cref/SimpleVector/$$ class with
     89$cref/elements of type/SimpleVector/Elements of Specified Type/$$
     90$icode Base$$.
     91The routine $cref/CheckSimpleVector/$$ will generate an error message
    8192if this is not the case.
    8293
    8394$head Example$$
    8495The file
    85 $xref/Forward.cpp/$$
     96$cref/Forward.cpp/$$
    8697contains an example and test of this operation.
    8798It returns true if it succeeds and false otherwise.
     
    105116
    106117$head Syntax$$
    107 $syntax%%dy% = %f%.Forward(1, %dx%)%$$
     118$icode%dy% = %f%.Forward(1, %dx%)
     119%$$
     120$icode%dy% = %f%.Forward(1, %dx%, %s%)
     121%$$
    108122
    109123
    110124$head Purpose$$
    111125We use $latex F : B^n \rightarrow B^m$$ to denote the
    112 $xref/glossary/AD Function/AD function/$$ corresponding to $italic f$$.
     126$cref/AD function/glossary/AD Function/$$ corresponding to $icode f$$.
    113127The result of the syntax above is
    114128$latex \[
     
    119133
    120134$head f$$
    121 The object $italic f$$ has prototype
    122 $syntax%
     135The object $icode f$$ has prototype
     136$codei%
    123137        ADFun<%Base%> %f%
    124138%$$
    125 Note that the $xref/ADFun/$$ object $italic f$$ is not $code const$$.
     139Note that the $cref/ADFun/$$ object $icode f$$ is not $code const$$.
    126140Before this call to $code Forward$$, the value returned by
    127 $syntax%
     141$codei%
    128142        %f%.size_taylor()
    129143%$$
    130144must be greater than or equal one.
    131 After this call it will be will be two (see $xref/size_taylor/$$).
     145After this call it will be will be two (see $cref/size_taylor/$$).
    132146
    133147$head x$$
    134 The vector $italic x$$ in expression for $italic dy$$ above
    135 corresponds to the previous call to $xref/ForwardZero/$$
    136 using this ADFun object $italic f$$; i.e.,
    137 $syntax%
     148The vector $icode x$$ in expression for $icode dy$$ above
     149corresponds to the previous call to $cref/ForwardZero/$$
     150using this ADFun object $icode f$$; i.e.,
     151$codei%
    138152        %f%.Forward(0, %x%)
    139153%$$
    140154If there is no previous call with the first argument zero,
    141 the value of the $xref/Independent//independent/$$ variables
     155the value of the $cref/independent/Independent/$$ variables
    142156during the recording of the AD sequence of operations is used
    143 for $italic x$$.
     157for $icode x$$.
    144158
    145159$head dx$$
    146 The argument $italic dx$$ has prototype
    147 $syntax%
    148         const %Vector% &%x%
    149 %$$
    150 (see $xref/ForwardOne/Vector/Vector/$$ below)
     160The argument $icode dx$$ has prototype
     161$codei%
     162        const %Vector%& %x%
     163%$$
     164(see $cref/Vector/ForwardOne/Vector/$$ below)
    151165and its size
    152 must be equal to $italic n$$, the dimension of the
    153 $xref/seq_property/Domain/domain/$$ space for $italic f$$.
     166must be equal to $icode n$$, the dimension of the
     167$cref/domain/seq_property/Domain/$$ space for $icode f$$.
     168
     169$head s$$
     170The argument $icode s$$, if present, is not used during this operation.
    154171
    155172$head dy$$
    156 The result $italic dy$$ has prototype
    157 $syntax%
     173The result $icode dy$$ has prototype
     174$codei%
    158175        %Vector% %dy%
    159176%$$
    160 (see $xref/ForwardOne/Vector/Vector/$$ below)
     177(see $cref/Vector/ForwardOne/Vector/$$ below)
    161178and its value is $latex F^{(1)} (x) * dx$$.
    162 The size of $italic dy$$
    163 is equal to $italic m$$, the dimension of the
    164 $xref/seq_property/Range/range/$$ space for $italic f$$.
     179The size of $icode dy$$
     180is equal to $icode m$$, the dimension of the
     181$cref/range/seq_property/Range/$$ space for $icode f$$.
    165182
    166183$head Vector$$
    167 The type $italic Vector$$ must be a $xref/SimpleVector/$$ class with
    168 $xref/SimpleVector/Elements of Specified Type/elements of type/$$
    169 $italic Base$$.
    170 The routine $xref/CheckSimpleVector/$$ will generate an error message
     184The type $icode Vector$$ must be a $cref/SimpleVector/$$ class with
     185$cref/elements of type/SimpleVector/Elements of Specified Type/$$
     186$icode Base$$.
     187The routine $cref/CheckSimpleVector/$$ will generate an error message
    171188if this is not the case.
    172189
    173190$head Example$$
    174191The file
    175 $xref/Forward.cpp/$$
     192$cref/Forward.cpp/$$
    176193contains an example and test of this operation.
    177194It returns true if it succeeds and false otherwise.
     
    181198$begin ForwardAny$$
    182199$spell
     200        std::cout
     201        ostream
    183202        xk
    184203        xp
     
    200219
    201220$head Syntax$$
    202 $syntax%%y_p% = %f%.Forward(%p%, %x_p% )%$$
    203 $pre
    204 $$
     221$icode%y_p% = %f%.Forward(%p%, %x_p% )
     222%$$
     223$icode%y_p% = %f%.Forward(%p%, %x_p%, %s%)
     224%$$
    205225
    206226
    207227$head Purpose$$
    208228We use $latex F : B^n \rightarrow B^m$$ to denote the
    209 $xref/glossary/AD Function/AD function/$$ corresponding to $italic f$$.
     229$cref/AD function/glossary/AD Function/$$ corresponding to $icode f$$.
    210230Given a function $latex X : B \rightarrow B^n$$,
    211231defined by its
    212 $xref/glossary/Taylor Coefficient/Taylor coefficients/$$,
     232$cref/Taylor coefficients/glossary/Taylor Coefficient/$$,
    213233forward mode computes the Taylor coefficients for the function
    214234$latex \[
     
    218238$subhead Function Values$$
    219239If you are using forward mode to compute values for $latex F(x)$$,
    220 $xref/ForwardZero/$$ is simpler to understand
     240$cref/ForwardZero/$$ is simpler to understand
    221241than this explanation of the general case.
    222242
    223243$subhead Derivative Values$$
    224244If you are using forward mode to compute values for $latex F^{(1)} (x) * dx$$,
    225 $xref/ForwardOne/$$ is simpler to understand
     245$cref/ForwardOne/$$ is simpler to understand
    226246than this explanation of the general case.
    227247
     
    235255For $latex k = 0, \ldots , p$$,
    236256the vector $latex x^{(k)}$$ above is defined as the value of
    237 $italic x_k$$ in the previous call (counting this call) of the form
    238 $syntax%
     257$icode x_k$$ in the previous call (counting this call) of the form
     258$codei%
    239259        %f%.Forward(%k%, %x_k%)
    240260%$$
     
    242262$latex x^{(0)}$$ is the value of the independent variables when the
    243263corresponding
    244 AD of $italic Base$$
     264AD of $icode Base$$
    245265$xref/glossary/Operation/Sequence/operation sequence/1/$$ was recorded.
    246266Note that
     
    269289
    270290$head f$$
    271 The $xref/ADFun/$$ object $italic f$$ has prototype
    272 $syntax%
     291The $cref/ADFun/$$ object $icode f$$ has prototype
     292$codei%
    273293        ADFun<%Base%> %f%
    274294%$$
    275 Note that the $xref/ADFun/$$ object $italic f$$ is not $code const$$.
     295Note that the $cref/ADFun/$$ object $icode f$$ is not $code const$$.
    276296Before this call to $code Forward$$, the value returned by
    277 $syntax%
     297$codei%
    278298        %f%.size_taylor()
    279299%$$
    280300must be greater than or equal $latex p$$.
    281 After this call it will be will be $latex p+1$$ (see $xref/size_taylor/$$).
     301After this call it will be will be $latex p+1$$ (see $cref/size_taylor/$$).
    282302
    283303$head p$$
    284 The argument $italic p$$ has prototype
    285 $syntax%
     304The argument $icode p$$ has prototype
     305$codei%
    286306        size_t %p%
    287307%$$
     
    289309
    290310$head x_p$$
    291 The argument $italic x_p$$ has prototype
    292 $syntax%
    293         const %Vector% &%x_p%
    294 %$$
    295 (see $xref/ForwardAny/Vector/Vector/$$ below)
     311The argument $icode x_p$$ has prototype
     312$codei%
     313        const %Vector%& %x_p%
     314%$$
     315(see $cref/Vector/ForwardAny/Vector/$$ below)
    296316and its size
    297 must be equal to $italic n$$, the dimension of the
    298 $xref/seq_property/Domain/domain/$$ space for $italic f$$.
     317must be equal to $icode n$$, the dimension of the
     318$cref/domain/seq_property/Domain/$$ space for $icode f$$.
    299319The $th p$$ order Taylor coefficient for $latex X(t)$$
    300320is defined by this value; i.e., $latex x^{(p)} = x\_p$$.
     
    302322defined by previous calls to $code Forward$$.)
    303323
     324$head s$$
     325If the argument $icode s$$ is not present, $code std::cout$$
     326is used in its place.
     327Otherwise, this argument has prototype
     328$codei%
     329        std::ostream& %s%
     330%$$
     331If $icode%p% == 0%$$,
     332$icode s$$ specifies where the output corresponding to $cref PrintFor$$
     333will be written.
     334If $icode%p% != 0%$$, $icode s$$ is not used.
     335
    304336$head y_p$$
    305 The return value $italic y_p$$ has prototype
    306 $syntax%
     337The return value $icode y_p$$ has prototype
     338$codei%
    307339        %Vector% %y_p%
    308340%$$
    309 (see $xref/ForwardAny/Vector/Vector/$$ below)
     341(see $cref/Vector/ForwardAny/Vector/$$ below)
    310342and its value is
    311343The $th p$$ order Taylor coefficient for $latex Y(t)$$; i.e.,
    312344$latex y^{(p)} = y\_p$$.
    313 The size of $italic y_p$$
    314 is equal to $italic m$$, the dimension of the
    315 $xref/seq_property/Range/range/$$ space for $italic f$$.
     345The size of $icode y_p$$
     346is equal to $icode m$$, the dimension of the
     347$cref/range/seq_property/Range/$$ space for $icode f$$.
    316348
    317349$head Vector$$
    318 The type $italic Vector$$ must be a $xref/SimpleVector/$$ class with
    319 $xref/SimpleVector/Elements of Specified Type/elements of type/$$
    320 $italic Base$$.
    321 The routine $xref/CheckSimpleVector/$$ will generate an error message
     350The type $icode Vector$$ must be a $cref/SimpleVector/$$ class with
     351$cref/elements of type/SimpleVector/Elements of Specified Type/$$
     352$icode Base$$.
     353The routine $cref/CheckSimpleVector/$$ will generate an error message
    322354if this is not the case.
    323355
    324356$head Zero Order$$
    325357In the case where $latex p = 0$$,
    326 the result $italic y_p$$ is given by
     358the result $icode y_p$$ is given by
    327359$latex \[
    328360\begin{array}{rcl}
     
    336368$latex y^{(0)}$$ above are replaced by
    337369$code 0$$,
    338 $italic x$$, and
    339 $italic y$$
    340 in $xref/ForwardZero/$$.
     370$icode x$$, and
     371$icode y$$
     372in $cref/ForwardZero/$$.
    341373
    342374$head First Order$$
    343375In the case where $latex p = 1$$,
    344 the result $italic y_p$$ is given by
     376the result $icode y_p$$ is given by
    345377$latex \[
    346378\begin{array}{rcl}
     
    356388$latex y^{(1)}$$ above are replaced by
    357389$code 1$$,
    358 $italic x$$,
    359 $italic dx$$, and
    360 $italic dy$$
    361 in $xref/ForwardOne/$$.
     390$icode x$$,
     391$icode dx$$, and
     392$icode dy$$
     393in $cref/ForwardOne/$$.
    362394$pre
    363395
    364396$$
    365397Note that if $latex x^{(1)}$$ is the $th j$$
    366 $xref/glossary/Elementary Vector/elementary vector/$$
     398$cref/elementary vector/glossary/Elementary Vector/$$
    367399$latex \[
    368400y^{(1)} = \D{F}{x_j} ( x^{(0)} )
     
    372404In the case where $latex p = 2$$,
    373405the $th i$$ element of
    374 the result $italic y_p$$ is given by
     406the result $icode y_p$$ is given by
    375407$latex \[
    376408\begin{array}{rcl}
     
    389421\] $$
    390422Note that if $latex x^{(1)}$$ is the $th j$$
    391 $xref/glossary/Elementary Vector/elementary vector/$$
     423$cref/elementary vector/glossary/Elementary Vector/$$
    392424and $latex x^{(2)}$$ is zero,
    393425$latex \[
     
    397429\] $$
    398430If $latex x^{(1)}$$ is the sum of the $th j$$ and $th l$$
    399 $xref/glossary/Elementary Vector/elementary vectors/$$
     431$cref/elementary vectors/glossary/Elementary Vector/$$
    400432and $latex x^{(2)}$$ is zero,
    401433$latex \[
     
    424456$head Example$$
    425457The file
    426 $xref/Forward.cpp/$$
     458$cref/Forward.cpp/$$
    427459contains an example and test of this operation.
    428460It returns true if it succeeds and false otherwise.
     
    440472
    441473$head Syntax$$
    442 $syntax%%s% = %f%.size_taylor()%$$
     474$icode%s% = %f%.size_taylor()%$$
    443475
    444476$subhead See Also$$
     
    447479$head Purpose$$
    448480Determine the number of Taylor coefficients, per variable,
    449 currently calculated and stored in the ADFun object $italic f$$.
     481currently calculated and stored in the ADFun object $icode f$$.
    450482See the discussion under
    451 $xref/size_taylor/Constructor/Constructor/$$,
    452 $xref/size_taylor/Forward/Forward/$$, and
    453 $xref/size_taylor/capacity_taylor/capacity_taylor/$$
     483$cref/Constructor/size_taylor/Constructor/$$,
     484$cref/Forward/size_taylor/Forward/$$, and
     485$cref/capacity_taylor/size_taylor/capacity_taylor/$$
    454486for a description of when this value can change.
    455487
    456488
    457489$head f$$
    458 The object $italic f$$ has prototype
    459 $syntax%
     490The object $icode f$$ has prototype
     491$codei%
    460492        const ADFun<%Base%> %f%
    461493%$$
    462494
    463495$head s$$
    464 The result $italic s$$ has prototype
    465 $syntax%
     496The result $icode s$$ has prototype
     497$codei%
    466498        size_t %s%
    467499%$$
    468500and is the number of Taylor coefficients,
    469501per variable in the AD operation sequence,
    470 currently calculated and stored in the ADFun object $italic f$$.
     502currently calculated and stored in the ADFun object $icode f$$.
    471503
    472504$head Constructor$$
    473 Directly after the $xref/FunConstruct/$$ syntax
    474 $syntax%
     505Directly after the $cref/FunConstruct/$$ syntax
     506$codei%
    475507        ADFun<%Base%> %f%(%x%, %y%)
    476508%$$
    477 the value of $italic s$$ returned by $code size_taylor$$ is one.
     509the value of $icode s$$ returned by $code size_taylor$$ is one.
    478510This is because
    479511there is an implicit call to $code Forward$$ that computes
     
    481513
    482514$head Forward$$
    483 After a call to $xref/ForwardAny//Forward/$$ with the syntax
    484 $syntax%
     515After a call to $cref/Forward/ForwardAny/$$ with the syntax
     516$codei%
    485517        %f%.Forward(%p%, %x_p%)
    486518%$$
    487 the value of $italic s$$ returned by $code size_taylor$$
     519the value of $icode s$$ returned by $code size_taylor$$
    488520would be $latex p + 1$$.
    489521The call to $code Forward$$ above
    490522uses the lower order Taylor coefficients to compute and store
    491523the $th p$$ order Taylor coefficients for all
    492 the variables in the operation sequence corresponding to $italic f$$.
    493 Thus there are $latex p + 1$$ (order zero through $italic p$$)
     524the variables in the operation sequence corresponding to $icode f$$.
     525Thus there are $latex p + 1$$ (order zero through $icode p$$)
    494526Taylor coefficients per variable.
    495527(You can determine the number of variables in the operation sequence
    496 using the $xref/seq_property/size_var/size_var/$$ function.)
     528using the $cref/size_var/seq_property/size_var/$$ function.)
    497529
    498530$head capacity_taylor$$
    499531If the number of Taylor coefficients
    500 currently stored in $italic f$$ is less than or equal $italic c$$,
    501 a call to $xref/capacity_taylor/$$ with the syntax
    502 $syntax%
     532currently stored in $icode f$$ is less than or equal $icode c$$,
     533a call to $cref/capacity_taylor/$$ with the syntax
     534$codei%
    503535        %f%.capacity_taylor(%c%)
    504536%$$
    505 does not affect the value $italic s$$ returned by $code size_taylor$$.
     537does not affect the value $icode s$$ returned by $code size_taylor$$.
    506538Otherwise,
    507 the value $italic s$$ returned by $code size_taylor$$
    508 is equal to $italic c$$
     539the value $icode s$$ returned by $code size_taylor$$
     540is equal to $icode c$$
    509541(only Taylor coefficients of order zero through $latex c-1$$
    510542have been retained).
     
    512544$head Example$$
    513545The file
    514 $xref/Forward.cpp/$$
     546$cref/Forward.cpp/$$
    515547contains an example and test of this operation.
    516548It returns true if it succeeds and false otherwise.
     
    531563
    532564$head Syntax$$
    533 $syntax%%c% = %f%.CompareChange()%$$
     565$icode%c% = %f%.CompareChange()%$$
    534566$pre
    535567$$
    536568$bold See Also$$
    537 $xref/FunCheck/$$
     569$cref/FunCheck/$$
    538570
    539571
    540572$head Purpose$$
    541573We use $latex F : B^n \rightarrow B^m$$ to denote the
    542 $xref/glossary/AD Function/AD function/$$ corresponding to $italic f$$.
     574$cref/AD function/glossary/AD Function/$$ corresponding to $icode f$$.
    543575This function may be not agree with the algorithm that was used
    544576to create the corresponding
    545 AD of $italic Base$$
     577AD of $icode Base$$
    546578$xref/glossary/Operation/Sequence/operation sequence/1/$$
    547579because of changes in AD
    548 $xref/Compare//comparison/$$ results.
     580$cref/comparison/Compare/$$ results.
    549581The $code CompareChange$$ function can be used to detect these changes.
    550582
    551583$head f$$
    552 The object $italic f$$ has prototype
    553 $syntax%
     584The object $icode f$$ has prototype
     585$codei%
    554586        const ADFun<%Base%> %f%
    555587%$$
    556588
    557589$head c$$
    558 The result $italic c$$ has prototype
    559 $syntax%
     590The result $icode c$$ has prototype
     591$codei%
    560592        size_t %c%
    561593%$$
    562594It is the number of
    563 $syntax%AD<%Base%>%$$ $xref/Compare//comparison/$$
     595$codei%AD<%Base%>%$$ $cref/comparison/Compare/$$
    564596operations,
    565 corresponding to the previous call to $xref/Forward/$$
    566 $syntax%
     597corresponding to the previous call to $cref/Forward/$$
     598$codei%
    567599        %f%.Forward(0, %x%)
    568600%$$
    569601that have a different result from
    570 when $italic F$$ was created by taping an algorithm.
     602when $icode F$$ was created by taping an algorithm.
    571603
    572604$head Discussion$$
    573 If $italic c$$ is not zero,
     605If $icode c$$ is not zero,
    574606the boolean values resulting from some of the
    575 $xref/Compare//comparison operations/$$ corresponding to $italic x$$
     607$cref/comparison operations/Compare/$$ corresponding to $icode x$$
    576608are different from when the
    577 AD of $italic Base$$
     609AD of $icode Base$$
    578610$xref/glossary/Operation/Sequence/operation sequence/1/$$ was created.
    579611In this case, you may want to re-tape the algorithm with the
    580612$cref/independent variables/glossary/Tape/Independent Variable/$$
    581 equal to the values in $italic x$$
     613equal to the values in $icode x$$
    582614(so AD operation sequence properly represents the algorithm
    583615for this value of independent variables).
    584616On the other hand, re-taping the AD operation sequence usually takes
    585 significantly more time than evaluation using $xref/ForwardZero/$$.
    586 If the functions values have not changed (see $xref/FunCheck/$$)
     617significantly more time than evaluation using $cref/ForwardZero/$$.
     618If the functions values have not changed (see $cref/FunCheck/$$)
    587619it may not be worth re-taping a new AD operation sequence.
    588620
     
    601633%$$
    602634The file
    603 $xref/CompareChange.cpp/$$
     635$cref/CompareChange.cpp/$$
    604636contains an example and test of this operation.
    605637They return true if they succeed and false otherwise.
  • trunk/omh/install_unix.omh.in

    r2014 r2057  
    1515$dollar ^$$
    1616$spell
     17        cout
    1718        Addr
    1819        sizeof
     
    194195        $cnext $title example.cpp$$
    195196$rnext
    196 $cref/print_for/print_for.cpp/Running/$$ 
    197         $cnext $title print_for.cpp$$
     197$cref/print_for_cout/print_for_cout.cpp/Running/$$ 
     198        $cnext $title print_for_cout.cpp$$
    198199$rnext
    199200$cref/speed_example/speed_example.cpp/Running Tests/$$ 
  • trunk/omh/library.omh

    r1992 r2057  
    5151        cppad/local/lu_ratio.hpp%
    5252
    53         cppad/std_math_unary.hpp%
    5453        cppad/vector.hpp%
    5554        omh/omp_alloc.omh%
     
    116115The classes listed are used to support CppAD calculations:
    117116$table
    118 $rref std_math_unary$$
    119117$rref CppAD_vector$$
    120118$rref omp_alloc$$
  • trunk/omh/whats_new_05.omh

    r2014 r2057  
    421421Change the
    422422$xref/InstallUnix/Configure/configure/$$ script so that compilation of the
    423 $xref/get_started.cpp/$$ and $xref/print_for.cpp/$$ examples are optional.
     423$xref/get_started.cpp/$$ and $xref/print_for_cout.cpp/$$ examples are optional.
    424424$pre
    425425
  • trunk/omh/whats_new_06.omh

    r2014 r2057  
    399399Put text written to standard output in the documentation for the
    400400$cref/get_started.cpp/get_started.cpp/Output/$$ and
    401 $cref/print_for.cpp/print_for.cpp/Output/$$ examples.
     401$code print_for.cpp$$ examples.
    402402(Now documentation can be built from a subversion checkout with out
    403403needing to execute automake.)
  • trunk/omh/whats_new_07.omh

    r2014 r2057  
    135135also required the user to know about $code float$$ and $code double$$
    136136definitions for the standard math
    137 functions in the CppAD namespace; see $cref/std_math_unary/$$.
     137functions in the CppAD namespace;
     138see $cref/base_std_math/$$.
    138139$pre
    139140
  • trunk/omh/whats_new_11.omh

    r2041 r2057  
    1313$begin whats_new_11$$
    1414$spell
     15        https
     16        abs_geq
     17        CondExpRel
    1518        num
    1619        Taylor
     
    6164assist you in learning about changes between various versions of CppAD.
    6265
     66$head 08-11$$
     67Modify the CppAD trunk using the
     68changes from svn revision 2044 to revision 2056 in the branch
     69$codep
     70        https://projects.coin-or.org/svn/CppAD/branches/base_require
     71$$
     72These changes are described below under the headings
     73$cref/08-04/whats_new_11/08-11/08-04/$$ through
     74$cref/08-10/whats_new_11/08-11/08-10/$$.
     75
     76$subhead 08-10$$
     77$list number$$
     78Add the output stream optional argument $icode s$$ in
     79$codei%
     80        %f%.Forward(0, %x%, %s%)
     81%$$
     82See $cref/zero order forward mode/ForwardZero/$$ and $cref PrintFor$$.
     83$lnext
     84Improve $cref/omp_alloc.cpp/$$ example.
     85$lend
     86
     87
     88$subhead 08-09$$
     89$list number$$
     90$cref/Warning:/base_require/Warning/$$
     91Add $cref/epsilon/base_require/epsilon/$$ to the
     92$icode Base$$ type requirements.
     93$lnext
     94Extend $cref/epsilon/$$ to AD types.
     95$lend
     96
     97$subhead 08-08$$
     98$list number$$
     99Improve the $cref/base_require/$$ documentation for
     100$cref/standard math functions/base_std_math/$$.
     101$lnext
     102$cref/Warning:/base_require/Warning/$$
     103Add $code abs_geq$$ to the $cref/requirements/base_require/$$
     104for a user defined $icode Base$$ type.
     105$lnext
     106Check that zero order forward mode results are approximately equal,
     107instead of exactly equal,
     108after an $cref optimize$$ operation.
     109This fixes a bug in the optimize correctness check
     110(The  order of operations can be changed by $code optimize$$
     111and hence the zero order forward mode results may not be exactly the same.)
     112$lend
     113
     114$subhead 08-07$$
     115Improve the $cref/base_require/$$ documentation for
     116$cref/EqualOpSeq/base_identical/EqualOpSeq/$$,
     117$cref/Identical/base_identical/Identical/$$
     118$cref/Integer/base_require/Integer/$$, and
     119$cref/Ordered/base_ordered/$$
     120operations.
     121
     122$subhead 08-06$$
     123Add the $cref/CondExpRel/base_cond_exp/CondExpRel/$$ paragraph to the
     124base requirements documentation.
     125This was missing and are required for
     126$cref/CondExp/$$ to work with $codei%AD<%Base%>%$$ arguments
     127and a non-standard $icode Base$$ type.
     128
     129$subhead 08-04$$
     130$list number$$
     131$cref/Warning:/base_require/Warning/$$
     132Change the $cref/include/base_require/Include Order/$$ file name to
     133$cref/base_require.hpp/base_require/$$.
     134$lnext
     135Use $cref base_float.hpp$$ and $cref base_double.hpp$$ as additional examples
     136in the $code/CondExp/base_require/CondExp/$$ $icode Base$$ requirements.
     137$lend
     138
    63139$head 08-03$$
    64140Change $cref/PrintFor/$$ condition from less than or equal zero
     
    72148$cref/start recording/Independent/Start Recording/$$.
    73149$lnext
    74 Improve the $cref print_for.cpp$$ example.
     150Improve the $cref print_for_cout.cpp$$ example.
    75151$lend
    76152
  • trunk/print_for/print_for.cpp

    r2039 r2057  
    1212
    1313/*
    14 $begin print_for.cpp$$
     14$begin print_for_cout.cpp$$
    1515$spell
    1616        const
  • trunk/test_more/makefile.am

    r2028 r2057  
    9595        pow.cpp \
    9696        pow_int.cpp \
     97        print_for.cpp \
    9798        romberg_one.cpp \
    9899        rosen_34.cpp \
  • trunk/test_more/makefile.in

    r2028 r2057  
    5353        mul_level.cpp mul_zero_one.cpp ndebug.cpp near_equal_ext.cpp \
    5454        neg.cpp ode_err_control.cpp optimize.cpp parameter.cpp \
    55         poly.cpp pow.cpp pow_int.cpp romberg_one.cpp rosen_34.cpp \
    56         runge_45.cpp reverse.cpp rev_sparse_hes.cpp rev_sparse_jac.cpp \
    57         rev_two.cpp simple_vector.cpp sin.cpp sin_cos.cpp sinh.cpp \
    58         sparse_hessian.cpp sparse_jacobian.cpp sparse_vec_ad.cpp \
    59         sqrt.cpp std_math.cpp sub.cpp sub_eq.cpp sub_zero.cpp tan.cpp \
    60         track_new_del.cpp value.cpp vec_ad.cpp vec_ad_par.cpp \
    61         vec_unary.cpp
     55        poly.cpp pow.cpp pow_int.cpp print_for.cpp romberg_one.cpp \
     56        rosen_34.cpp runge_45.cpp reverse.cpp rev_sparse_hes.cpp \
     57        rev_sparse_jac.cpp rev_two.cpp simple_vector.cpp sin.cpp \
     58        sin_cos.cpp sinh.cpp sparse_hessian.cpp sparse_jacobian.cpp \
     59        sparse_vec_ad.cpp sqrt.cpp std_math.cpp sub.cpp sub_eq.cpp \
     60        sub_zero.cpp tan.cpp track_new_del.cpp value.cpp vec_ad.cpp \
     61        vec_ad_par.cpp vec_unary.cpp
    6262@CppAD_ADOLC_TRUE@am__objects_1 = base_adolc.$(OBJEXT)
    6363am_test_more_OBJECTS = $(am__objects_1) test_more.$(OBJEXT) \
     
    7777        ode_err_control.$(OBJEXT) optimize.$(OBJEXT) \
    7878        parameter.$(OBJEXT) poly.$(OBJEXT) pow.$(OBJEXT) \
    79         pow_int.$(OBJEXT) romberg_one.$(OBJEXT) rosen_34.$(OBJEXT) \
    80         runge_45.$(OBJEXT) reverse.$(OBJEXT) rev_sparse_hes.$(OBJEXT) \
    81         rev_sparse_jac.$(OBJEXT) rev_two.$(OBJEXT) \
    82         simple_vector.$(OBJEXT) sin.$(OBJEXT) sin_cos.$(OBJEXT) \
    83         sinh.$(OBJEXT) sparse_hessian.$(OBJEXT) \
     79        pow_int.$(OBJEXT) print_for.$(OBJEXT) romberg_one.$(OBJEXT) \
     80        rosen_34.$(OBJEXT) runge_45.$(OBJEXT) reverse.$(OBJEXT) \
     81        rev_sparse_hes.$(OBJEXT) rev_sparse_jac.$(OBJEXT) \
     82        rev_two.$(OBJEXT) simple_vector.$(OBJEXT) sin.$(OBJEXT) \
     83        sin_cos.$(OBJEXT) sinh.$(OBJEXT) sparse_hessian.$(OBJEXT) \
    8484        sparse_jacobian.$(OBJEXT) sparse_vec_ad.$(OBJEXT) \
    8585        sqrt.$(OBJEXT) std_math.$(OBJEXT) sub.$(OBJEXT) \
     
    314314        pow.cpp \
    315315        pow_int.cpp \
     316        print_for.cpp \
    316317        romberg_one.cpp \
    317318        rosen_34.cpp \
     
    433434@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pow.Po@am__quote@
    434435@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pow_int.Po@am__quote@
     436@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/print_for.Po@am__quote@
    435437@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rev_sparse_hes.Po@am__quote@
    436438@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rev_sparse_jac.Po@am__quote@
  • trunk/test_more/optimize.cpp

    r1986 r2057  
    10801080                ok &= (y[0] == x[0] + x[1]);
    10811081
     1082                return ok;
     1083        }
     1084        bool not_identically_equal(void)
     1085        {       bool ok = true;
     1086                using CppAD::AD;
     1087
     1088                // independent variable vector
     1089                size_t n = 5;
     1090                CPPAD_TEST_VECTOR< AD<double> > ax(n);
     1091                size_t j;
     1092                for(j = 0; j < n; j++)
     1093                        ax[j] = 1. / 3.;
     1094                CppAD::Independent(ax);
     1095       
     1096                // dependent variable vector
     1097                size_t m = 1;
     1098                CPPAD_TEST_VECTOR< AD<double> > ay(m);
     1099                ay[0]       = 0.;
     1100                for(j = 0; j < n; j++)
     1101                {       if( j % 2 == 0 )
     1102                                ay[0] += ax[j];
     1103                        else    ay[0] -= ax[j];
     1104                }
     1105                CppAD::ADFun<double> f(ax, ay);
     1106       
     1107                // Used to fail assert in optimize that forward mode results
     1108                // are identically equal
     1109                f.optimize();
     1110       
    10821111                return ok;
    10831112        }
     
    11061135        // check user_atomic functions
    11071136        ok     &= user_atomic_test();
     1137        // case where results are not identically equal
     1138        ok     &= not_identically_equal();
    11081139
    11091140        CppAD::user_atomic<double>::clear();
  • trunk/test_more/test_more.cpp

    r2028 r2057  
    6262extern bool Pow(void);
    6363extern bool PowInt(void);
     64extern bool print_for(void);
    6465extern bool reverse(void);
    6566extern bool rev_sparse_hes(void);
     
    163164        ok &= Run( Pow,             "Pow"            );
    164165        ok &= Run( PowInt,          "PowInt"         );
     166        ok &= Run( print_for,       "print_for"      );
    165167        ok &= Run( reverse,         "reverse"        );
    166168        ok &= Run( rev_sparse_hes,  "rev_sparse_hes" );
  • trunk/test_more/test_more.vcproj

    r2032 r2057  
    351351                        </File>
    352352                        <File
     353                                RelativePath=".\print_for.cpp"
     354                                >
     355                        </File>
     356                        <File
    353357                                RelativePath=".\rev_sparse_hes.cpp"
    354358                                >
Note: See TracChangeset for help on using the changeset viewer.