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

Table of contents
Abstract
I/O
Parameters
Examples
Particulars
Exceptions
Files
Restrictions
Required_Reading
Literature_References
Author_and_Institution
Version
Index_Entries


Abstract


   CSPICE_SET compares two sets of any data type, as indicated by a
   relational operator.

I/O


   Given:

      a        a SPICE set.

               help, a
                  STRUCT = cspice_celld(N)   or   STRUCT = cspice_celli(N)

               The user must create `a' using either cspice_celld or
               cspice_celli.

      op       a string defining the comparison operator, indicating the way in
               which the input sets are to be compared.

               help, op
                  STRING = Scalar

               `op' may be any of the following:

                  Operator             Meaning
                  --------  ---------------------------------------------
                    "="     a = b is True if `a' and `b' are equal
                            (contain the same elements).

                    "<>"    a <> b is True if `a' and `b' are not
                            equal.

                    "<="    a <= b is True if `a' is a subset of `b'.

                    "<"     a < b is True if `a' is a proper subset
                            of 'b'.

                    ">="    a >= b is True if `b' is a subset of `a'.

                    ">"     a > b is True if `b' is a proper subset
                            of a.

                    "&"     a & b is True if `a' and `b' have one or more
                            elements in common (the intersection of
                            the two sets in non-empty.)

                    "~"     a ~ b is True if `a' and `b' are disjoint
                            sets.


      b        a SPICE set of the same data type as `a'.

               help, b
                  STRUCT = cspice_celli(M)   or   STRUCT = cspice_celli(M)

               The user must create `b' using either cspice_celld or
               cspice_celli.

   the call:

      set = cspice_set( a, op, b )

   returns:

      set      the result of the comparison: `a' (op) `b'.

               help, set
                  BOOLEAN = Scalar

Parameters


   None.

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.

   1) This example demonstrates all possible options to compare two
      sets of integer data values.

      Example code begins here.


      PRO set_ex1

         ;;
         ;; Create the cells...
         ;;
         SIZE = 10

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

         ;;
         ;; ... insert the test data so that
         ;; 'b' = 'c' define strict subsets of 'a'.
         ;;
         cspice_insrti, [ 1l, 2, 3, 4 ], a
         cspice_insrti, [ 1l, 3       ], b
         cspice_insrti, [ 1l, 3       ], c

         ;;
         ;; Evaluations returning TRUE
         ;;
         bval = cspice_set( b, "=",  c )
         if( bval ) then print, "True: b is equal to c"

         bval = cspice_set( a, "<>", c )
         if( bval ) then print, "True: a is not equal to c"

         bval = cspice_set( a, ">",  b )
         if( bval ) then print, "True: a is a proper superset of b"

         bval = cspice_set( b, "<=", c )
         if( bval ) then print, "True: b is a subset of c"

         bval = cspice_set( c, "<=", b )
         if( bval ) then print, "True: c is a subset of b"

         bval = cspice_set( a, "<=", a )
         if( bval ) then print, "True: a is a subset of a"

         bval = cspice_set( a, "&",  b )
         if( bval ) then print, "True: a has elements in common with b."

         bval = cspice_set( b, "&",  c )
         if( bval ) then print, "True: b has elements in common with c."

         print

         ;;
         ;; Evaluations returning FALSE
         ;;
         bval = cspice_set( b, "<>", c )
         if( ~ bval ) then print, "False: b is not equal to c"

         bval = cspice_set( a, "=",  c )
         if( ~ bval ) then print, "False: a is equal to c"

         bval = cspice_set( a, "<",  b )
         if( ~ bval ) then print, "False: a is a proper subset of b"

         bval = cspice_set( b, "<",  c )
         if( ~ bval ) then print, "False: b is a proper subset of c"

         bval = cspice_set( b, ">=", a )
         if( ~ bval ) then print, "False: b is a superset of a"

         bval = cspice_set( a, ">",  a )
         if( ~ bval ) then print, "False: a is a proper superset of a"

         bval = cspice_set( a, "~",  b )
         if( ~ bval ) then print, "False: a and b are disjoint sets."


      END


      When this program was executed on a Mac/Intel/IDL8.x/64-bit
      platform, the output was:


      True: b is equal to c
      True: a is not equal to c
      True: a is a proper superset of b
      True: b is a subset of c
      True: c is a subset of b
      True: a is a subset of a
      True: a has elements in common with b.
      True: b has elements in common with c.

      False: b is not equal to c
      False: a is equal to c
      False: a is a proper subset of b
      False: b is a proper subset of c
      False: b is a superset of a
      False: a is a proper superset of a
      False: a and b are disjoint sets.


Particulars


   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.

Exceptions


   1)  If the set relational operator is not recognized, the error
       SPICE(INVALIDOPERATION) is signaled by a routine in the call
       tree of this routine.

   2)  If the input operator string does not contain at least one
       character, since this input string cannot be converted to a
       Fortran-style string in this case, the error
       SPICE(EMPTYSTRING) is signaled by a routine in the call tree
       of this routine.

   3)  If the input set arguments don't have identical data types,
       the error SPICE(TYPEMISMATCH) is signaled by a routine in the
       call tree of this routine.

   4)  If either of the input set arguments may be unordered or
       contain duplicates, the error SPICE(NOTASET) is signaled by a
       routine in the call tree of this routine.

   5)  If any of the input arguments, `a', `op' or `b', is undefined,
       an error is signaled by the IDL error handling system.

   6)  If any of the input arguments, `a', `op' or `b', is not of the
       expected type, or it does not have the expected dimensions and
       size, an error is signaled by the Icy interface.

Files


   None.

Restrictions


   None.

Required_Reading


   ICY.REQ
   CELLS.REQ
   SETS.REQ

Literature_References


   None.

Author_and_Institution


   J. Diaz del Rio     (ODC Space)
   E.D. Wright         (JPL)

Version


   -Icy Version 1.0.2, 24-AUG-2021 (JDR)

       Added arguments' type and size information in the -I/O section.

       Edited the header to comply with NAIF standard. Added example's
       problem statement.

       Added -Parameters, -Exceptions, -Files, -Restrictions,
       -Literature_References and -Author_and_Institution sections.

       Removed reference to the routine's corresponding CSPICE header from
       -Abstract section.

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

       Corrections to English.
       Correct Required Reading citation cell.req to cells.req.

   -Icy Version 1.0.0, 22-AUG-2005 (EDW)

Index_Entries


   compare sets



Fri Dec 31 18:43:07 2021