[Developers] phase

John Sibert sibert at hawaii.edu
Mon Aug 9 11:04:37 PDT 2010


That would do it, and the if (ad_printf && pointer_to_phase) take care 
of the AUDODIF applications where phase in not defined.

On 08/08/2010 11:48 PM, dave fournier wrote:
> John Sibert wrote:
>
> But that is just the same difficulty in a different form.
> the right way I think is to put a global pointer in
> newfmin.cpp
>
>    int * pointer_to_phase=0;
>
> and then in  the initial_params startup assign
>
>     pointer_to_phase=&initial_params::current_phase;
>
> and then
>
>     if (ad_printf && pointer_to_phase) (*ad_printf)("Current Phase 
> %d   ",
>          *pointer_to_phase );
>
>
>
>> Or you could add an additional argument to fmmdisp(...), eg,
>>
>> void fmmdisp(_CONST dvector& x,_CONST dvector& g,
>>              const int& nvar, int scroll_flag,int noprintx, const int 
>> phase=-1)
>>
>> Giving phase a default value would not break calls to fmmdisp in 
>> other context, The problem would be that the code which calls fmmdisp 
>> would need to have access to the initial_params structure or the 
>> get_current_phase() function.
>>
>>
>> On 08/08/2010 08:37 PM, dave fournier wrote:
>>> There are a few issues involved here.
>>>
>>> First here is how it migbht be done.  the current phase is contained
>>> as a static member of the class initial_params. Lets say we are working
>>> with the quasi newton function minimizer in the file newfmin.cpp.
>>>
>>> first we need to add
>>>
>>> #include <admodel.h>
>>>
>>> near the top of the file.
>>>
>>> then at the right place(s) add something like
>>>
>>>     if (ad_printf) (*ad_printf)("Current Phase %d   ",
>>>         initial_params::current_phase );
>>>
>>> However this will break all code that just uses the autodif stuff
>>> I think as the symbol initial_params::current_phase will be undefined.
>>> Maybe someone has a better idea.
>>>
>>>
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> Developers mailing list
>>> Developers at admb-project.org
>>> http://lists.admb-project.org/mailman/listinfo/developers
>>>
>>
>
>

-- 
John Sibert
Emeritus Researcher, SOEST
University of Hawaii at Manoa

Visit the ADMB project http://admb-project.org/



More information about the Developers mailing list