Skip to content

Commit 16db44a

Browse files
committed
generalize roundup_lwork
1 parent 87a76f2 commit 16db44a

File tree

1 file changed

+18
-102
lines changed

1 file changed

+18
-102
lines changed

src/stdlib_linalg_lapack_aux.fypp

Lines changed: 18 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ module stdlib_linalg_lapack_aux
88

99

1010
public :: sp,dp,qp,lk,ilp
11-
public :: stdlib_chla_transtype
12-
public :: stdlib_droundup_lwork
11+
public :: stdlib_chla_transtype
1312
public :: stdlib_icmax1
1413
public :: stdlib_ieeeck
1514
public :: stdlib_iladiag
@@ -22,29 +21,24 @@ module stdlib_linalg_lapack_aux
2221
public :: stdlib_iparmq
2322
public :: stdlib_izmax1
2423
public :: stdlib_lsamen
25-
public :: stdlib_sroundup_lwork
2624
public :: stdlib_xerbla
2725
public :: stdlib_xerbla_array
2826

29-
#:for rk,rt,ri in REAL_KINDS_TYPES
27+
#:for rk,rt,ri in RC_KINDS_TYPES
3028
public :: stdlib_ila${ri}$lc
3129
public :: stdlib_ila${ri}$lr
30+
public :: stdlib_select_${ri}$
31+
public :: stdlib_selctg_${ri}$
32+
#:endfor
33+
34+
#:for rk,rt,ri in REAL_KINDS_TYPES
35+
public :: stdlib_${ri}$roundup_lwork
3236
#:endfor
3337

34-
#:if WITH_QP
35-
public :: stdlib_qroundup_lwork
36-
#:endif
37-
#:if WITH_QP
38-
public :: stdlib_ilaqiag
39-
#:endif
4038
#:if WITH_QP
4139
public :: stdlib_iwmax1
4240
#:endif
4341

44-
#:for rk,rt,ri in RC_KINDS_TYPES
45-
public :: stdlib_select_${ri}$
46-
public :: stdlib_selctg_${ri}$
47-
#:endfor
4842

4943
! SELCTG is a LOGICAL FUNCTION of three DOUBLE PRECISION arguments
5044
! used to select eigenvalues to sort to the top left of the Schur form.
@@ -110,29 +104,6 @@ module stdlib_linalg_lapack_aux
110104
return
111105
end function stdlib_chla_transtype
112106

113-
114-
pure real(dp) function stdlib_droundup_lwork( lwork )
115-
!! DROUNDUP_LWORK >= LWORK.
116-
!! DROUNDUP_LWORK is guaranteed to have zero decimal part.
117-
! -- lapack auxiliary routine --
118-
! -- lapack is a software package provided by univ. of tennessee, --
119-
! -- univ. of california berkeley, univ. of colorado denver and nag ltd..--
120-
! Scalar Arguments
121-
integer(ilp), intent(in) :: lwork
122-
! =====================================================================
123-
! Intrinsic Functions
124-
intrinsic :: epsilon,real,int
125-
! Executable Statements
126-
stdlib_droundup_lwork = real( lwork,KIND=dp)
127-
if( int( stdlib_droundup_lwork,KIND=ilp) < lwork ) then
128-
! force round up of lwork
129-
stdlib_droundup_lwork = stdlib_droundup_lwork * ( 1.0e+0_dp + epsilon(0.0e+0_dp) )
130-
131-
endif
132-
return
133-
end function stdlib_droundup_lwork
134-
135-
136107
pure integer(ilp) function stdlib_icmax1( n, cx, incx )
137108
!! ICMAX1 finds the index of the first vector element of maximum absolute value.
138109
!! Based on ICAMAX from Level 1 BLAS.
@@ -611,34 +582,10 @@ module stdlib_linalg_lapack_aux
611582
return
612583
end function stdlib_lsamen
613584

614-
615-
pure real(sp) function stdlib_sroundup_lwork( lwork )
616-
!! SROUNDUP_LWORK >= LWORK.
617-
!! SROUNDUP_LWORK is guaranteed to have zero decimal part.
618-
! -- lapack auxiliary routine --
619-
! -- lapack is a software package provided by univ. of tennessee, --
620-
! -- univ. of california berkeley, univ. of colorado denver and nag ltd..--
621-
! Scalar Arguments
622-
integer(ilp), intent(in) :: lwork
623-
! =====================================================================
624-
! Intrinsic Functions
625-
intrinsic :: epsilon,real,int
626-
! Executable Statements
627-
stdlib_sroundup_lwork = real( lwork,KIND=sp)
628-
if( int( stdlib_sroundup_lwork,KIND=ilp) < lwork ) then
629-
! force round up of lwork
630-
stdlib_sroundup_lwork = stdlib_sroundup_lwork * ( 1.0e+0_sp + epsilon(0.0e+0_sp) )
631-
632-
endif
633-
return
634-
end function stdlib_sroundup_lwork
635-
636-
#:if WITH_QP
637-
638-
639-
pure real(qp) function stdlib_qroundup_lwork( lwork )
640-
!! DROUNDUP_LWORK >= LWORK.
641-
!! DROUNDUP_LWORK is guaranteed to have zero decimal part.
585+
#:for rk,rt,ri in REAL_KINDS_TYPES
586+
pure real(${rk}$) function stdlib_${ri}$roundup_lwork( lwork )
587+
!! ROUNDUP_LWORK >= LWORK.
588+
!! ROUNDUP_LWORK is guaranteed to have zero decimal part.
642589
! -- lapack auxiliary routine --
643590
! -- lapack is a software package provided by univ. of tennessee, --
644591
! -- univ. of california berkeley, univ. of colorado denver and nag ltd..--
@@ -648,46 +595,15 @@ module stdlib_linalg_lapack_aux
648595
! Intrinsic Functions
649596
intrinsic :: epsilon,real,int
650597
! Executable Statements
651-
stdlib_qroundup_lwork = real( lwork,KIND=qp)
652-
if( int( stdlib_qroundup_lwork,KIND=ilp) < lwork ) then
598+
stdlib_${ri}$roundup_lwork = real(lwork,KIND=${rk}$)
599+
if (int( stdlib_${ri}$roundup_lwork,KIND=ilp)<lwork) then
653600
! force round up of lwork
654-
stdlib_qroundup_lwork = stdlib_qroundup_lwork * ( 1.0e+0_qp + epsilon(0.0e+0_qp) )
655-
601+
stdlib_${ri}$roundup_lwork = stdlib_${ri}$roundup_lwork * (1.0e+0_${rk}$ + epsilon(0.0e+0_${rk}$))
656602
endif
657603
return
658-
end function stdlib_qroundup_lwork
659-
#:endif
660-
661-
#:if WITH_QP
662-
663-
integer(ilp) function stdlib_ilaqiag( diag )
664-
!! This subroutine translated from a character string specifying if a
665-
!! matrix has unit diagonal or not to the relevant BLAST-specified
666-
!! integer constant.
667-
!! ILADIAG: returns an INTEGER. If ILADIAG: < 0, then the input is not a
668-
!! character indicating a unit or non-unit diagonal. Otherwise ILADIAG
669-
!! returns the constant value corresponding to DIAG.
670-
! -- lapack computational routine --
671-
! -- lapack is a software package provided by univ. of tennessee, --
672-
! -- univ. of california berkeley, univ. of colorado denver and nag ltd..--
673-
! Scalar Arguments
674-
character :: diag
675-
! =====================================================================
676-
! Parameters
677-
integer(ilp), parameter :: blas_non_unit_qiag = 131
678-
integer(ilp), parameter :: blas_unit_qiag = 132
679-
680-
! Executable Statements
681-
if( stdlib_lsame( diag, 'N' ) ) then
682-
stdlib_ilaqiag = blas_non_unit_qiag
683-
else if( stdlib_lsame( diag, 'U' ) ) then
684-
stdlib_ilaqiag = blas_unit_qiag
685-
else
686-
stdlib_ilaqiag = -1
687-
end if
688-
return
689-
end function stdlib_ilaqiag
690-
#:endif
604+
end function stdlib_${ri}$roundup_lwork
605+
606+
#:endfor
691607

692608
#:for rk,rt,ri in RC_KINDS_TYPES
693609
pure integer(ilp) function stdlib_ila${ri}$lc( m, n, a, lda )

0 commit comments

Comments
 (0)