[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-patch-tracker] [patch #8386] Fixed up "find" function with templ
From: |
David Spies |
Subject: |
[Octave-patch-tracker] [patch #8386] Fixed up "find" function with templates and fourth parameter |
Date: |
Thu, 20 Mar 2014 00:29:03 +0000 |
User-agent: |
Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:27.0) Gecko/20100101 Firefox/27.0 |
Follow-up Comment #3, patch #8386 (project octave):
Yes, here's the diff for just the cleanup/bugfixes to find without the extra
fourth parameter. The reason I thought the fourth parameter is necessary is
essentially summed up in
https://savannah.gnu.org/bugs/?func=detailitem&item_id=40296
Specifically, there are quite a few functions
(max,min,sum,any,all,product,find,and logical indexing ...) whose default
return value is "almost" always a column vector with the edge-case being when
the input happens to be a row-vector (and strange arbitrary behavior when
things with a zero-dimension are passed). When writing a "real" project (ie
something that's more than a couple lines of scripting), this is extremely
frustrating behavior because I almost always forget to reshape the output to
deal with those edge-cases.
All of these functions except find and logical indexing can take an extra
"dimension" parameter that clarifies whether you want to take the max/sum/etc.
over rows or columns and also fixes the dimension of the return value. It
seems only reasonable that find and logical indexing should also provide that
capability. Otherwise, the only stable use of "find" on a matrix is to just
always pair it with a reshape.
(file #30952)
_______________________________________________________
Additional Item Attachment:
File name: find_cleanup.diff Size:17 KB
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/patch/?8386>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/