sger(3f) - [BLAS:SINGLE_BLAS_LEVEL2]
A:=A+alphaSXTRANSPOSE(SY), rank 1 update, A a rectangular matrix.
subroutine sger(m,n,alpha,x,incx,y,incy,a,lda)
.. Scalar Arguments ..
real,intent(in) :: alpha
integer,intent(in) :: incx,incy,lda,m,n
..
.. Array Arguments ..
real,intent(in) :: x(*),y(*)
real,intent(inout) :: a(lda,*)
..
SGER 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.
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 REAL
On entry, ALPHA specifies the scalar alpha.
X
X is REAL 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 REAL 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 REAL 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 ).
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.
Online html documentation available at
http://www.netlib.org/lapack/explore-html/
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | m | |||
integer, | intent(in) | :: | n | |||
real, | intent(in) | :: | alpha | |||
real, | intent(in) | :: | x(*) | |||
integer, | intent(in) | :: | incx | |||
real, | intent(in) | :: | y(*) | |||
integer, | intent(in) | :: | incy | |||
real, | intent(inout) | :: | a(lda,*) | |||
integer, | intent(in) | :: | lda |
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
integer, | public | :: | i | ||||
integer, | public | :: | info | ||||
integer, | public | :: | ix | ||||
integer, | public | :: | j | ||||
integer, | public | :: | jy | ||||
integer, | public | :: | kx | ||||
real, | public | :: | temp | ||||
real, | public, | parameter | :: | zero | = | 0.0e+0 |
subroutine sger(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 ..
real,intent(in) :: alpha
integer,intent(in) :: incx,incy,lda,m,n
! ..
! .. Array Arguments ..
real,intent(in) :: x(*),y(*)
real,intent(inout) :: a(lda,*)
! ..
!
! =====================================================================
!
! .. Parameters ..
real zero
parameter (zero=0.0e+0)
! ..
! .. Local Scalars ..
real 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('SGER ',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 sger