VEC_$IADD_VECTOR16_I Domain/OS VEC_$IADD_VECTOR16_I
NAME
vec_$iadd_vector16_i - add vectors in two 16-bit integer matrixes
SYNOPSIS (C)
#include <apollo/base.h>
#include <apollo/vec.h>
void vec_$iadd_vector16_i(
short *start_vec,
long int &inc1,
short *add_vec,
long int &inc2,
long int &length,
short *result_vec,
long int &inc3)
SYNOPSIS (Pascal)
%include '/sys/ins/base.ins.pas';
%include '/sys/ins/vec.ins.pas';
procedure vec_$iadd_vector16_i(
in start_vec: univ vec_$integer16_vector;
in inc1: integer32;
in add_vec: univ vec_$integer16_vector;
in inc2: integer32;
in length: integer32;
out result_vec: univ vec_$integer16_vector;
in inc3: integer32);
SYNOPSIS (FORTRAN)
%include '/sys/ins/base.ins.ftn'
%include '/sys/ins/vec.ins.ftn'
parameter (nvec = 10)
integer*2 start_vec(nvec), add_vec(nvec), result_vec(nvec)
integer*4 length, inc1, inc2, inc3
call vec_$iadd_vector16_i(start_vec, inc1, add_vec, inc2,
& length, result_vec, inc3)
DESCRIPTION
Vec_$iadd_vector16_i adds elements of the array start_vec, selected by
inc1, to elements of the array add_vec, selected by inc1, and puts the
sums in elements of the array result_vec selected by inc3.
Through appropriate choice of inc1, inc2, and inc3, a program can use
vec_$iadd_vector16_i to add individual vectors in two matrixes and place
the sum in a vector of another matrix. To add the Mth vector in matrix X
to the Nth vector in matrix Y, choose inc1 equal to the number of vectors
in matrix X and inc2 equal to the number of vectors in matrix Y. Then
place the Mth element of matrix X at the beginning of start_vec, and
place the Nth element of matrix Y at the beginning of add_vec. To place
the result of the operation in the Pth vector of a resultant matrix,
choose inc2 equal to the number of vectors in the resultant matrix, and
place the Pth element of the matrix array at the beginning of result_vec.
In C, the resulting operation is
j = 0;
k = 0;
m = 0;
for (i = 0; i < length; ++i) {
result_vec[j] = start_vec[k] + add_vec[m];
j += inc3;
k += inc1;
m += inc2;
}
In Pascal, the resulting operation is
j := 1;
k := 1;
m := 1;
for i := 1 to length do
begin
result_vec[j] := start_vec[k] + add_vec[m];
j := j + inc3;
k := k + inc1;
m := m + inc2;
end
In FORTRAN, the resulting operation is
j = 1
k = 1
m = 1
do 10 i = 1, length
result_vec(j) = start_vec(k) + add_vec(m)
j = j + inc3
k = k + inc1
m = m + inc2
10 continue
start_vec
An array whose elements will be summed with elements of add_vec.
inc1 Increment for the index of start_vec used to select the elements of
start_vec that will be summed with elements of add_vec.
add_vec
An array whose elements will be summed with elements of start_vec.
inc2 Increment for the index of add_vec used to select the elements of
add_vec that will be summed with elements of start_vec.
length
The number of elements in start_vec that will be summed with ele-
ments of add_vec.
result_vec
An array to contain the length sums of elements of start_vec and
add_vec.
inc3 Increment for the index of result_vec used to select the elements of
result_vec that will receive the sums.
NOTES
In C and Pascal, vec_$iadd_vector16_i operates on column vectors; whereas
in FORTRAN, it operates on row vectors.
SEE ALSO
vec_$add_vector, vec_$dadd_vector_i, vec_$iadd_vector_i.