bugGNU Octave - Bugs: bug #50887, The find function is faulty

 
 

bug #50887: The find function is faulty

Submitted by:  None
Submitted on:  Thu 27 Apr 2017 09:23:26 AM UTC  
 
Category: Octave FunctionSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Incorrect Result
Status: InvalidAssigned to: None
Originator Name: KrisOriginator Email: -unavailable-
Open/Closed: ClosedRelease: 3.8.2
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.

 

Wed 11 Oct 2017 08:35:19 PM UTC, comment #4:

The reason that

fails in Matlab is that assignments are not expressions, so they don't return values. This also means that you can't do things like

In Octave, assignments return values, so that they can be chained. It also means that assignments can be used anywhere an expression is valid, like in the argument list to a function. I think this is a useful feature.

There is nothing to fix in the find function because all it sees is a matrix. It doesn't know that the value it is working on is an assignment.

Perhaps we could have an optional warning about assignments that appear in expression contexts. Then you could make that an error and get Matlab compatibility, but we'd have to be able to disable it for Octave code since it is a widely used feature.

John W. Eaton <jwe>
Project Administrator
Sat 07 Oct 2017 06:28:46 AM UTC, comment #3:

Hi,

I think this is a valid bug and should be re-opened because Octave's behaviour is different to Matlab.

In Matlab (R2008 is all I have access to), if you try find(A=B), having accidentally used the syntax for an assignment, Matlab will stop and throw an error. Octave on the other hand continues silently and find returns something plausible. This results in very hard to find bugs !

Regards

Jonathan Milton <jmilton>
Thu 27 Apr 2017 01:49:34 PM UTC, comment #2:

Agreed, closing report as invalid.

Pantxo Diribarne <pantxo>
Project Member
Thu 27 Apr 2017 09:36:40 AM UTC, comment #1:

When you do A = B you are assigning B to A, I guess what you want to do is find (A == B), note the double equal sign, that means comparison.

Juan Pablo Carbajal <juanpi>
Project Member
Thu 27 Apr 2017 09:23:26 AM UTC, original submission:

So, it has recently come to my attention that the when the find function is called and used with two vectors as such: find(A = B), the function yields the correct index results; however, it also reallocated vector 'A' into 'B'.

Thus for those who are unaware of the issue, will not know how to work around it.

Best Regards,
Kris

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 jwe (Posted a comment)
  • -unavailable- added by jmilton (Posted a comment)
  • -unavailable- added by pantxo (Posted a comment)
  • -unavailable- added by juanpi (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 2 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Thu 27 Apr 2017 01:49:34 PM UTCpantxoStatusNone=>Invalid
      Open/ClosedOpen=>Closed

    Back to the top


    Powered by Savane 3.1-cleanup1