help-octave
[Top][All Lists]
Advanced

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

Re: qp() in Octave 3.0.0 returns result egregiously violating input cons


From: Dmitri A. Sergatskov
Subject: Re: qp() in Octave 3.0.0 returns result egregiously violating input constraints
Date: Sun, 6 Apr 2008 16:45:31 -0500

On Sun, Apr 6, 2008 at 3:21 PM, Ben Abbott <address@hidden> wrote:
>
>  On Apr 6, 2008, at 3:55 PM, Dmitri A. Sergatskov wrote:
>
> > This is somewhat off topic.
> >
> > Looking at qp.m I see on line 205:
> >
> > xbar = pinv (A) * b;
> >
> > Should not it be:
> >
> >  xbar = A \ b;
> >
> > ?
> >
>
>
>  Dimigtri,
>
>  I recall we had modified polyfit.m to us qr instead of leftdivide. This was
> done to improve the stability of the solution.
>
>  Here's the thread below.
>
>         http://www.nabble.com/Polyfit-with-scaling-tc15191415.html#a15246667
>
>  The patch to polyfit contained
>
>  -  p = X \ y;
>  +  ## Solve by QR decomposition.
>  +  [q, r, k] = qr (v, 0);
>  +  p = r \ (y' * q)';
>  +  p(k) = p;
>
>  Should a similar approach be made here?
>
>  Ben
>

I am not really an expert here and cannot tell when QR is
preferable  to SVD. In the case of polyfit we switched to
QR mostly because it is what Matlab uses there.
I think SVD is more generic and robust, but QR may
be more accurate. QR is also more expensive computationally
(in case it matters) than SVD.
In any case  I think either of them is better
than calculating inverse matrix explicitly.

Sincerely,

Dmitri.

p.s. Perhaps we should switch this discussion to help-octave list.
--


reply via email to

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