Skip to content
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

linalg: enable 80-bit extended precision for whole library, xdp #839

Merged
merged 14 commits into from
Jul 4, 2024
13 changes: 13 additions & 0 deletions include/common.fypp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,19 @@
#:set CMPLX_INIT = CMPLX_INIT + ["w"]
#:endif

#! BLAS/LAPACK complex->real kind initial conversion
#! Converts a BLAS/LAPACK complex kind initial to a real kind initial
#!
#! Args:
#! ci (character): Complex kind initial in ["c","z","y","w"]
#!
#! Returns:
#! Real kind initial in ["s","d","x","q"] or an empty string on invalid input
#!
#:def c2ri(cmplx)
$:"s" if cmplx=="c" else "d" if cmplx=="z" else "x" if cmplx=="y" else "q" if cmplx=="w" else "ERROR"
#:enddef

#! Complex types to be considered during templating
#:set CMPLX_TYPES = ["complex({})".format(k) for k in CMPLX_KINDS]

Expand Down
20 changes: 0 additions & 20 deletions src/stdlib_linalg.fypp
Original file line number Diff line number Diff line change
Expand Up @@ -251,11 +251,9 @@ module stdlib_linalg
!! or several (from a 2-d right-hand-side vector `b(:,:)`) systems.
!!
!!@note The solution is based on LAPACK's generic LU decomposition based solvers `*GESV`.
!!@note BLAS/LAPACK backends do not currently support extended precision (``xdp``).
!!
#:for nd,ndsuf,nde in ALL_RHS
#:for rk,rt,ri in RC_KINDS_TYPES
#:if rk!="xdp"
module function stdlib_linalg_${ri}$_solve_${ndsuf}$(a,b,overwrite_a,err) result(x)
!> Input matrix a[n,n]
${rt}$, intent(inout), target :: a(:,:)
Expand All @@ -276,7 +274,6 @@ module stdlib_linalg
!> Result array/matrix x[n] or x[n,nrhs]
${rt}$, allocatable, target :: x${nd}$
end function stdlib_linalg_${ri}$_pure_solve_${ndsuf}$
#:endif
#:endfor
#:endfor
end interface solve
Expand All @@ -302,11 +299,9 @@ module stdlib_linalg
!! or several (from a 2-d right-hand-side vector `b(:,:)`) systems.
!!
!!@note The solution is based on LAPACK's generic LU decomposition based solvers `*GESV`.
!!@note BLAS/LAPACK backends do not currently support extended precision (``xdp``).
!!
#:for nd,ndsuf,nde in ALL_RHS
#:for rk,rt,ri in RC_KINDS_TYPES
#:if rk!="xdp"
pure module subroutine stdlib_linalg_${ri}$_solve_lu_${ndsuf}$(a,b,x,pivot,overwrite_a,err)
!> Input matrix a[n,n]
${rt}$, intent(inout), target :: a(:,:)
Expand All @@ -321,7 +316,6 @@ module stdlib_linalg
!> [optional] state return flag. On error if not requested, the code will stop
type(linalg_state_type), optional, intent(out) :: err
end subroutine stdlib_linalg_${ri}$_solve_lu_${ndsuf}$
#:endif
#:endfor
#:endfor
end interface solve_lu
Expand All @@ -342,11 +336,9 @@ module stdlib_linalg
!! Supported data types include `real` and `complex`.
!!
!!@note The solution is based on LAPACK's singular value decomposition `*GELSD` methods.
!!@note BLAS/LAPACK backends do not currently support extended precision (``xdp``).
!!
#:for nd,ndsuf,nde in ALL_RHS
#:for rk,rt,ri in RC_KINDS_TYPES
#:if rk!="xdp"
module function stdlib_linalg_${ri}$_lstsq_${ndsuf}$(a,b,cond,overwrite_a,rank,err) result(x)
!> Input matrix a[n,n]
${rt}$, intent(inout), target :: a(:,:)
Expand All @@ -363,7 +355,6 @@ module stdlib_linalg
!> Result array/matrix x[n] or x[n,nrhs]
${rt}$, allocatable, target :: x${nd}$
end function stdlib_linalg_${ri}$_lstsq_${ndsuf}$
#:endif
#:endfor
#:endfor
end interface lstsq
Expand All @@ -385,11 +376,9 @@ module stdlib_linalg
!! are provided, no internal memory allocations take place when using this interface.
!!
!!@note The solution is based on LAPACK's singular value decomposition `*GELSD` methods.
!!@note BLAS/LAPACK backends do not currently support extended precision (``xdp``).
!!
#:for nd,ndsuf,nde in ALL_RHS
#:for rk,rt,ri in RC_KINDS_TYPES
#:if rk!="xdp"
module subroutine stdlib_linalg_${ri}$_solve_lstsq_${ndsuf}$(a,b,x,real_storage,int_storage,&
#{if rt.startswith('c')}#cmpl_storage,#{endif}#cond,singvals,overwrite_a,rank,err)
!> Input matrix a[n,n]
Expand Down Expand Up @@ -417,7 +406,6 @@ module stdlib_linalg
!> [optional] state return flag. On error if not requested, the code will stop
type(linalg_state_type), optional, intent(out) :: err
end subroutine stdlib_linalg_${ri}$_solve_lstsq_${ndsuf}$
#:endif
#:endfor
#:endfor
end interface solve_lstsq
Expand All @@ -438,7 +426,6 @@ module stdlib_linalg
!!
#:for nd,ndsuf,nde in ALL_RHS
#:for rk,rt,ri in RC_KINDS_TYPES
#:if rk!="xdp"
pure module subroutine stdlib_linalg_${ri}$_lstsq_space_${ndsuf}$(a,b,lrwork,liwork#{if rt.startswith('c')}#,lcwork#{endif}#)
!> Input matrix a[m,n]
${rt}$, intent(in), target :: a(:,:)
Expand All @@ -447,7 +434,6 @@ module stdlib_linalg
!> Size of the working space arrays
integer(ilp), intent(out) :: lrwork,liwork#{if rt.startswith('c')}#,lcwork#{endif}#
end subroutine stdlib_linalg_${ri}$_lstsq_space_${ndsuf}$
#:endif
#:endfor
#:endfor
end interface lstsq_space
Expand Down Expand Up @@ -573,7 +559,6 @@ module stdlib_linalg
!! It is possible to use partial storage [m,k] and [k,n], `k=min(m,n)`, choosing `full_matrices=.false.`.
!!
!!@note The solution is based on LAPACK's singular value decomposition `*GESDD` methods.
!!@note BLAS/LAPACK backends do not currently support extended precision (``xdp``).
!!
!!### Example
!!
Expand All @@ -586,7 +571,6 @@ module stdlib_linalg
!!```
!!
#:for rk,rt,ri in RC_KINDS_TYPES
#:if rk!="xdp"
module subroutine stdlib_linalg_svd_${ri}$(a,s,u,vt,overwrite_a,full_matrices,err)
!!### Summary
!! Compute singular value decomposition of a matrix \( A = U \cdot S \cdot \V^T \)
Expand Down Expand Up @@ -622,7 +606,6 @@ module stdlib_linalg
!> [optional] state return flag. On error if not requested, the code will stop
type(linalg_state_type), optional, intent(out) :: err
end subroutine stdlib_linalg_svd_${ri}$
#:endif
#:endfor
end interface svd

Expand All @@ -645,7 +628,6 @@ module stdlib_linalg
!! singular values, with size [min(m,n)].
!!
!!@note The solution is based on LAPACK's singular value decomposition `*GESDD` methods.
!!@note BLAS/LAPACK backends do not currently support extended precision (``xdp``).
!!
!!### Example
!!
Expand All @@ -658,7 +640,6 @@ module stdlib_linalg
!!```
!!
#:for rk,rt,ri in RC_KINDS_TYPES
#:if rk!="xdp"
module function stdlib_linalg_svdvals_${ri}$(a,err) result(s)
!!### Summary
!! Compute singular values \(S \) from the singular-value decomposition of a matrix \( A = U \cdot S \cdot \V^T \).
Expand All @@ -682,7 +663,6 @@ module stdlib_linalg
!> Array of singular values
real(${rk}$), allocatable :: s(:)
end function stdlib_linalg_svdvals_${ri}$
#:endif
#:endfor
end interface svdvals

Expand Down
Loading
Loading