source: trunk/SRC/Matrix/union.pro @ 232

Last change on this file since 232 was 232, checked in by pinsard, 17 years ago

improvements/corrections of some *.pro headers

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