bugGNU Octave - Bugs: bug #54167, eigs called with user defined...

 
 

bug #54167: eigs called with user defined function gives incorrect results if B is not the identity matrix

Submitter:  None
Submitted:  Fri 22 Jun 2018 08:19:48 PM UTC
   
 
Category:  Libraries Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  None
Originator Name:  Octave user Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * 4.4.0
Operating System:  * Any Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Fri 27 Jul 2018 09:02:06 PM UTC, comment #7: 

I made some changes to the BIST tests to follow Octave conventions such as using double quotes (") instead of single quotes (') for strings.  I also decided to check it in on the development branch.   See https://hg.savannah.gnu.org/hgweb/octave/rev/3b6691ff0f59.

Thanks for taking care of this Marco.

Rik <rik5>
Group administrator
Fri 20 Jul 2018 07:26:44 AM UTC, comment #6: 

eigs has never worked with AF and B (worse, it has silently ignored B). So, this quite long patch should not introduce regressions. I think that stable branch is safe.

Marco Caliari <caliari>
Group Member
Fri 20 Jul 2018 03:19:05 AM UTC, comment #5: 

@Marco: Should this patch go on stable or default branch?

Rik <rik5>
Group administrator
Thu 05 Jul 2018 06:35:00 PM UTC, comment #4: 

The complex function was fixed, too. eigs3.diff replaces the previous and it is ready for reviewing.

(file #44513)

Marco Caliari <caliari>
Group Member
Tue 03 Jul 2018 12:15:57 PM UTC, comment #3: 

I completed EigsRealNonSymmetricFunc and EigsRealSymmetricFunc. The original test now passes. Comments are welcome before I conclude with EigsComplexNonSymmetricFunc. The new patch is a replacement of the previous.

(file #44498)

Marco Caliari <caliari>
Group Member
Wed 27 Jun 2018 07:00:08 AM UTC, comment #2: 

I started to work on this. Eigs...Func were not able to manage the generalized case. In the end, they should manage it, both with mode=1 and with mode=3. For the matrix case, the two modes are managed by different functions (Eigs...Matrix and Eigs...MatrixShift). For the moment, I implemented just mode=1 for EigsRealNonSymmetricFunc. I am not sure that a different function is needed for mode=3. But of course, some if-else statements are necessary. I added a simple test to eigs.m which fails with current octave and passes with the attached patch. The original submission require mode=3, so it is not ready yet. Comments are welcome.

(file #44442)

Marco Caliari <caliari>
Group Member
Mon 25 Jun 2018 07:44:41 AM UTC, comment #1: 

Confirmed, although it is rather a missing feature. I will investigate further.

Marco Caliari <caliari>
Group Member
Fri 22 Jun 2018 08:19:48 PM UTC, original submission:  

If you run the code below, you get an error if B is not the identity matrix.


clear all;
rand("seed", 0);

tol = sqrt(eps);

for j=1:2
  for i=1:100
    A = rand(10, 10);
    if j == 1
      B = eye(columns(A));
    else
      B = rand(rows(A), columns(A));
    endif
    A *= A.';
    B *= B.';
    opts.isreal = 1;
    opts.issym = 1;
    [v, lambda] = eigs(A, B, 3, "sm");
    [v2, lambda2] = eigs(@(x) A \ x, columns(A), B, 3, "sm", opts);
    assert(lambda, lambda2, tol*max(max(abs(lambda))));
    for i=1:columns(v)
      assert(A * v(:, i), lambda(i,i) * B * v(:,i), tol * norm(A * v(:,i)));
    endfor
    for i=1:columns(v2)
      assert(A * v2(:, i), lambda2(i,i) * B * v2(:, i), tol * norm(A * v2(:,i)));
    endfor
  endfor
endfor


Anonymous

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #44513:  eigs3.diff added by caliari (36KiB - application/x-tex)
file #44498:  eigs2.diff added by caliari (24KiB - application/x-tex)
file #44442:  eigs.diff added by caliari (11KiB - application/x-tex)
file #44417:  eigs_test.m added by None (694B - application/octet-stream)

 

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 caliari (Posted a comment)
  •  

    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 9 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-07-27 rik5 StatusPatch Submitted Fixed
        Open/ClosedOpen Closed
    2018-07-05 caliari Attached File- Added eigs3.diff, #44513
        StatusIn Progress Patch Submitted
    2018-07-03 caliari Attached File- Added eigs2.diff, #44498
    2018-06-27 caliari Attached File- Added eigs.diff, #44442
    2018-06-25 caliari StatusNone In Progress
        Operating SystemMicrosoft Windows Any
    2018-06-22 None Attached File- Added eigs_test.m, #44417

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code