Integer type:  int32  int64  nag_int  show int32  show int32  show int64  show int64  show nag_int  show nag_int

Chapter Contents
Chapter Introduction
NAG Toolbox

# NAG Toolbox: nag_blast_isum (f16dl)

## Purpose

nag_blast_isum (f16dl) sums the elements of an integer vector.

## Syntax

[result] = f16dl(n, x, incx)
[result] = nag_blast_isum(n, x, incx)

## Description

nag_blast_isum (f16dl) returns the sum
 x1 + x2 + ⋯ + xn $x1 + x2 + ⋯ + xn$
of the elements of an n$n$-element integer vector x$x$, via the function name.
If n0${\mathbf{n}}\le 0$ on entry, nag_blast_isum (f16dl) immediately returns the value 0$0$.

## References

Basic Linear Algebra Subprograms Technical (BLAST) Forum (2001) Basic Linear Algebra Subprograms Technical (BLAST) Forum Standard University of Tennessee, Knoxville, Tennessee http://www.netlib.org/blas/blast-forum/blas-report.pdf

## Parameters

### Compulsory Input Parameters

1:     n – int64int32nag_int scalar
n$n$, the number of elements in x$x$.
2:     x(1 + (n1) × |incx|$1+\left({\mathbf{n}}-1\right)×|{\mathbf{incx}}|$) – int64int32nag_int array
The vector x$x$. Element xi${x}_{\mathit{i}}$ is stored in x((i1) × |incx| + 1)${\mathbf{x}}\left(\left(\mathit{i}-1\right)×|{\mathbf{incx}}|+1\right)$, for i = 1,2,,n$\mathit{i}=1,2,\dots ,n$.
3:     incx – int64int32nag_int scalar
The increment in the subscripts of x between successive elements of x$x$.
Constraint: incx0${\mathbf{incx}}\ne 0$.

None.

None.

### Output Parameters

1:     result – int64int32nag_int scalar
The result of the function.

## Accuracy

The BLAS standard requires accurate implementations which avoid unnecessary over/underflow (see Section 2.7 of Basic Linear Algebra Subprograms Technical (BLAST) Forum (2001)).

None.

## Example

```function nag_blast_isum_example
n = int64(5);
x = [int64(1);10;11;-2;9];
incx = int64(1);
[result] = nag_blast_isum(n, x, incx)
```
```

result =

29

```
```function f16dl_example
n = int64(5);
x = [int64(1);10;11;-2;9];
incx = int64(1);
[result] = f16dl(n, x, incx)
```
```

result =

29

```