- Abstract
Compute a vector linear combination of two double precision
vectors of arbitrary dimension.
- Required_Reading
None.
- Brief_I/O
VARIABLE I/O DESCRIPTION
-------- --- --------------------------------------------------
n I Dimension of vector space
a I Coefficient of v1
v1 I Vector in n-space
b I Coefficient of v2
v2 I Vector in n-space
sum O Linear Vector Combination a*v1 + b*v2
- Detailed_Input
n This variable contains the dimension of the v1, v2 and sum.
a This double precision variable multiplies v1.
v1 This is an arbitrary, double precision n-dimensional vector.
b This double precision variable multiplies v2.
v2 This is an arbitrary, double precision n-dimensional vector.
- Detailed_Output
sum is an arbitrary, double precision n-dimensional vector
which contains the linear combination a*v1 + b*v2.
- Parameters
None.
- Particulars
For each index from 1 to n, this routine implements in C
code the expression:
sum[i] = a*v1[i] + b*v2[i]
No error checking is performed to guard against numeric overflow.
- Examples
We can easily use this routine to perform vector projections
to 2-planes in n-space. Let x be an arbitray n-vector
and let u and v be orthonormal n-vectors spanning the plane
of interest. The projection of x onto this 2-plane, projuv can
be obtained by the following code fragment.
vlcomg_c ( n, vdot_c(x,u,n), u, vdot_c(x,v,n), v, projuv );
- Restrictions
No error checking is performed to guard against numeric overflow
or underflow. The user is responsible for insuring that the
input values are reasonable.
- Exceptions
Error free.
- Files
None
- Author_and_Institution
W.L. Taber (JPL)
- Literature_References
None
- Version
-CSPICE Version 1.0.0, 30-JUN-1999
- Index_Entries
linear combination of two n-dimensional vectors
- Link to routine source