Changeset 133 for trunk/SRC/Matrix


Ignore:
Timestamp:
07/07/06 11:57:27 (18 years ago)
Author:
navarro
Message:

english and nicer header (1)

Location:
trunk/SRC/Matrix
Files:
3 added
7 moved

Legend:

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

    r132 r133  
     1;; Utility function, adapted from CMPRODUCT 
    12;+ 
    2 ; NAME: 
    3 ;   CMAPPLY 
    4 ; 
    5 ; AUTHOR: 
    6 ;   Craig B. Markwardt, NASA/GSFC Code 662, Greenbelt, MD 20770 
    7 ;   craigm@lheamail.gsfc.nasa.gov 
    8 ; 
    9 ; PURPOSE: 
    10 ;   Applies a function to specified dimensions of an array 
    11 ; 
    12 ; MAJOR TOPICS: 
    13 ;   Arrays 
    14 ; 
    15 ; CALLING SEQUENCE: 
    16 ;   XX = CMAPPLY(OP, ARRAY, DIMS, [/DOUBLE], [TYPE=TYPE]) 
    17 ; 
    18 ; DESCRIPTION: 
    19 ;   CMAPPLY will apply one of a few select functions to specified  
     3; @todo seb 
     4;- 
     5; 
     6function cmapply_product, x 
     7; 
     8  compile_opt idl2, strictarrsubs 
     9; 
     10  sz = size(x) 
     11  n = sz[1] 
     12 
     13  while n GT 1 do begin 
     14      if (n mod 2) EQ 1 then x[0,*] = x[0,*] * x[n-1,*] 
     15      n2 = floor(n/2) 
     16      x = x[0:n2-1,*] * x[n2:*,*] 
     17      n = n2 
     18  endwhile 
     19  return, reform(x[0,*], /overwrite) 
     20end 
     21 
     22;; Utility function, used to collect collaped dimensions 
     23;+ 
     24; @todo seb 
     25;- 
     26; 
     27pro cmapply_redim, newarr, dimapply, dimkeep, nkeep, totcol, totkeep 
     28; 
     29  compile_opt idl2, strictarrsubs 
     30; 
     31  sz = size(newarr) 
     32  ;; First task: rearrange dimensions so that the dimensions 
     33  ;; that are "kept" (ie, uncollapsed) are at the back 
     34  dimkeep = where(histogram(dimapply,min=1,max=sz[0]) ne 1, nkeep) 
     35  if nkeep EQ 0 then return 
     36 
     37  newarr = transpose(temporary(newarr), [dimapply-1, dimkeep]) 
     38  ;; totcol is the total number of collapsed elements 
     39  totcol = sz[dimapply[0]] 
     40  for i = 1, n_elements(dimapply)-1 do totcol = totcol * sz[dimapply[i]] 
     41  totkeep = sz[dimkeep[0]+1] 
     42  for i = 1, n_elements(dimkeep)-1 do totkeep = totkeep * sz[dimkeep[i]+1] 
     43 
     44  ;; this new array has two dimensions: 
     45  ;;   * the first, all elements that will be collapsed 
     46  ;;   * the second, all dimensions that will be preserved 
     47  ;; (the ordering is so that all elements to be collapsed are 
     48  ;;  adjacent in memory) 
     49  newarr = reform(newarr, [totcol, totkeep], /overwrite) 
     50end 
     51 
     52;; Main function 
     53;+ 
     54; 
     55; @file_comments  
     56; Applies a function to specified dimensions of an array 
     57; 
     58;   Description: 
     59; 
     60;      CMAPPLY will apply one of a few select functions to specified  
    2061;   dimensions of an array.  Unlike some IDL functions, you *do* have 
    2162;   a choice of which dimensions that are to be "collapsed" by this 
     
    59100;   elements is large. 
    60101; 
    61 ; 
    62 ; INPUTS: 
    63 ; 
    64 ;   OP - The operation to perform, as a string.  May be upper or lower 
     102; @categories Arrays 
     103; 
     104; @param OP {in}{required} The operation to perform, as a string.  May be upper or lower 
    65105;        case. 
    66106; 
     
    69109;        the user-defined function. 
    70110; 
    71 ;   ARRAY - An array of values to be operated on.  Must not be of type 
     111; @param ARRAY {in}{required} An array of values to be operated on.  Must not be of type 
    72112;           STRING (7) or STRUCTURE (8). 
    73113; 
    74 ; OPTIONAL INPUTS: 
    75 ; 
    76 ;   DIMS - An array of dimensions that are to be "collapsed", where 
     114; @param DIMS {in}{optional}{default=1 (ie, first dimension)}  
     115;          An array of dimensions that are to be "collapsed", where 
    77116;          the the first dimension starts with 1 (ie, same convention 
    78117;          as IDL function TOTAL).  Whereas TOTAL only allows one 
     
    84123;          DEFAULT: 1 (ie, first dimension) 
    85124; 
    86 ; KEYWORDS: 
    87 ; 
    88 ;   DOUBLE - Set this if you wish the internal computations to be done 
     125; @keyword DOUBLE Set this if you wish the internal computations to be done 
    89126;            in double precision if necessary.  If ARRAY is double  
    90127;            precision (real or complex) then DOUBLE=1 is implied. 
    91128;            DEFAULT: not set 
    92129; 
    93 ;   TYPE - Set this to the IDL code of the desired output type (refer 
     130; @keyword TYPE Set this to the IDL code of the desired output type (refer 
    94131;          to documentation of SIZE()).  Internal results will be 
    95132;          rounded to the nearest integer if the output type is an 
     
    97134;          DEFAULT: same is input type 
    98135; 
    99 ;   FUNCTARGS - If OP is 'USER:...', then the contents of this keyword 
     136; @keyword FUNCTARGS If OP is 'USER:...', then the contents of this keyword 
    100137;               are passed to the user function using the _EXTRA 
    101138;               mechanism.  This way you can pass additional data to 
     
    104141;               DEFAULT: undefined (i.e., no keywords passed by _EXTRA) 
    105142; 
    106 ; RETURN VALUE: 
    107 ; 
    108 ;   An array of the required TYPE, whose elements are the result of 
     143; @returns An array of the required TYPE, whose elements are the result of 
    109144;   the requested operation.  Depending on the operation and number of 
    110145;   elements in the input array, the result may be vulnerable to 
    111146;   overflow or underflow. 
    112147; 
    113 ; EXAMPLES: 
    114 ;   Shows how CMAPPLY can be used to total the second dimension of the 
     148; @examples  
     149;    
     150;   First example:  Shows how CMAPPLY can be used to total the second dimension of the 
    115151;   array called IN.  This is equivalent to OUT = TOTAL(IN, 2) 
    116152; 
     
    120156;   OUT             INT       = Array[5] 
    121157; 
    122 ;   Second example.  Input is assumed to be an 5x100 array of 1's and 
     158;   Second example:  Input is assumed to be an 5x100 array of 1's and 
    123159;   0's indicating the status of 5 detectors at 100 points in time. 
    124160;   The desired output is an array of 100 values, indicating whether 
     
    134170;   although there would have been more loop iterations). 
    135171; 
    136 ;   Third example.  Shows sum over first and third dimensions in an 
     172;   Third example:  Shows sum over first and third dimensions in an 
    137173;   array with dimensions 4x4x4: 
    138174; 
     
    142178;        408     472     536     600 
    143179; 
    144 ;   Fourth example. A user-function (MEDIAN) is used: 
     180;   Fourth example: A user-function (MEDIAN) is used: 
    145181; 
    146182;   IDL> IN = RANDOMN(SEED,10,10,5) 
     
    151187;   (OUT[i,j] is the median value of IN[i,j,*]) 
    152188; 
    153 ; MODIFICATION HISTORY: 
    154 ;   Mar 1998, Written, CM 
     189; @history Mar 1998, Written, CM 
    155190;   Changed usage message to not bomb, 24 Mar 2000, CM 
    156191;   Signficant rewrite for *, MIN and MAX (inspired by Todd Clements 
     
    163198;   Correct bug in MAX/MIN initialization of RESULT, CM, 05 Dec 2002 
    164199; 
    165 ;  $Id$ 
     200;  Author: Craig B. Markwardt, NASA/GSFC Code 662, Greenbelt, MD 20770 
     201;  craigm@lheamail.gsfc.nasa.gov 
     202; 
     203; @version $Id$ 
    166204; 
    167205;- 
    168 ; Copyright (C) 1998, 2000, 2002, Craig Markwardt 
    169 ; This software is provided as is without any warranty whatsoever. 
    170 ; Permission to use, copy, modify, and distribute modified or 
    171 ; unmodified copies is granted, provided this copyright and disclaimer 
    172 ; are included unchanged. 
    173 ;- 
    174  
    175 ;; Utility function, adapted from CMPRODUCT 
    176 function cmapply_product, x 
    177 ; 
    178   compile_opt idl2, strictarrsubs 
    179 ; 
    180   sz = size(x) 
    181   n = sz[1] 
    182  
    183   while n GT 1 do begin 
    184       if (n mod 2) EQ 1 then x[0,*] = x[0,*] * x[n-1,*] 
    185       n2 = floor(n/2) 
    186       x = x[0:n2-1,*] * x[n2:*,*] 
    187       n = n2 
    188   endwhile 
    189   return, reform(x[0,*], /overwrite) 
    190 end 
    191  
    192 ;; Utility function, used to collect collaped dimensions 
    193 pro cmapply_redim, newarr, dimapply, dimkeep, nkeep, totcol, totkeep 
    194 ; 
    195   compile_opt idl2, strictarrsubs 
    196 ; 
    197   sz = size(newarr) 
    198   ;; First task: rearrange dimensions so that the dimensions 
    199   ;; that are "kept" (ie, uncollapsed) are at the back 
    200   dimkeep = where(histogram(dimapply,min=1,max=sz[0]) ne 1, nkeep) 
    201   if nkeep EQ 0 then return 
    202  
    203   newarr = transpose(temporary(newarr), [dimapply-1, dimkeep]) 
    204   ;; totcol is the total number of collapsed elements 
    205   totcol = sz[dimapply[0]] 
    206   for i = 1, n_elements(dimapply)-1 do totcol = totcol * sz[dimapply[i]] 
    207   totkeep = sz[dimkeep[0]+1] 
    208   for i = 1, n_elements(dimkeep)-1 do totkeep = totkeep * sz[dimkeep[i]+1] 
    209  
    210   ;; this new array has two dimensions: 
    211   ;;   * the first, all elements that will be collapsed 
    212   ;;   * the second, all dimensions that will be preserved 
    213   ;; (the ordering is so that all elements to be collapsed are 
    214   ;;  adjacent in memory) 
    215   newarr = reform(newarr, [totcol, totkeep], /overwrite) 
    216 end 
    217  
    218 ;; Main function 
    219206function cmapply, op, array, dimapply, double=dbl, type=type, $ 
    220207                  functargs=functargs, nocatch=nocatch 
  • trunk/SRC/Matrix/cmset_op.pro

    r132 r133  
    11;+ 
    2 ; NAME: 
    3 ;   CMSET_OP 
    4 ; 
    5 ; AUTHOR: 
    6 ;   Craig B. Markwardt, NASA/GSFC Code 662, Greenbelt, MD 20770 
    7 ;   craigm@lheamail.gsfc.nasa.gov 
    8 ; 
    9 ; PURPOSE: 
    10 ;   Performs an AND, OR, or XOR operation between two sets 
    11 ; 
    12 ; CALLING SEQUENCE: 
    13 ;   SET      = CMSET_OP(A, OP, B) 
    14 ; 
    15 ; DESCRIPTION:  
    16 ; 
    17 ;   SET_OP performs three common operations between two sets.  The 
     2; @hidden 
     3; 
     4; @todo seb 
     5;- 
     6; 
     7;; Simplified version of CMSET_OP_UNIQ which sorts, and takes the 
     8;; "first" value, whatever that may mean. 
     9function cmset_op_uniq, a 
     10; 
     11  compile_opt idl2, strictarrsubs 
     12; 
     13  if n_elements(a) LE 1 then return, 0L 
     14 
     15  ii = sort(a) & b = a[ii] 
     16  wh = where(b NE shift(b, +1L), ct) 
     17  if ct GT 0 then return, ii[wh] 
     18 
     19  return, 0L 
     20; 
     21end 
     22;+ 
     23; 
     24; @file_comments  
     25; Performs an AND, OR, or XOR operation between two sets 
     26; 
     27;   Description: SET_OP performs three common operations between two sets.  The 
    1828;   three supported functions of OP are: 
    1929; 
     
    5565;   benefit. 
    5666; 
    57 ; INPUTS: 
    58 ; 
    59 ;   A, B - the two sets to be operated on.  A one dimensional array of 
     67; @categories array 
     68; 
     69; @param A {in}{required} The two sets to be operated on.  A one dimensional array of 
    6070;          either numeric or string type.  A and B must be of the same 
    6171;          type.  Empty sets are permitted, and are either represented 
    6272;          as an undefined variable, or by setting EMPTY1 or EMPTY2. 
    6373; 
    64 ;   OP - a string, the operation to be performed.  Must be one of 
     74; @param B {in}{required} See A 
     75; 
     76; @param OP {in}{required} a string, the operation to be performed.  Must be one of 
    6577;        'AND', 'OR' or 'XOR' (lower or mixed case is permitted). 
    6678;        Other operations will cause an error message to be produced. 
    6779; 
    68 ; KEYWORDS: 
    69 ; 
    70 ;   NOT1, NOT2 - if set and OP is 'AND', then the complement of A (for 
     80; @keyword NOT1 If set and OP is 'AND', then the complement of A (for 
    7181;                NOT1) or B (for NOT2) will be used in the operation. 
    7282;                NOT1 and NOT2 cannot be set simultaneously. 
    7383; 
    74 ;   EMPTY1, EMPTY2 - if set, then A (for EMPTY1) or B (for EMPTY2) are 
    75 ;                    assumed to be the empty set.  The actual values 
    76 ;                    passed as A or B are then ignored. 
    77 ; 
    78 ;   INDEX - if set, then return a list of indices instead of the array 
     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 
    7993;           values themselves.  The "slower" set operations are always 
    8094;           performed in this case. 
     
    8599;           from NA to NA+NB-1 refer to B[I-NA]. 
    86100; 
    87 ;   COUNT - upon return, the number of elements in the result set. 
     101; @keyword COUNT upon return, the number of elements in the result set. 
    88102;           This is only important when the result set is the empty 
    89103;           set, in which case COUNT is set to zero. 
    90104; 
    91 ; RETURNS: 
    92 ; 
    93 ;   The resulting set as a one-dimensional array.  The set may be 
     105; @returns The resulting set as a one-dimensional array.  The set may be 
    94106;   represented by either an array of data values (default), or an 
    95107;   array of indices (if INDEX is set).  Duplicate elements, if any, 
     
    104116;   SET_UTILS.PRO by RSI 
    105117; 
    106 ; MODIFICATION HISTORY: 
    107 ;   Written, CM, 23 Feb 2000 
     118; @history Written, CM, 23 Feb 2000 
    108119;   Added empty set capability, CM, 25 Feb 2000 
    109120;   Documentation clarification, CM 02 Mar 2000 
     
    133144;      range of the input variable (thanks to Will Maddox), CM, 16 Jan 2006 
    134145; 
    135 ;  $Id: cmset_op.pro,v 1.6 2006/01/16 19:45:22 craigm Exp $ 
    136 ; 
    137 ;- 
    138 ; Copyright (C) 2000, 2004, 2005, 2006, Craig Markwardt 
    139 ; This software is provided as is without any warranty whatsoever. 
    140 ; Permission to use, copy, modify, and distribute modified or 
    141 ; unmodified copies is granted, provided this copyright and disclaimer 
    142 ; are included unchanged. 
    143 ;- 
    144  
    145 ;; Utility function, similar to UNIQ, but allowing choice of taking 
    146 ;; first or last unique element, or non-unique elements. 
    147 ;; Unfortunately this doesn't work because of implementation dependent 
    148 ;; versions of the SORT() function. 
    149  
     146;   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 
     152; first or last unique element, or non-unique elements. 
     153; Unfortunately this doesn't work because of implementation dependent 
     154; versions of the SORT() function. 
     155; 
    150156; function cmset_op_uniq, a, first=first, non=non, count=ct, sort=sortit 
    151157;   if n_elements(a) LE 1 then return, 0L 
     
    168174; end 
    169175 
    170 ;; Simplified version of CMSET_OP_UNIQ which sorts, and takes the 
    171 ;; "first" value, whatever that may mean. 
    172 function cmset_op_uniq, a 
    173 ; 
    174   compile_opt idl2, strictarrsubs 
    175 ; 
    176   if n_elements(a) LE 1 then return, 0L 
    177  
    178   ii = sort(a) & b = a[ii] 
    179   wh = where(b NE shift(b, +1L), ct) 
    180   if ct GT 0 then return, ii[wh] 
    181  
    182   return, 0L 
    183 end 
     176; Simplified version of CMSET_OP_UNIQ which sorts, and takes the 
     177; "first" value, whatever that may mean. 
     178; 
     179;- 
     180 
    184181 
    185182function cmset_op, a, op0, b, not1=not1, not2=not2, count=count, $ 
  • trunk/SRC/Matrix/congridseb.pro

    r132 r133  
    33;------------------------------------------------------------ 
    44;+ 
    5 ; NAME:CONGRIDSEB 
    6 ; 
    7 ; PURPOSE:meme chose que congrid mais qui marche ... 
    8 ;        cf par ex: 
     5; @file_comment  
     6; Like congrid but here, it works... 
     7;        example: 
    98;IDL> print, congrid([[1,2,3,4],[5,6,7,8]],12,4) 
    109;       1 1 1 2 2 2 3 3 3 3 4 4 
     
    2322;       5 5 5 6 6 6 7 7 7 8 8 8 
    2423; 
    25 ; CATEGORY:bidouille matrices 
     24; @categories utilities 
    2625; 
    27 ; CALLING SEQUENCE:res=congridseb(tableau,x[,y]) 
     26; @param tableau {in}{required} A table 1 ou 2d 
    2827; 
    29 ; INPUTS:tableau:un tableau 1 ou 2d 
    30 ;        x:dim en x du resultat doit etre un multiple de dim en x de tableau 
    31 ;        y:dim en y du resultat doit etre un multiple de dim en y de tableau 
     28; @param x {in}{required} dimension in x of the result which must be  
     29;                         a multiple of the dimension in x of the table. 
    3230; 
    33 ; KEYWORD PARAMETERS: 
     31; @param y {in}{required} dimension in y of the result which must be  
     32;                         a multiple of the dimension in y of the table. 
    3433; 
    35 ; OUTPUTS:res un tableau de dim x * y 
     34; @returns res a table dim x * y 
    3635; 
    37 ; COMMON BLOCKS: 
    38 ; 
    39 ; SIDE EFFECTS: 
    40 ; 
    41 ; RESTRICTIONS: 
    42 ; 
    43 ; EXAMPLE: 
    44 ; 
    45 ; MODIFICATION HISTORY: Sebastien Masson (smasson@lodyc.jussieu.fr) 
     36; @history Sebastien Masson (smasson@lodyc.jussieu.fr) 
    4637;                      20/3/98 
    4738;                      18/6/1999 supression d''une horrible boucle 
     39; 
     40; @version $Id$ 
     41; 
    4842;- 
    4943;------------------------------------------------------------ 
  • trunk/SRC/Matrix/different.pro

    r132 r133  
    33;------------------------------------------------------------ 
    44;+ 
    5 ; NAME:different 
    65; 
    7 ; PURPOSE:calcule les elements differents de 2 matrices D'ENTIERS POSITIFS 
     6; @file_comments  
     7; calculate the different elements of 2 matrix of positif whole numbers. 
    88; 
    9 ; CATEGORY:calcule sur les matrices 
     9; @categories Calculation of matrixes 
    1010; 
    11 ; CALLING SEQUENCE:res=different(a,b) 
    12 ; 
    13 ; INPUTS:a et b:arrays of positive integers, which need 
     11; @param a {in}{required} arrays of positive integers, which need 
    1412;               not be sorted. Duplicate elements are ignored, as they have no 
    1513;               effect on the result 
    1614; 
    17 ; KEYWORD PARAMETERS: 
     15; @param b {in}{required} see a 
    1816; 
    19 ; OUTPUTS:tableau 
     17; @returns tableau 
    2018; 
    21 ; COMMON BLOCKS: 
    22 ; 
    23 ; SIDE EFFECTS: 
    24 ; 
    25 ; The empty set is denoted by an array with the first element equal to 
     19; @restrictions The empty set is denoted by an array with the first element equal to 
    2620; -1. 
    2721; 
    28 ; RESTRICTIONS: 
    29 ; 
    30 ; These functions will not be efficient on sparse sets with wide 
     22; @restrictions These functions will not be efficient on sparse sets with wide 
    3123; ranges, as they trade memory for efficiency. The HISTOGRAM function 
    3224; is used, which creates arrays of size equal to the range of the 
    3325; resulting set. 
    3426; 
    35 ; EXAMPLE: 
     27; @examples 
    3628; 
    3729;   a = [2,4,6,8] 
     
    3931;   different(a,b) = [ 4, 8]         ; Elements in A but not in B 
    4032; 
    41 ; MODIFICATION HISTORY:  
     33; @history http://www.dfanning.com/tips/set_operations.html 
    4234; 
    43 ; http://www.dfanning.com/tips/set_operations.html 
     35; @version $Id$ 
     36; 
    4437;- 
    4538;------------------------------------------------------------ 
  • trunk/SRC/Matrix/inter.pro

    r132 r133  
    33;------------------------------------------------------------ 
    44;+ 
    5 ; NAME:inter 
    65; 
    7 ; PURPOSE:calcule l''intersection de 2 matrices D'ENTIERS POSITIFS 
     6; @file_comments  
     7; calculate the intersection between 2 matrixes of whole numbers 
    88; 
    9 ; CATEGORY:calcule sur les matrices 
     9; @categories calculation of matrixes 
    1010; 
    11 ; CALLING SEQUENCE:res=inter(a,b) 
    12 ; 
    13 ; INPUTS:a et b:arrays of positive integers, which need not to be 
     11; @param a {in}{required} arrays of positive integers, which need not to be 
    1412; sorted. Duplicate elements are ignored, as they have noeffect on the 
    1513; result 
    1614; 
    17 ; KEYWORD PARAMETERS: 
     15; @param b {in}{required} see a 
    1816; 
    19 ; OUTPUTS:tableau 
     17; @returns tableau 
    2018; 
    21 ; COMMON BLOCKS: 
    22 ; 
    23 ; SIDE EFFECTS: 
    24 ; 
    25 ; The empty set is denoted by an array with the first element equal to 
     19; @restrictions The empty set is denoted by an array with the first element equal to 
    2620; -1. 
    2721; 
    28 ; RESTRICTIONS: 
    29 ; 
    30 ; These functions will not be efficient on sparse sets with wide 
     22; @restrictions These functions will not be efficient on sparse sets with wide 
    3123; ranges, as they trade memory for efficiency. The HISTOGRAM function 
    3224; is used, which creates arrays of size equal to the range of the 
    3325; resulting set. 
    3426; 
    35 ; EXAMPLE: 
     27; @examples  a = [2,4,6,8] 
     28;   b = [6,1,3,2] 
     29;   inter(a,b) = [ 2, 6]       ; Common elements  
    3630; 
    37 ;   a = [2,4,6,8] 
    38 ;   b = [6,1,3,2] 
    39 ;   inter(a,b) = [ 2, 6]       ; Common elements 
     31; @history  http://www.dfanning.com/tips/set_operations.html 
    4032; 
    41 ; MODIFICATION HISTORY:  
     33; @version $Id$ 
    4234; 
    43 ; http://www.dfanning.com/tips/set_operations.html 
    4435;- 
    4536;------------------------------------------------------------ 
  • trunk/SRC/Matrix/make_selection.pro

    r132 r133  
    1 ; $Id$ 
    2 ;------------------------------------------------------------- 
    31;+ 
    4 ; NAME: 
    5 ;        MAKE_SELECTION (function) 
    62; 
    7 ; PURPOSE: 
    8 ;        Convert an array of selected values to an index 
     3; file_comments  
     4; Convert an array of selected values to an index 
    95;        array that identifies the selected values in a list 
    106;        or data array.  
    117; 
    12 ; CATEGORY: 
    13 ;        Tools 
     8; categories tools 
     9;  
     10; @param NAMES {in}{required} A list or array of values to choose from  
    1411; 
    15 ; CALLING SEQUENCE: 
    16 ;        index = MAKE_SELECTION(NAMES,SELNAMES [,keywords]) 
     12; @param SELNAMES {in}{required} A list of selected values 
    1713; 
    18 ; INPUTS: 
    19 ;        NAMES -> A list or array of values to choose from  
    20 ; 
    21 ;        SELNAMES -> A list of selected values 
    22 ; 
    23 ; KEYWORD PARAMETERS: 
    24 ;        ONLY_VALID -> Return only indices of found values. Values not 
     14; @keyword ONLY_VALID Return only indices of found values. Values not 
    2515;            found are skipped. Default is to return 1 index value for 
    2616;            each SELNAME, which is -1 if SELNAME is not contained in  
     
    2919;            at all. 
    3020; 
    31 ;        REQUIRED -> Normally, MAKE_SELECTION will return indices for 
     21; @keyword REQUIRED Normally, MAKE_SELECTION will return indices for 
    3222;            all values that are found, simply ignoring the selected 
    3323;            values that are not in the NAMES array (although an error 
     
    3525;            -1 as soon as a selected value is not found. 
    3626; 
    37 ;        QUIET -> Suppress printing of the error message if a 
     27; @keyword QUIET Suppress printing of the error message if a 
    3828;            selected value is not found (the error condition will 
    3929;            still be set). 
    4030; 
    41 ; OUTPUTS: 
    42 ;        A (long) array with indices to reference the selected values 
     31; @returns A (long) array with indices to reference the selected values 
    4332;        in the NAMES array. 
    4433; 
    45 ; SUBROUTINES: 
    46 ; 
    47 ; REQUIREMENTS: 
    48 ; 
    49 ; NOTES: 
    50 ;        If the NAMES array contains multiple entries of the same value, 
     34; @restrictions If the NAMES array contains multiple entries of the same value, 
    5135;        only the index to the first entry will be returned. 
    5236; 
     
    5539;        (See example below) 
    5640; 
    57 ; EXAMPLE: 
    58 ;        names = [ 'Alfred','Anton','Peter','John','Mary'] 
    59 ;        index = MAKE_SELECTION(names,['Peter','Mary']) 
    60 ;        print,index 
    61 ;        ; prints  2  4 
     41; @examples names = [ 'Alfred','Anton','Peter','John','Mary'] 
     42;           index = MAKE_SELECTION(names,['Peter','Mary']) 
     43;           print,index 
     44;           ; prints  2  4 
    6245; 
    63 ;        vals = indgen(20) 
    64 ;        index = MAKE_SELECTION(vals,[9,-5,8,7,7,8,9]) 
    65 ;        print,index 
    66 ;        ; prints  9  -1  8  7  7  8  9 
     46;           vals = indgen(20) 
     47;           index = MAKE_SELECTION(vals,[9,-5,8,7,7,8,9]) 
     48;           print,index 
     49;           ; prints  9  -1  8  7  7  8  9 
    6750; 
    68 ;        index = MAKE_SELECTION(vals,[9,-5,8,7,7,8,9],/ONLY_VALID) 
    69 ;        print,index 
    70 ;        ; prints  9  8  7  7  8  9 
     51;           index = MAKE_SELECTION(vals,[9,-5,8,7,7,8,9],/ONLY_VALID) 
     52;           print,index 
     53;           ; prints  9  8  7  7  8  9 
    7154; 
    72 ;        index = MAKE_SELECTION(vals,[9,-5,8,7,7,8,9],/REQUIRED) 
    73 ;        print,index 
    74 ;        ; prints  -1 
     55;           index = MAKE_SELECTION(vals,[9,-5,8,7,7,8,9],/REQUIRED) 
     56;           print,index 
     57;           ; prints  -1 
    7558; 
     59; @history mgs, 28 Aug 1998: VERSION 1.00 
     60;          mgs, 29 Aug 1998: - changed behaviour and added ONLY_VALID keyword 
    7661; 
    77 ; MODIFICATION HISTORY: 
    78 ;        mgs, 28 Aug 1998: VERSION 1.00 
    79 ;        mgs, 29 Aug 1998: - changed behaviour and added ONLY_VALID keyword 
     62; @version $Id$ 
    8063; 
    8164;- 
  • trunk/SRC/Matrix/union.pro

    r132 r133  
    33;------------------------------------------------------------ 
    44;+ 
    5 ; NAME:union 
    65; 
    7 ; PURPOSE:calcule l''union de 2 matrices D'ENTIERS POSITIFS 
     6; @file_comments  
     7; calculate tne union between 2 matrixes of whole numbers 
    88; 
    9 ; CATEGORY:calcule sur les matrices 
     9; @categories calculation of matrixes 
    1010; 
    11 ; CALLING SEQUENCE:res=union(a,b) 
    12 ; 
    13 ; INPUTS:a et b:arrays of positive integers, which need 
     11; @param a {in}{required} arrays of positive integers, which need 
    1412;               not be sorted. Duplicate elements are ignored, as they have no 
    1513;               effect on the result 
    1614; 
    17 ; KEYWORD PARAMETERS: 
     15; @param b {in}{required} see a 
    1816; 
    19 ; OUTPUTS:tableau 
     17; @returns tableau 
    2018; 
    21 ; COMMON BLOCKS: 
    22 ; 
    23 ; SIDE EFFECTS: 
    24 ; 
    25 ; The empty set is denoted by an array with the first element equal to 
     19; @restrictions The empty set is denoted by an array with the first element equal to 
    2620; -1. 
    2721; 
    28 ; RESTRICTIONS: 
    29 ; 
    30 ; These functions will not be efficient on sparse sets with wide 
     22; @restrictions These functions will not be efficient on sparse sets with wide 
    3123; ranges, as they trade memory for efficiency. The HISTOGRAM function 
    3224; is used, which creates arrays of size equal to the range of the 
    3325; resulting set. 
    3426; 
    35 ; EXAMPLE: 
     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 
    3630; 
    37 ;   a = [2,4,6,8] 
    38 ;   b = [6,1,3,2] 
    39 ;   union(a,b) = [ 1, 2, 3, 4, 6, 8]  ; Elements in either set 
     31; @history  http://www.dfanning.com/tips/set_operations.html 
    4032; 
    41 ; MODIFICATION HISTORY:  
     33; @version $Id$ 
    4234; 
    43 ; http://www.dfanning.com/tips/set_operations.html 
    4435;- 
    4536;------------------------------------------------------------ 
Note: See TracChangeset for help on using the changeset viewer.