Skip to content

Commit 4b5a6e6

Browse files
committed
bbcsd: generalize templated interface
1 parent c0f508f commit 4b5a6e6

File tree

1 file changed

+12
-69
lines changed

1 file changed

+12
-69
lines changed

src/stdlib_linalg_lapack.fypp

+12-69
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ module stdlib_linalg_lapack
1818
!! X = [----------------]
1919
!! [ B21 | B22 0 0 ]
2020
!! [ 0 | 0 0 I ]
21-
!! [ C | -S 0 0 ]
21+
!! [ C | -S 0 0 ]
22+
!!
2223
!! [ U1 | ] [ 0 | 0 -I 0 ] [ V1 | ]**H
2324
!! = [---------] [---------------] [---------] .
2425
!! [ | U2 ] [ S | C 0 0 ] [ | V2 ]
@@ -33,86 +34,28 @@ module stdlib_linalg_lapack
3334
!! The input matrices are pre- or post-multiplied by the appropriate
3435
!! singular vector matrices.
3536
#:for ik,it,ii in LINALG_INT_KINDS_TYPES
37+
#:for rk,rt,ri in RC_KINDS_TYPES
38+
#:if rk in ["sp","dp"]
3639
#ifdef STDLIB_EXTERNAL_LAPACK${ii}$
37-
pure subroutine cbbcsd( jobu1, jobu2, jobv1t, jobv2t, trans, m, p, q,theta, phi, &
38-
u1, ldu1, u2, ldu2, v1t, ldv1t,v2t, ldv2t, b11d, b11e, b12d, b12e, b21d, b21e,b22d,&
39-
b22e, rwork, lrwork, info )
40-
import sp,dp,qp,${ik}$,lk
41-
implicit none(type,external)
42-
character, intent(in) :: jobu1,jobu2,jobv1t,jobv2t,trans
43-
integer(${ik}$), intent(out) :: info
44-
integer(${ik}$), intent(in) :: ldu1,ldu2,ldv1t,ldv2t,lrwork,m,p,q
45-
real(sp), intent(out) :: b11d(*),b11e(*),b12d(*),b12e(*),b21d(*),b21e(*),b22d(&
46-
*),b22e(*),rwork(*)
47-
real(sp), intent(inout) :: phi(*),theta(*)
48-
complex(sp), intent(inout) :: u1(ldu1,*),u2(ldu2,*),v1t(ldv1t,*),v2t(ldv2t,*)
49-
50-
end subroutine cbbcsd
51-
#else
52-
module procedure stdlib${ii}$_cbbcsd
53-
#endif
54-
#ifdef STDLIB_EXTERNAL_LAPACK${ii}$
55-
pure subroutine dbbcsd( jobu1, jobu2, jobv1t, jobv2t, trans, m, p, q,theta, phi, &
56-
u1, ldu1, u2, ldu2, v1t, ldv1t,v2t, ldv2t, b11d, b11e, b12d, b12e, b21d, b21e,b22d,&
57-
b22e, work, lwork, info )
58-
import sp,dp,qp,${ik}$,lk
59-
implicit none(type,external)
60-
character, intent(in) :: jobu1,jobu2,jobv1t,jobv2t,trans
61-
integer(${ik}$), intent(out) :: info
62-
integer(${ik}$), intent(in) :: ldu1,ldu2,ldv1t,ldv2t,lwork,m,p,q
63-
real(dp), intent(out) :: b11d(*),b11e(*),b12d(*),b12e(*),b21d(*),b21e(*),b22d(&
64-
*),b22e(*),work(*)
65-
real(dp), intent(inout) :: phi(*),theta(*),u1(ldu1,*),u2(ldu2,*),v1t(ldv1t,*),&
66-
v2t(ldv2t,*)
67-
end subroutine dbbcsd
68-
#else
69-
module procedure stdlib${ii}$_dbbcsd
70-
#endif
71-
#ifdef STDLIB_EXTERNAL_LAPACK${ii}$
72-
pure subroutine sbbcsd( jobu1, jobu2, jobv1t, jobv2t, trans, m, p, q,theta, phi, &
73-
u1, ldu1, u2, ldu2, v1t, ldv1t,v2t, ldv2t, b11d, b11e, b12d, b12e, b21d, b21e,b22d,&
74-
b22e, work, lwork, info )
75-
import sp,dp,qp,${ik}$,lk
76-
implicit none(type,external)
77-
character, intent(in) :: jobu1,jobu2,jobv1t,jobv2t,trans
78-
integer(${ik}$), intent(out) :: info
79-
integer(${ik}$), intent(in) :: ldu1,ldu2,ldv1t,ldv2t,lwork,m,p,q
80-
real(sp), intent(out) :: b11d(*),b11e(*),b12d(*),b12e(*),b21d(*),b21e(*),b22d(&
81-
*),b22e(*),work(*)
82-
real(sp), intent(inout) :: phi(*),theta(*),u1(ldu1,*),u2(ldu2,*),v1t(ldv1t,*),&
83-
v2t(ldv2t,*)
84-
end subroutine sbbcsd
85-
#else
86-
module procedure stdlib${ii}$_sbbcsd
87-
#endif
88-
#ifdef STDLIB_EXTERNAL_LAPACK${ii}$
89-
pure subroutine zbbcsd( jobu1, jobu2, jobv1t, jobv2t, trans, m, p, q,theta, phi, &
40+
pure subroutine ${ri}$bbcsd( jobu1, jobu2, jobv1t, jobv2t, trans, m, p, q,theta, phi, &
9041
u1, ldu1, u2, ldu2, v1t, ldv1t,v2t, ldv2t, b11d, b11e, b12d, b12e, b21d, b21e,b22d,&
9142
b22e, rwork, lrwork, info )
9243
import sp,dp,qp,${ik}$,lk
9344
implicit none(type,external)
9445
character, intent(in) :: jobu1,jobu2,jobv1t,jobv2t,trans
9546
integer(${ik}$), intent(out) :: info
9647
integer(${ik}$), intent(in) :: ldu1,ldu2,ldv1t,ldv2t,lrwork,m,p,q
97-
real(dp), intent(out) :: b11d(*),b11e(*),b12d(*),b12e(*),b21d(*),b21e(*),b22d(&
98-
*),b22e(*),rwork(*)
99-
real(dp), intent(inout) :: phi(*),theta(*)
100-
complex(dp), intent(inout) :: u1(ldu1,*),u2(ldu2,*),v1t(ldv1t,*),v2t(ldv2t,*)
48+
real(${rk}$), intent(out) :: b11d(*),b11e(*),b12d(*),b12e(*),b21d(*),b21e(*),&
49+
b22d(*),b22e(*),rwork(*)
50+
real(${rk}$), intent(inout) :: phi(*),theta(*)
51+
${rt}$, intent(inout) :: u1(ldu1,*),u2(ldu2,*),v1t(ldv1t,*),v2t(ldv2t,*)
10152

102-
end subroutine zbbcsd
53+
end subroutine ${ri}$bbcsd
10354
#else
104-
module procedure stdlib${ii}$_zbbcsd
105-
#endif
106-
#:for rk,rt,ri in REAL_KINDS_TYPES
107-
#:if not rk in ["sp","dp"]
108-
module procedure stdlib${ii}$_${ri}$bbcsd
109-
11055
#:endif
111-
#:endfor
112-
#:for rk,rt,ri in CMPLX_KINDS_TYPES
113-
#:if not rk in ["sp","dp"]
11456
module procedure stdlib${ii}$_${ri}$bbcsd
115-
57+
#:if rk in ["sp","dp"]
58+
#endif
11659
#:endif
11760
#:endfor
11861
#:endfor

0 commit comments

Comments
 (0)