10 #undef NO_FTN_STRING_LEN_AT_END
16 #ifndef LAPACK_FTN_TRAILING_UNDERSCORE
19 #define _DGETRF_ dgetrf
20 #define _DGETRS_ dgetrs
21 #define _DGETRI_ dgetri
22 #define _DGBCON_ dgbcon
24 #define _DGBTRF_ dgbtrf
25 #define _DGBTRS_ dgbtrs
26 #define _DGECON_ dgecon
27 #define _DLANGE_ dlange
29 #define _DGEQRF_ dgeqrf
30 #define _DORMQR_ dormqr
31 #define _DTRTRS_ dtrtrs
32 #define _DTRCON_ dtrcon
33 #define _DPOTRF_ dpotrf
34 #define _DPOTRS_ dpotrs
38 #define _DGEMV_ dgemv_
39 #define _DGETRF_ dgetrf_
40 #define _DGETRS_ dgetrs_
41 #define _DGETRI_ dgetri_
42 #define _DGBCON_ dgbcon_
43 #define _DGBSV_ dgbsv_
44 #define _DGBTRF_ dgbtrf_
45 #define _DGBTRS_ dgbtrs_
46 #define _DGECON_ dgecon_
47 #define _DLANGE_ dlange_
48 #define _DSCAL_ dscal_
49 #define _DGEQRF_ dgeqrf_
50 #define _DORMQR_ dormqr_
51 #define _DTRTRS_ dtrtrs_
52 #define _DTRCON_ dtrcon_
53 #define _DPOTRF_ dpotrf_
54 #define _DPOTRS_ dpotrs_
61 typedef enum {Transpose = 1, NoTranspose = 0} transpose_t;
62 typedef enum {ColMajor = 1, RowMajor = 0} storage_t;
63 typedef enum {UpperTriangular = 0, LowerTriangular = 1} upperlower_t;
64 typedef enum {Left = 0, Right = 1} side_t;
66 const char no_yes[2] = {
'N',
'T'};
67 const char upper_lower[2] = {
'U',
'L'};
68 const char left_right[2] = {
'L',
'R'};
73 #ifdef LAPACK_FTN_STRING_LEN_AT_END
74 int _DGEMV_(
const char* transpose,
75 const integer* m,
const integer* n,
const doublereal* alpha,
76 const doublereal* a,
const integer* lda,
const doublereal* x,
77 const integer* incX,
const doublereal* beta, doublereal* y,
78 const integer* incY, ftnlen trsize);
81 int _DGEMV_(
const char* transpose, ftnlen trsize,
82 const integer* m,
const integer* n,
const doublereal* alpha,
83 const doublereal* a,
const integer* lda,
const doublereal* x,
84 const integer* incX,
const doublereal* beta, doublereal* y,
88 int _DGETRF_(
const integer* m,
const integer* n,
89 doublereal* a, integer* lda, integer* ipiv,
92 #ifdef LAPACK_FTN_STRING_LEN_AT_END
94 int _DGETRS_(
const char* transpose,
const integer* n,
95 const integer* nrhs, doublereal* a,
const integer* lda,
96 integer* ipiv, doublereal* b,
const integer* ldb,
97 integer* info, ftnlen trsize);
101 int _DGETRS_(
const char* transpose, ftnlen trsize,
const integer* n,
102 const integer* nrhs,
const doublereal* a,
const integer* lda,
103 integer* ipiv, doublereal* b,
const integer* ldb, integer* info);
107 int _DGETRI_(
const integer* n, doublereal* a,
const integer* lda,
108 integer* ipiv, doublereal* work, integer* lwork, integer* info);
110 int _DGBSV_(integer* n, integer* kl, integer* ku, integer* nrhs,
111 doublereal* a, integer* lda, integer* ipiv, doublereal* b,
112 integer* ldb, integer* info);
114 int _DGBTRF_(integer* m, integer* n, integer* kl, integer* ku,
115 doublereal* a, integer* lda, integer* ipiv, integer* info);
117 #ifdef LAPACK_FTN_STRING_LEN_AT_END
118 int _DGBTRS_(
const char* trans, integer* n, integer* kl, integer* ku,
119 integer* nrhs, doublereal* a, integer* lda, integer* ipiv,
120 doublereal* b, integer* ldb, integer* info, ftnlen trsize);
122 int _DGBTRS_(
const char* trans, ftnlen trsize,
123 integer* n, integer* kl, integer* ku,
124 integer* nrhs, doublereal* a, integer* lda, integer* ipiv,
125 doublereal* b, integer* ldb, integer* info);
128 int _DSCAL_(integer* n, doublereal* da, doublereal* dx, integer* incx);
130 int _DGEQRF_(
const integer* m,
const integer* n, doublereal* a,
const integer* lda,
131 doublereal* tau, doublereal* work,
const integer* lwork, integer* info);
133 #ifdef LAPACK_FTN_STRING_LEN_AT_END
134 int _DORMQR_(
const char* side,
const char* trans,
const integer* m,
const integer* n,
135 const integer* k, doublereal* a,
const integer* lda,
136 doublereal* tau, doublereal* c,
const integer* ldc,
137 doublereal* work,
const integer* lwork, integer* info, ftnlen sisize, ftnlen trsize);
139 int _DORMQR_(
const char* side, ftnlen sisize,
const char* trans, ftnlen trsize,
const integer* m,
140 const integer* n,
const integer* k, doublereal* a,
const integer* lda,
141 doublereal* tau,doublereal* c,
const integer* ldc,
142 doublereal* work,
const integer* lwork, integer* info);
145 #ifdef LAPACK_FTN_STRING_LEN_AT_END
146 int _DTRTRS_(
const char* uplo,
const char* trans,
const char* diag,
const integer* n,
147 const integer* nrhs, doublereal* a,
const integer* lda,
148 doublereal* b,
const integer* ldb, integer* info,
149 ftnlen upsize, ftnlen trsize, ftnlen disize);
151 int _DTRTRS_(
const char* uplo, ftnlen upsize,
const char* trans, ftnlen trsize,
const char* diag,
152 ftnlen disize,
const integer* n,
const integer* nrhs, doublereal* a,
const integer* lda,
153 doublereal* b,
const integer* ldb, integer* info);
157 #ifdef LAPACK_FTN_STRING_LEN_AT_END
158 int _DTRCON_(
const char* norm,
const char* uplo,
const char* diag,
const integer* n,
159 doublereal* a,
const integer* lda,
const doublereal* rcond,
160 doublereal* work,
const integer* iwork, integer* info, ftnlen nosize,
161 ftnlen upsize, ftnlen disize);
163 int _DTRCON_(
const char* norm, ftnlen nosize,
const char* uplo, ftnlen upsize,
const char* diag,
164 ftnlen disize,
const integer* n, doublereal* a,
const integer* lda,
const doublereal* rcond,
165 doublereal* work,
const integer* iwork, integer* info);
169 #ifdef LAPACK_FTN_STRING_LEN_AT_END
170 int _DPOTRF_(
const char* uplo,
const integer* n, doublereal* a,
const integer* lda, integer* info,
173 int _DPOTRF_(
const char* uplo, ftnlen upsize,
const integer* n, doublereal* a,
const integer* lda,
177 #ifdef LAPACK_FTN_STRING_LEN_AT_END
178 int _DPOTRS_(
const char* uplo,
const integer* n,
const integer* nrhs, doublereal* a,
const integer* lda,
179 doublereal* b,
const integer* ldb, integer* info, ftnlen upsize);
181 int _DPOTRS_(
const char* uplo, ftnlen upsize,
const integer* n,
const integer* nrhs, doublereal* a,
const integer* lda,
182 doublereal* b,
const integer* ldb, integer* info);
186 #ifdef LAPACK_FTN_STRING_LEN_AT_END
187 int _DGECON_(
const char* norm,
const integer* n, doublereal* a,
const integer* lda,
188 const doublereal* rnorm,
const doublereal* rcond,
189 doublereal* work,
const integer* iwork, integer* info, ftnlen nosize);
191 int _DGECON_(
const char* norm, ftnlen nosize,
const integer* n, doublereal* a,
const integer* lda,
192 const doublereal* rnorm,
const doublereal* rcond,
193 doublereal* work,
const integer* iwork, integer* info);
197 #ifdef LAPACK_FTN_STRING_LEN_AT_END
198 int _DGBCON_(
const char* norm,
const integer* n, integer* kl, integer* ku, doublereal* ab,
const integer* ldab,
199 const integer* ipiv,
const doublereal* anorm,
const doublereal* rcond,
200 doublereal* work,
const integer* iwork, integer* info, ftnlen nosize);
202 int _DGBCON_(
const char* norm, ftnlen nosize,
const integer* n, integer* kl, integer* ku, doublereal* ab,
const integer* ldab,
203 const integer* ipiv,
const doublereal* anorm,
const doublereal* rcond,
204 doublereal* work,
const integer* iwork, integer* info);
207 #ifdef LAPACK_FTN_STRING_LEN_AT_END
208 doublereal _DLANGE_(
const char* norm,
const integer* m,
const integer* n, doublereal* a,
const integer* lda,
209 doublereal* work, ftnlen nosize);
211 doublereal _DLANGE_(
const char* norm, ftnlen nosize,
const integer* m,
const integer* n, doublereal* a,
const integer* lda,
219 inline void ct_dgemv(ctlapack::storage_t storage,
220 ctlapack::transpose_t trans,
221 int m,
int n, doublereal alpha,
const doublereal* a,
int lda,
222 const doublereal* x,
int incX, doublereal beta,
223 doublereal* y,
int incY)
225 integer f_m = m, f_n = n, f_lda = lda, f_incX = incX, f_incY = incY;
226 doublereal f_alpha = alpha, f_beta = beta;
228 #ifdef NO_FTN_STRING_LEN_AT_END
229 _DGEMV_(&no_yes[trans], &f_m, &f_n, &f_alpha, a,
230 &f_lda, x, &f_incX, &f_beta, y, &f_incY);
232 #ifdef LAPACK_FTN_STRING_LEN_AT_END
233 _DGEMV_(&no_yes[trans], &f_m, &f_n, &f_alpha, a,
234 &f_lda, x, &f_incX, &f_beta, y, &f_incY, trsize);
236 _DGEMV_(&no_yes[trans], trsize, &f_m, &f_n, &f_alpha, a,
237 &f_lda, x, &f_incX, &f_beta, y, &f_incY);
243 inline void ct_dgbsv(
int n,
int kl,
int ku,
int nrhs,
244 doublereal* a,
int lda, integer* ipiv, doublereal* b,
int ldb,
247 integer f_n = n, f_kl = kl, f_ku = ku, f_nrhs = nrhs, f_lda = lda,
248 f_ldb = ldb, f_info = info;
249 _DGBSV_(&f_n, &f_kl, &f_ku, &f_nrhs, a, &f_lda, ipiv,
254 inline void ct_dgbtrf(
size_t m,
size_t n,
size_t kl,
size_t ku,
255 doublereal* a,
size_t lda, integer* ipiv,
int& info)
257 integer f_m = (int) m;
258 integer f_n = (int) n;
259 integer f_kl = (int) kl;
260 integer f_ku = (int) ku;
261 integer f_lda = (int) lda;
262 integer f_info = info;
263 _DGBTRF_(&f_m, &f_n, &f_kl, &f_ku, a, &f_lda, ipiv, &f_info);
267 inline void ct_dgbtrs(ctlapack::transpose_t trans,
size_t n,
268 size_t kl,
size_t ku,
size_t nrhs, doublereal* a,
size_t lda,
269 integer* ipiv, doublereal* b,
size_t ldb,
int& info)
271 integer f_n = (int) n;
272 integer f_kl = (int) kl;
273 integer f_ku = (int) ku;
274 integer f_nrhs = (int) nrhs;
275 integer f_lda = (int) lda;
276 integer f_ldb = (int) ldb;
277 integer f_info = info;
278 char tr = no_yes[trans];
279 #ifdef NO_FTN_STRING_LEN_AT_END
280 _DGBTRS_(&tr, &f_n, &f_kl, &f_ku, &f_nrhs, a, &f_lda, ipiv,
284 #ifdef LAPACK_FTN_STRING_LEN_AT_END
285 _DGBTRS_(&tr, &f_n, &f_kl, &f_ku, &f_nrhs, a, &f_lda, ipiv,
286 b, &f_ldb, &f_info, trsize);
288 _DGBTRS_(&tr, trsize, &f_n, &f_kl, &f_ku, &f_nrhs, a, &f_lda, ipiv,
295 inline void ct_dgetrf(
size_t m,
size_t n,
296 doublereal* a,
size_t lda, integer* ipiv,
int& info)
298 integer mm = (int) m;
299 integer nn = (int) n;
300 integer ldaa = (int) lda;
301 integer infoo = info;
302 _DGETRF_(&mm, &nn, a, &ldaa, ipiv, &infoo);
306 inline void ct_dgetrs(ctlapack::transpose_t trans,
size_t n,
307 size_t nrhs, doublereal* a,
size_t lda,
308 integer* ipiv, doublereal* b,
size_t ldb,
int& info)
310 integer f_n = (int) n;
311 integer f_lda = (int) lda;
312 integer f_nrhs = (int) nrhs;
313 integer f_ldb = (int) ldb;
314 integer f_info = info;
315 char tr = no_yes[trans];
317 #ifdef NO_FTN_STRING_LEN_AT_END
318 _DGETRS_(&tr, &f_n, &f_nrhs, a, &f_lda, ipiv, b, &f_ldb,
322 #ifdef LAPACK_FTN_STRING_LEN_AT_END
323 _DGETRS_(&tr, &f_n, &f_nrhs, a, &f_lda, ipiv, b, &f_ldb, &f_info, trsize);
325 _DGETRS_(&tr, trsize, &f_n, &f_nrhs, a, &f_lda, ipiv, b, &f_ldb, &f_info);
331 inline void ct_dgetri(
int n, doublereal* a,
int lda, integer* ipiv,
332 doublereal* work,
int lwork,
int& info)
334 integer f_n = n, f_lda = lda, f_lwork = lwork, f_info = info;
335 _DGETRI_(&f_n, a, &f_lda, ipiv, work, &f_lwork, &f_info);
338 inline void ct_dscal(
int n, doublereal da, doublereal* dx,
int incx)
340 integer f_n = n, f_incx = incx;
341 _DSCAL_(&f_n, &da, dx, &f_incx);
344 inline void ct_dgeqrf(
size_t m,
size_t n, doublereal* a,
size_t lda, doublereal* tau,
345 doublereal* work,
size_t lwork,
int& info)
347 integer f_m =
static_cast<integer
>(m);
348 integer f_n =
static_cast<integer
>(n);
349 integer f_lda =
static_cast<integer
>(lda);
350 integer f_lwork =
static_cast<integer
>(lwork);
351 integer f_info = info;
352 _DGEQRF_(&f_m, &f_n, a, &f_lda, tau, work, &f_lwork, &f_info);
356 inline void ct_dormqr(ctlapack::side_t rlside, ctlapack::transpose_t trans,
size_t m,
357 size_t n,
size_t k, doublereal* a,
size_t lda, doublereal* tau, doublereal* c,
size_t ldc,
358 doublereal* work,
size_t lwork,
int& info)
360 char side = left_right[rlside];
361 char tr = no_yes[trans];
362 integer f_m =
static_cast<integer
>(m);
363 integer f_n =
static_cast<integer
>(n);
364 integer f_k =
static_cast<integer
>(k);
365 integer f_lwork =
static_cast<integer
>(lwork);
366 integer f_lda =
static_cast<integer
>(lda);
367 integer f_ldc =
static_cast<integer
>(ldc);
368 integer f_info = info;
369 #ifdef NO_FTN_STRING_LEN_AT_END
370 _DORMQR_(&side, &tr, &f_m, &f_n, &f_k, a, &f_lda, tau, c, &f_ldc, work, &f_lwork, &f_info);
373 #ifdef LAPACK_FTN_STRING_LEN_AT_END
374 _DORMQR_(&side, &tr, &f_m, &f_n, &f_k, a, &f_lda, tau, c, &f_ldc, work, &f_lwork, &f_info, trsize, trsize);
376 _DORMQR_(&side, trsize, &tr, trsize, &f_m, &f_n, &f_k, a, &f_lda, tau, c, &f_ldc, work, &f_lwork, &f_info);
382 inline void ct_dtrtrs(ctlapack::upperlower_t uplot, ctlapack::transpose_t trans,
const char* diag,
383 size_t n,
size_t nrhs, doublereal* a,
size_t lda, doublereal* b,
size_t ldb,
int& info)
385 char uplo = upper_lower[uplot];
386 char tr = no_yes[trans];
391 integer f_n =
static_cast<integer
>(n);
392 integer f_nrhs =
static_cast<integer
>(nrhs);
393 integer f_lda =
static_cast<integer
>(lda);
394 integer f_ldb =
static_cast<integer
>(ldb);
395 integer f_info = info;
396 #ifdef NO_FTN_STRING_LEN_AT_END
397 _DTRTRS_(&uplo, &tr, &dd, &f_n, &f_nrhs, a, &f_lda, b, &f_ldb, &f_info);
400 #ifdef LAPACK_FTN_STRING_LEN_AT_END
401 _DTRTRS_(&uplo, &tr, &dd, &f_n, &f_nrhs, a, &f_lda, b, &f_ldb, &f_info, trsize, trsize, trsize);
403 _DTRTRS_(&uplo, trsize, &tr, trsize, &dd, trsize, &f_n, &f_nrhs, a, &f_lda, b, &f_ldb, &f_info);
414 inline doublereal
ct_dtrcon(
const char* norm, ctlapack::upperlower_t uplot,
const char* diag,
415 size_t n, doublereal* a,
size_t lda, doublereal* work,
int* iwork,
int& info)
417 char uplo = upper_lower[uplot];
426 integer f_n =
static_cast<integer
>(n);
427 integer f_lda =
static_cast<integer
>(lda);
428 integer f_info = info;
430 #ifdef NO_FTN_STRING_LEN_AT_END
431 _DTRCON_(&nn, &uplo, &dd, &f_n, a, &f_lda, &rcond, work, iwork, &f_info);
434 #ifdef LAPACK_FTN_STRING_LEN_AT_END
435 _DTRCON_(&nn, &uplo, &dd, &f_n, a, &f_lda, &rcond, work, iwork, &f_info, trsize, trsize, trsize);
437 _DTRCON_(&nn, trsize, &uplo, trsize, &dd, trsize, &f_n, a, &f_lda, &rcond, work, iwork, &f_info);
445 inline void ct_dpotrf(ctlapack::upperlower_t uplot,
size_t n, doublereal* a,
size_t lda,
int& info)
447 char uplo = upper_lower[uplot];
448 integer f_n =
static_cast<integer
>(n);
449 integer f_lda =
static_cast<integer
>(lda);
450 integer f_info = info;
452 #ifdef NO_FTN_STRING_LEN_AT_END
453 _DPOTRF_(&uplo, &f_n, a, &f_lda, &f_info);
456 #ifdef LAPACK_FTN_STRING_LEN_AT_END
457 _DPOTRF_(&uplo, &f_n, a, &f_lda, &f_info, trsize);
459 _DPOTRF_(&uplo, trsize, &f_n, a, &f_lda, &f_info);
469 inline void ct_dpotrs(ctlapack::upperlower_t uplot,
size_t n,
size_t nrhs, doublereal* a,
size_t lda,
470 doublereal* b,
size_t ldb,
int& info)
472 char uplo = upper_lower[uplot];
473 integer f_n =
static_cast<integer
>(n);
474 integer f_nrhs =
static_cast<integer
>(nrhs);
475 integer f_lda =
static_cast<integer
>(lda);
476 integer f_ldb =
static_cast<integer
>(ldb);
477 integer f_info = info;
479 #ifdef NO_FTN_STRING_LEN_AT_END
480 _DPOTRS_(&uplo, &f_n, &f_nrhs, a, &f_lda, b, &f_ldb, &f_info);
483 #ifdef LAPACK_FTN_STRING_LEN_AT_END
484 _DPOTRS_(&uplo, &f_n, &f_nrhs, a, &f_lda, b, &f_ldb, &f_info, trsize);
486 _DPOTRS_(&uplo, trsize, &f_n, &f_nrhs, a, &f_lda, b, &f_ldb, &f_info);
497 inline doublereal ct_dgecon(
const char norm,
size_t n, doublereal* a,
size_t lda, doublereal anorm,
498 doublereal* work,
int* iwork,
int& info)
504 integer f_n =
static_cast<integer
>(n);
505 integer f_lda =
static_cast<integer
>(lda);
506 integer f_info = info;
509 #ifdef NO_FTN_STRING_LEN_AT_END
510 _DGECON_(&cnorm, &f_n a, &f_lda, &anorm, &rcond, work, iwork, &f_info);
513 #ifdef LAPACK_FTN_STRING_LEN_AT_END
514 _DGECON_(&cnorm, &f_n, a, &f_lda, &anorm, &rcond, work, iwork, &f_info, trsize);
516 _DGECON_(&cnorm, trsize, &f_n, a, &f_lda, &anorm, &rcond, work, iwork, &f_info);
527 inline doublereal ct_dgbcon(
const char norm,
size_t n,
size_t kl,
size_t ku,
528 doublereal* a,
size_t ldab,
int* ipiv, doublereal anorm,
529 doublereal* work,
int* iwork,
int& info)
535 integer f_n =
static_cast<integer
>(n);
536 integer f_kl =
static_cast<integer
>(kl);
537 integer f_ku =
static_cast<integer
>(ku);
538 integer f_ldab =
static_cast<integer
>(ldab);
539 integer f_info = info;
542 #ifdef NO_FTN_STRING_LEN_AT_END
543 _DGBCON_(&cnorm, &f_n , &f_kl, &f_ku, a, &f_ldab, ipiv, &anorm, &rcond, work, iwork, &f_info);
546 #ifdef LAPACK_FTN_STRING_LEN_AT_END
547 _DGBCON_(&cnorm, &f_n, &f_kl, &f_ku, a, &f_ldab, ipiv, &anorm, &rcond, work, iwork, &f_info, trsize);
549 _DGBCON_(&cnorm, trsize, &f_n, &f_kl, &f_ku, a, &f_ldab, ipiv, &anorm, &rcond, work, iwork, &f_info);
560 inline doublereal ct_dlange(
const char norm,
size_t m,
size_t n, doublereal* a,
size_t lda,
567 integer f_m =
static_cast<integer
>(m);
568 integer f_n =
static_cast<integer
>(n);
569 integer f_lda =
static_cast<integer
>(lda);
572 #ifdef NO_FTN_STRING_LEN_AT_END
573 anorm = _DLANGE_(&cnorm, &f_m, &f_n a, &f_lda, work);
576 #ifdef LAPACK_FTN_STRING_LEN_AT_END
577 anorm = _DLANGE_(&cnorm, &f_m, &f_n, a, &f_lda, work, trsize);
579 anorm = _DLANGE_(&cnorm, trsize, &f_m, &f_n, a, &f_lda, work);