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

 
 

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

Submitter:  David Spies <dspyz>
Submitted:  Mon 10 Mar 2014 12:07:40 AM UTC
 
Category:  Octave Function Severity:  3 - Normal
Priority:  3 - Low Item Group:  Feature Request
Status:  Patch Submitted Assigned to:  None
Originator Name:  Open/Closed:  * Open
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment (Rich Markup)
   

Comment Type & Canned Response:
       

 

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>
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 Files:
   
   
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
  • -email is unavailable- added by lachlan (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by dspyz (Submitted the item)
  •  

    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 project members can vote.

     

     

     

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-03-22 lachlan Priority5 - Normal 3 - Low
        StatusNone Patch Submitted
    2014-03-10 dspyz Attached File- Added find4.diff, #30838

    Back to the top


    Powered by Savane 3.9