zgeru Subroutine

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

NAME

zgeru(3f) - [BLAS:COMPLEX_16_BLAS_LEVEL2]

SYNOPSIS

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

   .. Scalar Arguments ..
   complex(kind=real64),intent(in)    :: alpha
   integer,intent(in)                 :: incx,incy,lda,m,n
   ..
   .. Array Arguments ..
   complex(kind=real64),intent(in)    :: x(*),y(*)
   complex(kind=real64),intent(inout) :: a(lda,*)
   ..

DEFINITION

ZGERU 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   On entry, M specifies the number of rows of the matrix A.
     M must be at least zero.

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

 ALPHA  On entry, ALPHA specifies the scalar alpha.

 X   array, dimension at least

     ( 1 + ( m - 1 )*abs( INCX ) ).

     Before entry, the incremented array X must contain the m
     element vector x.

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

 Y  array, dimension at least

     ( 1 + ( n - 1 )*abs( INCY ) ).

    Before entry, the incremented array Y must contain the n
    element vector y.

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

 A    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  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
complex(kind=real64), intent(in) :: alpha
complex(kind=real64), intent(in) :: x(*)
integer, intent(in) :: incx
complex(kind=real64), intent(in) :: y(*)
integer, intent(in) :: incy
complex(kind=real64), 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
complex(kind=real64), public :: temp
complex(kind=real64), public, parameter :: zero = (0.0d+0,0.0d+0)

Source Code

       subroutine zgeru(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 ..
      complex(kind=real64),intent(in)    :: alpha
      integer,intent(in)                 :: incx,incy,lda,m,n
!     ..
!     .. Array Arguments ..
      complex(kind=real64),intent(in)    :: x(*),y(*)
      complex(kind=real64),intent(inout) :: a(lda,*)
!     ..
!
!  =====================================================================
!
!     .. Parameters ..
      complex(kind=real64) :: zero
      parameter (zero= (0.0d+0,0.0d+0))
!     ..
!     .. Local Scalars ..
      complex(kind=real64) :: temp
      integer i,info,ix,j,jy,kx
!     ..
!     .. External Subroutines ..
!      EXTERNAL XERBLA
!     ..
!     .. 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('ZGERU ',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 zgeru