bugGNU Octave - Bugs: bug #59776, pcg() returns incorrect flag

 
 

bug #59776: pcg() returns incorrect flag

Submitter:  None
Submitted:  Tue 29 Dec 2020 01:24:58 PM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Regression
Status:  Fixed Assigned to:  None
Originator Name:  S Mahesh Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * 6.1.0
Operating System:  * Any Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Wed 30 Dec 2020 06:58:48 PM UTC, comment #2: 

Thanks for catching this bug.  It turns out that it was the final relative residual value that was not being calculated correctly.  Fixing that calculation then allowed pcg() to return the correct FLAG output.  I checked the change in on the stable branch of Octave here http://hg.savannah.gnu.org/hgweb/octave/rev/56978d4b266c.  This will be a part of the next bug fix release, 6.1.1, which should be out within a few months.  If you need the change sooner you can simply download the pcg.m file from Octave's Mercurial repository.

Rik <rik5>
Group administrator
Wed 30 Dec 2020 04:56:06 PM UTC, comment #1: 

Confirmed.  This is a regression that happened between the 4.2.X and 4.4.X series (i.e., years ago).

I suspect that the issue is related to the fact that pcg succeeds in 1 iteration which means some checks that were expected to occur as part of the iterative process of convergence did not occur.

Rik <rik5>
Group administrator
Tue 29 Dec 2020 01:24:58 PM UTC, original submission:  

In octave 5.2.0, pcg() returns the wrong flag, even though it correctly computes the answer. MWE:


A = [1.00000000  -0.00054274  -0.00066848; -0.00054274   1.00000000  -0.00060330; -0.00066848  -0.00060330   1.00000000];
b = [1 1 1]';
[x, flag, relres, iter] = pcg( A, b, 1e-6, 4, [], [], [1; 1; 1] )


output:
x =

   1.0012
   1.0011
   1.0013

flag =  1
relres =  0.000025738
iter =  1

The answer (x) is correct: norm(A*x-b) = 0.000000053976 is less than the tolerance of 1e-6

flag = 1 is supposed to indicate the number of iterations reached the maximum allowable, but that has not happened here.

I therefore suspect the value returned in FLAG is a bug. In octave 4.0.0 flag = 0 is returned correctly.

Thanks for any help.

Anonymous

 

(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 rik5 (Posted a comment)
  • -email is unavailable- added by None (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 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2020-12-30 rik5 StatusConfirmed Fixed
        Open/ClosedOpen Closed
    2020-12-30 rik5 Item GroupIncorrect Result Regression
        StatusNone Confirmed
        Release5.2.0 6.1.0
        Operating SystemGNU/Linux Any

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code