dscal(3f) - [BLAS:DOUBLE_BLAS_LEVEL1] scales a vector by a constant.
subroutine dscal(n,da,dx,incx)
.. Scalar Arguments ..
double precision,intent(in) :: da
integer,intent(in) :: incx,n
..
.. Array Arguments ..
double precision,intent(inout) :: dx(*)
..
DSCAL scales a vector by a constant.
uses unrolled loops for increment equal to 1.
N number of elements in input vector(s) DA On entry, DA specifies the scalar alpha. DX array, dimension ( 1 + ( N - 1 )*abs( INCX ) ) INCX storage spacing between elements of DX
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 | |||
double precision, | intent(in) | :: | da | |||
double precision, | intent(inout) | :: | dx(*) | |||
integer, | intent(in) | :: | incx |
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
integer, | public | :: | i | ||||
integer, | public | :: | m | ||||
integer, | public | :: | mp1 | ||||
integer, | public | :: | nincx |
subroutine dscal(n,da,dx,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 ..
double precision,intent(in) :: da
integer,intent(in) :: incx,n
! ..
! .. Array Arguments ..
double precision,intent(inout) :: dx(*)
! ..
! =====================================================================
! .. 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
dx(i) = da*dx(i)
enddo
if (n.lt.5) return
endif
mp1 = m + 1
do i = mp1,n,5
dx(i) = da*dx(i)
dx(i+1) = da*dx(i+1)
dx(i+2) = da*dx(i+2)
dx(i+3) = da*dx(i+3)
dx(i+4) = da*dx(i+4)
enddo
else
!
! code for increment not equal to 1
!
nincx = n*incx
do i = 1,nincx,incx
dx(i) = da*dx(i)
enddo
endif
end subroutine dscal