Table of contents
CSPICE_VMINUG negates a double precision vector of arbitrary dimension.
Given:
vin any double precision vector of arbitrary size.
help, vin
DOUBLE = Array[N]
the call:
cspice_vminug, vin, vout
returns:
vout a n-dimensional double precision vector which contains the
negation of `vin'.
help, vout
DOUBLE = Array[N]
`vout' may overwrite `vin'.
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) Define a set of n-dimensional vectors and negate each of them.
Example code begins here.
PRO vminug_ex1
;;
;; Local parameters.
;;
SETSIZ = 2L
;;
;; Define a set of n-dimensional vectors.
;;
vin = [ [ -10.D0, 15.D0, -5.D0, 20.D0 ], $
[ 0.D0, 0.D0, 0.D0, 0.D0 ] ]
;;
;; Negate each vector
;;
for i=0L, SETSIZ-1L do begin
cspice_vminug, vin[*,i], vout
print, format='(A,4F7.1)', 'Input vector : ', vin[*,i]
print, format='(A,4F7.1)', 'Negated vector: ', vout
print
endfor
END
When this program was executed on a Mac/Intel/IDL8.x/64-bit
platform, the output was:
Input vector : -10.0 15.0 -5.0 20.0
Negated vector: 10.0 -15.0 5.0 -20.0
Input vector : 0.0 0.0 0.0 0.0
Negated vector: -0.0 -0.0 -0.0 -0.0
For each value of the index `i' from 0 to NDIM-1, where NDIM is the
dimension of `vin', cspice_vminug negates `vin' by the expression:
vout[i] = -vin[i]
No error checking is performed since overflow can occur ONLY if
the dynamic range of positive floating point numbers is not the
same size as the dynamic range of negative floating point numbers
AND at least one component of `vin' falls outside the common range.
The likelihood of this occurring is so small as to be of no
concern.
The IDL native code to perform the same operation:
vout = -vin
1) If the input argument `vin' is undefined, an error is signaled
by the IDL error handling system.
2) If the input argument `vin' is not of the expected type, or it
does not have the expected dimensions and size, an error is
signaled by the Icy interface.
3) If the output argument `vout' is not a named variable, an
error is signaled by the Icy interface.
None.
None.
ICY.REQ
None.
J. Diaz del Rio (ODC Space)
E.D. Wright (JPL)
-Icy Version 1.0.2, 10-AUG-2021 (JDR)
Edited the header to comply with NAIF standard. Added complete
code example.
Added -Parameters, -Exceptions, -Files, -Restrictions,
-Literature_References and -Author_and_Institution sections, and
completed -Particulars section. Moved the existing contents of -Examples
section to -Particulars.
Removed reference to the routine's corresponding CSPICE header from
-Abstract section.
Added arguments' type and size information in the -I/O section.
-Icy Version 1.0.1, 09-DEC-2005 (EDW)
Added -Examples section.
-Icy Version 1.0.0, 16-JUN-2003 (EDW)
negate an n-dimensional vector
|