 LAPACK 3.11.0 LAPACK: Linear Algebra PACKage
Searching...
No Matches

## ◆ daxpy()

 subroutine daxpy ( integer N, double precision DA, double precision, dimension(*) DX, integer INCX, double precision, dimension(*) DY, integer INCY )

DAXPY

Purpose:
```    DAXPY constant times a vector plus a vector.
uses unrolled loops for increments equal to one.```
Parameters
 [in] N ``` N is INTEGER number of elements in input vector(s)``` [in] DA ``` DA is DOUBLE PRECISION On entry, DA specifies the scalar alpha.``` [in] DX ` DX is DOUBLE PRECISION array, dimension ( 1 + ( N - 1 )*abs( INCX ) )` [in] INCX ``` INCX is INTEGER storage spacing between elements of DX``` [in,out] DY ` DY is DOUBLE PRECISION array, dimension ( 1 + ( N - 1 )*abs( INCY ) )` [in] INCY ``` INCY is INTEGER storage spacing between elements of DY```
Further Details:
```     jack dongarra, linpack, 3/11/78.
modified 12/3/93, array(1) declarations changed to array(*)```

Definition at line 88 of file daxpy.f.

89*
90* -- Reference BLAS level1 routine --
91* -- Reference BLAS is a software package provided by Univ. of Tennessee, --
92* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
93*
94* .. Scalar Arguments ..
95 DOUBLE PRECISION DA
96 INTEGER INCX,INCY,N
97* ..
98* .. Array Arguments ..
99 DOUBLE PRECISION DX(*),DY(*)
100* ..
101*
102* =====================================================================
103*
104* .. Local Scalars ..
105 INTEGER I,IX,IY,M,MP1
106* ..
107* .. Intrinsic Functions ..
108 INTRINSIC mod
109* ..
110 IF (n.LE.0) RETURN
111 IF (da.EQ.0.0d0) RETURN
112 IF (incx.EQ.1 .AND. incy.EQ.1) THEN
113*
114* code for both increments equal to 1
115*
116*
117* clean-up loop
118*
119 m = mod(n,4)
120 IF (m.NE.0) THEN
121 DO i = 1,m
122 dy(i) = dy(i) + da*dx(i)
123 END DO
124 END IF
125 IF (n.LT.4) RETURN
126 mp1 = m + 1
127 DO i = mp1,n,4
128 dy(i) = dy(i) + da*dx(i)
129 dy(i+1) = dy(i+1) + da*dx(i+1)
130 dy(i+2) = dy(i+2) + da*dx(i+2)
131 dy(i+3) = dy(i+3) + da*dx(i+3)
132 END DO
133 ELSE
134*
135* code for unequal increments or equal increments
136* not equal to 1
137*
138 ix = 1
139 iy = 1
140 IF (incx.LT.0) ix = (-n+1)*incx + 1
141 IF (incy.LT.0) iy = (-n+1)*incy + 1
142 DO i = 1,n
143 dy(iy) = dy(iy) + da*dx(ix)
144 ix = ix + incx
145 iy = iy + incy
146 END DO
147 END IF
148 RETURN
149*
150* End of DAXPY
151*