Index Page
cspice_sdiff
A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X 

Abstract
I/O
Examples
Particulars
Required Reading
Version
Index_Entries

Abstract


   CSPICE_DIFF takes the symmetric difference of two sets of any data type 
   to form a third set.

   For important details concerning this module's function, please refer to
   the CSPICE routine sdiff_c.

I/O

   
   Given:

      a,
      b   scalar Icy sets, each of the same type, double precision
          or integer.
       
          The user must create 'a' and 'b' using either
          cspice_celld, or cspice_celli.

   the call:

      cspice_diff, a, b, c
   
   returns:

      c   is an Icy set, distinct from sets 'a' and 'b' but with
          the same type, containing the difference of 'a' and 'b'
          (that is, all of the elements which are in 'a' or
          'b' but NOT both).
       
          The user must create 'c' using either cspice_celld
          or cspice_celli.

Examples


   Any numerical results shown for this example may differ between
   platforms as the results depend on the SPICE kernels used as input
   and the machine specific arithmetic implementation.

      ;;
      ;; Create three cells with the necessary size.
      ;; Set 'c' need not have a larger size than the
      ;; larger of 'a' or 'b'.
      ;;
      SIZE = 10

      a = cspice_celli( SIZE )
      b = cspice_celli( SIZE )
      c = cspice_celli( SIZE )

      ;;
      ;; Create vectors of integers. It is more efficient to
      ;; load a set from a vector than looping over the
      ;; call, inserting one 'item' per iteration.
      ;;
      ints1 = [ 0, 1, 1, 2, 3, 5, 8, 13 ]
      ints2 = [ 1, 3, 5, 7, 11, 13]

      ;;
      ;; Insert the 'ints1' list into set 'a', 'ints2 '
      ;; into set 'b'.
      ;;
      cspice_insrti, ints1, a
      cspice_insrti, ints2, b
      
      ;;
      ;; Calculate the symmetric difference between sets , 
      ;; 'a' and 'b' return that difference to set 'c'.
      ;;
      cspice_sdiff, a, b, c
      
      ;;
      ;; Output the contents of set 'c'. Recall
      ;; set data begins at 'c.base[ c.data + 0 ]'.
      ;;
      for i=0, cspice_card(c)-1 do begin
         print, c.base[ c.data + i]
      endfor 

   IDL outputs:
   
           0
           2
           7
           8
          11

   The members of 'a' and 'b' not in both 'a' and 'b'.

Particulars

   
  The symmetric difference of two sets contains every element which is
   in the first set OR in the second set, but NOT in both sets.

         {a,b}      sym. difference {c,d}     =  {a,b,c,d} 
         {a,b,c}                    {b,c,d}      {a,d} 
         {a,b,c,d}                  {}           {a,b,c,d} 
         {}                         {a,b,c,d}    {a,b,c,d} 
         {}                         {}           {} 


   The user must create any needed cell structures with cspice_celld,
   cspice_celli prior to use regardless of whether the routine 
   uses the cell as input or returns it as output.
   

Required Reading


   ICY.REQ
   CELLS.REQ
   SETS.REQ

Version


   -Icy Version 1.0.1, 28-SEP-2006, EDW (JPL)

      Corrections to English.
      Correct Required Reading citation CELL.REQ to CELLS.REQ.

   -Icy Version 1.0.0, 21-FEB-2005, EDW (JPL)

Index_Entries

 
   symmetric difference of two sets 
 



Wed Apr  5 17:58:03 2017