| Description |
C-Mex: anyEq
This is a simple but fast check, if two arrays contain any common element.
If no common element is found, the C-Mex is 30% to 50% faster than the equivalent Matlab expression "any(X(:) == y)" and much faster than "any(ismember(X, Y))" if Y is an array.
If a matching element is found early, this function returns very fast without testing the rest.
In opposite to the Matlab version, the C-mex does not need any temporary arrays.
R = anyEq(X, Y)
INPUT:
X, Y: Arrays, arbitrary size. The order of X and Y does not influence
the speed. Types: DOUBLE, SINGLE, (U)INT8/16/32/64, CHAR.
OUTPUT:
R: TRUE if X and Y have any common element.
Tested: Matlab 6.5, 2008a/b, 2009a, 2011b, 32/64 bit
LCC, BCC, OWC, MSVC 2008 and 2010, WinXP and Win7.
Assumed compatibility: Linux, MacOS.
Pre-compiled Mex: http://www.n-simon.de/mex
Suggestion and bugreports through the author page of the FEX or by email are appreciated. |
| Other requirements |
Tested: Matlab 6.5, 7.7, 7.8, WinXP, 32 bit (64 bit assumed to work)
Compiler: BCC5.5, LCC2.4/3.8, Open Watcom 1.8, MSVC++ 2008
Pre-compiled Mex: http://n-simon.de/mex |