SSCAL scales a vector by a constant. uses unrolled loops for increment equal to 1.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer(kind=ilp), | intent(in) | :: | n | |||
real(kind=sp), | intent(in) | :: | sa | |||
real(kind=sp), | intent(inout) | :: | sx(*) | |||
integer(kind=ilp), | intent(in) | :: | incx |
pure subroutine stdlib_sscal(n,sa,sx,incx) !! SSCAL scales a vector by a constant. !! uses unrolled loops for increment equal to 1. ! -- reference blas level1 routine -- ! -- reference blas is a software package provided by univ. of tennessee, -- ! -- univ. of california berkeley, univ. of colorado denver and nag ltd..-- ! Scalar Arguments real(sp), intent(in) :: sa integer(ilp), intent(in) :: incx, n ! Array Arguments real(sp), intent(inout) :: sx(*) ! ===================================================================== ! Local Scalars integer(ilp) :: i, m, mp1, nincx ! Intrinsic Functions intrinsic :: mod if (n<=0 .or. incx<=0) return if (incx==1) then ! code for increment equal to 1 ! clean-up loop m = mod(n,5) if (m/=0) then do i = 1,m sx(i) = sa*sx(i) end do if (n<5) return end if 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) end do else ! code for increment not equal to 1 nincx = n*incx do i = 1,nincx,incx sx(i) = sa*sx(i) end do end if return end subroutine stdlib_sscal