1 #include "blas_extended.h"
2 #include "blas_extended_private.h"
3 
BLAS_zwaxpby_z_d(int n,const void * alpha,const void * x,int incx,const void * beta,const double * y,int incy,void * w,int incw)4 void BLAS_zwaxpby_z_d(int n, const void *alpha, const void *x, int incx,
5 		      const void *beta, const double *y, int incy, void *w,
6 		      int incw)
7 
8 /*
9  * Purpose
10  * =======
11  *
12  * This routine computes:
13  *
14  *     w <- alpha * x + beta * y
15  *
16  * Arguments
17  * =========
18  *
19  * n     (input) int
20  *       The length of vectors x, y, and w.
21  *
22  * alpha (input) const void*
23  *
24  * x     (input) const void*
25  *       Array of length n.
26  *
27  * incx  (input) int
28  *       The stride used to access components x[i].
29  *
30  * beta  (input) const void*
31  *
32  * y     (input) double*
33  *       Array of length n.
34  *
35  * incy  (input) int
36  *       The stride used to access components y[i].
37  *
38  * w     (output) void*
39  *       Array of length n.
40  *
41  * incw  (input) int
42  *       The stride used to write components w[i].
43  *
44  */
45 {
46   char *routine_name = "BLAS_zwaxpby_z_d";
47 
48   int i, ix = 0, iy = 0, iw = 0;
49   double *w_i = (double *) w;
50   const double *x_i = (double *) x;
51   const double *y_i = y;
52   double *alpha_i = (double *) alpha;
53   double *beta_i = (double *) beta;
54   double x_ii[2];
55   double y_ii;
56   double tmpx[2];
57   double tmpy[2];
58 
59 
60 
61   /* Test the input parameters. */
62   if (incx == 0)
63     BLAS_error(routine_name, -4, incx, NULL);
64   else if (incy == 0)
65     BLAS_error(routine_name, -7, incy, NULL);
66   else if (incw == 0)
67     BLAS_error(routine_name, -9, incw, NULL);
68 
69 
70   /* Immediate return */
71   if (n <= 0) {
72     return;
73   }
74 
75 
76 
77   incx *= 2;
78 
79   incw *= 2;
80   if (incx < 0)
81     ix = (-n + 1) * incx;
82   if (incy < 0)
83     iy = (-n + 1) * incy;
84   if (incw < 0)
85     iw = (-n + 1) * incw;
86 
87   for (i = 0; i < n; ++i) {
88     x_ii[0] = x_i[ix];
89     x_ii[1] = x_i[ix + 1];
90     y_ii = y_i[iy];
91     {
92       tmpx[0] = (double) alpha_i[0] * x_ii[0] - (double) alpha_i[1] * x_ii[1];
93       tmpx[1] = (double) alpha_i[0] * x_ii[1] + (double) alpha_i[1] * x_ii[0];
94     }				/* tmpx  = alpha * x[ix] */
95     {
96       tmpy[0] = beta_i[0] * y_ii;
97       tmpy[1] = beta_i[1] * y_ii;
98     }				/* tmpy = beta * y[iy] */
99     tmpy[0] = tmpy[0] + tmpx[0];
100     tmpy[1] = tmpy[1] + tmpx[1];
101     w_i[iw] = tmpy[0];
102     w_i[iw + 1] = tmpy[1];
103     ix += incx;
104     iy += incy;
105     iw += incw;
106   }				/* endfor */
107 
108 
109 
110 }
111