1
/* ---------------------------------------------------------------------
3
* -- Automatically Tuned Linear Algebra Software (ATLAS)
4
* (C) Copyright 2000 All Rights Reserved
6
* -- ATLAS routine -- Version 3.2 -- December 15, 2000
8
* -- Suggestions, comments, bugs reports should be sent to the follo-
9
* wing e-mail address: atlas@cs.utk.edu
11
* Author : Antoine P. Petitet
12
* University of Tennessee - Innovative Computing Laboratory
13
* Knoxville TN, 37996-1301, USA.
15
* ---------------------------------------------------------------------
17
* -- Copyright notice and Licensing terms:
19
* Redistribution and use in source and binary forms, with or without
20
* modification, are permitted provided that the following conditions
23
* 1. Redistributions of source code must retain the above copyright
24
* notice, this list of conditions and the following disclaimer.
25
* 2. Redistributions in binary form must reproduce the above copyright
26
* notice, this list of conditions, and the following disclaimer in
27
* the documentation and/or other materials provided with the distri-
29
* 3. The name of the University, the ATLAS group, or the names of its
30
* contributors may not be used to endorse or promote products deri-
31
* ved from this software without specific written permission.
35
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
36
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
37
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
38
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY
39
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPE-
40
* CIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
41
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
42
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEO-
43
* RY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (IN-
44
* CLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
45
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
47
* ---------------------------------------------------------------------
52
#include "atlas_refmisc.h"
53
#include "atlas_reflevel1.h"
69
* ATL_zrefaxpy performs the following operation:
73
* where alpha is a scalar and x and y are two n-vectors.
79
* On entry, N specifies the length of the vector x. N must be
80
* at least zero. Unchanged on exit.
82
* ALPHA (input) const double *
83
* On entry, ALPHA specifies the scalar alpha. When ALPHA is
84
* supplied as zero, then the entries of the incremented array X
85
* need not be set on input. Unchanged on exit.
87
* X (input) const double *
88
* On entry, X points to the first entry to be accessed of an
89
* incremented array of size equal to or greater than
90
* ( 1 + ( n - 1 ) * abs( INCX ) ) * sizeof( double[2] ),
91
* that contains the vector x. Unchanged on exit.
93
* INCX (input) const int
94
* On entry, INCX specifies the increment for the elements of X.
95
* INCX must not be zero. Unchanged on exit.
97
* Y (input/output) double *
98
* On entry, Y points to the first entry to be accessed of an
99
* incremented array of size equal to or greater than
100
* ( 1 + ( n - 1 ) * abs( INCY ) ) * sizeof( double[2] ),
101
* that contains the vector y. On exit, the entries of the in-
102
* cremented array Y are updated with the scaled entries of the
103
* incremented array X.
105
* INCY (input) const int
106
* On entry, INCY specifies the increment for the elements of Y.
107
* INCY must not be zero. Unchanged on exit.
109
* ---------------------------------------------------------------------
112
* .. Local Variables ..
114
register const double alpha_r = *ALPHA, alpha_i = ALPHA[1];
115
register double x0_r, x0_i, x1_r, x1_i, y0_r, y0_i, y1_r, y1_i;
118
int incx2 = 2 * INCX, incy2 = 2 * INCY, nu;
119
const int incX2 = 2 * incx2, incY2 = 2 * incy2;
121
* .. Executable Statements ..
124
if( ( N > 0 ) && !Mdzero( alpha_r, alpha_i ) )
126
if( ( nu = ( N >> 1 ) << 1 ) != 0 )
128
StX = (double *)X + nu * incx2;
132
x0_r = (*X); y0_r = (*Y);
133
x0_i = X[1]; y0_i = Y[1];
134
x1_r = X[incx2 ]; y1_r = Y[incy2 ];
135
x1_i = X[incx2+1]; y1_i = Y[incy2+1];
137
*Y = y0_r + alpha_r * x0_r - alpha_i * x0_i;
138
Y[1] = y0_i + alpha_i * x0_r + alpha_r * x0_i;
139
Y[incy2 ] = y1_r + alpha_r * x1_r - alpha_i * x1_i;
140
Y[incy2+1] = y1_i + alpha_i * x1_r + alpha_r * x1_i;
148
for( i = N - nu; i != 0; i-- )
150
x0_r = (*X); y0_r = (*Y);
151
x0_i = X[1]; y0_i = Y[1];
153
*Y = y0_r + alpha_r * x0_r - alpha_i * x0_i;
154
Y[1] = y0_i + alpha_i * x0_r + alpha_r * x0_i;
161
* End of ATL_zrefaxpy