forked from mjlaine/mcmcf90
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlapack_inc.h
190 lines (173 loc) · 5.27 KB
/
lapack_inc.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
!!! lapack and blas interfaces -*- mode: F90; -*-
!!! blas routines used in mcmc-code
!!! dcopy (dsymv) dtrmv (dsyr)
!!! daxpy dswap (if linpack)
!!! integer is now assumed 4 byte, this can be a problem in some implementations
!!! BLAS
! dcopy
INTERFACE
SUBROUTINE DCOPY(N,DX,INCX,DY,INCY)
INTEGER(KIND=4) :: N
REAL(KIND=8) :: DX(*)
INTEGER(KIND=4) :: INCX
REAL(KIND=8) :: DY(*)
INTEGER(KIND=4) :: INCY
END SUBROUTINE DCOPY
END INTERFACE
INTERFACE
SUBROUTINE DSCAL(N,A,X,INCX)
INTEGER(KIND=4) :: N
REAL(KIND=8) :: A
REAL(KIND=8) :: X(*)
INTEGER(KIND=4) :: INCX
END SUBROUTINE DSCAL
END INTERFACE
INTERFACE
SUBROUTINE DSYMV(UPLO,N,ALPHA,A,LDA,X,INCX,BETA,Y,INCY)
INTEGER(KIND=4) :: LDA
CHARACTER(LEN=1) :: UPLO
INTEGER(KIND=4) :: N
REAL(KIND=8) :: ALPHA
REAL(KIND=8) :: A(LDA,*)
REAL(KIND=8) :: X(*)
INTEGER(KIND=4) :: INCX
REAL(KIND=8) :: BETA
REAL(KIND=8) :: Y(*)
INTEGER(KIND=4) :: INCY
END SUBROUTINE DSYMV
END INTERFACE
INTERFACE
SUBROUTINE DTRMV(UPLO,TRANS,DIAG,N,A,LDA,X,INCX)
INTEGER(KIND=4) :: LDA
CHARACTER(LEN=1) :: UPLO
CHARACTER(LEN=1) :: TRANS
CHARACTER(LEN=1) :: DIAG
INTEGER(KIND=4) :: N
REAL(KIND=8) :: A(LDA,*)
REAL(KIND=8) :: X(*)
INTEGER(KIND=4) :: INCX
END SUBROUTINE DTRMV
END INTERFACE
INTERFACE
SUBROUTINE DGEMV(TRANS,M,N,ALPHA,A,LDA,X,INCX,BETA,Y,INCY)
INTEGER(KIND=4) :: LDA
CHARACTER(LEN=1) :: TRANS
INTEGER(KIND=4) :: M
INTEGER(KIND=4) :: N
REAL(KIND=8) :: ALPHA
REAL(KIND=8) :: A(LDA,*)
REAL(KIND=8) :: X(*)
INTEGER(KIND=4) :: INCX
REAL(KIND=8) :: BETA
REAL(KIND=8) :: Y(*)
INTEGER(KIND=4) :: INCY
END SUBROUTINE DGEMV
END INTERFACE
! rank one update of symmetric matrix
INTERFACE
SUBROUTINE DSYR(UPLO,N,ALPHA,X,INCX,A,LDA)
INTEGER(KIND=4) :: LDA
CHARACTER(LEN=1) :: UPLO
INTEGER(KIND=4) :: N
REAL(KIND=8) :: ALPHA
REAL(KIND=8) :: X(*)
INTEGER(KIND=4) :: INCX
REAL(KIND=8) :: A(LDA,*)
END SUBROUTINE DSYR
END INTERFACE
!!! LAPACK
! dpotrf, dpotri
INTERFACE
SUBROUTINE DPOTRF(UPLO,N,A,LDA,INFO)
INTEGER(KIND=4) :: LDA
CHARACTER(LEN=1) :: UPLO
INTEGER(KIND=4) :: N
REAL(KIND=8) :: A(LDA,*)
INTEGER(KIND=4) :: INFO
END SUBROUTINE DPOTRF
END INTERFACE
INTERFACE
SUBROUTINE DPOTRI(UPLO,N,A,LDA,INFO)
INTEGER(KIND=4) :: LDA
CHARACTER(LEN=1) :: UPLO
INTEGER(KIND=4) :: N
REAL(KIND=8) :: A(LDA,*)
INTEGER(KIND=4) :: INFO
END SUBROUTINE DPOTRI
END INTERFACE
interface
subroutine dgesvd(jobu,jobvt,m,n,a,lda,s,u,ldu,vt,ldvt,work,lwork,info)
implicit none
character(len=1), intent(in) :: jobu, jobvt
integer(kind=4), intent(in) :: lda, ldu, ldvt, lwork, m, n
integer(kind=4), intent(out) :: info
real(kind=8),intent(inout) :: a(lda,*)
real(kind=8),intent(out) :: s(*), u(ldu,*),vt(ldvt,*),work(*)
end subroutine dgesvd
end interface
!!! symmetric linear solver
!! C = alpha*A*A'+beta*C
interface
subroutine dsyrk(uplo,trans,n,k,alpha,a,lda,beta,c,ldc)
implicit none
character(len=1), intent(in) :: uplo, trans
integer(kind=4), intent(in) :: n, k, lda, ldc
real(kind=8), intent(in) :: alpha, beta
real(kind=8), intent(in) :: a(lda,*)
real(kind=8), intent(inout) :: c(ldc,*)
end subroutine dsyrk
end interface
!! B = A\B, A general n*n
interface
subroutine dgesv(n, nrhs, a, lda, ipiv, b, ldb, info)
implicit none
integer(kind=4), intent(in) :: n, nrhs, lda, ldb
real(kind=8), intent(inout) :: a(lda,n), b(ldb,n)
integer(kind=4), intent(out) :: ipiv(n)
integer(kind=4), intent(out) :: info
end subroutine dgesv
end interface
!! B = A\B, A symmetric n*n
interface
subroutine dposv(uplo, n, nrhs, a, lda, b, ldb, info)
implicit none
character(len=1), intent(in) :: uplo
integer(kind=4), intent(in) :: n, nrhs, lda, ldb
real(kind=8), intent(inout) :: a(lda,n), b(ldb,n)
integer(kind=4), intent(out) :: info
end subroutine dposv
end interface
interface
subroutine dgels(trans, m, n, nrhs, a, lda, b, ldb, work, lwork, info)
implicit none
character(len=1), intent(in) :: trans
integer(kind=4), intent(in) :: m, n, nrhs, lda, ldb, lwork
real(kind=8), intent(inout) :: a(lda,n), b(ldb,nrhs)
real(kind=8), intent(inout) :: work(lwork)
integer(kind=4), intent(out) :: info
end subroutine dgels
end interface
interface
logical function disnan(x)
real(kind=8), intent(in) :: x
end function disnan
end interface
interface
subroutine dsytrf( uplo, n, a, lda, ipiv, work, lwork, info )
implicit none
character(len=1), intent(in) :: uplo
integer(kind=4), intent(in) :: n, lda, lwork
real(kind=8), intent(inout) :: a(lda,n)
real(kind=8), intent(inout) :: work(lwork)
integer(kind=4), intent(out) :: ipiv(n), info
end subroutine dsytrf
subroutine dsytri( uplo, n, a, lda, ipiv, work, info )
implicit none
character(len=1), intent(in) :: uplo
integer(kind=4), intent(in) :: n, lda
real(kind=8), intent(inout) :: a(lda,n)
real(kind=8), intent(inout) :: work(n)
integer(kind=4), intent(in) :: ipiv(n)
integer(kind=4), intent(out) :: info
end subroutine dsytri
end interface