Table of contents
CSPICE_VSCL multiplies a scalar and a double precision 3-dimensional
vector.
Given:
s a double precision scalar used to multiply the vector `v1'.
help, s
DOUBLE = Scalar
v1 a double precision 3-dimensional vector, which is to be scaled
by `s'.
help, v1
DOUBLE = Array[3]
the call:
cspice_vscl, s, v1, vout
returns:
vout a double precision 3-dimensional vector containing the product
of the scalar with the vector `v1'.
help, vout
DOUBLE = Array[3]
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 sets of scalar double precision values and use them
to scale a given 3-dimensional vector.
Example code begins here.
PRO vscl_ex1
;;
;; Local parameters.
;;
SETSIZ = 3L
;;
;; Define the set of scalars and the input vector.
;;
s = [3.D0, 0.D0, -1.D0]
v1 = [1.D0, 2.D0, -3.D0]
print, format='(A,3F6.1)', 'Input vector : ', v1
print
;;
;; Calculate product of each scalar and `v1'.
;;
for i=0L, SETSIZ-1L do begin
cspice_vscl, s[i], v1, vout
print, format='(A,F6.1)', 'Scale factor : ', s[i]
print, format='(A,3F6.1)', 'Output vector: ', vout
print
endfor
END
When this program was executed on a Mac/Intel/IDL8.x/64-bit
platform, the output was:
Input vector : 1.0 2.0 -3.0
Scale factor : 3.0
Output vector: 3.0 6.0 -9.0
Scale factor : 0.0
Output vector: 0.0 0.0 -0.0
Scale factor : -1.0
Output vector: -1.0 -2.0 3.0
For each value of the index `i' from 0 to 2, this procedure
performs the following multiplication
vout[i] = s * v1[i]
No error checking is performed to guard against numeric overflow
or underflow.
Native IDL code to calculate the same vector result:
vout = s * v1
The IDL functionality accepts arbitrary sized N vectors.
1) If any of the input arguments, `s' or `v1', is undefined, an
error is signaled by the IDL error handling system.
2) If any of the input arguments, `s' or `v1', 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.
1) The user is responsible for insuring that no floating point
overflow occurs from multiplying `s' by any component of `v1'. No
error recovery or reporting scheme is incorporated in this
routine.
ICY.REQ
None.
J. Diaz del Rio (ODC Space)
E.D. Wright (JPL)
-Icy Version 1.0.4, 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.
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.3, 13-JUN-2011 (EDW)
Edits to comply with NAIF standard for Icy headers.
-Icy Version 1.0.2, 09-DEC-2005 (EDW)
Added -Examples section.
-Icy Version 1.0.1, 19-MAY-2005 (EDW)
Corrected typo in the function description. Miscoded the call
description in -I/O as a FORTRAN call, not an IDL call.
-Icy Version 1.0.0, 16-JUN-2003 (EDW)
3-dimensional vector scaling
|