You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think stdlib_scsum1 in stdlib_linalg_lapack_s.f90 can be rewritten without gotos as
pure real(sp) function stdlib_scsum1(n,cx,incx)
! -- lapack auxiliary routine --
! -- lapack is a software package provided by univ. of tennessee, --
! -- univ. of california berkeley, univ. of colorado denver and nag ltd..--
! Scalar Arguments
integer(ilp),intent(in) :: incx,n
! Array Arguments
complex(sp),intent(in) :: cx(*)
! =====================================================================
! Local Scalars
integer(ilp) :: i,nincx
real(sp) :: stemp
! Intrinsic Functions
intrinsic :: abs
! Executable Statements
stdlib_scsum1 = zero
stemp = zero
if (n <= 0) return
if (incx /= 1) then
! code for increment not equal to 1
nincx = n*incx
do i = 1,nincx,incx
! next line modified.
stemp = stemp + abs(cx(i))
end do
stdlib_scsum1 = stemp
else
! code for increment equal to 1
do i = 1,n
! next line modified.
stemp = stemp + abs(cx(i))
end do
stdlib_scsum1 = stemp
end if
return
end function stdlib_scsum1
The original is
pure real(sp) function stdlib_scsum1(n,cx,incx)
! -- lapack auxiliary routine --
! -- lapack is a software package provided by univ. of tennessee, --
! -- univ. of california berkeley, univ. of colorado denver and nag ltd..--
! Scalar Arguments
integer(ilp),intent(in) :: incx,n
! Array Arguments
complex(sp),intent(in) :: cx(*)
! =====================================================================
! Local Scalars
integer(ilp) :: i,nincx
real(sp) :: stemp
! Intrinsic Functions
intrinsic :: abs
! Executable Statements
stdlib_scsum1 = zero
stemp = zero
if (n <= 0) return
if (incx == 1) go to 20
! code for increment not equal to 1
nincx = n*incx
do i = 1,nincx,incx
! next line modified.
stemp = stemp + abs(cx(i))
end do
stdlib_scsum1 = stemp
return
! code for increment equal to 1
20 continue
do i = 1,n
! next line modified.
stemp = stemp + abs(cx(i))
end do
stdlib_scsum1 = stemp
return
end function stdlib_scsum1
A general question is whether doing the work to eliminate as many gotos as possible is worth it. If it has to be done manually, perhaps not.
The text was updated successfully, but these errors were encountered:
I think stdlib_scsum1 in stdlib_linalg_lapack_s.f90 can be rewritten without gotos as
The original is
A general question is whether doing the work to eliminate as many gotos as possible is worth it. If it has to be done manually, perhaps not.
The text was updated successfully, but these errors were encountered: