CSPICE_SET compare two sets of any data type given a relational
operator.
For important details concerning this module's function, please refer to
the CSPICE routine set_c.
Given:
a is a scalar Icy set.
op is a scalar string defining the comparison operator,
indicating the way in which the input sets are to be
compared. '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 nonempty.)
"~" a ~ b is true if 'a' and 'b' are disjoint
sets.
b is an Icy set of the same data type as 'a'.
The user must create 'a' and 'b' using either
cspice_celld or cspice_celli.
the call:
boolean = cspice_set( a, op, b )
returns:
The function returns the result of the comparison: 'a' (op) 'b'.
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 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."
IDL outputs:
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.
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.
ICY.REQ
CELLS.REQ
SETS.REQ
Icy Version 1.0.1, 28SEP2006, EDW (JPL)
Corrections to English.
Correct Required Reading citation CELL.REQ to CELLS.REQ.
Icy Version 1.0.0, 22AUG2005, EDW (JPL)
compare sets
