VEC_$DOT_I Domain/OS VEC_$DOT_I
NAME
vec_$dot_i - return the dot product of two vectors in single-precision
matrixes
SYNOPSIS (C)
#include <apollo/base.h>
#include <apollo/vec.h>
float vec_$dot_i(
float *vector1,
long int &inc1,
float *vector2,
long int &inc2,
long int &length)
SYNOPSIS (Pascal)
%include '/sys/ins/base.ins.pas';
%include '/sys/ins/vec.ins.pas';
function vec_$dot_i(
in vector1: univ vec_$real_vector;
in inc1: integer32;
in vector2: univ vec_$real_vector;
in inc2: integer32;
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, inc1, inc2
result = vec_$dot_i(vector1, inc1, vector2, inc2, length)
DESCRIPTION
Vec_$dot_i returns the dot (scalar) product of two vectors from the
single-precision arrays vector1 and vector2.
In C, the resulting operation is
j = 0;
k = 0;
return_value = 0.0;
for (i = 0; i < length; ++i) {
return_value += vector1[j] * vector2[k];
j += inc1;
k += inc2;
}
In Pascal, the resulting operation is
j := 1;
k := 1;
return_value := 0.0;
for i := 1 to length do
begin
return_value := return_value
+ vector1[j] * vector2[k];
j := j + inc1;
k := k + inc2;
end;
In FORTRAN, the resulting operation is
j = 1
k = 1
vec_$dot_i = 0.0
do 10 i = 1,length
vec_$dot_i = vec_$dot_i
& + vector1(j) * vector2(k)
j = j + inc1
k = k + inc2
10 continue
vector1
An array containing one of the vectors to use in calculating the dot
product.
inc1 An increment for vector1 that chooses which elements will be used to
calculate the product.
vector2
An array containing the other vector to use in calculating the dot
product.
inc2 An increment for vector2 that chooses which elements will be used to
calculate the product.
length
The number of elements from vector1 or vector2 to use in calculating
the dot product.
NOTES
When vec_$dot_i is used on matrixes in C or Pascal, vector1 and vector2
are column vectors; whereas in FORTRAN, they are row vectors.
SEE ALSO
vec_$ddot_i, vec_$dot, vec_$idot16_i, vec_$idot_i.