LAPACK  3.8.0
LAPACK: Linear Algebra PACKage

◆ 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
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date
November 2017
Further Details:
     jack dongarra, linpack, 3/11/78.
     modified 12/3/93, array(1) declarations changed to array(*)

Definition at line 91 of file daxpy.f.

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