dger Subroutine

public subroutine dger(m, n, alpha, x, incx, y, incy, a, lda)

NAME

dger(3f) - [BLAS:DOUBLE_BLAS_LEVEL2]

SYNOPSIS

 subroutine dger(m,n,alpha,x,incx,y,incy,a,lda)

   .. Scalar Arguments ..
   double precision,intent(in)    :: alpha
   integer,intent(in)             :: incx,incy,lda,m,n
   ..
   .. Array Arguments ..
   double precision,intent(in)    :: x(*),y(*)
   double precision,intent(inout) :: a(lda,*)
   ..

DEFINITION

DGER performs the rank 1 operation

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

where alpha is a scalar, x is an m element vector, y is an n element vector and A is an m by n matrix.

OPTIONS

M

       M is INTEGER
        On entry, M specifies the number of rows of the matrix A.
        M must be at least zero.

N

       N is INTEGER
        On entry, N specifies the number of columns of the matrix A.
        N must be at least zero.

ALPHA

       ALPHA is DOUBLE PRECISION.
        On entry, ALPHA specifies the scalar alpha.

X

       X is DOUBLE PRECISION array, dimension at least
        ( 1 + ( m - 1 )*abs( INCX ) ).
        Before entry, the incremented array X must contain the m
        element vector x.

INCX

       INCX is INTEGER
        On entry, INCX specifies the increment for the elements of
        X. INCX must not be zero.

Y

       Y is DOUBLE PRECISION array, dimension at least
        ( 1 + ( n - 1 )*abs( INCY ) ).
        Before entry, the incremented array Y must contain the n
        element vector y.

INCY

       INCY is INTEGER
        On entry, INCY specifies the increment for the elements of
        Y. INCY must not be zero.

A

       A is DOUBLE PRECISION array, dimension ( LDA, N )
        Before entry, the leading m by n part of the array A must
        contain the matrix of coefficients. On exit, A is
        overwritten by the updated matrix.

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 ).

AUTHORS

  • Univ. of Tennessee
  • Univ. of California Berkeley
  • Univ. of Colorado Denver
  • NAG Ltd.

date:December 2016

FURTHER DETAILS

Level 2 Blas routine.

– 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.

SEE ALSO

Online html documentation available at
http://www.netlib.org/lapack/explore-html/

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: m
integer, intent(in) :: n
double precision, intent(in) :: alpha
double precision, intent(in) :: x(*)
integer, intent(in) :: incx
double precision, intent(in) :: y(*)
integer, intent(in) :: incy
double precision, intent(inout) :: a(lda,*)
integer, intent(in) :: lda

Contents

Source Code


Variables

Type Visibility Attributes Name Initial
integer, public :: i
integer, public :: info
integer, public :: ix
integer, public :: j
integer, public :: jy
integer, public :: kx
double precision, public :: temp
double precision, public, parameter :: zero = 0.0d+0

Source Code

       subroutine dger(m,n,alpha,x,incx,y,incy,a,lda)
      implicit none
!
!  -- Reference BLAS level2 routine (version 3.7.0) --
!  -- Reference BLAS is a software package provided by Univ. of Tennessee,    --
!  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
!     December 2016
!
!     .. Scalar Arguments ..
      double precision,intent(in)    :: alpha
      integer,intent(in)             :: incx,incy,lda,m,n
!     ..
!     .. Array Arguments ..
      double precision,intent(in)    :: x(*),y(*)
      double precision,intent(inout) :: a(lda,*)
!     ..
!
!  =====================================================================
!
!     .. Parameters ..
      double precision zero
      parameter (zero=0.0d+0)
!     ..
!     .. Local Scalars ..
      double precision temp
      integer i,info,ix,j,jy,kx
!     ..
!     .. External Subroutines ..
!     ..
!     .. Intrinsic Functions ..
      intrinsic max
!     ..
!
!     Test the input parameters.
!
      info = 0
      if (m.lt.0) then
          info = 1
      elseif (n.lt.0) then
          info = 2
      elseif (incx.eq.0) then
          info = 5
      elseif (incy.eq.0) then
          info = 7
      elseif (lda.lt.max(1,m)) then
          info = 9
      endif
      if (info.ne.0) then
          call xerbla('DGER  ',info)
          return
      endif
!
!     Quick return if possible.
!
      if ((m.eq.0) .or. (n.eq.0) .or. (alpha.eq.zero)) return
!
!     Start the operations. In this version the elements of A are
!     accessed sequentially with one pass through A.
!
      if (incy.gt.0) then
          jy = 1
      else
          jy = 1 - (n-1)*incy
      endif
      if (incx.eq.1) then
          do j = 1,n
              if (y(jy).ne.zero) then
                  temp = alpha*y(jy)
                  do i = 1,m
                      a(i,j) = a(i,j) + x(i)*temp
                  enddo
              endif
              jy = jy + incy
          enddo
      else
          if (incx.gt.0) then
              kx = 1
          else
              kx = 1 - (m-1)*incx
          endif
          do j = 1,n
              if (y(jy).ne.zero) then
                  temp = alpha*y(jy)
                  ix = kx
                  do i = 1,m
                      a(i,j) = a(i,j) + x(ix)*temp
                      ix = ix + incx
                  enddo
              endif
              jy = jy + incy
          enddo
      endif
!
      end subroutine dger