LAPACK  3.5.0
LAPACK: Linear Algebra PACKage
dgemv.f File Reference

Go to the source code of this file.

Functions/Subroutines

subroutine dgemv (TRANS, M, N, ALPHA, A, LDA, X, INCX, BETA, Y, INCY)
 DGEMV More...
 

Function/Subroutine Documentation

subroutine dgemv ( character  TRANS,
integer  M,
integer  N,
double precision  ALPHA,
double precision, dimension(lda,*)  A,
integer  LDA,
double precision, dimension(*)  X,
integer  INCX,
double precision  BETA,
double precision, dimension(*)  Y,
integer  INCY 
)

DGEMV

Purpose:
 DGEMV  performs one of the matrix-vector operations

    y := alpha*A*x + beta*y,   or   y := alpha*A**T*x + beta*y,

 where alpha and beta are scalars, x and y are vectors and A is an
 m by n matrix.
Parameters
[in]TRANS
          TRANS is CHARACTER*1
           On entry, TRANS specifies the operation to be performed as
           follows:

              TRANS = 'N' or 'n'   y := alpha*A*x + beta*y.

              TRANS = 'T' or 't'   y := alpha*A**T*x + beta*y.

              TRANS = 'C' or 'c'   y := alpha*A**T*x + beta*y.
[in]M
          M is INTEGER
           On entry, M specifies the number of rows of the matrix A.
           M must be at least zero.
[in]N
          N is INTEGER
           On entry, N specifies the number of columns of the matrix A.
           N must be at least zero.
[in]ALPHA
          ALPHA is DOUBLE PRECISION.
           On entry, ALPHA specifies the scalar alpha.
[in]A
          A is DOUBLE PRECISION array of DIMENSION ( LDA, n ).
           Before entry, the leading m by n part of the array A must
           contain the matrix of coefficients.
[in]LDA
          LDA is INTEGER
           On entry, LDA specifies the first dimension of A as declared
           in the calling (sub) program. LDA must be at least
           max( 1, m ).
[in]X
          X is DOUBLE PRECISION array of DIMENSION at least
           ( 1 + ( n - 1 )*abs( INCX ) ) when TRANS = 'N' or 'n'
           and at least
           ( 1 + ( m - 1 )*abs( INCX ) ) otherwise.
           Before entry, the incremented array X must contain the
           vector x.
[in]INCX
          INCX is INTEGER
           On entry, INCX specifies the increment for the elements of
           X. INCX must not be zero.
[in]BETA
          BETA is DOUBLE PRECISION.
           On entry, BETA specifies the scalar beta. When BETA is
           supplied as zero then Y need not be set on input.
[in,out]Y
          Y is DOUBLE PRECISION array of DIMENSION at least
           ( 1 + ( m - 1 )*abs( INCY ) ) when TRANS = 'N' or 'n'
           and at least
           ( 1 + ( n - 1 )*abs( INCY ) ) otherwise.
           Before entry with BETA non-zero, the incremented array Y
           must contain the vector y. On exit, Y is overwritten by the
           updated vector y.
[in]INCY
          INCY is INTEGER
           On entry, INCY specifies the increment for the elements of
           Y. INCY must not be zero.
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date
November 2011
Further Details:
  Level 2 Blas routine.
  The vector and matrix arguments are not referenced when N = 0, or M = 0

  -- Written on 22-October-1986.
     Jack Dongarra, Argonne National Lab.
     Jeremy Du Croz, Nag Central Office.
     Sven Hammarling, Nag Central Office.
     Richard Hanson, Sandia National Labs.

Definition at line 158 of file dgemv.f.

158 *
159 * -- Reference BLAS level2 routine (version 3.4.0) --
160 * -- Reference BLAS is a software package provided by Univ. of Tennessee, --
161 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
162 * November 2011
163 *
164 * .. Scalar Arguments ..
165  DOUBLE PRECISION alpha,beta
166  INTEGER incx,incy,lda,m,n
167  CHARACTER trans
168 * ..
169 * .. Array Arguments ..
170  DOUBLE PRECISION a(lda,*),x(*),y(*)
171 * ..
172 *
173 * =====================================================================
174 *
175 * .. Parameters ..
176  DOUBLE PRECISION one,zero
177  parameter(one=1.0d+0,zero=0.0d+0)
178 * ..
179 * .. Local Scalars ..
180  DOUBLE PRECISION temp
181  INTEGER i,info,ix,iy,j,jx,jy,kx,ky,lenx,leny
182 * ..
183 * .. External Functions ..
184  LOGICAL lsame
185  EXTERNAL lsame
186 * ..
187 * .. External Subroutines ..
188  EXTERNAL xerbla
189 * ..
190 * .. Intrinsic Functions ..
191  INTRINSIC max
192 * ..
193 *
194 * Test the input parameters.
195 *
196  info = 0
197  IF (.NOT.lsame(trans,'N') .AND. .NOT.lsame(trans,'T') .AND.
198  + .NOT.lsame(trans,'C')) THEN
199  info = 1
200  ELSE IF (m.LT.0) THEN
201  info = 2
202  ELSE IF (n.LT.0) THEN
203  info = 3
204  ELSE IF (lda.LT.max(1,m)) THEN
205  info = 6
206  ELSE IF (incx.EQ.0) THEN
207  info = 8
208  ELSE IF (incy.EQ.0) THEN
209  info = 11
210  END IF
211  IF (info.NE.0) THEN
212  CALL xerbla('DGEMV ',info)
213  RETURN
214  END IF
215 *
216 * Quick return if possible.
217 *
218  IF ((m.EQ.0) .OR. (n.EQ.0) .OR.
219  + ((alpha.EQ.zero).AND. (beta.EQ.one))) RETURN
220 *
221 * Set LENX and LENY, the lengths of the vectors x and y, and set
222 * up the start points in X and Y.
223 *
224  IF (lsame(trans,'N')) THEN
225  lenx = n
226  leny = m
227  ELSE
228  lenx = m
229  leny = n
230  END IF
231  IF (incx.GT.0) THEN
232  kx = 1
233  ELSE
234  kx = 1 - (lenx-1)*incx
235  END IF
236  IF (incy.GT.0) THEN
237  ky = 1
238  ELSE
239  ky = 1 - (leny-1)*incy
240  END IF
241 *
242 * Start the operations. In this version the elements of A are
243 * accessed sequentially with one pass through A.
244 *
245 * First form y := beta*y.
246 *
247  IF (beta.NE.one) THEN
248  IF (incy.EQ.1) THEN
249  IF (beta.EQ.zero) THEN
250  DO 10 i = 1,leny
251  y(i) = zero
252  10 CONTINUE
253  ELSE
254  DO 20 i = 1,leny
255  y(i) = beta*y(i)
256  20 CONTINUE
257  END IF
258  ELSE
259  iy = ky
260  IF (beta.EQ.zero) THEN
261  DO 30 i = 1,leny
262  y(iy) = zero
263  iy = iy + incy
264  30 CONTINUE
265  ELSE
266  DO 40 i = 1,leny
267  y(iy) = beta*y(iy)
268  iy = iy + incy
269  40 CONTINUE
270  END IF
271  END IF
272  END IF
273  IF (alpha.EQ.zero) RETURN
274  IF (lsame(trans,'N')) THEN
275 *
276 * Form y := alpha*A*x + y.
277 *
278  jx = kx
279  IF (incy.EQ.1) THEN
280  DO 60 j = 1,n
281  IF (x(jx).NE.zero) THEN
282  temp = alpha*x(jx)
283  DO 50 i = 1,m
284  y(i) = y(i) + temp*a(i,j)
285  50 CONTINUE
286  END IF
287  jx = jx + incx
288  60 CONTINUE
289  ELSE
290  DO 80 j = 1,n
291  IF (x(jx).NE.zero) THEN
292  temp = alpha*x(jx)
293  iy = ky
294  DO 70 i = 1,m
295  y(iy) = y(iy) + temp*a(i,j)
296  iy = iy + incy
297  70 CONTINUE
298  END IF
299  jx = jx + incx
300  80 CONTINUE
301  END IF
302  ELSE
303 *
304 * Form y := alpha*A**T*x + y.
305 *
306  jy = ky
307  IF (incx.EQ.1) THEN
308  DO 100 j = 1,n
309  temp = zero
310  DO 90 i = 1,m
311  temp = temp + a(i,j)*x(i)
312  90 CONTINUE
313  y(jy) = y(jy) + alpha*temp
314  jy = jy + incy
315  100 CONTINUE
316  ELSE
317  DO 120 j = 1,n
318  temp = zero
319  ix = kx
320  DO 110 i = 1,m
321  temp = temp + a(i,j)*x(ix)
322  ix = ix + incx
323  110 CONTINUE
324  y(jy) = y(jy) + alpha*temp
325  jy = jy + incy
326  120 CONTINUE
327  END IF
328  END IF
329 *
330  RETURN
331 *
332 * End of DGEMV .
333 *
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:62
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55

Here is the call graph for this function: