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 $y←α x+β y$
where x$x$ and y$y$ are n$n$-element real vectors, and α$\alpha$ and β$\beta$ real scalars. If n$n$ is less than or equal to zero, or if α$\alpha$ is equal to zero and β$\beta$ is equal to 1$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:     n – int64int32nag_int scalar
n$n$, the number of elements in x$x$ and y$y$.
2:     alpha – double scalar
The scalar α$\alpha$.
3:     x(1 + (n1) × |incx|$1+\left({\mathbf{n}}-1\right)×|{\mathbf{incx}}|$) – double array
The n$n$-element vector x$x$.
If incx > 0${\mathbf{incx}}>0$, xi${x}_{\mathit{i}}$ must be stored in x(1 + (i1) × incx)${\mathbf{x}}\left(1+\left(\mathit{i}-1\right)×{\mathbf{incx}}\right)$, for i = 1,2,,n$\mathit{i}=1,2,\dots ,{\mathbf{n}}$.
If incx < 0${\mathbf{incx}}<0$, xi${x}_{\mathit{i}}$ must be stored in x(1(ni) × incx)${\mathbf{x}}\left(1-\left({\mathbf{n}}-\mathit{i}\right)×{\mathbf{incx}}\right)$, for i = 1,2,,n$\mathit{i}=1,2,\dots ,{\mathbf{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$x$.
Constraint: incx0${\mathbf{incx}}\ne 0$.
5:     beta – double scalar
The scalar β$\beta$.
6:     y(1 + (n1) × |incy|$1+\left({\mathbf{n}}-1\right)×|{\mathbf{incy}}|$) – double array
The n$n$-element vector y$y$.
If incy > 0${\mathbf{incy}}>0$, yi${y}_{\mathit{i}}$ must be stored in y(1 + (i1) × incy)${\mathbf{y}}\left(1+\left(\mathit{i}-1\right)×{\mathbf{incy}}\right)$, for i = 1,2,,n$\mathit{i}=1,2,\dots ,{\mathbf{n}}$.
If incy < 0${\mathbf{incy}}<0$, yi${y}_{\mathit{i}}$ must be stored in y(1(ni) × incy)${\mathbf{y}}\left(1-\left({\mathbf{n}}-\mathit{i}\right)×{\mathbf{incy}}\right)$, for i = 1,2,,n$\mathit{i}=1,2,\dots ,{\mathbf{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$y$.
Constraint: incy0${\mathbf{incy}}\ne 0$.

None.

None.

### Output Parameters

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

## Error Indicators and Warnings

${\mathbf{ifail}}=\mathbf{}$
Constraint: incx0${\mathbf{incx}}\ne 0$.
Constraint: incy0${\mathbf{incy}}\ne 0$.
Constraint: n0${\mathbf{n}}\ge 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_daxpby_example
n = int64(5);
alpha = 3;
x = [-4; 2.1; 3.7; 4.5; -6];
incx = int64(1);
beta = -1;
y = [-3; -2.4; 6.4; -5; -5.1];
incy = int64(1);
[y] = nag_blast_daxpby(n, alpha, x, incx, beta, y, incy)
```
```

y =

-9.0000
8.7000
4.7000
18.5000
-12.9000

```
```function f16ec_example
n = int64(5);
alpha = 3;
x = [-4; 2.1; 3.7; 4.5; -6];
incx = int64(1);
beta = -1;
y = [-3; -2.4; 6.4; -5; -5.1];
incy = int64(1);
[y] = f16ec(n, alpha, x, incx, beta, y, incy)
```
```

y =

-9.0000
8.7000
4.7000
18.5000
-12.9000

```

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–2013