Last change
on this file since 367 was
325,
checked in by pinsard, 17 years ago
|
modification of some headers (+some corrections) to prepare usage of the new idldoc
|
-
Property svn:eol-style set to
native
-
Property svn:keywords set to
Id
|
File size:
1.1 KB
|
Line | |
---|
1 | ;+ |
---|
2 | ; |
---|
3 | ; @file_comments |
---|
4 | ; calculate the union between 2 matrices of whole numbers |
---|
5 | ; |
---|
6 | ; @categories |
---|
7 | ; Calculation |
---|
8 | ; |
---|
9 | ; @param a {in}{required} |
---|
10 | ; arrays of positive integers, which need |
---|
11 | ; not be sorted. Duplicate elements are ignored, as they have no |
---|
12 | ; effect on the result |
---|
13 | ; |
---|
14 | ; @param b {in}{required} |
---|
15 | ; see a |
---|
16 | ; |
---|
17 | ; @returns |
---|
18 | ; tableau |
---|
19 | ; |
---|
20 | ; @restrictions |
---|
21 | ; The empty set is denoted by an array with the first element equal to -1. |
---|
22 | ; |
---|
23 | ; @restrictions |
---|
24 | ; These functions will not be efficient on sparse sets with wide |
---|
25 | ; ranges, as they trade memory for efficiency. |
---|
26 | ; The <proidl>HISTOGRAM</proidl> function |
---|
27 | ; is used, which creates arrays of size equal to the range of the |
---|
28 | ; resulting set. |
---|
29 | ; |
---|
30 | ; @examples |
---|
31 | ; IDL> a = [2,4,6,8] |
---|
32 | ; IDL> b = [6,1,3,2] |
---|
33 | ; IDL> union(a,b) = [ 1, 2, 3, 4, 6, 8] ; Elements in either set |
---|
34 | ; |
---|
35 | ; @history |
---|
36 | ; <a href="http://www.dfanning.com/tips/set_operations.html"/> |
---|
37 | ; |
---|
38 | ; @version |
---|
39 | ; $Id$ |
---|
40 | ; |
---|
41 | ;- |
---|
42 | FUNCTION union, a, b |
---|
43 | ; |
---|
44 | compile_opt idl2, strictarrsubs |
---|
45 | ; |
---|
46 | IF a[0] LT 0 THEN RETURN, b ;A union NULL = a |
---|
47 | IF b[0] LT 0 THEN RETURN, a ;B union NULL = b |
---|
48 | RETURN, Where(Histogram([a,b], OMin = omin)) + omin ; Return combined set |
---|
49 | END |
---|
Note: See
TracBrowser
for help on using the repository browser.