1 /*
2 
3 -Procedure vsclg_c ( Vector scaling, general dimension )
4 
5 -Abstract
6 
7    Multiply a scalar and a double precision vector of arbitrary
8    dimension.
9 
10 -Disclaimer
11 
12    THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE
13    CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S.
14    GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE
15    ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE
16    PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS"
17    TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY
18    WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A
19    PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC
20    SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE
21    SOFTWARE AND RELATED MATERIALS, HOWEVER USED.
22 
23    IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA
24    BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT
25    LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND,
26    INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS,
27    REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE
28    REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY.
29 
30    RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF
31    THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY
32    CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE
33    ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE.
34 
35 -Required_Reading
36 
37    None.
38 
39 -Keywords
40 
41    VECTOR
42 
43 */
44 
45    #include "SpiceUsr.h"
46    #undef    vsclg_c
47 
48 
vsclg_c(SpiceDouble s,ConstSpiceDouble * v1,SpiceInt ndim,SpiceDouble * vout)49    void vsclg_c ( SpiceDouble          s,
50                   ConstSpiceDouble   * v1,
51                   SpiceInt             ndim,
52                   SpiceDouble        * vout )
53 /*
54 
55 -Brief_I/O
56 
57    VARIABLE  I/O  DESCRIPTION
58    --------  ---  --------------------------------------------------
59    s          I     Scalar to multiply a vector.
60    v1         I     Vector to be multiplied.
61    ndim       I     Dimension of v1 (and also vout).
62    vout       O     Product vector, s*v1. vout can overwrite v1.
63 
64 -Detailed_Input
65 
66    s      is a double precision scalar.
67 
68    v1     is a double precision vector of arbitrary dimension.
69 
70    ndim   is the dimension of v1 (and vout).
71 
72 -Detailed_Output
73 
74    vout   is a double precision vector of arbitrary dimension
75           containing the product of the scalar with the vector v1.
76           vout may overwrite v1.
77 
78 -Parameters
79 
80    None.
81 
82 -Exceptions
83 
84    Error free.
85 
86 -Particulars
87 
88    For each value of the index i from 0 to ndim-1, this subroutine
89    performs the following multiplication
90 
91       vout[i] = s * v1[i];
92 
93    No error checking is performed to guard against numeric overflow
94    or underflow.  vout may overwrite v1.
95 
96 -Examples
97 
98    The following table shows the results of vsclg_c from various
99    inputs.
100 
101    v1                 s           ndim        vout
102    -----------------------------------------------------------------
103    (1, 2, -3, 4)      3            4         ( 3,  6, -9, 12)
104    (1, 2, -3, 4)      0            4         ( 0,  0,  0,  0)
105    (1, 2, -3, 4)     -1            4         (-3, -6,  9,-12)
106 
107 -Restrictions
108 
109    No error checking is performed to guard against numeric overflow.
110    The programmer is thus required to insure that the values in v1
111    and s are reasonable and will not cause overflow.
112 
113 -Files
114 
115    None.
116 
117 -Author_and_Institution
118 
119    W.M. Owen       (JPL)
120 
121 -Literature_References
122 
123    None.
124 
125 -Version
126 
127    -CSPICE Version 1.1.0, 22-OCT-1998 (NJB)
128 
129       Made input vector const.  Removed #includes of SpiceZfc.h and
130       SpiceZst.h.
131 
132   -CSPICE Version 1.0.0, 13-JUL-1998 (NJB) (WMO)
133 
134 -Index_Entries
135 
136    n-dimensional vector scaling
137 
138 -&
139 */
140 
141 { /* Begin vsclg_c */
142 
143 
144    /*
145    Local variables
146    */
147 
148    SpiceInt                i;
149 
150 
151    for ( i = 0;  i < ndim;  i++ )
152    {
153       vout[i] = s * v1[i];
154    }
155 
156 
157 } /* End vsclg_c */
158