Sum1D

Advanced Analysis Library Only

AnalysisLibErrType Sum1D (double inputArray[], int numberOfElements, double *sum);

Purpose

Finds the sum of the elements of the input array. Sum1D obtains the sum of the elements using the following formula:

Example

/* Generate a random array and sum the elements. */
double x[20], sum;
int n;
n = 20;
Uniform (n, 17, x);
Sum1D (x, n, &sum);

Parameters

Input
Name Type Description
inputArray double-precision array Input array whose elements are summed.
numberOfElements integer Number of elements to sum.
Output
Name Type Description
sum double-precision Sum of elements of the input array.

Return Value

Name Type Description
status AnalysisLibErrType A value that specifies the type of error that occurred. Refer to analysis.h for definitions of these constants.