Prev Next whats_new_05

@(@\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}} }@)@
Changes and Additions to CppAD During 2005

Fix a memory leak that could occur during the ForSparseJac calculations.

The buffers that are used to do RevSparseJac and RevSparseHes calculations are now freed directly after use.

The TrackNewDel.cpp example was missing from the Windows install examples and testing project file. This has been fixed.

The buffer that is are used to do Reverse mode calculations is now freed directly after use. This reduces the memory requirements attached to an ADFun object.

Buffers that are used to store the tape information corresponding to the AD<Base> type are now freed when the corresponding ADFun object is constructed. This reduces memory requirements and actually had better results with the speed_cppad tests.

The speed_cppad test program now outputs the version of CppAD at the top (to help when comparing output between different versions).

The TrackNewDel routines were added for track memory allocation and deletion with new[] and delete[]. This is in preparation for making CppAD more efficient in it's use of memory. The bug mentioned on 12-01 resurfaced and the corresponding routine was changed as follows:
     static local::ADTape<Base> *Tape(void)
     {    // If we return &tape, instead of creating and returning ptr,
          // there seems to be a bug in g++ with -O2 option.
          static local::ADTape<Base> tape;
          static local::ADTape<Base> *ptr = &tape;
          return ptr;

The NearEqual function documentation for the relative error case was changed to
x - y | <= r * ( |x| + |y| )
so that there is no problem with division by zero when x and y are zero (the code was changed to that form also). The std::abs function replaced the direct computation of the complex norms (for the complex case in NearEqual). In addition, more extensive testing was done in near_equal.cpp .

Extend NearEqual and NearEqualExt to cover more cases while converting them from, a library function in lib/CppADlib.a and an utility in example/NearEqualExt.h, to a template functions in cppad/near_equal.hpp and cppad/local/NearEqualExt.h. This is another step along the way of removing the entire CppADlib.a library.

The change on 12-14 broke the Microsoft project files example/Example.sln and TestMore/TestMore.sln used during CppAD installation on Windows. This has been fixed.

Move lib/SpeedTest.cpp to cppad/speed_test.hpp. This was the last change necessary in order to remove the CppAD library, so remove all commands related to building and linking CppADlib.a. The corresponding entry has been removed from the wish_list .

One of the entries in the wish_list corresponded to the Integer function. It has also been removed (because it is already implemented).

Extend erf to cover more cases while converting it from a function in lib/CppADlib.a to a template function in cppad/local/Erf.h. This is one step along the way of removing the entire CppADlib.a library.

Group routines that extend the domain for which an ADFun object is useful into the ExtendDomain section.

Add an example of a C callable routine that computes derivatives using CppAD (see interface2c.cpp ).

Split out LuFactor with the ratio argument to a separate function called LuRatio . This needed to be done because LuRatio is more restrictive and should not be part of the general template utilities .

Improve CheckSimpleVector so that it tests element assignment. Change check_simple_vector.cpp so that it provides and example and test of a case where a simple vector returns a type different from the element type and the element assignment returns void.

The specifications for a SimpleVector template class were extended so that the return type of an element access is not necessarily the same as the type of the elements. This enables us to include std::vector<bool> which packs multiple elements into a single storage location and returns a special type on element access (not the same as bool). To be more specific, if x is a std::vector<bool> object and i has type size_t, x[i] does not have type bool.

Add a Home icon, that links to the CppAD home page , to the top left of the navigation frame (left frame) for each documentation section.

The RevSparseHes reverse mode Hessian sparsity calculation has been added.

The definition of a sparsity pattern has been corrected to properly correspond to the more efficient form mentioned under whats_new_05 below.

The dates in this file used to correspond to local time for when the change was checked into the subversion repository . From now on the dates in this file will correspond to the first version of CppAD where the change appears; i.e., the date in the unix and windows download file names CppAD-yy-mm-dd .

There was a bug in the RevSparseJac reverse mode sparsity patterns when used with VecAD calculations. This bug was fixed and the calculations were made more efficient (fewer true entries).

There was a bug in the ForSparseJac forward mode sparsity patterns when used with VecAD calculations. This bug was fixed and the calculations were made more efficient (fewer true entries).

The speed test of lu_vec_ad.cpp has been reinstated. It appears that there is some sort of bug in the gcc compiler with the -O2 option whereby the following member function
     static local::ADTape<Base> *Tape(void)
     {    static local::ADTape<Base> tape;
          return &tape;
(in cppad/local/AD.h) would sometimes return a null value (during VecAD operations). A speed improvement in cppad/local/ExtendBuffer.h seems to prevent this problem. This fix is not well understood; i.e., we should watch to see if this problem reoccurs.

The source code for lu_vec_ad_ok.cpp was mistakenly used for speed_cppad/LuSolveSpeed.cpp. This has been fixed.

The speed test of lu_vec_ad.cpp has been commented out because it sometimes generates a segmentation fault. Here is an explanation:

If X is a AD<Base> object, y is a Base object, X[y] uses pointer from the element back to the original vector. Optimizing compilers might reorder operations so that the vector is destroyed before the object is used. This can be avoided by changing the syntax for VecAD objects to use set and get member functions.

A much better example for using VecAD vectors has been provided. In addition, a bug in the computation of derivatives using VecAD vectors has been fixed.

CppAD now checks that the domain dimension during Independent and the range dimension during ADFun (provided that -DNDEBUG is not defined). If either of these is zero, the CppADUsageError macro is invoked.

The sparsity pattern routines ForSparseJac and RevSparseJac have been modified so that they are relative to the Jacobian at a single argument value. This enables us to return more efficient sparsity patterns .

An extra exception has been added to the use of VecAD elements. This makes VecAD some what more efficient.

Improve the output messages generated during execution of the configure command.

Put a try and catch block around all of the uses of new so that if a memory allocation error occurs, it will generate a CppADUsageError/ message.

The get_started.cpp example has been simplified so that it is easier to understand.

Fix a memory leak in both the ForSparseJac and RevSparseJac calculations.

Add reverse mode Jacobian sparsity calculation.

Add prototype documentation for logdet in the LuSolve function.

Add the optional ratio argument to the LuFactor routine. (This has since been moved to a separate routine called LuRatio .)

Remove some blank lines from the example files listed directly below (under 11-06). Comments for computing the entire Jacobian entire sparsity pattern was added.

The cases of std::vector, std::valarray, and CppAD::vector were folded into the standard example and tests format for the following cases: rev_two.cpp , rev_one.cpp , Reverse.cpp, hessian.cpp , jacobian.cpp , forward.cpp , for_two.cpp , for_one.cpp , Fun.cpp (Fun.cpp has since been replaced by independent.cpp , Reverse.cpp has since been replaced by reverse_one.cpp and reverse_checkpoint.cpp).

Add forward mode Jacobian sparsity calculation.

Add sparsity patterns to the whish list.

The Unix install configure command was missing the -- before of the prefix command line argument.

The template class CppAD_vector uses a try/catch block during the allocation of memory (for error reporting). This may be slow down memory allocation and hence it is now replaced by simple memory allocation when the preprocessor variable NDEBUG is defined.

The specialization of CppAD::vector<bool> was moved to vectorBool so that CppAD::vector<bool> does not pack one bit per value (which can be slow to access).

Change the configure script so that compilation of the get_started.cpp and print_for_cout.cpp examples are optional.

One of the dates in the Unix installation extraction discussion was out of date. This has been fixed.

Change the Unix install configure script so that is reports information using the same order and notation as its documentation .

Some compiler errors in the ode_gear_control.cpp and ode_stiff.cpp examples were fixed.

Add a specialization to CppAD_vector for the CppAD::vector<bool> case. A test for the push_back member function as well as a CheckSimpleVector test has been added to cppad_vector.cpp . The source code for this template vector class, cppad/vector.hpp, has been removed from the documentation.

Add the prefix_dir and postfix_dir ( postfix_dir has since been removed) options to the configure command line. This gives the user more control over the location where CppAD is installed.

The stiff Ode routines, OdeGear and OdeGearControl , were added to the utilities . A comparison various Ode solvers on a stiff problem ode_stiff.cpp was added. In addition, OdeGear and OdeGearControl were added to the utilities and the library was reorganized.

The Microsoft compiler project files example/Example.vcproj and TestMore/TestMore.vcproj were not up to date. This has been fixed. In addition, the example numeric_type.cpp has been added.

Make the building of the Example, TestMore, and Speed, directories optional during the configure command. The Unix installation instructions were overhauled to make the larger set of options easy to understand.

Added the NumericType concept and made the following library routines require this concept for their floating point template parameter type: LuSolve , LuFactor , RombergOne , RombergMul , Runge45 , Rosen34 , and OdeErrControl . This is more restrictive than the previous requirements for these routines but it enables future changes to the implementation of these routines (for optimization purposes) with out affecting their specifications.

Add the UnaryPlus operator and move the Neg examples and tests to UnaryMinus .

Change name of distribution files from CppAD.unix.tar.gz and CppAD.dos.tar.gz to CppAD-yy-mm-dd.tar.gz and (the *.zip file uses pkzip compression).

The maxabs argument has been added to the OdeErrControl function so that it can be used with relative errors where components of the ODE solution may be zero (some of the time). In addition, some of the rest of the OdeErrControl documentation has been improved.

The documentation for replacing defaults in CppAD error macros has been improved.

Changed Romberg to RombergOne and added RombergMul . In addition, added missing entries to ListAllExamples and reorganized utilities .

Backed out addition of Romberg integration routine (at this point uncertain of the interface that is most useful in the context of AD.)

Added a Romberg integration routine for where the argument types are template parameters (for use with AD types).

The Microsoft project files example/Example.vcproj and TestMore/TestMore.vcproj were missing some necessary routines. In addition, Speed/Speed.vcproj was generating a warning. This has been fixed.

An Integer conversion function as been added.

The value.cpp example has been improved and the old example has been moved into the TestMore directory.

The unary_standard_math functions sinh, and cosh have been added. In addition, more correctness testing has been added for the sin and cos functions.

The OdeErrControl routine could lock in an infinite loop. This has been fixed and a test case has been added to check for this problem.

The conditional expression function has been changed from just CondExp to CondExpLt, CondExpLe, CondExpEq, CondExpGe, CondExpGt. This should make code with conditional expressions easier to understand. In addition, it should reduce the number of tape operations because one need not create as many temporaries to do comparisons with. The old CondExp function has been deprecated.

Remove unnecessary no-op that was left in tape for the unary_standard_math functions acos, asin, atan, cos.

Improve the index entries in the documentation that corresponds to the cppad/local directory source code.

The wish_list and Bugs information were moved out of this section and into their own separate sections (the Bugs section has been removed; see the bug subdirectory instead).

A discussion of VecAD speed and memory was added as well as an entry in the wish_list to make it more efficient.

The BOOST_DIR and CPP_ERROR_WARN configure options were not properly implemented for compiling the lib sub-directory. This has been fixed.

Some compiler warnings in the file lib/ErrFun.cpp, which computes the erf function, have been fixed.

The push_back function has been added to the CppAD::vector template class.

It appears that the TestMore/Runge45.cpp file was missing an include of example/NearEqualExt.h. This has been fixed.

The documentation for Forward and Reverse has been improved.

The rosen_34.cpp example mixed the CppAD::vector and CppADvector vector types. This caused the compilation of the examples to fail when CppADvector was defined as something other than CppAD::vector (found by Jon Pearce). This has been fixed.

The CheckSimpleVector run time code has been improved so that it is only run once per case that is being checked.

Simple Vector concept checking (CheckSimpleVector ) was added to the routines: ForOne , ForTwo , Forward , ADFun , Hessian , Independent , Jacobian , RevOne , RevTwo , and Reverse .

Simple Vector concept checking (CheckSimpleVector ) was added to the routines: LuFactor , LuSolve , LuInvert , OdeErrControl , Runge45 , and Rosen34 .

The previous version of the routine OdeErrControl was mistakenly in the global namespace. It has been moved to the CppAD namespace (where all the other utilities routines are).

The previous distribution (version 05-07-02) was missing the file cppad/local/Default.h. This has been fixed.

Added CheckSimpleVector , a C++ concept checking utility that checks if a vector type has all the necessary conditions to be a SimpleVector class with a specific element type.

Version 7 of Microsoft's C++ compiler supports the standard declaration for a friend template function. Version 6 did not and CppAD used macros to substitute the empty string for <Base>, < AD<Base> >, and < VecAD<Base> > in these declarations. These macro substitutions have been removed because Version 6 of Microsoft's C++ compiler is no longer supported by CppAD.

The copy base section was split into the default constructor and the construction for the base type. The construction from base type has been extended to include any type that is convertible to the base type. As a special case, this provides the previous wish list item of a constructor from an arbitrary Base to a AD< AD<Base> > , AD< AD< AD<Base> > > etc.

The permissions were set as executable for many of the no-executable files in the distribution; for example, the README, file. This has been fixed.

Some improvements were made to the README, AUTHORS, COPYING, and INSTALL files. In addition, the file UWCopy040507.html which contains the University of Washington's copyright policy (see Section 2) was added to the distribution.

The List2Vector example utility is no longer used and has been removed.

CppAD is now supported by Microsoft Visual C++ version 7 or higher. The version 6 project files *.dsw and *.dsp have been replaced by the version 7 project files *.sln and *.vcproj .

A new CondExp example has been added and the old CondExp example has been moved to the TestMore directory (it is now only a test).

The changes made on 06-06 do not run under Microsoft Visual C++ version 6.0 (even though they are within the C++ standard). Preliminary testing under version 7 indicates that Microsoft has fixed this problem in later versions of their C++ compiler.

Converted the routines Forward and Reverse to allow for any SimpleVector instead of just CppADvector. In addition, separated the syntax of the function call from the prototype for each of the arguments. This was also done for all the easy to use Drivers as well as the Independent function and the ADFun constructor.

Add a section containing a list of all the examples .

A significant improvement in speed was obtained by moving the buffer extension to a separate function and then inline the rest of putting operators in the tape. For example, here is part of the speed test output before this change:
     Tape of Expansion by Minors Determinant: Length = 350, Memory = 6792
     size = 5 rate = 230
     size = 4 rate = 1,055
     size = 3 rate = 3,408
     size = 2 rate = 7,571
     size = 1 rate = 13,642
and here is the same output after this change:
     Tape of Expansion by Minors Determinant: Length = 350, Memory = 6792
     size = 5 rate = 448
     size = 4 rate = 2,004
     size = 3 rate = 5,761
     size = 2 rate = 10,221
     size = 1 rate = 14,734
Note that your results will vary depending on operating system and machine.

Change name of OdeControl to OdeErrControl and improve its documentation.

Correct the syntax for the Parameter and Variable functions.

Change OdeErrControl to have method return its order instead of having a separate argument to OdeErrControl.

Add the argument scur to OdeErrControl, improve OdeErrControl choice of step size and documentation.

Using profiling, the multiplication operator was show to take a significant amount of time. It was reorganized in order to make it faster. The profiling indicated an improvement so that same change was made to the ad_binary and compound_assign operators.

The documentation for SimpleVector and NearEqual were changed to use more syntax (what the user enters) and simpler prototypes (the compiler oriented description of the arguments). In addition, exercises were added at the end of the SimpleVector , CppAD_vector , and NearEqual documentation.

There was a undesired divide by zero case in the file TestMore/VecUnary.cpp that just happened to work in corresponding NearEqual check. The NearEqual routine has been changed to return false if either of the values being compared is infinite or not a number. In addition, the divide by zero has been removed from the TestMore/VecUnary.cpp test.

The doubly linked list was also removed from the VecAD internal data structure because this method of coding is simpler and it makes it more like the rest of CppAD.

The profiling indicated that the destructor for an AD object was using a significant amount of time. The internal data structure of an AD object had a doubly linked list that pointed to the current variables and this was modified when an AD object was destroyed. In order to speed AD operations in general, the internal data structure of an AD object has been changed so that this list is no longer necessary (a tape id number is used in its place)

During the process above, the function Variable was added.

Add profiling to the speed tests.

Remove an extra (not necessary) semi-colon from the file cppad/local/Operator.h.

The new routine OdeErrControl does automatic step size control for the ODE solvers.

The routine Rosen34 is an improved stiff integration method that has an optional error estimate in the calling sequence. You must change all your calls to OdeImplicit to use Rosen34 (but do not need to change other arguments because error estimate is optional).

The routine Runge45 is an improved Runge-Kutta method that has an optional error estimate in the calling sequence. You must change all your calls to OdeRunge to use Runge45 (but do not need to change other arguments because error estimate is optional).

Some extra semi-colons (empty statements) were generating warnings on some compilers. The ones that occurred after the macros CppADStandardMathBinaryFun, CppADCompareMember, CppADBinaryMember, and CppADFoldBinaryOperator have been removed.

An new multiple level of AD example mul_level was added.

An option that specifies error and warning flags for all the C++ compile commands, was added to the Unix installation instructions .

The routine LuSolve was split into LuFactor and LuInvert . This enables one to efficiently solve equations where the matrix does not change and the right hand side for one equation depends on the left hand side for a previous equation.

An extra requirement was added to the SimpleVector template class. There must be a typedef for value_type which is the type of elements in the vector

Under Mandrake Linux 10.1, some template friend declarations were failing because the corresponding operations were not declared before being indicated as friends (found by Jean-Pierre Dussault ). This has been fixed.

The erf function was added. The implementation of this function used conditional expressions (CondExp ) and some times the expression that was not valid in a region caused division by zero. For this reason, the check and abort on division by zero has been removed.
Input File: omh/appendix/whats_new/whats_new_05.omh