[Developers] (extract_) diagonal
dave fournier
davef at otter-rsch.com
Mon May 31 00:52:03 PDT 2010
Arni Magnusson wrote:
Easiest is to add
dvar_vector extract_diagonal(const dvar_matrix & M)
{
return diagonal(M);
}
to the code.
> The current manuals for ADMB (p. 15-9) and AUTODIF (p. 4-11) describe
> a function 'extract_diagonal', but it seems to be implemented as
> 'diagonal'. To verify this, I used a slightly modified version of
> simple.tpl:
>
> DATA_SECTION
> init_int n
> init_vector X(1,n)
> init_vector Y(1,n)
> PARAMETER_SECTION
> init_number b0
> init_number b1
> vector Yfit(1,n)
> matrix foo(1,3,1,3)
> objective_function_value RSS
> PRELIMINARY_CALCS_SECTION
> foo(1,1)=11; foo(1,2)=12; foo(1,3)=13;
> foo(2,1)=21; foo(2,2)=22; foo(2,3)=23;
> foo(3,1)=31; foo(3,2)=32; foo(3,3)=33;
> PROCEDURE_SECTION
> Yfit = b0 + b1*X;
> RSS = norm2(Y-Yfit);
> REPORT_SECTION
> report << diagonal(foo) << endl;
>
> If you change 'diagonal' to 'extract_diagonal' the model does not
> compile. The function name should either be changed in the manuals, or
> in the source code.
>
> Arni
> _______________________________________________
> Developers mailing list
> Developers at admb-project.org
> http://lists.admb-project.org/mailman/listinfo/developers
>
More information about the Developers
mailing list