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_dwaxpby (f16eh)

 Contents

    1  Purpose
    2  Syntax
    7  Accuracy
    9  Example

Purpose

nag_blast_dwaxpby (f16eh) computes the sum of two scaled vectors, preserving input, for real scalars and vectors.

Syntax

[w] = f16eh(n, alpha, x, incx, beta, y, incy, incw)
[w] = nag_blast_dwaxpby(n, alpha, x, incx, beta, y, incy, incw)

Description

nag_blast_dwaxpby (f16eh) performs the operation
w αx+βy,  
where x and y are n-element real vectors, and α and β are real scalars.

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, y and w.
2:     alpha – double scalar
The scalar α.
3:     x1+n-1×incx – double 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.
4:     incx int64int32nag_int scalar
The increment in the subscripts of x between successive elements of x.
Constraint: incx0.
5:     beta – double scalar
The scalar β.
6:     y1+n-1×incy – double array
The n-element vector y.
If incy>0, yi must be stored in y1+i-1×incy, for i=1,2,,n.
If incy<0, yi must be stored in y1-n-i×incy, for i=1,2,,n.
Intermediate elements of y are not referenced.
7:     incy int64int32nag_int scalar
The increment in the subscripts of y between successive elements of y.
Constraint: incy0.
8:     incw int64int32nag_int scalar
The increment in the subscripts of w between successive elements of w.
Constraint: incw0.

Optional Input Parameters

None.

Output Parameters

1:     w1+n-1×incw – double array
The n-element vector w.
If incw>0, wi is in w1+i-1×incw , for i=1,2,,n.
If incw<0, wi is in w1+n-i×incw , for i=1,2,,n.
Intermediate elements of w are not referenced.

Error Indicators and Warnings

If incx=0 or incy=0 or incw=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 result of a scaled vector accumulation for
α=3,   x = -6,4.5,3.7,2.1,-4T , β=-1,   y = -5.1,-5,6.4,-2.4,-3T .  
x and y, and also the sum vector w, are stored in reverse order.
function f16eh_example


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

% real vectors x and y;
n = int64(5);
x = [-4    2.1    3.7    4.5   -6.0];
y = [-3   -2.4    6.4   -5.0   -5.1];

% w = 3x - y;
alpha = 3;
beta = -1;

incx = int64(1);
incy = incx;
incw = incx;

[w] = f16eh(n, alpha, x, incx, beta, y, incy, incw);

fprintf('x = ');
fprintf('%5.1f',x);
fprintf('\ny = ');
fprintf('%5.1f',y);
fprintf('\n%4.1f x %+4.1f y = ',alpha,beta);
fprintf('%7.1f',w);
fprintf('\n');


f16eh example results

x =  -4.0  2.1  3.7  4.5 -6.0
y =  -3.0 -2.4  6.4 -5.0 -5.1
 3.0 x -1.0 y =    -9.0    8.7    4.7   18.5  -12.9

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