Table of contents
CSPICE_REMOVI removes an item from a integer set.
Given:
item an item or an N-vector of items which is to be removed from
the specified set.
help, item
LONG = Scalar or LONG = Array[N]
`item' may or may not already be an element of the set.
a a SPICE set.
help, a
STRUCT = cspice_celli(N)
The user must create `a' using cspice_celli.
On input, `a' may or may not contain the input `item'
as an element.
the call:
cspice_removi, items, a
returns:
a on output, contains the difference of input `a' and input
`item'.
help, a
STRUCT = cspice_celli(N)
If the item is not an element of `set', the set is not changed.
None.
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) Create an integer set for ten elements, insert items
to it and then remove the even values.
Example code begins here.
PRO removi_ex1
;;
;; Create a cell for ten elements.
;;
SIZE = 10
a = cspice_celli( SIZE )
;;
;; Now insert a list of items. If the item is
;; an element of the set, the set is not changed.
;;
items = [ 0, 1, 1, 2, 3, 5, 8, 13, 21 ]
cspice_insrti, items, a
;;
;; Output the original contents of `a'. Recall
;; set data begins at `a.base[ a.data + 0 ]'.
;;
print, 'Items in original set A:'
for i=0, cspice_card(a)-1 do begin
print, FORMAT='(I6,$)', a.base[ a.data + i]
endfor
print, ' '
;;
;; Remove the even values. If the item is not an element of
;; the set, the set is not changed.
;;
items = [ 0, 2, 4, 6, 8, 12 ]
cspice_removi, items, a
;;
;; Output the contents of `a'. Recall
;; set data begins at `a.base[ a.data + 0 ]'.
;;
print, 'Odd numbers in set A:'
for i=0, cspice_card(a)-1 do begin
print, FORMAT='(I6,$)', a.base[ a.data + i]
endfor
print, ' '
END
When this program was executed on a Mac/Intel/IDL8.x/64-bit
platform, the output was:
Items in original set A:
0 1 2 3 5 8 13 21
Odd numbers in set A:
1 3 5 13 21
The user must create any needed cell structures with cspice_celld
or cspice_celli prior to use regardless of whether the routine
uses the cell as input or returns it as output.
1) If the input set `a' has invalid cardinality, an error is
signaled by a routine in the call tree of this routine.
2) If the input set `a' has invalid size, an error is signaled by a
routine in the call tree of this routine.
3) The data values in set `a' must be monotone strictly increasing.
This is not checked. If this condition is not met, the results
are unpredictable.
4) If any of the input arguments, `item' or `a', is undefined, an
error is signaled by the IDL error handling system.
5) If any of the input arguments, `item' or `a', is not of the
expected type, or it does not have the expected dimensions and
size, an error is signaled by the Icy interface.
None.
None.
ICY.REQ
CELLS.REQ
SETS.REQ
None.
J. Diaz del Rio (ODC Space)
E.D. Wright (JPL)
-Icy Version 1.1.0, 24-AUG-2021 (JDR)
Added arguments' type and size information in the -I/O section.
Changed the argument name "set" to "a" for consistency with
other routines.
Edited the -Examples section to comply with NAIF standard. Added
example's problem statement and reformatted example's output.
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, 21-FEB-2005 (EDW)
remove an item from an integer set
|