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_zaxpby (f16gc)

 Contents

    1  Purpose
    2  Syntax
    7  Accuracy
    9  Example

Purpose

nag_blast_zaxpby (f16gc) computes the sum of two scaled vectors, for complex scalars and vectors.

Syntax

[y] = f16gc(n, alpha, x, incx, beta, y, incy)
[y] = nag_blast_zaxpby(n, alpha, x, incx, beta, y, incy)

Description

nag_blast_zaxpby (f16gc) performs the operation
y αx+βy,  
where x and y are n-element complex vectors, and α and β are complex scalars. If n is less than or equal to zero, or if α is equal to zero and β 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:     n int64int32nag_int scalar
n, the number of elements in x and y.
2:     alpha – complex scalar
The scalar α.
3:     x1+n-1×incx – complex 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 – complex scalar
The scalar β.
6:     y1+n-1×incy – complex array
The n-element vector y.
If incy>0, yi must be stored in yi-1×incy+1, for i=1,2,,n.
If incy<0, yi must be stored in yn-i×incy+1, 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.

Optional Input Parameters

None.

Output Parameters

1:     y1+n-1×incy – complex 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 incx=0 or 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)).

Further Comments

None.

Example

This example computes the result of a scaled vector accumulation for
α=3+2i,   x = -6+1.2i,3.7+4.5i,-4+2.1iT , β=-i,   y = -5.1,6.4-5i,-3-2.4iT .  
x and y are stored in reverse order.
function f16gc_example


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

n = int64(3);
x = [ -4 + 2.1i    3.7 + 4.5i     -6   + 1.2i];
y = [ -3 - 2.4i    6.4 - 5.0i     -5.1 + 0.0i];

% z = alpha*x +beta*y;
alpha =  3 + 2i;
beta  =  0 - 1i;

incx = int64(-1);
incy = int64(-1);
[z] = f16gc( ...
	     n, alpha, x, incx, beta, y, incy);

disp('x, y:');
fprintf('  x = ');
for j = 1:n
  fprintf('%11.4f %+ 8.4fi',real(x(j)),imag(x(j)));
end
fprintf('\n  y = ');
for j = 1:n
  fprintf('%11.4f %+ 8.4fi',real(y(j)),imag(y(j)));
end

fprintf('\n\nalpha = %5.1f%+5.1fi      beta = %5.1f%+5.1fi\n', ...
	real(alpha), imag(alpha), real(beta), imag(beta));
fprintf('\nalpha*x + beta*y = \n      ');
for j = 1:n
  fprintf('%11.4f %+ 8.4fi',real(z(j)),imag(z(j)));
end
fprintf('\n');


f16gc example results

x, y:
  x =     -4.0000  +2.1000i     3.7000  +4.5000i    -6.0000  +1.2000i
  y =     -3.0000  -2.4000i     6.4000  -5.0000i    -5.1000  +0.0000i

alpha =   3.0 +2.0i      beta =   0.0 -1.0i

alpha*x + beta*y = 
         -18.6000  +1.3000i    -2.9000 +14.5000i   -20.4000  -3.3000i

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