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_dmax_val (f16jn)

## Purpose

nag_blast_dmax_val (f16jn) computes the largest component of a real vector, along with the index of that component.

## Syntax

[k, r] = f16jn(n, x, incx)
[k, r] = nag_blast_dmax_val(n, x, incx)

## Description

nag_blast_dmax_val (f16jn) computes the largest component, r$r$, of an n$n$-element real vector x$x$, and determines the smallest index, k$k$, such that
 r = xk = max xj. j
$r=xk=maxjxj.$

## 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}}|$) – double 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:     k – int64int32nag_int scalar
k$k$, the index, from the set {1,1 + |incx|,,1 + (n1) × |incx|} $\left\{1,1+|{\mathbf{incx}}|,\dots ,1+\left({\mathbf{n}}-1\right)×|{\mathbf{incx}}|\right\}$, of the largest component of x$x$. If n0${\mathbf{n}}\le 0$ on input then k is returned as 0$0$.
2:     r – double scalar
r$r$, the largest component of x$x$. If n0${\mathbf{n}}\le 0$ on input then r is returned as 0.0$0.0$.

## 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_dmax_val_example
n = int64(5);
x = [1;
10;
11;
-2;
9];
incx = int64(1);
[k, r] = nag_blast_dmax_val(n, x, incx)
```
```

k =

3

r =

11

```
```function f16jn_example
n = int64(5);
x = [1;
10;
11;
-2;
9];
incx = int64(1);
[k, r] = f16jn(n, x, incx)
```
```

k =

3

r =

11

```