Min/Max selection
by Bruno Luong
07 Apr 2009
(Updated 29 Apr 2013)
Search for k smallest or largest elements in the array
|
Watch this File
|
| File Information |
| Description |
Using a partial quick-sort algorithm implemented with C-MEX. The complexity is O(n + k.log(k)), where n is the size of the array, and k is the number of elements to be selected.
Faster than SORT or multiple call of MIN/MAX for large size inputs.
Multidimensional capability supported |
| MATLAB release |
MATLAB 7.3 (R2006b)
|
|
Tags for This File
|
| Everyone's Tags |
|
| Tags I've Applied |
|
| Add New Tags |
Please login to tag files.
|
| Updates |
| 07 Apr 2009 |
Bug correction (for k=0)
Do not compute unnecessary location indexes when not required. |
| 24 May 2009 |
Supported sparse input |
| 26 Jun 2009 |
handle arrays with NaN |
| 29 Jun 2009 |
Correct bug + inplace engine |
| 11 Aug 2009 |
Correct bug: cleanup the inplace variable when MEX issues an error (otherwise computer might crash) |
| 10 Jan 2010 |
Possibility to disable post-sorting step |
| 16 Aug 2010 |
Fix the bugs for sparse and all-NaN vector |
| 05 Mar 2011 |
Specific installation for R2010B |
| 27 Aug 2011 |
Change installation script, now copy prototype header file for V2010B or later.
Correct BUG when working on sparse matrix. |
| 29 Apr 2013 |
Fix C/C++ comment style issue |
|
Contact us