hide long namesshow long names
hide short namesshow short names
Integer type:  int32  int64  nag_int  show int32  show int32  show int64  show int64  show nag_int  show nag_int

PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

NAG Toolbox: nag_blast_iamax_val (f16dq)

 Contents

    1  Purpose
    2  Syntax
    7  Accuracy
    9  Example

Purpose

nag_blast_iamax_val (f16dq) computes, with respect to absolute value, the largest component of an integer vector, along with the index of that component.

Syntax

[k, ii] = f16dq(n, x, incx)
[k, ii] = nag_blast_iamax_val(n, x, incx)

Description

nag_blast_iamax_val (f16dq) computes, with respect to absolute value, the largest component, i, of an n-element integer vector x, and determines the smallest index, k, such that
i=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, the number of elements in x.
2:     x1+n-1×incx int64int32nag_int array
The n-element vector x.
If incx>0, xi must be stored in xi-1×incx+1, for i=1,2,,n.
If incx<0, xi must be stored in xn-i×incx+1, for i=1,2,,n.
Intermediate elements of x are not referenced. If n=0, x is not referenced.
3:     incx int64int32nag_int scalar
The increment in the subscripts of x between successive elements of x.
Constraint: incx0.

Optional Input Parameters

None.

Output Parameters

1:     k int64int32nag_int scalar
k, the index, from the set 1,2,,n , of the largest component of x with respect to absolute value. If n0 on input then k is returned as 0.
2:     ii int64int32nag_int scalar
i, the largest component of x with respect to absolute value. If n0 on input then ii is returned as 0.

Error Indicators and Warnings

If incx=0, an error message is printed and program execution is terminated.

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)).

Further Comments

None.

Example

This example computes the largest component with respect to absolute value and index of that component for the vector
x= 1,10,11,-2,9T .  
function f16dq_example


fprintf('f16dq example results\n\n');

% max absolute integer and location
n    = int64(5);
x    = [int64(1)  10   11   -2   9];
incx = int64(1);

[xloc, xmax] = f16dq(n, x, incx);

fprintf('maxabs(');
fprintf('%4d',x);
fprintf(') = |x(%4d)| = %5d\n', xloc, xmax);


f16dq example results

maxabs(   1  10  11  -2   9) = |x(   3)| =    11

PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015