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_zwaxpby (f16gh)

## Purpose

nag_blast_zwaxpby (f16gh) computes the sum of two scaled vectors, preserving input, for complex scalars and vectors.

## Syntax

[w] = f16gh(n, alpha, x, incx, beta, y, incy, incw)
[w] = nag_blast_zwaxpby(n, alpha, x, incx, beta, y, incy, incw)

## Description

nag_blast_zwaxpby (f16gh) performs the operation
 w ← αx + βy, $w ← αx+βy,$
where x$x$ and y$y$ are n$n$-element complex vectors, and α$\alpha$ and β$\beta$ are complex 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$n$, the number of elements in x$x$, y$y$ and w$w$.
2:     alpha – complex scalar
The scalar α$\alpha$.
3:     x(1 + (n1) × |incx|$1+\left({\mathbf{n}}-1\right)×|{\mathbf{incx}}|$) – complex 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 – complex scalar
The scalar β$\beta$.
6:     y(1 + (n1) × |incy|$1+\left({\mathbf{n}}-1\right)×|{\mathbf{incy}}|$) – complex 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$.
8:     incw – int64int32nag_int scalar
The increment in the subscripts of w between successive elements of w$w$.
Constraint: incw0${\mathbf{incw}}\ne 0$.

None.

None.

### Output Parameters

1:     w(1 + (n1) × |incw|$1+\left({\mathbf{n}}-1\right)×|{\mathbf{incw}}|$) – complex array
The n$n$-element vector w$w$.
If incw > 0${\mathbf{incw}}>0$, wi${w}_{i}$ is in w (1 + (i1) × incw) ${\mathbf{w}}\left(1+\left(\mathit{i}-1\right)×{\mathbf{incw}}\right)$, for i = 1,2,,n$\mathit{i}=1,2,\dots ,{\mathbf{n}}$.
If incw < 0${\mathbf{incw}}<0$, wi${w}_{i}$ is in w (1 + (ni) × incw)${\mathbf{w}}\left(1+\left({\mathbf{n}}-\mathit{i}\right)×{\mathbf{incw}}\right)$, for i = 1,2,,n$\mathit{i}=1,2,\dots ,{\mathbf{n}}$.
Intermediate elements of w are not referenced.

## 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_zwaxpby_example
n = int64(3);
alpha =  3 + 2i;
x = [ -4 + 2.1i;
3.7 + 4.5i;
-6 + 1.2i];
incx = int64(1);
beta =  0 - 1i;
y = [ -3 - 2.4i;
6.4 - 5i;
-5.1 + 0i];
incy = int64(1);
incw = int64(1);
[w] = nag_blast_zwaxpby(n, alpha, x, incx, beta, y, incy, incw)
```
```

w =

-18.6000 + 1.3000i
-2.9000 +14.5000i
-20.4000 - 3.3000i

```
```function f16gh_example
n = int64(3);
alpha =  3 + 2i;
x = [ -4 + 2.1i;
3.7 + 4.5i;
-6 + 1.2i];
incx = int64(1);
beta =  0 - 1i;
y = [ -3 - 2.4i;
6.4 - 5i;
-5.1 + 0i];
incy = int64(1);
incw = int64(1);
[w] = f16gh(n, alpha, x, incx, beta, y, incy, incw)
```
```

w =

-18.6000 + 1.3000i
-2.9000 +14.5000i
-20.4000 - 3.3000i

```