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 _DGELSS_ dgelss
23 #define _DGBCON_ dgbcon
25 #define _DGBTRF_ dgbtrf
26 #define _DGBTRS_ dgbtrs
27 #define _DGECON_ dgecon
28 #define _DLANGE_ dlange
30 #define _DGEQRF_ dgeqrf
31 #define _DORMQR_ dormqr
32 #define _DTRTRS_ dtrtrs
33 #define _DTRCON_ dtrcon
34 #define _DPOTRF_ dpotrf
35 #define _DPOTRS_ dpotrs
39 #define _DGEMV_ dgemv_
40 #define _DGETRF_ dgetrf_
41 #define _DGETRS_ dgetrs_
42 #define _DGETRI_ dgetri_
43 #define _DGELSS_ dgelss_
44 #define _DGBCON_ dgbcon_
45 #define _DGBSV_ dgbsv_
46 #define _DGBTRF_ dgbtrf_
47 #define _DGBTRS_ dgbtrs_
48 #define _DGECON_ dgecon_
49 #define _DLANGE_ dlange_
50 #define _DSCAL_ dscal_
51 #define _DGEQRF_ dgeqrf_
52 #define _DORMQR_ dormqr_
53 #define _DTRTRS_ dtrtrs_
54 #define _DTRCON_ dtrcon_
55 #define _DPOTRF_ dpotrf_
56 #define _DPOTRS_ dpotrs_
63 typedef enum {Transpose = 1, NoTranspose = 0} transpose_t;
64 typedef enum {ColMajor = 1, RowMajor = 0} storage_t;
65 typedef enum {UpperTriangular = 0, LowerTriangular = 1} upperlower_t;
66 typedef enum {Left = 0, Right = 1} side_t;
68 const char no_yes[2] = {
'N',
'T'};
69 const char upper_lower[2] = {
'U',
'L'};
70 const char left_right[2] = {
'L',
'R'};
75 #ifdef LAPACK_FTN_STRING_LEN_AT_END
76 int _DGEMV_(
const char* transpose,
77 const integer* m,
const integer* n,
const doublereal* alpha,
78 const doublereal* a,
const integer* lda,
const doublereal* x,
79 const integer* incX,
const doublereal* beta, doublereal* y,
80 const integer* incY, ftnlen trsize);
83 int _DGEMV_(
const char* transpose, ftnlen trsize,
84 const integer* m,
const integer* n,
const doublereal* alpha,
85 const doublereal* a,
const integer* lda,
const doublereal* x,
86 const integer* incX,
const doublereal* beta, doublereal* y,
90 int _DGETRF_(
const integer* m,
const integer* n,
91 doublereal* a, integer* lda, integer* ipiv,
94 #ifdef LAPACK_FTN_STRING_LEN_AT_END
96 int _DGETRS_(
const char* transpose,
const integer* n,
97 const integer* nrhs, doublereal* a,
const integer* lda,
98 integer* ipiv, doublereal* b,
const integer* ldb,
99 integer* info, ftnlen trsize);
103 int _DGETRS_(
const char* transpose, ftnlen trsize,
const integer* n,
104 const integer* nrhs,
const doublereal* a,
const integer* lda,
105 integer* ipiv, doublereal* b,
const integer* ldb, integer* info);
109 int _DGETRI_(
const integer* n, doublereal* a,
const integer* lda,
110 integer* ipiv, doublereal* work, integer* lwork, integer* info);
112 int _DGELSS_(
const integer* m,
const integer* n,
const integer* nrhs,
113 doublereal* a,
const integer* lda, doublereal* b,
114 const integer* ldb, doublereal* s,
const doublereal* rcond,
115 integer* rank, doublereal* work, integer* lwork, integer* info);
117 int _DGBSV_(integer* n, integer* kl, integer* ku, integer* nrhs,
118 doublereal* a, integer* lda, integer* ipiv, doublereal* b,
119 integer* ldb, integer* info);
121 int _DGBTRF_(integer* m, integer* n, integer* kl, integer* ku,
122 doublereal* a, integer* lda, integer* ipiv, integer* info);
124 #ifdef LAPACK_FTN_STRING_LEN_AT_END
125 int _DGBTRS_(
const char* trans, integer* n, integer* kl, integer* ku,
126 integer* nrhs, doublereal* a, integer* lda, integer* ipiv,
127 doublereal* b, integer* ldb, integer* info, ftnlen trsize);
129 int _DGBTRS_(
const char* trans, ftnlen trsize,
130 integer* n, integer* kl, integer* ku,
131 integer* nrhs, doublereal* a, integer* lda, integer* ipiv,
132 doublereal* b, integer* ldb, integer* info);
135 int _DSCAL_(integer* n, doublereal* da, doublereal* dx, integer* incx);
137 int _DGEQRF_(
const integer* m,
const integer* n, doublereal* a,
const integer* lda,
138 doublereal* tau, doublereal* work,
const integer* lwork, integer* info);
140 #ifdef LAPACK_FTN_STRING_LEN_AT_END
141 int _DORMQR_(
const char* side,
const char* trans,
const integer* m,
const integer* n,
142 const integer* k, doublereal* a,
const integer* lda,
143 doublereal* tau, doublereal* c,
const integer* ldc,
144 doublereal* work,
const integer* lwork, integer* info, ftnlen sisize, ftnlen trsize);
146 int _DORMQR_(
const char* side, ftnlen sisize,
const char* trans, ftnlen trsize,
const integer* m,
147 const integer* n,
const integer* k, doublereal* a,
const integer* lda,
148 doublereal* tau,doublereal* c,
const integer* ldc,
149 doublereal* work,
const integer* lwork, integer* info);
152 #ifdef LAPACK_FTN_STRING_LEN_AT_END
153 int _DTRTRS_(
const char* uplo,
const char* trans,
const char* diag,
const integer* n,
154 const integer* nrhs, doublereal* a,
const integer* lda,
155 doublereal* b,
const integer* ldb, integer* info,
156 ftnlen upsize, ftnlen trsize, ftnlen disize);
158 int _DTRTRS_(
const char* uplo, ftnlen upsize,
const char* trans, ftnlen trsize,
const char* diag,
159 ftnlen disize,
const integer* n,
const integer* nrhs, doublereal* a,
const integer* lda,
160 doublereal* b,
const integer* ldb, integer* info);
164 #ifdef LAPACK_FTN_STRING_LEN_AT_END
165 int _DTRCON_(
const char* norm,
const char* uplo,
const char* diag,
const integer* n,
166 doublereal* a,
const integer* lda,
const doublereal* rcond,
167 doublereal* work,
const integer* iwork, integer* info, ftnlen nosize,
168 ftnlen upsize, ftnlen disize);
170 int _DTRCON_(
const char* norm, ftnlen nosize,
const char* uplo, ftnlen upsize,
const char* diag,
171 ftnlen disize,
const integer* n, doublereal* a,
const integer* lda,
const doublereal* rcond,
172 doublereal* work,
const integer* iwork, integer* info);
176 #ifdef LAPACK_FTN_STRING_LEN_AT_END
177 int _DPOTRF_(
const char* uplo,
const integer* n, doublereal* a,
const integer* lda, integer* info,
180 int _DPOTRF_(
const char* uplo, ftnlen upsize,
const integer* n, doublereal* a,
const integer* lda,
184 #ifdef LAPACK_FTN_STRING_LEN_AT_END
185 int _DPOTRS_(
const char* uplo,
const integer* n,
const integer* nrhs, doublereal* a,
const integer* lda,
186 doublereal* b,
const integer* ldb, integer* info, ftnlen upsize);
188 int _DPOTRS_(
const char* uplo, ftnlen upsize,
const integer* n,
const integer* nrhs, doublereal* a,
const integer* lda,
189 doublereal* b,
const integer* ldb, integer* info);
193 #ifdef LAPACK_FTN_STRING_LEN_AT_END
194 int _DGECON_(
const char* norm,
const integer* n, doublereal* a,
const integer* lda,
195 const doublereal* rnorm,
const doublereal* rcond,
196 doublereal* work,
const integer* iwork, integer* info, ftnlen nosize);
198 int _DGECON_(
const char* norm, ftnlen nosize,
const integer* n, doublereal* a,
const integer* lda,
199 const doublereal* rnorm,
const doublereal* rcond,
200 doublereal* work,
const integer* iwork, integer* info);
204 #ifdef LAPACK_FTN_STRING_LEN_AT_END
205 int _DGBCON_(
const char* norm,
const integer* n, integer* kl, integer* ku, doublereal* ab,
const integer* ldab,
206 const integer* ipiv,
const doublereal* anorm,
const doublereal* rcond,
207 doublereal* work,
const integer* iwork, integer* info, ftnlen nosize);
209 int _DGBCON_(
const char* norm, ftnlen nosize,
const integer* n, integer* kl, integer* ku, doublereal* ab,
const integer* ldab,
210 const integer* ipiv,
const doublereal* anorm,
const doublereal* rcond,
211 doublereal* work,
const integer* iwork, integer* info);
214 #ifdef LAPACK_FTN_STRING_LEN_AT_END
215 doublereal _DLANGE_(
const char* norm,
const integer* m,
const integer* n, doublereal* a,
const integer* lda,
216 doublereal* work, ftnlen nosize);
218 doublereal _DLANGE_(
const char* norm, ftnlen nosize,
const integer* m,
const integer* n, doublereal* a,
const integer* lda,
226 inline void ct_dgemv(ctlapack::storage_t storage,
227 ctlapack::transpose_t trans,
228 int m,
int n, doublereal alpha,
const doublereal* a,
int lda,
229 const doublereal* x,
int incX, doublereal beta,
230 doublereal* y,
int incY)
232 integer f_m = m, f_n = n, f_lda = lda, f_incX = incX, f_incY = incY;
233 doublereal f_alpha = alpha, f_beta = beta;
235 #ifdef NO_FTN_STRING_LEN_AT_END
236 _DGEMV_(&no_yes[trans], &f_m, &f_n, &f_alpha, a,
237 &f_lda, x, &f_incX, &f_beta, y, &f_incY);
239 #ifdef LAPACK_FTN_STRING_LEN_AT_END
240 _DGEMV_(&no_yes[trans], &f_m, &f_n, &f_alpha, a,
241 &f_lda, x, &f_incX, &f_beta, y, &f_incY, trsize);
243 _DGEMV_(&no_yes[trans], trsize, &f_m, &f_n, &f_alpha, a,
244 &f_lda, x, &f_incX, &f_beta, y, &f_incY);
250 inline void ct_dgbsv(
int n,
int kl,
int ku,
int nrhs,
251 doublereal* a,
int lda, integer* ipiv, doublereal* b,
int ldb,
254 integer f_n = n, f_kl = kl, f_ku = ku, f_nrhs = nrhs, f_lda = lda,
255 f_ldb = ldb, f_info = info;
256 _DGBSV_(&f_n, &f_kl, &f_ku, &f_nrhs, a, &f_lda, ipiv,
261 inline void ct_dgelss(
size_t m,
size_t n,
size_t nrhs, doublereal* a,
262 size_t lda, doublereal* b,
size_t ldb, doublereal* s,
263 doublereal rcond,
size_t& rank, doublereal* work,
264 int& lwork,
int& info)
266 integer f_m =
static_cast<integer
>(m);
267 integer f_n =
static_cast<integer
>(n);
268 integer f_nrhs =
static_cast<integer
>(nrhs);
269 integer f_lda =
static_cast<integer
>(lda);
270 integer f_ldb =
static_cast<integer
>(ldb);
271 integer f_lwork =
static_cast<integer
>(lwork);
272 integer f_rank, f_info;
274 _DGELSS_(&f_m, &f_n, &f_nrhs, a, &f_lda, b, &f_ldb, s, &rcond, &f_rank,
275 work, &f_lwork, &f_info);
277 info =
static_cast<int>(f_info);
278 rank =
static_cast<size_t>(f_rank);
279 lwork =
static_cast<int>(f_lwork);
282 inline void ct_dgbtrf(
size_t m,
size_t n,
size_t kl,
size_t ku,
283 doublereal* a,
size_t lda, integer* ipiv,
int& info)
285 integer f_m = (int) m;
286 integer f_n = (int) n;
287 integer f_kl = (int) kl;
288 integer f_ku = (int) ku;
289 integer f_lda = (int) lda;
290 integer f_info = info;
291 _DGBTRF_(&f_m, &f_n, &f_kl, &f_ku, a, &f_lda, ipiv, &f_info);
295 inline void ct_dgbtrs(ctlapack::transpose_t trans,
size_t n,
296 size_t kl,
size_t ku,
size_t nrhs, doublereal* a,
size_t lda,
297 integer* ipiv, doublereal* b,
size_t ldb,
int& info)
299 integer f_n = (int) n;
300 integer f_kl = (int) kl;
301 integer f_ku = (int) ku;
302 integer f_nrhs = (int) nrhs;
303 integer f_lda = (int) lda;
304 integer f_ldb = (int) ldb;
305 integer f_info = info;
306 char tr = no_yes[trans];
307 #ifdef NO_FTN_STRING_LEN_AT_END
308 _DGBTRS_(&tr, &f_n, &f_kl, &f_ku, &f_nrhs, a, &f_lda, ipiv,
312 #ifdef LAPACK_FTN_STRING_LEN_AT_END
313 _DGBTRS_(&tr, &f_n, &f_kl, &f_ku, &f_nrhs, a, &f_lda, ipiv,
314 b, &f_ldb, &f_info, trsize);
316 _DGBTRS_(&tr, trsize, &f_n, &f_kl, &f_ku, &f_nrhs, a, &f_lda, ipiv,
323 inline void ct_dgetrf(
size_t m,
size_t n,
324 doublereal* a,
size_t lda, integer* ipiv,
int& info)
326 integer mm = (int) m;
327 integer nn = (int) n;
328 integer ldaa = (int) lda;
329 integer infoo = info;
330 _DGETRF_(&mm, &nn, a, &ldaa, ipiv, &infoo);
334 inline void ct_dgetrs(ctlapack::transpose_t trans,
size_t n,
335 size_t nrhs, doublereal* a,
size_t lda,
336 integer* ipiv, doublereal* b,
size_t ldb,
int& info)
338 integer f_n = (int) n;
339 integer f_lda = (int) lda;
340 integer f_nrhs = (int) nrhs;
341 integer f_ldb = (int) ldb;
342 integer f_info = info;
343 char tr = no_yes[trans];
345 #ifdef NO_FTN_STRING_LEN_AT_END
346 _DGETRS_(&tr, &f_n, &f_nrhs, a, &f_lda, ipiv, b, &f_ldb,
350 #ifdef LAPACK_FTN_STRING_LEN_AT_END
351 _DGETRS_(&tr, &f_n, &f_nrhs, a, &f_lda, ipiv, b, &f_ldb, &f_info, trsize);
353 _DGETRS_(&tr, trsize, &f_n, &f_nrhs, a, &f_lda, ipiv, b, &f_ldb, &f_info);
359 inline void ct_dgetri(
int n, doublereal* a,
int lda, integer* ipiv,
360 doublereal* work,
int lwork,
int& info)
362 integer f_n = n, f_lda = lda, f_lwork = lwork, f_info = info;
363 _DGETRI_(&f_n, a, &f_lda, ipiv, work, &f_lwork, &f_info);
366 inline void ct_dscal(
int n, doublereal da, doublereal* dx,
int incx)
368 integer f_n = n, f_incx = incx;
369 _DSCAL_(&f_n, &da, dx, &f_incx);
372 inline void ct_dgeqrf(
size_t m,
size_t n, doublereal* a,
size_t lda, doublereal* tau,
373 doublereal* work,
size_t lwork,
int& info)
375 integer f_m =
static_cast<integer
>(m);
376 integer f_n =
static_cast<integer
>(n);
377 integer f_lda =
static_cast<integer
>(lda);
378 integer f_lwork =
static_cast<integer
>(lwork);
379 integer f_info = info;
380 _DGEQRF_(&f_m, &f_n, a, &f_lda, tau, work, &f_lwork, &f_info);
384 inline void ct_dormqr(ctlapack::side_t rlside, ctlapack::transpose_t trans,
size_t m,
385 size_t n,
size_t k, doublereal* a,
size_t lda, doublereal* tau, doublereal* c,
size_t ldc,
386 doublereal* work,
size_t lwork,
int& info)
388 char side = left_right[rlside];
389 char tr = no_yes[trans];
390 integer f_m =
static_cast<integer
>(m);
391 integer f_n =
static_cast<integer
>(n);
392 integer f_k =
static_cast<integer
>(k);
393 integer f_lwork =
static_cast<integer
>(lwork);
394 integer f_lda =
static_cast<integer
>(lda);
395 integer f_ldc =
static_cast<integer
>(ldc);
396 integer f_info = info;
397 #ifdef NO_FTN_STRING_LEN_AT_END
398 _DORMQR_(&side, &tr, &f_m, &f_n, &f_k, a, &f_lda, tau, c, &f_ldc, work, &f_lwork, &f_info);
401 #ifdef LAPACK_FTN_STRING_LEN_AT_END
402 _DORMQR_(&side, &tr, &f_m, &f_n, &f_k, a, &f_lda, tau, c, &f_ldc, work, &f_lwork, &f_info, trsize, trsize);
404 _DORMQR_(&side, trsize, &tr, trsize, &f_m, &f_n, &f_k, a, &f_lda, tau, c, &f_ldc, work, &f_lwork, &f_info);
410 inline void ct_dtrtrs(ctlapack::upperlower_t uplot, ctlapack::transpose_t trans,
const char* diag,
411 size_t n,
size_t nrhs, doublereal* a,
size_t lda, doublereal* b,
size_t ldb,
int& info)
413 char uplo = upper_lower[uplot];
414 char tr = no_yes[trans];
419 integer f_n =
static_cast<integer
>(n);
420 integer f_nrhs =
static_cast<integer
>(nrhs);
421 integer f_lda =
static_cast<integer
>(lda);
422 integer f_ldb =
static_cast<integer
>(ldb);
423 integer f_info = info;
424 #ifdef NO_FTN_STRING_LEN_AT_END
425 _DTRTRS_(&uplo, &tr, &dd, &f_n, &f_nrhs, a, &f_lda, b, &f_ldb, &f_info);
428 #ifdef LAPACK_FTN_STRING_LEN_AT_END
429 _DTRTRS_(&uplo, &tr, &dd, &f_n, &f_nrhs, a, &f_lda, b, &f_ldb, &f_info, trsize, trsize, trsize);
431 _DTRTRS_(&uplo, trsize, &tr, trsize, &dd, trsize, &f_n, &f_nrhs, a, &f_lda, b, &f_ldb, &f_info);
442 inline doublereal
ct_dtrcon(
const char* norm, ctlapack::upperlower_t uplot,
const char* diag,
443 size_t n, doublereal* a,
size_t lda, doublereal* work,
int* iwork,
int& info)
445 char uplo = upper_lower[uplot];
454 integer f_n =
static_cast<integer
>(n);
455 integer f_lda =
static_cast<integer
>(lda);
456 integer f_info = info;
458 #ifdef NO_FTN_STRING_LEN_AT_END
459 _DTRCON_(&nn, &uplo, &dd, &f_n, a, &f_lda, &rcond, work, iwork, &f_info);
462 #ifdef LAPACK_FTN_STRING_LEN_AT_END
463 _DTRCON_(&nn, &uplo, &dd, &f_n, a, &f_lda, &rcond, work, iwork, &f_info, trsize, trsize, trsize);
465 _DTRCON_(&nn, trsize, &uplo, trsize, &dd, trsize, &f_n, a, &f_lda, &rcond, work, iwork, &f_info);
473 inline void ct_dpotrf(ctlapack::upperlower_t uplot,
size_t n, doublereal* a,
size_t lda,
int& info)
475 char uplo = upper_lower[uplot];
476 integer f_n =
static_cast<integer
>(n);
477 integer f_lda =
static_cast<integer
>(lda);
478 integer f_info = info;
480 #ifdef NO_FTN_STRING_LEN_AT_END
481 _DPOTRF_(&uplo, &f_n, a, &f_lda, &f_info);
484 #ifdef LAPACK_FTN_STRING_LEN_AT_END
485 _DPOTRF_(&uplo, &f_n, a, &f_lda, &f_info, trsize);
487 _DPOTRF_(&uplo, trsize, &f_n, a, &f_lda, &f_info);
497 inline void ct_dpotrs(ctlapack::upperlower_t uplot,
size_t n,
size_t nrhs, doublereal* a,
size_t lda,
498 doublereal* b,
size_t ldb,
int& info)
500 char uplo = upper_lower[uplot];
501 integer f_n =
static_cast<integer
>(n);
502 integer f_nrhs =
static_cast<integer
>(nrhs);
503 integer f_lda =
static_cast<integer
>(lda);
504 integer f_ldb =
static_cast<integer
>(ldb);
505 integer f_info = info;
507 #ifdef NO_FTN_STRING_LEN_AT_END
508 _DPOTRS_(&uplo, &f_n, &f_nrhs, a, &f_lda, b, &f_ldb, &f_info);
511 #ifdef LAPACK_FTN_STRING_LEN_AT_END
512 _DPOTRS_(&uplo, &f_n, &f_nrhs, a, &f_lda, b, &f_ldb, &f_info, trsize);
514 _DPOTRS_(&uplo, trsize, &f_n, &f_nrhs, a, &f_lda, b, &f_ldb, &f_info);
525 inline doublereal ct_dgecon(
const char norm,
size_t n, doublereal* a,
size_t lda, doublereal anorm,
526 doublereal* work,
int* iwork,
int& info)
532 integer f_n =
static_cast<integer
>(n);
533 integer f_lda =
static_cast<integer
>(lda);
534 integer f_info = info;
537 #ifdef NO_FTN_STRING_LEN_AT_END
538 _DGECON_(&cnorm, &f_n a, &f_lda, &anorm, &rcond, work, iwork, &f_info);
541 #ifdef LAPACK_FTN_STRING_LEN_AT_END
542 _DGECON_(&cnorm, &f_n, a, &f_lda, &anorm, &rcond, work, iwork, &f_info, trsize);
544 _DGECON_(&cnorm, trsize, &f_n, a, &f_lda, &anorm, &rcond, work, iwork, &f_info);
555 inline doublereal ct_dgbcon(
const char norm,
size_t n,
size_t kl,
size_t ku,
556 doublereal* a,
size_t ldab,
int* ipiv, doublereal anorm,
557 doublereal* work,
int* iwork,
int& info)
563 integer f_n =
static_cast<integer
>(n);
564 integer f_kl =
static_cast<integer
>(kl);
565 integer f_ku =
static_cast<integer
>(ku);
566 integer f_ldab =
static_cast<integer
>(ldab);
567 integer f_info = info;
570 #ifdef NO_FTN_STRING_LEN_AT_END
571 _DGBCON_(&cnorm, &f_n , &f_kl, &f_ku, a, &f_ldab, ipiv, &anorm, &rcond, work, iwork, &f_info);
574 #ifdef LAPACK_FTN_STRING_LEN_AT_END
575 _DGBCON_(&cnorm, &f_n, &f_kl, &f_ku, a, &f_ldab, ipiv, &anorm, &rcond, work, iwork, &f_info, trsize);
577 _DGBCON_(&cnorm, trsize, &f_n, &f_kl, &f_ku, a, &f_ldab, ipiv, &anorm, &rcond, work, iwork, &f_info);
588 inline doublereal ct_dlange(
const char norm,
size_t m,
size_t n, doublereal* a,
size_t lda,
595 integer f_m =
static_cast<integer
>(m);
596 integer f_n =
static_cast<integer
>(n);
597 integer f_lda =
static_cast<integer
>(lda);
600 #ifdef NO_FTN_STRING_LEN_AT_END
601 anorm = _DLANGE_(&cnorm, &f_m, &f_n a, &f_lda, work);
604 #ifdef LAPACK_FTN_STRING_LEN_AT_END
605 anorm = _DLANGE_(&cnorm, &f_m, &f_n, a, &f_lda, work, trsize);
607 anorm = _DLANGE_(&cnorm, trsize, &f_m, &f_n, a, &f_lda, work);
This file contains definitions of terms that are used in internal routines and are unlikely to need m...
doublereal ct_dtrcon(const char *norm, ctlapack::upperlower_t uplot, const char *diag, size_t n, doublereal *a, size_t lda, doublereal *work, int *iwork, int &info)