SpiceDouble vdotg_c ( ConstSpiceDouble * v1,
ConstSpiceDouble * v2,
SpiceInt ndim )
Compute the dot product of two vectors of arbitrary dimension.
None.
VECTOR
VARIABLE I/O DESCRIPTION
-------- --- --------------------------------------------------
v1 I First vector in the dot product.
v2 I Second vector in the dot product.
ndim I Dimension of v1 and v2.
The function returns the value of the dot product of v1 and v2.
v1 This may be any double precision vector of arbitrary
dimension.
v2 This may be any double precision vector of arbitrary
dimension.
The function returns the value of the dot product of v1 and v2.
None.
1) If ndim is not physically realistic, greater than zero, a
BADDIMENSION error is signaled. The value 0. is returned.
None.
vdotg_c calculates the dot product of v1 and v2 by a simple
application of the definition. No error checking is
performed to prevent or recover from numeric overflow.
Suppose that given two n-dimensional vectors, we want to change
one of the vectors until the two vectors are perpendicular.
The following code fragment demonstrates the use of vdot_c to do
so.
dot = vdotg_c ( v1, v2, ndim );
while ( dot != 0. )
{
/. change one of the vectors ./
....
dot = vdotg_c ( v1, v2, ndim );
}
The user is responsible for determining that the vectors v1 and
v2 are not so large as to cause numeric overflow. In most cases
this won't present a problem.
None.
W.M. Owen (JPL)
E.D. Wright (JPL)
-CSPICE Version 1.1.0, 22-OCT-1998 (NJB)
Made input vectors const. Converted check-in style to discovery.
-CSPICE Version 1.0.0, 31-MAR-1998 (EDW)
dot product of n-dimensional vectors
Link to routine vdotg_c source file vdotg_c.c
|