bugGNU Octave - Bugs: bug #49690, inv(inf) behaves differently from...

 
 

bug #49690: inv(inf) behaves differently from inf^-1, 1/inf, inf\1

Submitted by:  None
Submitted on:  Thu 24 Nov 2016 08:06:58 AM UTC  
 
Category: Octave FunctionSeverity: 3 - Normal
Priority: 3 - LowItem Group: Incorrect Result
Status: FixedAssigned to: None
Originator Name: Originator Email: -unavailable-
Open/Closed: ClosedRelease: dev
Operating System: GNU/Linux

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

(Jump to the original submission Jump to the original submission)

Wed 30 Nov 2016 12:47:44 AM UTC, comment #7:

Thanks for checking. I pushed a cset to fix this here (http://hg.savannah.gnu.org/hgweb/octave/rev/1d242ae72240).

Closing report.

Rik <rik5>
Project Administrator
Tue 29 Nov 2016 09:59:32 PM UTC, comment #6:

MATLAB's result:

which is also mathematically correct in complex plane.

count <count>
Tue 29 Nov 2016 01:37:19 AM UTC, comment #5:

The trouble was actually buried in liboctave where we are changing the matrix to all Inf if the reciprical condition number is 0.

I've fixed things for the ordinary cases. But what does Matlab do for

When I have the answer for that I can make inverse(x) and 1 / x yield the same result across all inputs.

Rik <rik5>
Project Administrator
Sat 26 Nov 2016 04:03:18 AM UTC, comment #4:

I think it should be properly handled in liboctave because inv.cc is part of the interpreter and there is no reason someone might not write their own C++ file and link to liboctave to have access to Arrays and matrix functions. An obvious case would be someone writing a .oct file.

Rik <rik5>
Project Administrator
Fri 25 Nov 2016 05:37:24 PM UTC, comment #3:

The inv function has a special case for diagonal matrices, a special case for permutation matrices, and then the general case. Unfortunately a scalar is not recognized as a diagonal matrix here, so it falls into the general case which uses a different algorithm.

It might be nice to add another special case to inv.cc to handle a scalar directly without going to the Array library.

Mike Miller <mtmiller>
Project Administrator
Fri 25 Nov 2016 03:50:23 AM UTC, comment #2:

Besides, inv() returns incorrect result only for scalar Inf.
All of them return correct results for matrices:

Anonymous
Thu 24 Nov 2016 02:37:32 PM UTC, comment #1:

Confirmed on 4.2.0. It's not a big deal--the inv function is really meant for matrices rather than scalars--but it would be nice to get the same results out of all of the different operators.

Rik <rik5>
Project Administrator
Thu 24 Nov 2016 08:06:58 AM UTC, original submission:

I'm not sure whether this is a bug since "inf" is not a finite value, and I'm not sure whether it is required that inv() should behave exactly as ()^-1 .
Also, I'm sorry that I have no Octave 4.2.0 installed so I could not help to test this on the new released version.

Anonymous

 

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

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by count (Posted a comment)
  • -unavailable- added by mtmiller (Posted a comment)
  • -unavailable- added by rik5 (Posted a comment)
  • -unavailable- added by None (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 6 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Wed 30 Nov 2016 12:47:44 AM UTCrik5StatusConfirmed=>Fixed
      Open/ClosedOpen=>Closed
    Fri 25 Nov 2016 05:37:24 PM UTCmtmillerPriority5 - Normal=>3 - Low
      Release4.2.0=>dev
    Thu 24 Nov 2016 02:37:32 PM UTCrik5StatusNone=>Confirmed
      Release4.0.3=>4.2.0

    Back to the top


    Powered by Savane 3.1-cleanup1