Ignore:
Timestamp:
07/10/06 17:20:19 (18 years ago)
Author:
pinsard
Message:

some improvements and corrections in some .pro file according to
aspell and idldoc log file

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/SRC/Matrix/cmset_op.pro

    r134 r136  
    22; @hidden 
    33; 
     4; @file_comments 
     5; Simplified version of CMSET_OP_UNIQ which sorts, and takes the 
     6; "first" value, whatever that may mean. 
     7; 
    48; @todo seb 
    59;- 
    610; 
    7 ;; Simplified version of CMSET_OP_UNIQ which sorts, and takes the 
    8 ;; "first" value, whatever that may mean. 
    911function cmset_op_uniq, a 
    1012; 
     
    2224;+ 
    2325; 
    24 ; @file_comments  
     26; @file_comments 
    2527; Performs an AND, OR, or XOR operation between two sets 
    2628; 
    27 ;   Description: SET_OP performs three common operations between two sets. The 
    28 ;   three supported functions of OP are: 
     29; Description: SET_OP performs three common operations between two sets. The 
     30; three supported functions of OP are: 
    2931; 
    3032;        OP          Meaning 
    3133;      'AND' - to find the intersection of A and B; 
    3234;      'OR'  - to find the union of A and B; 
    33 ;      'XOR' - to find the those elements who are members of A or B  
     35;      'XOR' - to find the those elements who are members of A or B 
    3436;              but not both; 
    3537; 
    3638;   Sets as defined here are one dimensional arrays composed of 
    37 ;   numeric or string types.  Comparisons of equality between elements 
     39;   numeric or string types. Comparisons of equality between elements 
    3840;   are done using the IDL EQ operator. 
    3941; 
    4042;   The complements of either set can be taken as well, by using the 
    41 ;   NOT1 and NOT2 keywords.  For example, it may be desireable to find 
     43;   NOT1 and NOT2 keywords. For example, it may be desireable to find 
    4244;   the elements in A but not B, or B but not A (they are different!). 
    4345;   The following IDL expressions achieve each of those effects: 
     
    5254; 
    5355;   NOT1 and NOT2 can only be set for the 'AND' operator, and never 
    54 ;   simultaneously.  This is because the results of an operation with 
     56;   simultaneously. This is because the results of an operation with 
    5557;   'OR' or 'XOR' and any combination of NOTs -- or with 'AND' and 
    5658;   both NOTs -- formally cannot produce a defined result. 
    5759; 
    58 ;   The implementation depends on the type of operands.  For integer 
    59 ;   types, a fast technique using HISTOGRAM is used.  However, this 
     60;   The implementation depends on the type of operands. For integer 
     61;   types, a fast technique using HISTOGRAM is used. However, this 
    6062;   algorithm becomes inefficient when the dynamic range in the data 
    61 ;   is large.  For those cases, and for other data types, a technique 
    62 ;   based on SORT() is used.  Thus the compute time should scale 
     63;   is large. For those cases, and for other data types, a technique 
     64;   based on SORT() is used. Thus the compute time should scale 
    6365;   roughly as (A+B)*ALOG(A+B) or better, rather than (A*B) for the 
    64 ;   brute force approach.  For large arrays this is a significant 
     66;   brute force approach. For large arrays this is a significant 
    6567;   benefit. 
    6668; 
    6769; @categories array 
    6870; 
    69 ; @param A {in}{required} The two sets to be operated on.  A one dimensional array of 
    70 ;          either numeric or string type.  A and B must be of the same 
    71 ;          type.  Empty sets are permitted, and are either represented 
    72 ;          as an undefined variable, or by setting EMPTY1 or EMPTY2. 
    73 ; 
    74 ; @param B {in}{required} See A 
    75 ; 
    76 ; @param OP {in}{required} a string, the operation to be performed.  Must be one of 
    77 ;        'AND', 'OR' or 'XOR' (lower or mixed case is permitted). 
    78 ;        Other operations will cause an error message to be produced. 
    79 ; 
    80 ; @keyword NOT1 If set and OP is 'AND', then the complement of A (for 
    81 ;                NOT1) or B (for NOT2) will be used in the operation. 
    82 ;                NOT1 and NOT2 cannot be set simultaneously. 
    83 ; 
    84 ; @keyword NOT2 See NOT1 
    85 ; 
    86 ; @keyword EMPTY1 If set, then A (for EMPTY1) or B (for EMPTY2) are 
    87 ;                 assumed to be the empty set.  The actual values 
    88 ;                 passed as A or B are then ignored. 
    89 ; 
    90 ; @keyword EMPTY2 See EMPTY1 
    91 ; 
    92 ; @keyword INDEX if set, then return a list of indices instead of the array 
    93 ;           values themselves.  The "slower" set operations are always 
    94 ;           performed in this case. 
    95 ; 
    96 ;           The indices refer to the *combined* array [A,B].  To 
    97 ;           clarify, in the following call: I = CMSET_OP(..., /INDEX); 
    98 ;           returned values from 0 to NA-1 refer to A[I], and values 
    99 ;           from NA to NA+NB-1 refer to B[I-NA]. 
    100 ; 
    101 ; @keyword COUNT upon return, the number of elements in the result set. 
    102 ;           This is only important when the result set is the empty 
    103 ;           set, in which case COUNT is set to zero. 
    104 ; 
    105 ; @returns The resulting set as a one-dimensional array.  The set may be 
    106 ;   represented by either an array of data values (default), or an 
    107 ;   array of indices (if INDEX is set).  Duplicate elements, if any, 
    108 ;   are removed, and element order may not be preserved. 
    109 ; 
    110 ;   The empty set is represented as a return value of -1L, and COUNT 
    111 ;   is set to zero.  Note that the only way to recognize the empty set 
    112 ;   is to examine COUNT. 
     71; @param A {in}{required} 
     72; The two sets to be operated on. A one dimensional array of 
     73; either numeric or string type. A and B must be of the same 
     74; type. Empty sets are permitted, and are either represented 
     75; as an undefined variable, or by setting EMPTY1 or EMPTY2. 
     76; 
     77; @param B {in}{required} 
     78; See A 
     79; 
     80; @param OP0 {in}{required} 
     81; a string, the operation to be performed. Must be one of 
     82; 'AND', 'OR' or 'XOR' (lower or mixed case is permitted). 
     83; Other operations will cause an error message to be produced. 
     84; 
     85; @keyword NOT1 
     86; If set and OP is 'AND', then the complement of A (for 
     87; NOT1) or B (for NOT2) will be used in the operation. 
     88; NOT1 and NOT2 cannot be set simultaneously. 
     89; 
     90; @keyword NOT2 
     91; See NOT1 
     92; 
     93; @keyword EMPTY1 
     94; If set, then A (for EMPTY1) or B (for EMPTY2) are 
     95; assumed to be the empty set. The actual values 
     96; passed as A or B are then ignored. 
     97; 
     98; @keyword EMPTY2 
     99; See EMPTY1 
     100; 
     101; @keyword INDEX 
     102; if set, then return a list of indices instead of the array 
     103; values themselves. The "slower" set operations are always 
     104; performed in this case. 
     105; 
     106; The indices refer to the *combined* array [A,B]. To 
     107; clarify, in the following call: I = CMSET_OP(..., /INDEX); 
     108; returned values from 0 to NA-1 refer to A[I], and values 
     109; from NA to NA+NB-1 refer to B[I-NA]. 
     110; 
     111; @keyword COUNT 
     112; upon return, the number of elements in the result set. 
     113; This is only important when the result set is the empty 
     114; set, in which case COUNT is set to zero. 
     115; 
     116; @returns 
     117; The resulting set as a one-dimensional array. The set may be 
     118; represented by either an array of data values (default), or an 
     119; array of indices (if INDEX is set). Duplicate elements, if any, 
     120; are removed, and element order may not be preserved. 
     121; 
     122; The empty set is represented as a return value of -1L, and COUNT 
     123; is set to zero. Note that the only way to recognize the empty set 
     124; is to examine COUNT. 
    113125; 
    114126; SEE ALSO: 
    115127; 
    116  SET_UTILS.PRO by RSI 
     128SET_UTILS.PRO by RSI 
    117129; 
    118130; @history Written, CM, 23 Feb 2000 
     
    145157; 
    146158;   Author: Craig B. Markwardt, NASA/GSFC Code 662, Greenbelt, MD 20770 
    147 ;   craigm@lheamail.gsfc.nasa.gov 
    148 ; 
    149 ; @version $Id: cmset_op.pro,v 1.6 2006/01/16 19:45:22 craigm Exp $ 
    150 ; 
    151 ; @examples Utility function, similar to UNIQ, but allowing choice of taking 
     159;   craigm\@lheamail.gsfc.nasa.gov 
     160; 
     161; @version $Id$ 
     162; 
     163; @examples 
     164; Utility function, similar to UNIQ, but allowing choice of taking 
    152165; first or last unique element, or non-unique elements. 
    153166; Unfortunately this doesn't work because of implementation dependent 
     
    235248      if n2 GT 0 then b1 = cmset_op_uniq(b) 
    236249      n1 = n_elements(a1) < n1 & n2 = n_elements(b1) < n2 
    237       case op of  
     250      case op of 
    238251          'OR': if n1 EQ 0 then goto, RET_A1 else goto, RET_B1 
    239252         'XOR': if n1 EQ 0 then goto, RET_B1 else goto, RET_A1 
     
    255268     if kind then begin 
    256269         if count GT 0 then return, b1+n1 else return, -1L 
    257      endif          
     270     endif 
    258271     if count GT 0 then return, b[b1] else return, -1L 
    259272 endif 
     
    294307      ;; String and real types, or large int arrays 
    295308      SLOW_SET_OP: 
    296       case op of  
     309      case op of 
    297310          'OR': begin 
    298311              uu = [a,b]    ;; OR is simple; just take unique values 
     
    394407 
    395408      ;; Compute NOT cases 
    396       if keyword_set(not1) then ha = 1b - ha   
     409      if keyword_set(not1) then ha = 1b - ha 
    397410      if keyword_set(not2) then hb = 1b - hb 
    398       case op of  
     411      case op of 
    399412          ;; Boolean operations 
    400           'AND': mask = temporary(ha) AND temporary(hb)  
     413          'AND': mask = temporary(ha) AND temporary(hb) 
    401414           'OR': mask = temporary(ha)  OR temporary(hb) 
    402415          'XOR': mask = temporary(ha) XOR temporary(hb) 
     
    405418      wh = where(temporary(mask), count) 
    406419      if count EQ 0 then return, -1L 
    407        
     420 
    408421      result = temporary(wh+minn) 
    409422      if tp1 NE tp2 then return, result 
Note: See TracChangeset for help on using the changeset viewer.