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

Last change on this file since 133 was 133, checked in by navarro, 18 years ago

english and nicer header (1)

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 1.5 KB
RevLine 
[2]1;------------------------------------------------------------
2;------------------------------------------------------------
3;------------------------------------------------------------
4;+
5;
[133]6; @file_comments
7; calculate tne union between 2 matrixes of whole numbers
[2]8;
[133]9; @categories calculation of matrixes
[2]10;
[133]11; @param a {in}{required} arrays of positive integers, which need
[2]12;               not be sorted. Duplicate elements are ignored, as they have no
13;               effect on the result
14;
[133]15; @param b {in}{required} see a
[2]16;
[133]17; @returns tableau
[2]18;
[133]19; @restrictions The empty set is denoted by an array with the first element equal to
[2]20; -1.
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;
[133]27; @examples a = [2,4,6,8]
28;           b = [6,1,3,2]
29;           union(a,b) = [ 1, 2, 3, 4, 6, 8]  ; Elements in either set
[2]30;
[133]31; @history  http://www.dfanning.com/tips/set_operations.html
[2]32;
[133]33; @version $Id$
[2]34;
35;-
36;------------------------------------------------------------
37;------------------------------------------------------------
38;------------------------------------------------------------
39FUNCTION union, a, b
[114]40;
41  compile_opt idl2, strictarrsubs
42;
[2]43IF a[0] LT 0 THEN RETURN, b    ;A union NULL = a
44IF b[0] LT 0 THEN RETURN, a    ;B union NULL = b
45RETURN, Where(Histogram([a,b], OMin = omin)) + omin ; Return combined set
46END
Note: See TracBrowser for help on using the repository browser.