./
intersect.pro
topintersect
Utilities
result = intersect(vec1, vec2 [, count=count] [, sparse=sparse] [, dense=dense] [, verbose=verbose])
Intersect returns the intersection of two 1D, interger-valued vectors. That is, given vec1 and vec2, intersect returns the values common to both sets of data.
Intersect has three methods to find the intersection. One uses histograms, and is optimized for dense vectors (i.e. the range of values in vec1 and vec2 is much larger than the number of elements in those vectors). The second method uses value_locate, and is more efficient when the input vectors are sparse (the range of values greatly exceeds the number of elements).
The method to use can be chosen manually. If not, the program makes a guess at which process is faster based on the data. Some lightweight testing on my machine suggests that, for range / n_elements >~ 30, the sparse method is faster.
Return value
The values common to both vec1 and vec2. If the two sets are mutually exclusive, the routine returns NAN
Parameters
- vec1 in required
A one-dimensional vector. It must be one of the integer data types (byte, int, long, uint, ulong, ulong64, or long64)
- vec2 in required
A one-dimensional vector. It must be one of the integer data types.
Keywords
- count in optional
Set to a variable to hold the number of intersection elements.
- sparse in optional
Force intersect to find the inersection using the method optimized for sparse data sets.
- dense in optional
Force intersect to find the intersection using the method optimized for dense data sets
- verbose in optional
Set to a number (1-3) to produce textual output with varying levels of detail. See VERBOSITY for details.
File attributes
| Modifcation date: | Mon Mar 22 16:17:13 2010 |
| Lines: | 124 |
![[attach.png]](idldoc-resources/attach.png)