dscal Subroutine

public subroutine dscal(n, da, dx, incx)

scales a vector by a constant.

Arguments

Type IntentOptional Attributes Name
integer :: n
real(kind=wp) :: da
real(kind=wp) :: dx(*)
integer :: incx

Called by

proc~~dscal~~CalledByGraph proc~dscal lsqpblas_module::dscal proc~acheck lsqr_module::lsqr_solver%acheck proc~acheck->proc~dscal proc~lsqr lsqr_module::lsqr_solver%LSQR proc~lsqr->proc~dscal proc~xcheck lsqr_module::lsqr_solver%xcheck proc~xcheck->proc~dscal proc~solve_ez lsqr_module::lsqr_solver_ez%solve_ez proc~solve_ez->proc~lsqr

Source Code

    subroutine dscal(n,da,dx,incx)

    real(wp) da
    integer incx,n
    real(wp) dx(*)

    integer i,m,mp1,nincx

    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
                dx(i) = da*dx(i)
            end do
            if (n<5) return
        end if
        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)
        end do
    else
        ! code for increment not equal to 1
        nincx = n*incx
        do i = 1,nincx,incx
            dx(i) = da*dx(i)
        end do
    end if

    end subroutine dscal