help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: rcond = 0 when using leasqr. How to check result?


From: Olaf Till
Subject: Re: rcond = 0 when using leasqr. How to check result?
Date: Wed, 22 Aug 2007 08:46:50 +0200
User-agent: Mutt/1.5.13 (2006-08-11)

On Tue, Aug 21, 2007 at 06:32:23PM +0200, address@hidden wrote:
> Dear octave friends,
> both optimizations bellow agree in their results, but the latter gives a msg:
> `` warning: inverse: matrix singular to machine precision, rcond = 0 ''
> 
> ==== 1st =====
> pin=[1 0.1];
> F=@(x,p) p(1)*exp(-p(2)*x.^2);
> leasqr(data(:,1),   data(:,2), pin, F );
> 
> ==== 2nd =====
> pin=[1  0.1  1];
> F=@(x,p) p(1)*exp(-p(2)*x.^2) + 0*p(3)*x;
> leasqr(data(:,1),   data(:,2), pin, F );
> 
> As you see, the term p(3) in the second is not used.
That is probably the reason for the singularity. When 'leasqr'
estimates the gradient (or Jacobian), nothing 'happens' for that
parameter and the respective component(s) will be zero.

As Sörens reply shows, the error (or warning) happens after converging
(or not converging --- check [..., ..., _kvg_, ...] = leasqr (...) ),
when additional information is computed, which you possibly do not
need, the optimization is already completed.

I would guess that the unused parameter does not change the result of
optimization, once 'leasqr' succeeds. The reason for succeeding anyway
is probably that in optimization the pseudoinverse is used, not the
inverse. Still I would advise you not to pass p(3) as an optimization
parameter; put it into a global variable or construct a suitable
anonymous function.

The problem may still occur sometimes, probably if 'leasqr' converges
to regions with very flat gradients. Then, if the warning annoys you,
you can simply edit 'leasqr' and check for singularity.

Olaf




reply via email to

[Prev in Thread] Current Thread [Next in Thread]