bugGNU Octave - Bugs: bug #41818, Fixed up "find" function...

 
 

bug #41818: Fixed up "find" function with templates and fourth parameter

Submitted by:  David Spies <dspyz>
Submitted on:  Mon 10 Mar 2014 12:07:40 AM UTC  
 
Category: Octave FunctionSeverity: 3 - Normal
Priority: 3 - LowItem Group: Feature Request
Status: Patch SubmittedAssigned to: None
Originator Name: Open/Closed: Open
Release: devOperating System: Any

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

Mon 08 Feb 2016 02:06:56 PM UTC, comment #2:

David, do you plan to respond to Rik's request?

Also, what is the main benefit of your patch? Is it smaller code, faster execution, easier maintenance or just the elegance of having a common template?

You note that min() isn't in the code; the code uses std::min in some places.

It would be nice for each function or template to have a brief comment explaining why it exists. Most are so simple that the reader can see what and how, but it is useful to describe why -- what does the function enable?

Lachlan Andrew <lachlan>
Project Member
Thu 13 Mar 2014 10:51:13 PM UTC, comment #1:

Have you looked at the Matlab find function (http://www.mathworks.com/help/matlab/ref/find.html)? There is no 4th argument and Octave is extremely unlikely to break compatibility with such a core function.

I think it would be better to submit a changeset for just the template changes.

Rik <rik5>
Project Administrator
Mon 10 Mar 2014 12:07:40 AM UTC, original submission:

I cleaned up the "find" function adding templates to channel all calls to 'find' for all types into the same template function.

As a side-effect, this fixes the following matlab/full-matrix incompatibility:
octave:3> a = sparse(0,0);
octave:4> size(find(a))
ans =

0 1

(Matlab and full matrices give 0 0)

Additionally I added a fourth parameter to specify the desired dimension of the output vectors:
octave:3> a = eye(3);
octave:4> [i,j,v] = find(a,Inf,"first",2)
i =

1 2 3

j =

1 2 3

v =

1 1 1

Could someone please look over my changes?

Thanks

David Spies <dspyz>

 

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

Attach File(s):
   
   
Comment:
   

Attached Files
file #30838:  find4.diff added by dspyz (23KiB - text/x-patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by lachlan (Posted a comment)
  • -unavailable- added by rik5 (Posted a comment)
  • -unavailable- added by dspyz (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 3 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Tue 22 Mar 2016 10:05:46 AM UTClachlanPriority5 - Normal=>3 - Low
      StatusNone=>Patch Submitted
    Mon 10 Mar 2014 12:07:40 AM UTCdspyzAttached File-=>Added find4.diff, #30838

    Back to the top


    Powered by Savane 3.1-cleanup1