Prev Next whats_new_15

@(@\newcommand{\W}[1]{ \; #1 \; } \newcommand{\R}[1]{ {\rm #1} } \newcommand{\B}[1]{ {\bf #1} } \newcommand{\D}[2]{ \frac{\partial #1}{\partial #2} } \newcommand{\DD}[3]{ \frac{\partial^2 #1}{\partial #2 \partial #3} } \newcommand{\Dpow}[2]{ \frac{\partial^{#1}}{\partial {#2}^{#1}} } \newcommand{\dpow}[2]{ \frac{ {\rm d}^{#1}}{{\rm d}\, {#2}^{#1}} }@)@
CppAD Changes and Additions During 2015

This section contains a list of the changes to CppAD during 2015 (in reverse order by date). The purpose of this section is to assist you in learning about changes between various versions of CppAD.

The download instructions were modified to have more mention of using git and less mention of subversion .

Separate to_string from ad_to_string so that it can be used without the rest of CppAD; i.e., by including
     # include <cppad/utility/to_string.hpp>

  1. Add the to_string utility.
  2. Add base_to_string to the Base type requirements.
  3. A Base requirements item was added to the wish list.
  4. The wish_list item to reorganize the include directory has been removed. It was completed when the utilities was moved to cppad/utility; see 11-30 .

  1. A convention was included for addon library files .
  2. Change new utility specifications to allow for individual file includes; e.g., <cppad/utility/vector.hpp>.

Fix problem with autotools install handling of the deprecated files. This included changing the autotools --with-implicit_ctor option to autotools . This was removed on 2017-02-10 .

  1. The library section has been moved to the utilities section. In addition, the corresponding source code files in cppad have been moved to cppad/utility.
  2. The individual utility include files have been deprecated; see include_deprecated . For example,
         # include <cppad/runge_45.hpp>
    You should us the utility include instead; i.e.,
         # include <cppad/utility.hpp>
  3. The numeric_ad routines where moved from the library the a separate documentation section.
  4. Change cmake_install_prefix to cppad_prefix and Change cmake_install_postfix to cppad_postfix .
  5. Change cppad_implicit_ctor_from_any_type to cppad_deprecated and change its specifications to refer to all deprecated features.

  1. CppAD now installs the object library
    to be included when linking. Currently, it is only required when colpack_prefix is specified on the cmake command .
  2. It is no longer necessary to compile and link the file
    when colpack_prefix is specified during the install process; see cmake command . (It is included in cppad_lib).

  1. The check_for_nan output now includes the first dependent variable index that is nan in its error message.
  2. Change the deprecated include reference pow_int.h to pow_int.hpp in pow_int .

There was a bug in the new get_check_for_nan feature that writes independent variable values to a temporary file; see 11-06 below. This has been fixed.

  1. Fixed a bug in the RevSparseJac routine. To be specific, the argument r was transposed from what the documentation said. (This has no effect in the usual case where r is the identity.)
  2. Added the bool_sparsity.cpp examples which show how to conserve memory when computing sparsity patterns. (This has since been replaced by rc_sparsity.cpp .)
  3. Modified the ipopt_solve procedure to take advantage of the memory conserving sparsity pattern calculations when retape is false.
  4. Added the bit_per_unit function to the vectorBool class. (This aids the memory conservation mentioned above.)

It is often difficult to determine what cause a nan result during an operation with an ADFun object. The new feature get_check_for_nan was added to make this easier.

There was a mistake in the documentation for index_sort , the argument ind is not const.

Add a PrintFor optimization wish list item. This has been done, see no_print_for_op .

  1. Add CPPAD_USE_CPLUSPLUS_2011 , CPPAD_NUMERIC_LIMITS, and CPPAD_STANDARD_MATH_UNARY, to the preprocessor section. In addition, remove checking that all user API preprocessor symbols are in this section form the wish_list .
  2. Alphabetize and make some corrections to list of examples .
  3. The documentation for some of the deprecated features was missing the date when they were deprecated. This has been fixed; e.g., see Deprecated 2012-12-26 .

  1. base_require : Add the macro CPPAD_NUMERIC_LIMITS to aid in setting the numeric limits for a user defined Base class.
  2. base_require : The quiet_NaN function has been added to the CppAD numeric_limits. Note the reason for not using std::numeric_limits .
  3. The nan(zero) function computes a nan by dividing zero by zero which results in a warning when using some compilers. This function has been deprecated and the corresponding wish_list item has been removed.
  4. Move documentation for zdouble to deprecated section and documentation for numeric_limits to ADValued .
  5. Remove all uses of, and references to, zdouble from the examples .

base_require : It is no longer necessary to define the specialization for CppAD::epsilon<Base>() for each Base type.

There was a bug in test_more/azmul.cpp whereby the vector z had the wrong dimension (in two places). This has been fixed.

  1. Use the current atomic_option setting to determine which type of sparsity patterns to use for dependency calculations during optimize procedure. It used to be that the bool_sparsity_enum was used when pack_sparsity_enum was specified.
  2. It is not longer an error to take the derivative of the square root function, because the result may be the part of a conditional expression that is not used.
  3. Update the wish_list section.

  1. It is no longer necessary to use the zdouble class when computing with multiple levels of AD conditional expressions and reverse mode .
  2. The zdouble class has been deprecated. Use the azmul function for absolute zero (when it is needed).

base_require : absolute zero multiplication is now required for user defined base types. This makes it possible to combine conditional expression , multiple levels , reverse , and a base type that has standard ieee multiplication; e.g., double. In other words, not all multiplications will need to have an absolute zero (as is the case with the zdouble base class.

Fix some Visual Studio 2013 C++ level four /W4 warnings (previous warnings were are level 3). In addition, disable warning 4100 unreferenced formal parameter, and warning 4127 conditional expression is constant.

CppAD can optionally test its use with the external packages eigen , ipopt , and colpack . In addition, it can compare its speed with the external AD packages adolc , fadbad , and sacado . The scripts that download and install a local copy of these external packages have been modified to automatically skip installation when it has already been done.

Improve discussion of windows download and testing .

  1. Add the cppad_profile_flag to the list of possible cmake command arguments.
  2. More of the warnings generated by Visual Studio 2013 have been fixed. One remaining warning is about asctime and gmtime not being thread safe.

  1. There was a bug in the numeric_limits section of the example user defined base type. This has been fixed.
  2. There were some compile and link errors when running the tests using Visual Studio 2013. These have been fixed.
  3. Many of the warnings generated by Visual Studio 2013 have been fixed.

The conditional expressions, CondExp , were not working for the type < CppAD::AD<adouble> > where adouble is the ADOL-C AD type. This has been fixed by adding a call to CPPAD_COND_EXP_REL in base_adolc.hpp.

  1. There was a bug in the vectorBool assignment . To be specific, it not allow a size zero vector to be assigned using a vector any other size. This has been fixed.
  2. The addition of the pack option on 08-31 introduced a bug in the calculation of RevSparseHes . The checkpoint.cpp example was changed to demonstrate this problem and the bug was fixed.

The dependency pattern was not being computed correctly for the sign , Discrete , and VecAD operations. This has been fixed. This could have caused problems using checkpoint functions that used any of these operations.

  1. Mention the fact that using checkpoint functions can make recordings faster .
  2. Add the pack sparsity option for atomic_base operations.
  3. Add the pack sparsity option to checkpoint functions.
  4. Added the example/atomic/sparsity.cpp example.
  5. Remove mention of OpenMP from thread_alloc::thread_num (thread_alloc never was OpenMP specific).

  1. The sparsity argument was added to the atomic_base constructor and the checkpoint constructor.
  2. Make atomic_norm_sq.cpp an example with no set sparsity and atomic_reciprocal.cpp an example with no bool sparsity.
  3. Improve discussion of Independent and parallel mode .

Some asserts in the checkpoint implementation were not using the CppAD ErrorHandler . This has been fixed.

Free checkpoint function sparsity patters during forward operations that use its atomic operation. (They kept between sparsity calculations because they do not change.)

Fix a bug in RevSparseJac when used to compute sparsity pattern for a subset of the rows in a checkpoint function.

Reduce the amount of memory required for checkpoint functions (since sparsity patterns are now being held so they do not need to be recalculated).

Added an example that computes the sparsity pattern for a subset of the Jacobian and a subset of the Hessian .

  1. Do some optimization of the checkpoint feature so that sparsity patterns are stored and not recalculated.
  2. Fix a warning (introduced on 08-11) where the CppAD::vector data function was being shadowed by a local variable.
  3. The source code control for CppAD has a link to compile, instead of real file. This sometimes caused problems with the deprecated autotools install procedure and has been fixed.

  1. Improve the documentation for checkpoint functions. To be specific, change the syntax to use the name atom_fun . In addition, include the fact that atom_fun must not be destructed for as along as the corresponding atomic operations are used.
  2. Add the size_var function to the checkpoint objects.

Add the preservation of data to the specifications of a CppAD::vector during a resize when the capacity of the vector does not change. In addition, added and example of this to cppad_vector.cpp .

The zdouble numeric_limits were not being computed properly. This has been fixed.

Added the sparse_sub_hes.cpp example, a way to compute the sparsity for a subset of variables without using multiple levels of AD .

  1. There were some unknown asserts when the sparsity pattern p in sparse_jacobian and sparse_hessian was not properly dimensioned. These have been changed to known asserts to give better error reporting.
  2. In the special case where sparse Hessian work or sparse Jacobian work was specified and the set of elements to be computed was empty, the work vector is empty after the call (and it appears to need to be calculated on subsequent calls). This resulted in a bug when the sparsity pattern was not provided on subsequent calls (and has been fixed).

  1. Some C++11 features were not being taken advantage of after the change on 05-10 . To be specific, move semantics, the high resolution clock, and null pointers. This has been fixed.
  2. In the example zdouble.cpp , the vector a1z was not properly dimensioned. This has been fixed and the dimensions of all the variables have been clarified.

Add an abort_op_index item to the wish list. It has since been removed (domain errors may not affect the results due to conditional expressions ).

Add a absolute zero item and a numeric_limits item to the wish list. The absolute zero item has been completed and the numeric limit item was modified on implementation. Remove the multiple directions with list item.


There was a problem using conditional expressions with multiple levels of AD where the result of the conditional expression might not be determined during forward mode. This would generate an assert of the form:
     Error detected by false result for
    at line 
number in the file
where side was left or right and number was the line number of an assert in cskip_op.hpp. This has been fixed.

There was a problem with using conditional expressions and reverse mode with multiple levels of AD . This was problem was represented by the file bug/
  1. The problem above has been fixed by adding the base type zdouble, see CppAD motivation for this new type. (It is no longer necessary to use zdouble to get an absolute zero because CppAD now uses azmul where an absolute zero is required.)
  2. The sections mul_level , change_param.cpp , mul_level.cpp , and mul_level_ode.cpp were changed to use zdouble .
  3. The adolc multi-level examples mul_level_adolc.cpp and mul_level_adolc_ode.cpp were changed to mention the limitations because Adolc does not have an absolute zero .
  4. The example above were also changed so that AD variable names that indicated the level of AD for the variable.
  5. base_require : The base type requirements were modified to include mention of absolute zero . In addition, the base type requirements API warning is now more informative.

Reorganize the unary_standard_math documentation.

  1. Add the exponential minus one function log1p .
  2. base_require : If you are defining your own base type, note that log1p was added to the base type requirements.
  3. Use the single preprocessor flag CPPAD_USE_CPLUSPLUS_2011 to signal that the functions erf, asinh, acosh, atanh, expm1, log1p are part of the base type requirements.

  1. Add the exponential minus one function expm1 . If you are defining your own base type, note that expm1 was added to the base type requirements.
  2. Fix some warnings about comparing signed and unsigned integers when using eigen for the CppAD test vector. (The eigen vector size() function returns an int instead of a size_t.)

  1. Add the inverse hyperbolic sine function atanh . If you are defining your own base type, note that atanh was added to the base type requirements.
  2. Fix a bug in the implementation of the acosh multiple direction forward mode forward_dir (when compiler has acosh ).

Add the inverse hyperbolic sine function acosh . If you are defining your own base type, note that acosh was added to the base type requirements.

Add the inverse hyperbolic sine function asinh . If you are defining your own base type, note that asinh was added to the base type requirements.

In the sparse jacobian and sparse hessian calculations, If work is present, and has already been computed, the sparsity pattern p is not used. This has been added to the documentation; see sparse jacobian and sparse hessian documentation for work and p .

Remove the syntax
Basey = x
for the AD constructor documentation because it does not work when the constructor is explicit . Also document the restriction that the constructor in the assignment must be implicit.

The developers of the TMB package reported that for large ADFun tapes, the optimize routine uses a large amount of memory because it allocates a standard set for each variable on the tape. These sets are only necessary for variables in conditional expressions that can be skipped once the independent variables have a set value. The problem has been reduced by using a NULL pointer for the empty set and similar changes. It still needs more work.

It used to be the case that the Reverse mode would propagate nan through the conditional expression case that is not used. For example, if
     AD<double> aeps = 1e-10;
     ay[0] = CondExpGt( ax[0], aeps, 1.0/ax[0], 1.0/aeps );
     ADFun<double> f(ax, ay);
The corresponding reverse mode calculation, at x[0] = 0.0, would result in
     Error detected by false result for
     ! ( hasnan(value) && check_for_nan_ )
This has been fixed so that only the conditional expression case that is used affects the reverse mode results. The example cond_exp.cpp was changed to reflect this (a check for nan was changed to a check for zero). Note that this fix only works when IdenticalPar is true for the base type of the result in the conditional expression; e.g., one can still get a nan effect from the case that is not selected when using AD< AD<double> > conditional expressions.

If the compiler supports the c++11 feature std::chrono:high_resolution_clock then use it for the elapsed_seconds function.

The new example sub_sparse_hes.cpp shows one way to compute a Hessian for a subset of variables without having to compute the sparsity pattern for the entire functions.

Fix another bug in the derivative calculations for the c++11 version of the error function; see CPPAD_USE_CPLUSPLUS_2011 .

Fix a bug in the optimization of conditional expressions. To be specific, if NDEBUG is not defined, one could get an assert with the message:
     Error detected by false result for
          var_index_ >= NumRes(op_)

The change on 2014-12-23 introduced a bug when the c++11 version of the error function was used with an optimized function. see CPPAD_USE_CPLUSPLUS_2011 . There was also a bug in the sparsity calculations for when this erf function was included. These bugs have been fixed.

The test test_more/optimize.cpp was failing on some systems because an exactly equality check should have been a near equal check. This has been fixed.

On some systems, the library corresponding to speed/src could not be found. This library is only used for testing and so has been changed to always be static (hence does not need to be found at run time).

There was a bug in the coloring method change on 2015-01-07 . To be specific, work.color_method was not being set to "cppad.symmetric" after work.color_method.clear() . This has been fixed.

  1. Enable the same install of CppAD to be used both with and without C++11 features; e.g., with both g++ --std=c++11 and with g++ --std=c++98. Previously if the cppad_cxx_flags specified C++11, then it could only be used in that way.
  2. The cmake command now requires the version of cmake to be greater than or equal 2.8 (due a bug in cmake version 2.6).

Improved the searching for the boost multi-threading library which is used for by the team_bthread.cpp case of the thread_test.cpp example and test.

Improve the documentation for the cmake command line options
for dir equal to prefix, postfix, includedirs, libdirs, datadir, and docdir.

Fix bug in link_sparse_hessian speed test introduced on 01-09 below.

Fix some warnings generated by g++ 4.9.2.

The change of global variables to local in cppad/local/op_code.hpp on 2014-50-14 created a bug in parallel_ad (some local statics needed to be initialized). This has been fixed.

There was a bug in the cmake install detection of compiler features. One symptom of this bug was that on systems that had the gettimeofday function, the cmake install would sometimes report
     cppad_has_gettimeofday = 0
This has been fixed.

The deprecated autotools procedure had a bug in the detection of when the size of an unsigned int was the same as the size of a size_t. This has been fixed.

  1. The new compare_change interface has been created and the old CompareChange function has been deprecated; see the compare_change.cpp example. This enables one to determine the source code during taping that corresponds to changes in the comparisons during zero order forward operations; see abort_op_index .
  2. This new compare_change interface can detect comparison changes even if NDEBUG is defined and even if f.optimize() has been called. The deprecated function CompareChange used to always return zero after
    and was not even defined when NDEBUG was defined. There was a resulting speed effect for this; see no_compare_op .
  3. The date when some features where deprecated has been added to the documentation. For example, see Deprecated 2006-12-17 .

  1. The change 01-07 below included (but did not mention) using a sparse, instead of full, structure for the Hessian in the test. This has also been done for the sparse Jacobian test.
  2. For both the sparse_jacobian and sparse_hessian tests, the sparse function is only chosen once (it used to be different for every repeat). This reduced the amount of computation not connected what is being tested. It also make the onetape a valid option for these tests.
  3. There was a bug in the multiple direction forward routine. Results for function values that are parameter were not being computed properly (all the derivatives are zero in this case). This has been fixed.

The following changes were merged in from the color_hes branch:
  1. Specify the type of coloring for the sparse hessian calculations. To be specific, instead of "cppad" and "colpack", the choices are "cppad.symmetric", "cppad.general", and "". This is not compatible with the change on 01-02 , which was so recent that this should not be a problem.
  2. The n_sweep values were not being returned properly by cppad_sparse_hessian.cpp and adolc_sparse_hessian.cpp . The CppAD version has been fixed and the ADOL-C version has been set to zero.
  3. The link_sparse_hessian example case was to sparse for good testing (by mistake). This has been fixed.
  4. Add n_sweep to link_sparse_hessian and speed_main .
  5. Change the cppad sparse Hessian color_method to take advantage of the symmetry of the Hessian (in a similar fashion to the colpack coloring method).

Added to option to uses colpack for the sparse Hessian coloring method ; see the example colpack_hes.cpp .
Input File: omh/appendix/whats_new/whats_new_15.omh