bugGNU Octave - Bugs: bug #63178, Incorrect lambda for lsqnonneg and...

 
 

bug #63178: Incorrect lambda for lsqnonneg and pqpnonneg

Submitter:  Arun Giridhar <arungiridhar>
Submitted:  Fri 07 Oct 2022 10:10:11 AM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Unexpected Error or Warning
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * 7.2.0 Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Sun 09 Oct 2022 06:15:29 PM UTC, comment #5: 

Done: https://hg.savannah.gnu.org/hgweb/octave/rev/b902f78ecf66

Hopefully the other checks are OK. This one might get better on its own with newer OpenBlas. I was running with 3.21.

Arun Giridhar <arungiridhar>
Group Member
Sun 09 Oct 2022 05:40:54 PM UTC, comment #4: 

Oh. That's only a tolerance issue for the test. I'll increase it to 10*eps.

Arun Giridhar <arungiridhar>
Group Member
Sun 09 Oct 2022 04:47:37 PM UTC, comment #3: 

The CI with the Windows nightly builds is failing for mingw64.
E.g.:
https://github.com/gnu-octave/octave-buildbot/actions/runs/3211133434/jobs/5249086034#step:11:89716

>>>>> processing D:\a\OCTAVE~1\OCTAVE~1\OCTAVE~1\mingw64\share\octave\7.2.1\m\optimization\pqpnonneg.m
***** test
 [x, resid, ~, ~, lambda] = pqpnonneg ([3 2; 2 2], [-6; -5]);
 assert (x, [1 1.5]', 10*eps);
 assert (resid, -6.75, eps);
 assert (lambda, [0 0]', eps);
 assert (x .* lambda, [0 0]')
!!!!! test failed
ASSERT errors for:  assert (resid,-6.75,eps)

  Location  |  Observed  |  Expected  |  Reason
     ()         -6.75        -6.75       Abs err 8.8818e-16 exceeds tol 2.2204e-16 by 7e-16


Those test are running with OpenBLAS 0.3.18 in case that should matter.

Should we just increase the tolerance in the test? Or does that point to another issue?

Markus Mützel <mmuetzel>
Group administrator
Sat 08 Oct 2022 12:57:03 PM UTC, comment #2: 

No complaint from CI. Closing as fixed.

Arun Giridhar <arungiridhar>
Group Member
Fri 07 Oct 2022 10:28:02 AM UTC, comment #1: 

Bug fix uploaded here to stable: https://hg.savannah.gnu.org/hgweb/octave/rev/44a68ac1a22f

Marking as Ready for test.

Arun Giridhar <arungiridhar>
Group Member
Fri 07 Oct 2022 10:10:11 AM UTC, original submission:  

It turns out that the previously undocumented output "lambda" from the functions lsqnonneg and pqpnonneg was supposed to be a Lagrange multiplier, not a conjugate gradient. Matlab returns the Lagrange multiplier correctly (see https://octave.discourse.group/t/what-does-matlab-do-for-this-code/3374). In Octave, there was a bug in the calculation of that output in both functions causing the duality logic to be violated, and in some cases Octave would also have a size mismatch error.

The error can be replicated with this test:

[x, ~, ~, ~, ~, lambda] = lsqnonneg ([1 0; 0 1; 2 1], [1 1 3]');    assert (x .* lambda, [0 0]')
[x, ~, ~, ~, ~, lambda] = lsqnonneg ([1 0; 0 1; 2 1], [1 -1 1]');   assert (x .* lambda, [0 0]')
[x, ~, ~, ~, ~, lambda] = lsqnonneg ([1 0; 0 1; 2 1], [-1 1 -1]');  assert (x .* lambda, [0 0]')
[x, ~, ~, ~, ~, lambda] = lsqnonneg ([1 0; 0 1; 2 1], [-1 -1 -3]'); assert (x .* lambda, [0 0]')

[x, ~, ~, ~, lambda] = pqpnonneg ([3 2; 2 2], [6; 5]);              assert (x .* lambda, [0 0]')
[x, ~, ~, ~, lambda] = pqpnonneg ([3 2; 2 2], [6; -5]);             assert (x .* lambda, [0 0]')
[x, ~, ~, ~, lambda] = pqpnonneg ([3 2; 2 2], [-6; 5]);             assert (x .* lambda, [0 0]')
[x, ~, ~, ~, lambda] = pqpnonneg ([3 2; 2 2], [-6; -5]);            assert (x .* lambda, [0 0]')


I have a fix for this bug, along with docstring updates and BISTs, which I will upload once I get a bug number.

Arun Giridhar <arungiridhar>
Group Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by mmuetzel (Posted a comment)
  • -email is unavailable- added by arungiridhar (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2022-10-08 arungiridhar StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2022-10-07 arungiridhar StatusNone Ready For Test

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code