VEC_$ISUM Domain/OS VEC_$ISUM
NAME
vec_$isum - sum the elements of a 32-bit integer vector
SYNOPSIS (C)
#include <apollo/base.h>
#include <apollo/vec.h>
long vec_$isum(
long *vec,
long int &length)
SYNOPSIS (Pascal)
%include '/sys/ins/base.ins.pas';
%include '/sys/ins/vec.ins.pas';
function vec_$isum(
in vec: univ vec_$integer32_vector;
in length: integer32): integer32
SYNOPSIS (FORTRAN)
%include '/sys/ins/base.ins.ftn'
%include '/sys/ins/vec.ins.ftn'
parameter (nvec = 10)
integer*4 vec(nvec), sum
integer*4 length
sum = vec_$isum(vec, length)
DESCRIPTION
Vec_$isum adds together length elements of the 32-bit integer array vec-
tor and returns the sum.
In C, the resulting operation is
return_value = 0;
for (i = 0; i < length; ++i)
return_value += vec[i];
In Pascal, the resulting operation is
return_value := 0;
for i := 1 to length do
return_value := return_value + vec[i];
In FORTRAN, the resulting operation is
vec_$isum = 0
do 10 i = 1, length
vec_$isum = vec_$isum + vec(i)
10 continue
vec The vector to sum.
length
The number of elements in vec to sum.
NOTES
When vec_$isum is used to operate on matrixes in C and Pascal, vec is a
row vector; whereas in FORTRAN, it is a column vector.
SEE ALSO
vec_$dsum, vec_$isum16, vec_$isum_i, vec_$sum.