qp() in Octave 3.0.0 returns result egregiously violating input constraints

Ben Abbott bpabbott at mac.com
Sun Apr 6 15:21:55 CDT 2008


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


More information about the Bug-octave mailing list