Marc Labelle’s outdated but informative notes
To use AUTODIFF LIBRARY classes from within the Visual C++ IDE
Create new console application from within IDE
Move into workspace. Under menu -> project -> add to project -> files
Add main source file (.cpp). to project (from wherever) and header files
Under menu project -> Link -> General -> object/library modules, add at end of list
ads32.lib adt32.lib (or ado32.lib adt32.lib if you used optimized library)
Under menu project -> settings -> C/C++, -> category ‘Pre-Processor’ -> additional include directory, type D:\admodel\include; D:\MarcL\NMFS... (the subdirectory where your main code is)
In workspace window, highlight project file, then select from menu project -> settings -> C/C++, -> category ‘Pre-Processor’ -> preprocessor definitions
At end of list add MSVC32,DOS386,OPT_LIB (double underscores at ends of MSVC32)
** If you are loading ‘safe’ libraries of admodel (i.e. ads32.lib), do not add OPT_LIB
Under menu project -> settings -> C/C++, -> category ‘Precompiled Headers’, select “Automatic use of precompiled headers.
Under C/C++ -> General -> Debug Info box, select Program database for edit and continue
Under C/C++ -> General -> Optimizations, select Disable (Debug) for the debug version.
Under menu project -> settings -> C/C++, -> category ‘Pre-Processor’ -> project options
Insert among statements in box “D:\admodel\include”/D and “MSVC32“/D
Under menu project -> settings -> Link -> category ‘input’ -> additional library path
Under menu project -> settings -> Debug-> category ‘general’ -> working directory
Type that of console application (in my case D:\MarcL\NMFS)
Before compiling , under Build/Set active Configuration, select the Win32 Debug option (for debug with ads32.option) or Win32 Release options (for the release version, with the opt_lib and ado32.lib options).
Note: to run admb from VC++ IDE, follow above guidelines, but add all admb libraries to project, as well as both files generated by tpl2cpp (simple.htp and simple.cpp). Might need to add .dat file as well, since the debugger won’t work if not.
Extra stuff to run MFCL under VC6 IDE
If .hpp files are in directory MFCL, Under tools/options/directories, add in lower box D:\MarcL\SPC\MFCL
Under tools/options/lib, add in lower box D:\admodel\lib
Under tools/options/source file, add in box D:\MarcL\SPC\MFCL
When you first conduct your first build under the Debug version, you goto C/C++, category optimization, then in Optimizations window just below, select Default. For the Release version, one must first compile all files using /Ox compiler option (fast code), and then compiler REMAINING ones with /O1 option.
For that go to Project-Settings-C/C++ Under category/optimization/customize select full-optimization. Then to compile the last 2-3 files, select optimization/minimize code, and specify ‘no’ when the compiler asks you if you want to compile all affected files.
Using VC6’s debugger to look at the contents of AUTODIFF matrices
You have to use a special syntaxt because the debugger does not know how to deal with Dave’s overloaded operators. The names of the pointers to objects are in Fvar.hpp. You must use his structure information.
A dvector object x, the ith element is given by x.v+i.
That of a dvar_vector is given by x.va+I
A dvar_matrix has a pointer m in it which point to the array of dvar_vectors it is made up of. catch.m+1 points at the first row, and (catch.m+1)->va+1 points at the first element in that row. For a dmatrix it would be (catch.m+1)->v+1.
For a d3_array, it is ((d.t+I)->m+j)->v+k
For a dvar3_array w, you use ((d.t+I)->m+j)->va+k
Type the above in the Quickview window, and you should be able to see the container contents
ADMB Foundation © 2007–2023