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_daxpby (f16ec)

## Purpose

nag_blast_daxpby (f16ec) computes the sum of two scaled vectors, for real vectors and scalars.

## Syntax

[y] = f16ec(n, alpha, x, incx, beta, y, incy)
[y] = nag_blast_daxpby(n, alpha, x, incx, beta, y, incy)

## Description

nag_blast_daxpby (f16ec) performs the operation
 $y←α x+β y$
where $x$ and $y$ are $n$-element real vectors, and $\alpha$ and $\beta$ real scalars. If $n$ is equal to zero, or if $\alpha$ is equal to zero and $\beta$ is equal to $1$, this function returns immediately.

## 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:     $\mathrm{n}$int64int32nag_int scalar
$n$, the number of elements in $x$ and $y$.
2:     $\mathrm{alpha}$ – double scalar
The scalar $\alpha$.
3:     $\mathrm{x}\left(1+\left({\mathbf{n}}-1\right)×\left|{\mathbf{incx}}\right|\right)$ – double array
The $n$-element vector $x$.
If ${\mathbf{incx}}>0$, ${x}_{\mathit{i}}$ must be stored in ${\mathbf{x}}\left(\left(\mathit{i}-1\right)×\left|{\mathbf{incx}}\right|+1\right)$, for $\mathit{i}=1,2,\dots ,{\mathbf{n}}$.
If ${\mathbf{incx}}<0$, ${x}_{\mathit{i}}$ must be stored in ${\mathbf{x}}\left(\left({\mathbf{n}}-\mathit{i}\right)×\left|{\mathbf{incx}}\right|-1\right)$, for $\mathit{i}=1,2,\dots ,{\mathbf{n}}$.
Intermediate elements of x are not referenced.
4:     $\mathrm{incx}$int64int32nag_int scalar
The increment in the subscripts of x between successive elements of $x$.
Constraint: ${\mathbf{incx}}\ne 0$.
5:     $\mathrm{beta}$ – double scalar
The scalar $\beta$.
6:     $\mathrm{y}\left(1+\left({\mathbf{n}}-1\right)×\left|{\mathbf{incy}}\right|\right)$ – double array
The $n$-element vector $y$.
If ${\mathbf{incy}}>0$, ${y}_{\mathit{i}}$ must be stored in ${\mathbf{y}}\left(1+\left(\mathit{i}-1\right)×{\mathbf{incy}}\right)$, for $\mathit{i}=1,2,\dots ,{\mathbf{n}}$.
If ${\mathbf{incy}}<0$, ${y}_{\mathit{i}}$ must be stored in ${\mathbf{y}}\left(1-\left({\mathbf{n}}-\mathit{i}\right)×{\mathbf{incy}}\right)$, for $\mathit{i}=1,2,\dots ,{\mathbf{n}}$.
Intermediate elements of y are not referenced.
7:     $\mathrm{incy}$int64int32nag_int scalar
The increment in the subscripts of y between successive elements of $y$.
Constraint: ${\mathbf{incy}}\ne 0$.

None.

### Output Parameters

1:     $\mathrm{y}\left(1+\left({\mathbf{n}}-1\right)×\left|{\mathbf{incy}}\right|\right)$ – double array
The updated vector $y$ stored in the array elements used to supply the original vector $y$.
Intermediate elements of y are unchanged.

## Error Indicators and Warnings

If ${\mathbf{incx}}=0$ or ${\mathbf{incy}}=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)).

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$ are stored in reverse order.
```function f16ec_example

fprintf('f16ec 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];

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

incx = int64(1);
incy = incx;

[z] = f16ec(n, alpha, x, incx, beta, y, incy);

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',z);
fprintf('\n');

```
```f16ec 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