VEC_$DOT Domain/OS VEC_$DOT
NAME
vec_$dot - return the dot product of two single-precision vectors
SYNOPSIS (C)
#include <apollo/base.h>
#include <apollo/vec.h>
float vec_$dot(
float *vector1,
float *vector2,
long int &length)
SYNOPSIS (Pascal)
%include '/sys/ins/base.ins.pas';
%include '/sys/ins/vec.ins.pas';
function vec_$dot(
in vector1: univ vec_$real_vector;
in vector2: univ vec_$real_vector;
in length: integer32): real;
SYNOPSIS (FORTRAN)
%include '/sys/ins/base.ins.ftn'
%include '/sys/ins/vec.ins.ftn'
parameter (nvec = 10)
real vector1(nvec), vector2(nvec), result
integer*4 length
result = vec_$dot(vector1, vector2, length)
DESCRIPTION
Vec_$dot returns the dot (scalar) product of two single-precision vec-
tors, vector1 and vector2.
In C, the resulting operation is
return_value = 0.0;
for (i = 0; i < length; ++i)
return_value += vector1[i] * vector2[i];
In Pascal, the resulting operation is
return_value := 0.0;
for i := 1 to length do
begin
return_value := return_value
+ vector1[i] * vector2[i];
end
In FORTRAN, the resulting operation is
vec_$dot = 0.0
do 10 i = 1,length
vec_$dot = vec_$dot + vector1(i) * vector2(i)
10 continue
vector1
A vector.
vector2
Another vector.
length
The number of elements to use in calculating the dot (scalar) pro-
duct.
NOTES
When vec_$dot is used on matrixes in C or Pascal, vector1 and vector2 are
row vectors; whereas in FORTRAN they are column vectors.
SEE ALSO
vec_$ddot, vec_$dot_i, vec_$idot, vec_$idot16.