bugGNU Octave - Bugs: bug #62866, mldivide gives different answer...

 
 

bug #62866: mldivide gives different answer from Matlab for nearly singular matrix

Submitter:  None
Submitted:  Fri 05 Aug 2022 07:47:17 PM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  Need Info Assigned to:  None
Originator Name:  Junjie Yu Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * 7.2.0
Operating System:  * Any Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Wed 17 Aug 2022 09:32:52 PM UTC, comment #6: 

No response, and no progress can be made without an example demonstrating a difference.  Closing report.

Rik <rik5>
Group administrator
Mon 08 Aug 2022 05:45:47 PM UTC, comment #5: 

Changing status to Need Info.

@OP Junjie Yu: Post an example where Matlab gives you the answer you want and Octave does not.

This works for full matrices but not yet for sparse ones unless they can be made full, memory permitting.

Arun Giridhar <arungiridhar>
Group Member
Sun 07 Aug 2022 06:32:46 PM UTC, comment #4: 

This could be a dupe of, or at least related to, bug #48564.

Philip Nienhuis <philipnienhuis>
Group Member
Sat 06 Aug 2022 03:57:31 AM UTC, comment #3: 

https://hg.savannah.gnu.org/hgweb/octave/rev/3cb8519fed0f

The previous fix applied only to full matrices not sparse ones like what OP has. OP's matrix is too large to represent as full.

Is there a way to import the LU factorization to sparse matrices?

Arun Giridhar <arungiridhar>
Group Member
Fri 05 Aug 2022 11:15:33 PM UTC, comment #2: 

Changing title.

Possibly related discussion about mldivide on nearly singular matrices: https://octave.discourse.group/t/q-a-b-matlab-vs-octave-handling-of-near-singular-matrices/1365

Arun Giridhar <arungiridhar>
Group Member
Fri 05 Aug 2022 11:04:31 PM UTC, comment #1: 

@OP (Junjie Yu): I don't see an attached test.m file. Was it supposed to be attached?

Arun Giridhar <arungiridhar>
Group Member
Fri 05 Aug 2022 07:47:17 PM UTC, original submission:  

I was working on running some Matlab files in Octave (7.2.0) and got an incorrect answer. After digging for a while, I found Octave meets 'matrix singular to machine precision' warning when solving large-size linear equations. Below I provide a simple test case for reproducing the error.
We want to solve a linear system: A*x = rhs(see test.m file)
Where A has dimension 93248*93248 and is very sparse, rhs has the dimension of 93248*1.
we can solve x using x = mldivide(A, rhs);
matlab can solve this correctly, octave lead to precision error and give a totally wrong result.


octave-output:
warning: matrix singular to machine precision, rcond = 1.31465e-17
warning: called from
    test at line 6 column 3

ans = -0.027239

matlab-output:
ans =

   6.7878e+11

Could you check whether you can reproduce this error and give me any suggestions to handle this?
Thanks so much!



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 arungiridhar (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 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2022-08-17 rik5 Open/ClosedOpen Closed
    2022-08-08 arungiridhar StatusNone Need Info
    2022-08-05 arungiridhar Summarywrong result when solving large-scale linear equation mldivide gives different answer from Matlab for nearly singular matrix

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code