sscal(3f) - [BLAS:SINGLE_BLAS_LEVEL1] SX:=SA*SX.
subroutine sscal(n,sa,sx,incx)
.. Scalar Arguments ..
real,intent(in) :: sa
integer,intent(in) :: incx,n
..
.. Array Arguments ..
real,intent(inout) :: sx(*)
..
SSCAL scales a vector by a constant.
uses unrolled loops for increment equal to 1.
N
N is INTEGER
number of elements in input vector(s)
SA
SA is REAL
On entry, SA specifies the scalar alpha.
SX
SX is REAL array, dimension ( 1 + ( N - 1 )*abs( INCX ) )
INCX
INCX is INTEGER
storage spacing between elements of SX
date:November 2017
FURTHER DETAILS
jack dongarra, linpack, 3/11/78.
modified 3/93 to return if incx .le. 0.
modified 12/3/93, array(1) declarations changed to array(*)
Online html documentation available at
http://www.netlib.org/lapack/explore-html/
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | n | |||
real, | intent(in) | :: | sa | |||
real, | intent(inout) | :: | sx(*) | |||
integer, | intent(in) | :: | incx |
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
integer, | public | :: | i | ||||
integer, | public | :: | m | ||||
integer, | public | :: | mp1 | ||||
integer, | public | :: | nincx |
subroutine sscal(n,sa,sx,incx)
implicit none
!
! -- Reference BLAS level1 routine (version 3.8.0) --
! -- Reference BLAS is a software package provided by Univ. of Tennessee, --
! -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
! November 2017
!
! .. Scalar Arguments ..
real,intent(in) :: sa
integer,intent(in) :: incx,n
! ..
! .. Array Arguments ..
real,intent(inout) :: sx(*)
! ..
!
! =====================================================================
!
! .. Local Scalars ..
integer i,m,mp1,nincx
! ..
! .. Intrinsic Functions ..
intrinsic mod
! ..
if (n.le.0 .or. incx.le.0) return
if (incx.eq.1) then
!
! code for increment equal to 1
!
!
! clean-up loop
!
m = mod(n,5)
if (m.ne.0) then
do i = 1,m
sx(i) = sa*sx(i)
enddo
if (n.lt.5) return
endif
mp1 = m + 1
do i = mp1,n,5
sx(i) = sa*sx(i)
sx(i+1) = sa*sx(i+1)
sx(i+2) = sa*sx(i+2)
sx(i+3) = sa*sx(i+3)
sx(i+4) = sa*sx(i+4)
enddo
else
!
! code for increment not equal to 1
!
nincx = n*incx
do i = 1,nincx,incx
sx(i) = sa*sx(i)
enddo
endif
end subroutine sscal