[ADMB Users] ADMB-RE fitting failure in 11 but not in 10.1
Mollie Brooks
mbrooks at ufl.edu
Thu Dec 6 12:23:59 PST 2012
Hi Tim,
A while back I had a similar underflow problem with solve(dvar_dmatrix). The elements of my determinant were so small and there were so many of them that the product was 0. As Dave suggests, the solution to my problem was to replace the determinant checking code with this code that doesn't have underflow issues.
int i,imax,j,k,n;
n=aa.colsize();
int lb=aa.colmin();
int ub=aa.colmax();
for (i=lb;i<=ub;i++)
{
big=0.0;
for (j=lb;j<=ub;j++)
{
temp=fabs(bb.elem(i,j));
if (temp > big)
{
big=temp;
}
}
if (big == 0.0)
{
cerr << "Error in matrix inverse -- matrix singular in solve(dvar_dmatrix)\n";
ofstream ofs("matrixerror");
ofs << aa << endl;
ofs.close();
ad_exit(1);
}
vv[i]=1.0/big;
}
I'm suprised that
> exp(sum(log(fabs(determinant components)))) == 0.0 and product(determinant components) == 0.0
could give different answers besides the sign.
Mollie
Mollie Brooks
Postdoctoral Researcher, Ponciano Lab
Biology Department, University of Florida
http://people.biology.ufl.edu/mbrooks
On 6 Dec 2012, at 11:47 AM, Tim Miller wrote:
> Dear Users,
>
> During the fitting of a random effects model in version 11 (Windows 7, MinGW GCC-4.5.2), I get a failure with error message:
>
> Error in matrix inverse -- matrix singular in solve(dmatrix)
>
> This occurs before a .par file is written. In 10.1 convergence is fine. The error doesn't occur in 11 when I use the sparse hessian option -shess and in that case I get the same result as 10.1 (with or without -shess).
>
> I think I have traced it to the solve function in ludcmp_solve.cpp just by searching for the error text in all the source code files and I think the error occurs when checking the determinant. In version 11 the function appears to check whether exp(sum(log(fabs(determinant components)))) == 0.0 whereas in 10.1 it checks product(determinant components) == 0.0.
>
> Assuming I have traced the source of the error correctly, why is the newer determinant checking method better than that in 10.1? If it is better, maybe there is a way to continue on rather than exiting on the error?
>
> I could provide the tpl/dat files, but fitting the model without -shess is annoying because it takes a while to get to the error.
>
> Tim
>
>
>
> _______________________________________________
> Users mailing list
> Users at admb-project.org
> http://lists.admb-project.org/mailman/listinfo/users
>
More information about the Users
mailing list