[ADMB Users] Having trouble with this; segmenataion fault

John Sibert sibert at hawaii.edu
Mon Dec 8 11:18:14 PST 2014


Hi Steve,
Yes. That indeed works. My problem is contextual. The call is embedded 
in a separable function. In the model_parameters:: member function the 
return value appears to require a dvariable, and in the  
df1b2_pre_parameters:: member function, the return value appears to 
reqauire a   df1b2variable. In both cases, I think the argument type is 
a and init_parameter type.

The KISS principle applies here. The code I originally wrote works fine.
    dvariable tprop = 1.0/(1.0+exp(-LmeanPropL));

I hate templates
John

John Sibert
Emeritus Researcher, SOEST
University of Hawaii at Manoa
Honolulu HI (GMT-10)
808-294-3842 (mobile)

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

On 12/08/2014 08:40 AM, Steve Martell wrote:
> John,
>
> This works for me:
>
>
> DATA_SECTION
>
> PARAMETER_SECTION
>          init_number dum;
>
>          objective_function_value f;
>          random_effects_vector re(1,3);
>
> PROCEDURE_SECTION
>
>          df1b2variable x = 2.;
>          alogit(x);
>
> GLOBALS_SECTION
>          template <typename SCALAR> SCALAR alogit(const SCALAR& a)
>           {
>              SCALAR p = 1.0/(1.0+exp(-a));
>              return p;
>           }
>           // template df1b2variable alogit(const df1b2variable& a);
>
>
>
>
>> On Dec 8, 2014, at 9:25 AM, John Sibert <sibert at hawaii.edu> wrote:
>>
>>   template <typename SCALAR> SCALAR alogit(const SCALAR& a)
>>   {
>>      SCALAR p = 1.0/(1.0+exp(-a));
>>      return p;
>>   }
>>   template df1b2variable alogit(const df1b2variable& a);
>>
>> --
>> John Sibert
>> Emeritus Researcher, SOEST
>> University of Hawaii at Manoa
>> Honolulu HI (GMT-10)
>> 808-294-3842 (mobile)
>>
>> Visit the ADMB project http://admb-project.org/
>>
>> _______________________________________________
>> Users mailing list
>> Users at admb-project.org
>> http://lists.admb-project.org/mailman/listinfo/users
>
> ________________________________
>
> This internet e-mail message, and any files transmitted with it, contains confidential, privileged information that is intended only for the addressee. If you have received this e-mail message in error, please call us at (206) 634-1838 collect if necessary) and ask to speak to the message sender. Nothing in this e-mail or the act of transmitting it, is to be construed as a waiver of any rights or privileges enjoyed by the sender or the International Pacific Halibut Commission pursuant to the International Organizations Immunities Act, 22 U.S.C. Sec. 288 et seq.
>



More information about the Users mailing list