VEC_$ISUB16_I Domain/OS VEC_$ISUB16_I
NAME
vec_$isub16_i - subtract 16-bit integer vectors in matrixes
SYNOPSIS (C)
#include <apollo/base.h>
#include <apollo/vec.h>
SYNOPSIS (Pascal)
%include '/sys/ins/base.ins.pas';
%include '/sys/ins/vec.ins.pas';
SYNOPSIS (FORTRAN)
%include '/sys/ins/base.ins.ftn'
%include '/sys/ins/vec.ins.ftn'
parameter (nvec = 10)
integer*2 start_vec(nvec), sub_vec(nvec), result_vec(nvec)
integer*4 length, inc1, inc2, inc3
call vec_$isub16_i(start_vec, inc1, sub_vec, inc2,
& length, result_vec, inc3)
DESCRIPTION
Vec_$isub16_i subtracts length elements of sub_vec selected by inc2 from
length elements of start_vec selected by inc1, and supplies the result in
the elements of result_vec selected by inc3.
Through appropriate choice of inc1, inc2, and inc3, a program can use
vec_$isub16_i to subtract individual vectors in two matrixes and place
the difference in a vector of another matrix. To subtract the Nth vector
in matrix Y from the Mth vector in matrix X, choose inc2 equal to the
number of vectors in matrix Y and inc1 equal to the number of vectors in
matrix X. 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
sub_vec. To place the result of the operation in the Pth vector of a
resultant matrix, choose inc3 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;
l = 0;
for (i = 0; i < length, ++i) {
result_vec[j] = start_vec[k] - sub_vec[l];
j += inc3;
k += inc1;
l += inc2;
}
In Pascal, the resulting operation is
j := 1;
k := 1;
l := 1;
for i := 1 to length do
begin
result_vec[j] := start_vec[k] - sub_vec[l];
j := j + inc3;
k := k + inc1;
l := l + inc2;
end
In FORTRAN, the resulting operation is
j = 1
k = 1
l = 1
do 10 i = 1, length
result_vec(j) = start_vec(k) - sub_vec(l)
j = j + inc3
k = k + inc1
l = l + inc2
10 continue
start_vec
The vector to subtract sub_vec from.
inc1 An increment for the index of start_vec that chooses which elements
the elements of sub_vec will be subtracted from.
sub_vec
The vector to subtract from start_vec.
inc2 An increment for the index of sub_vec that chooses which elements
will be subtracted from the elements of start_vec.
length
The number of scalar differences to calculate.
result_vec
The difference of start_vec and sub_vec.
inc3 An increment for the index of result_vec that chooses which elements
will received the differences.
NOTES
In C and Pascal, vec_$isub16_i operates on column vectors; whereas in
FORTRAN, it operates on row vectors.
SEE ALSO
vec_$dsub_i, vec_$isub16, vec_$isub_i, vec_$sub_i.