-
Notifications
You must be signed in to change notification settings - Fork 3
/
lap.h
167 lines (139 loc) · 5.07 KB
/
lap.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
/*
* lap.h
* Copyright (C) 2007, Tomasz Koziara (t.koziara AT gmail.com)
* --------------------------------------------------------------
* LAPACK interface
*/
/* This file is part of Solfec.
* Solfec is free software: you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
* Solfec is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with Solfec. If not, see <http://www.gnu.org/licenses/>. */
#ifndef __lapack__
#define __lapack__
int dgetrf_ (int *m, int *n,
double *a, int *lda, int *ipiv, int *info);
int dgetrs_ (char *trans, int *n, int *nrhs, double *a,
int *lda, int *ipiv, double *b, int *ldb, int *info);
int dgesv_ (int *n, int *nrhs, double *a, int *lda,
int *ipiv, double *b, int *ldb, int *info);
int dgels_ (char *trans, int *m, int *n, int *nrhs, double *a, int *lda,
double *b, int *ldb, double *work, int *lwork, int *info);
int dgetri_ (int *n,double *a, int *lda,
int *ipiv, double *work, int *lwork, int *info);
int dpotrf_ (char *uplo, int *n,
double *a, int *lda, int *info);
int dpotrs_ (char *uplo, int *n, int *nrhs, double *a,
int *lda, double *b, int *ldb, int *info);
int dposv_ (char *uplo, int *n, int *nrhs, double *a, int *lda,
double *b, int *ldb, int *info);
int dpotri_ (char *uplo, int *n, double *a, int *lda, int *info);
int dgesvd_ (char *jobu, char *jobvt, int *m, int *n,
double *a, int *lda, double *s, double *u, int * ldu,
double *vt, int *ldvt, double *work, int *lwork, int *info);
/* old simple eigenvalue driver */
int dsyev_ (char *jobz, char *uplo, int *n, double *a,
int *lda, double *w, double *work, int *lwork, int *info);
/* the fastest current eigenvalue driver (Dhillon & Parlett) */
int dsyevr_ (char *jobz, char *range, char *uplo, int *n, double *a,
int *lda, double *vl, double *vu, int *il, int *iu, double *abstol,
int *m, double *w, double *z, int *ldz, int *isuppz, double *work,
int *lwork, int *iwork, int *liwork, int *info);
/* another eigenvalue dirver needed by BLOPEX */
int dsygv_ (int *itype, char *jobz, char *uplo, int *n, double *a,
int *lda, double *b, int *ldb, double *w,
double *work, int *lwork, int *info);
inline static int lapack_dgetrf (int m,
int n, double *a, int lda, int *ipiv)
{
int info;
dgetrf_ (&m, &n, a, &lda, ipiv, &info);
return info;
}
inline static int lapack_dgetrs (char trans, int n,
int nrhs, double *a, int lda, int *ipiv, double *b, int ldb)
{
int info;
dgetrs_ (&trans, &n, &nrhs, a, &lda, ipiv, b, &ldb, &info);
return info;
}
inline static int lapack_dgesv (int n,
int nrhs, double *a, int lda, int *ipiv, double *b, int ldb)
{
int info;
dgesv_ (&n, &nrhs, a, &lda, ipiv, b, &ldb, &info);
return info;
}
inline static int lapack_dgels (char trans, int m, int n, int nrhs,
double *a, int lda, double *b, int ldb, double *work, int lwork)
{
int info;
dgels_ (&trans, &m, &n, &nrhs, a, &lda, b, &ldb, work, &lwork, &info);
return info;
}
inline static int lapack_dgetri (int n,double *a,
int lda, int *ipiv, double *work, int lwork)
{
int info;
dgetri_ (&n, a, &lda, ipiv, work, &lwork, &info);
return info;
}
inline static int lapack_dpotrf (char uplo, int n, double *a, int lda)
{
int info;
dpotrf_ (&uplo, &n, a, &lda, &info);
return info;
}
inline static int lapack_dpotrs (char uplo, int n, int nrhs, double *a, int lda, double *b, int ldb)
{
int info;
dpotrs_ (&uplo, &n, &nrhs, a, &lda, b, &ldb, &info);
return info;
}
inline static int lapack_dposv (char uplo, int n, int nrhs, double *a, int lda, double *b, int ldb)
{
int info;
dposv_ (&uplo, &n, &nrhs, a, &lda, b, &ldb, &info);
return info;
}
inline static int lapack_dpotri (char uplo, int n, double *a, int lda)
{
int info;
dpotri_ (&uplo, &n, a, &lda, &info);
return info;
}
inline static int lapack_dgesvd (char jobu, char jobvt,
int m, int n, double *a, int lda, double *s, double *u,
int ldu, double *vt, int ldvt, double *work, int lwork)
{
int info;
dgesvd_ (&jobu, &jobvt, &m, &n, a, &lda, s,
u, &ldu, vt, &ldvt, work, &lwork, &info);
return info;
}
inline static int lapack_dsyev (char jobz, char uplo, int n, double *a,
int lda, double *w, double *work, int lwork)
{
int info;
dsyev_ (&jobz, &uplo, &n, a,
&lda, w, work, &lwork, &info);
return info;
}
inline static int lapack_dsyevr (char jobz, char range, char uplo, int n, double *a,
int lda, double vl, double vu, int il, int iu, double abstol, int *m, double *w,
double *z, int ldz, int *isuppz, double *work, int lwork, int *iwork, int liwork)
{
int info;
dsyevr_ (&jobz, &range, &uplo, &n, a, &lda, &vl, &vu, &il, &iu, &abstol,
m, w, z, &ldz, isuppz, work, &lwork, iwork, &liwork, &info);
return info;
}
#endif