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
vminus_c

Table of contents
Procedure
Abstract
Required_Reading
Keywords
Brief_I/O
Detailed_Input
Detailed_Output
Parameters
Exceptions
Files
Particulars
Examples
Restrictions
Literature_References
Author_and_Institution
Version
Index_Entries

Procedure

   vminus_c ( Negate vector, "-v", 3 dimensions ) 

   void vminus_c ( ConstSpiceDouble    v1     [3],
                   SpiceDouble         vout   [3] )

Abstract

   Negate a double precision 3-dimensional vector.

Required_Reading

   None.

Keywords

   VECTOR


Brief_I/O

   VARIABLE  I/O  DESCRIPTION
   --------  ---  --------------------------------------------------
   v1         I   Vector to be negated.
   vout       O   Negated vector -v1.

Detailed_Input

   v1          is any double precision 3-dimensional vector.

Detailed_Output

   vout        is the negation (additive inverse) of `v1'. It is a
               double precision 3-dimensional vector. `vout' may
               overwrite `v1'.

Parameters

   None.

Exceptions

   Error free.

Files

   None.

Particulars

   For each value of the index `i' from 0 to 2, vminus_c negates `v1'
   by the expression:

      vout[i] = -v1[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 `v1' falls outside the common range.
   The likelihood of this occurring is so small as to be of no
   concern.

Examples

   The numerical results shown for this example may differ across
   platforms. The results depend on the SPICE kernels used as
   input, the compiler and supporting libraries, and the machine
   specific arithmetic implementation.

   1) Define a set of 3-dimensional vectors and negate each of them.


      Example code begins here.


      /.
         Program vminus_ex1
      ./
      #include <stdio.h>
      #include "SpiceUsr.h"

      int main( )
      {

         /.
         Local parameters.
         ./
         #define SETSIZ       2

         /.
         Local variables.
         ./
         SpiceDouble          vout   [3];

         SpiceInt             i;

         /.
         Define a set of 3-dimensional vectors.
         ./
         SpiceDouble          v1     [SETSIZ][3] = { { 1.0, -2.0, 0.0 },
                                                     { 0.0,  0.0, 0.0 } };

         /.
         Negate each vector
         ./
         for ( i = 0; i < SETSIZ; i++ )
         {

            vminus_c ( v1[i], vout );

            printf( "Input vector  :  %5.1f %5.1f %5.1f\n",
                               v1[i][0], v1[i][1], v1[i][2] );
            printf( "Negated vector:  %5.1f %5.1f %5.1f\n",
                                  vout[0], vout[1], vout[2] );
            printf( "\n" );

         }

         return ( 0 );
      }


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


      Input vector  :    1.0  -2.0   0.0
      Negated vector:   -1.0   2.0  -0.0

      Input vector  :    0.0   0.0   0.0
      Negated vector:   -0.0  -0.0  -0.0

Restrictions

   None.

Literature_References

   None.

Author_and_Institution

   N.J. Bachman        (JPL)
   J. Diaz del Rio     (ODC Space)
   W.M. Owen           (JPL)
   E.D. Wright         (JPL)

Version

   -CSPICE Version 1.1.1, 01-NOV-2021 (JDR)

       Edited the header to comply with NAIF standard. Added complete
       code example based on existing example.

   -CSPICE Version 1.1.0, 22-OCT-1998 (NJB)

       Made input vector const.

   -CSPICE Version 1.0.0, 08-FEB-1998 (EDW) (WMO)

Index_Entries

   negate a 3-dimensional vector
Fri Dec 31 18:41:15 2021