VEC_$DSUM Domain/OS VEC_$DSUM
NAME
vec_$dsum - sum the elements of a double-precision vector
SYNOPSIS (C)
#include <apollo/base.h>
#include <apollo/vec.h>
double vec_$dsum(
double *vec,
long int &length)
SYNOPSIS (Pascal)
%include '/sys/ins/base.ins.pas';
%include '/sys/ins/vec.ins.pas';
function vec_$dsum(
in vec: univ vec_$double_vector;
in length: integer32): double;
SYNOPSIS (FORTRAN)
%include '/sys/ins/base.ins.ftn'
%include '/sys/ins/vec.ins.ftn'
parameter (nvec = 10)
double precision vec(nvec), sum
integer*4 length
sum = vec_$dsum(vec, length)
DESCRIPTION
Vec_$dsum adds together length elements of the double-precision array
vector and returns the sum.
In C, the resulting operation is
return_value = 0.0;
for (i = 0; i < length; ++i)
return_value += vec[i];
In Pascal, the resulting operation is
return_value := 0.0;
for i := 1 to length do
return_value := return_value + vec[i];
In FORTRAN, the resulting operation is
vec_$dsum = 0.0
do 10 i = 1, length
vec_$dsum = vec_$dsum + vec(i)
10 continue
vec The vector to sum.
length
The number of elements in vec to sum.
NOTES
When vec_$dsum 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_i, vec_$isum, vec_$isum16, vec_$sum.