VEC_$SUB_I Domain/OS VEC_$SUB_I
NAME
vec_$sub_i - subtract single-precision vectors in matrixes
SYNOPSIS (C)
#include <apollo/base.h>
#include <apollo/vec.h>
void vec_$sub_i(
float *start_vec,
long int &inc1,
float *sub_vec,
long int &inc2,
long int &length,
float *result_vec,
long int &inc3)
SYNOPSIS (Pascal)
%include '/sys/ins/base.ins.pas';
%include '/sys/ins/vec.ins.pas';
procedure vec_$sub_i(
in start_vec: univ vec_$real_vector;
in inc1: integer32;
in sub_vec: univ vec_$real_vector;
in inc2: integer32;
in length: integer32;
out result_vec: univ vec_$real_vector;
in inc3: integer32);
SYNOPSIS (FORTRAN)
%include '/sys/ins/base.ins.ftn'
%include '/sys/ins/vec.ins.ftn'
parameter (nvec = 10)
real start_vec(nvec), sub_vec(nvec), result_vec(nvec)
integer*4 length, inc1, inc2, inc3
call vec_$sub_i(start_vec, inc1, sub_vec, inc2,
& length, result_vec, inc3)
DESCRIPTION
Vec_$sub_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_$sub_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_$sub_i operates on column vectors; whereas in FOR-
TRAN, it operates on row vectors.
SEE ALSO
vec_$dsub_i, vec_$isub16_i, vec_$isub_i, vec_$sub.