Skip to content

linalg: refactor blas/lapack modules #913

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 19 commits into from
Jan 24, 2025
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
533 changes: 533 additions & 0 deletions legacy/refactor_blaslapack_subm.py
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for providing the generating script.
Please delete it as it is not necessary to have it inside stdlib once the refactoring is merged.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -2557,6 +2557,7 @@ module stdlib_linalg_blas_c
complex(sp), intent(inout) :: a
complex(sp), intent(in) :: b
complex(sp), intent(out) :: s
! =====================================================================
! Local Scalars
real(sp) :: d, f1, f2, g1, g2, h2, p, u, uu, v, vv, w
complex(sp) :: f, fs, g, gs, r, t
Expand Down
32 changes: 14 additions & 18 deletions src/stdlib_linalg_blas_d.fypp → legacy/stdlib_linalg_blas_d.fypp
Original file line number Diff line number Diff line change
Expand Up @@ -840,22 +840,22 @@ module stdlib_linalg_blas_d
end subroutine stdlib${ii}$_dger


pure function stdlib${ii}$_dnrm2( n, x, incx )
pure real(dp) function stdlib${ii}$_dnrm2( n, x, incx )
!! DNRM2 returns the euclidean norm of a vector via the function
!! name, so that
!! DNRM2 := sqrt( x'*x )
real(dp) :: stdlib${ii}$_dnrm2
! -- reference blas level1 routine (version 3.9.1_dp) --
! -- reference blas is a software package provided by univ. of tennessee, --
! -- univ. of california berkeley, univ. of colorado denver and nag ltd..--
! march 2021
! Constants
real(dp), parameter :: maxn = huge(0.0_dp)
! .. blue's scaling constants ..
! Scalar Arguments
integer(${ik}$), intent(in) :: incx, n
integer(${ik}$), intent(in) :: incx, n
! Array Arguments
real(dp), intent(in) :: x(*)
! =====================================================================
! Constants
real(dp), parameter :: maxn = huge(0.0_dp)
! .. blue's scaling constants ..
! Local Scalars
integer(${ik}$) :: i, ix
logical(lk) :: notbig
Expand Down Expand Up @@ -990,6 +990,7 @@ module stdlib_linalg_blas_d
! Scalar Arguments
real(dp), intent(inout) :: a, b
real(dp), intent(out) :: c, s
! =====================================================================
! Local Scalars
real(dp) :: anorm, bnorm, scl, sigma, r, z
anorm = abs(a)
Expand Down Expand Up @@ -1049,11 +1050,9 @@ module stdlib_linalg_blas_d
real(dp), intent(inout) :: dx(*), dy(*)
! =====================================================================
! Local Scalars
real(dp) :: dflag, dh11, dh12, dh21, dh22, two, w, z, zero
real(dp) :: dflag, dh11, dh12, dh21, dh22, w, z
integer(${ik}$) :: i, kx, ky, nsteps
! Data Statements
zero = 0.0_dp
two = 2.0_dp
dflag = dparam(1)
if (n<=0 .or. (dflag+two==zero)) return
if (incx==incy.and.incx>0) then
Expand Down Expand Up @@ -1158,13 +1157,10 @@ module stdlib_linalg_blas_d
! =====================================================================
! Local Scalars
real(dp) :: dflag, dh11, dh12, dh21, dh22, dp1, dp2, dq1, dq2, dtemp, du, gam, gamsq, &
one, rgamsq, two, zero
rgamsq
! Intrinsic Functions
intrinsic :: abs
! Data Statements
zero = 0.0_dp
one = 1.0_dp
two = 2.0_dp
gam = 4096.0_dp
gamsq = 16777216.0_dp
rgamsq = 5.9604645e-8_dp
Expand Down Expand Up @@ -4411,22 +4407,22 @@ module stdlib_linalg_blas_d
end function stdlib${ii}$_dzasum


pure function stdlib${ii}$_dznrm2( n, x, incx )
pure real(dp) function stdlib${ii}$_dznrm2( n, x, incx )
!! DZNRM2 returns the euclidean norm of a vector via the function
!! name, so that
!! DZNRM2 := sqrt( x**H*x )
real(dp) :: stdlib${ii}$_dznrm2
! -- reference blas level1 routine (version 3.9.1_dp) --
! -- reference blas is a software package provided by univ. of tennessee, --
! -- univ. of california berkeley, univ. of colorado denver and nag ltd..--
! march 2021
! Constants
real(dp), parameter :: maxn = huge(0.0_dp)
! .. blue's scaling constants ..
! Scalar Arguments
integer(${ik}$), intent(in) :: incx, n
! Array Arguments
complex(dp), intent(in) :: x(*)
! =====================================================================
! Constants
real(dp), parameter :: maxn = huge(0.0_dp)
! .. blue's scaling constants ..
! Local Scalars
integer(${ik}$) :: i, ix
logical(lk) :: notbig
Expand Down
32 changes: 14 additions & 18 deletions src/stdlib_linalg_blas_q.fypp → legacy/stdlib_linalg_blas_q.fypp
Original file line number Diff line number Diff line change
Expand Up @@ -844,22 +844,22 @@ module stdlib_linalg_blas_${ri}$
end subroutine stdlib${ii}$_${ri}$ger


pure function stdlib${ii}$_${ri}$nrm2( n, x, incx )
pure real(${rk}$) function stdlib${ii}$_${ri}$nrm2( n, x, incx )
!! DNRM2: returns the euclidean norm of a vector via the function
!! name, so that
!! DNRM2 := sqrt( x'*x )
real(${rk}$) :: stdlib${ii}$_${ri}$nrm2
! -- reference blas level1 routine (version 3.9.1_${rk}$) --
! -- reference blas is a software package provided by univ. of tennessee, --
! -- univ. of california berkeley, univ. of colorado denver and nag ltd..--
! march 2021
! Constants
real(${rk}$), parameter :: maxn = huge(0.0_${rk}$)
! .. blue's scaling constants ..
! Scalar Arguments
integer(${ik}$), intent(in) :: incx, n
integer(${ik}$), intent(in) :: incx, n
! Array Arguments
real(${rk}$), intent(in) :: x(*)
! =====================================================================
! Constants
real(${rk}$), parameter :: maxn = huge(0.0_${rk}$)
! .. blue's scaling constants ..
! Local Scalars
integer(${ik}$) :: i, ix
logical(lk) :: notbig
Expand Down Expand Up @@ -994,6 +994,7 @@ module stdlib_linalg_blas_${ri}$
! Scalar Arguments
real(${rk}$), intent(inout) :: a, b
real(${rk}$), intent(out) :: c, s
! =====================================================================
! Local Scalars
real(${rk}$) :: anorm, bnorm, scl, sigma, r, z
anorm = abs(a)
Expand Down Expand Up @@ -1053,11 +1054,9 @@ module stdlib_linalg_blas_${ri}$
real(${rk}$), intent(inout) :: dx(*), dy(*)
! =====================================================================
! Local Scalars
real(${rk}$) :: dflag, dh11, dh12, dh21, dh22, two, w, z, zero
real(${rk}$) :: dflag, dh11, dh12, dh21, dh22, w, z
integer(${ik}$) :: i, kx, ky, nsteps
! Data Statements
zero = 0.0_${rk}$
two = 2.0_${rk}$
dflag = dparam(1)
if (n<=0 .or. (dflag+two==zero)) return
if (incx==incy.and.incx>0) then
Expand Down Expand Up @@ -1162,13 +1161,10 @@ module stdlib_linalg_blas_${ri}$
! =====================================================================
! Local Scalars
real(${rk}$) :: dflag, dh11, dh12, dh21, dh22, dp1, dp2, dq1, dq2, dtemp, du, gam, gamsq, &
one, rgamsq, two, zero
rgamsq
! Intrinsic Functions
intrinsic :: abs
! Data Statements
zero = 0.0_${rk}$
one = 1.0_${rk}$
two = 2.0_${rk}$
gam = 4096.0_${rk}$
gamsq = 16777216.0_${rk}$
rgamsq = 5.9604645e-8_${rk}$
Expand Down Expand Up @@ -4415,22 +4411,22 @@ module stdlib_linalg_blas_${ri}$
end function stdlib${ii}$_${ri}$zasum


pure function stdlib${ii}$_${ri}$znrm2( n, x, incx )
pure real(${rk}$) function stdlib${ii}$_${ri}$znrm2( n, x, incx )
!! DZNRM2: returns the euclidean norm of a vector via the function
!! name, so that
!! DZNRM2 := sqrt( x**H*x )
real(${rk}$) :: stdlib${ii}$_${ri}$znrm2
! -- reference blas level1 routine (version 3.9.1_${rk}$) --
! -- reference blas is a software package provided by univ. of tennessee, --
! -- univ. of california berkeley, univ. of colorado denver and nag ltd..--
! march 2021
! Constants
real(${rk}$), parameter :: maxn = huge(0.0_${rk}$)
! .. blue's scaling constants ..
! Scalar Arguments
integer(${ik}$), intent(in) :: incx, n
! Array Arguments
complex(${rk}$), intent(in) :: x(*)
! =====================================================================
! Constants
real(${rk}$), parameter :: maxn = huge(0.0_${rk}$)
! .. blue's scaling constants ..
! Local Scalars
integer(${ik}$) :: i, ix
logical(lk) :: notbig
Expand Down
37 changes: 17 additions & 20 deletions src/stdlib_linalg_blas_s.fypp → legacy/stdlib_linalg_blas_s.fypp
Original file line number Diff line number Diff line change
Expand Up @@ -225,22 +225,22 @@ module stdlib_linalg_blas_s
end function stdlib${ii}$_scasum


pure function stdlib${ii}$_scnrm2( n, x, incx )
pure real(sp) function stdlib${ii}$_scnrm2( n, x, incx )
!! SCNRM2 returns the euclidean norm of a vector via the function
!! name, so that
!! SCNRM2 := sqrt( x**H*x )
real(sp) :: stdlib${ii}$_scnrm2
! -- reference blas level1 routine (version 3.9.1_sp) --
! -- reference blas is a software package provided by univ. of tennessee, --
! -- univ. of california berkeley, univ. of colorado denver and nag ltd..--
! march 2021
! Constants
real(sp), parameter :: maxn = huge(0.0_sp)
! .. blue's scaling constants ..
! Scalar Arguments
integer(${ik}$), intent(in) :: incx, n
integer(${ik}$), intent(in) :: incx, n
! Array Arguments
complex(sp), intent(in) :: x(*)
! =====================================================================
! Constants
real(sp), parameter :: maxn = huge(0.0_sp)
! .. blue's scaling constants ..
! Local Scalars
integer(${ik}$) :: i, ix
logical(lk) :: notbig
Expand Down Expand Up @@ -445,6 +445,7 @@ module stdlib_linalg_blas_s
integer(${ik}$), intent(in) :: incx, incy, n
! Array Arguments
real(sp), intent(in) :: sx(*), sy(*)
! =====================================================================
! Local Scalars
real(dp) :: dsdot
integer(${ik}$) :: i, kx, ky, ns
Expand Down Expand Up @@ -1019,22 +1020,22 @@ module stdlib_linalg_blas_s
end subroutine stdlib${ii}$_sger


pure function stdlib${ii}$_snrm2( n, x, incx )
pure real(sp) function stdlib${ii}$_snrm2( n, x, incx )
!! SNRM2 returns the euclidean norm of a vector via the function
!! name, so that
!! SNRM2 := sqrt( x'*x ).
real(sp) :: stdlib${ii}$_snrm2
! -- reference blas level1 routine (version 3.9.1_sp) --
! -- reference blas is a software package provided by univ. of tennessee, --
! -- univ. of california berkeley, univ. of colorado denver and nag ltd..--
! march 2021
! Constants
real(sp), parameter :: maxn = huge(0.0_sp)
! .. blue's scaling constants ..
! Scalar Arguments
integer(${ik}$), intent(in) :: incx, n
integer(${ik}$), intent(in) :: incx, n
! Array Arguments
real(sp), intent(in) :: x(*)
! =====================================================================
! Constants
real(sp), parameter :: maxn = huge(0.0_sp)
! .. blue's scaling constants ..
! Local Scalars
integer(${ik}$) :: i, ix
logical(lk) :: notbig
Expand Down Expand Up @@ -1170,6 +1171,7 @@ module stdlib_linalg_blas_s
! Scalar Arguments
real(sp), intent(inout) :: a, b
real(sp), intent(out) :: c, s
! =====================================================================
! Local Scalars
real(sp) :: anorm, bnorm, scl, sigma, r, z
anorm = abs(a)
Expand Down Expand Up @@ -1229,11 +1231,9 @@ module stdlib_linalg_blas_s
real(sp), intent(inout) :: sx(*), sy(*)
! =====================================================================
! Local Scalars
real(sp) :: sflag, sh11, sh12, sh21, sh22, two, w, z, zero
real(sp) :: sflag, sh11, sh12, sh21, sh22, w, z
integer(${ik}$) :: i, kx, ky, nsteps
! Data Statements
zero = 0.0_sp
two = 2.0_sp
sflag = sparam(1)
if (n<=0 .or. (sflag+two==zero)) return
if (incx==incy.and.incx>0) then
Expand Down Expand Up @@ -1337,14 +1337,11 @@ module stdlib_linalg_blas_s
real(sp), intent(out) :: sparam(5)
! =====================================================================
! Local Scalars
real(sp) :: gam, gamsq, one, rgamsq, sflag, sh11, sh12, sh21, sh22, sp1, sp2, sq1, sq2,&
stemp, su, two, zero
real(sp) :: gam, gamsq, rgamsq, sflag, sh11, sh12, sh21, sh22, sp1, sp2, sq1, sq2,&
stemp, su
! Intrinsic Functions
intrinsic :: abs
! Data Statements
zero = 0.0_sp
one = 1.0_sp
two = 2.0_sp
gam = 4096.0_sp
gamsq = 1.67772e7_sp
rgamsq = 5.96046e-8_sp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2643,6 +2643,7 @@ module stdlib_linalg_blas_${ci}$
complex(${ck}$), intent(inout) :: a
complex(${ck}$), intent(in) :: b
complex(${ck}$), intent(out) :: s
! =====================================================================
! Local Scalars
real(${ck}$) :: d, f1, f2, g1, g2, h2, p, u, uu, v, vv, w
complex(${ck}$) :: f, fs, g, gs, r, t
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2635,6 +2635,7 @@ module stdlib_linalg_blas_z
complex(dp), intent(inout) :: a
complex(dp), intent(in) :: b
complex(dp), intent(out) :: s
! =====================================================================
! Local Scalars
real(dp) :: d, f1, f2, g1, g2, h2, p, u, uu, v, vv, w
complex(dp) :: f, fs, g, gs, r, t
Expand Down
Loading
Loading