19 #ifndef AMESOS2_SUPERLU_FUNCTIONMAP_HPP
20 #define AMESOS2_SUPERLU_FUNCTIONMAP_HPP
22 #ifdef HAVE_TEUCHOS_COMPLEX
44 #include "supermatrix.h"
46 #include "superlu_enum_consts.h"
63 extern float slangs (
char *, SLU::SuperMatrix *);
65 extern void sgscon (
char *, SuperMatrix *, SuperMatrix *,
66 float,
float *, SuperLUStat_t*,
int *);
69 sCompRow_to_CompCol(
int,
int,
int,
float*,
int*,
int*,
70 float **,
int **,
int **);
72 sgssvx(SLU::superlu_options_t *, SLU::SuperMatrix *,
int *,
int *,
int *,
73 char *,
float *,
float *, SLU::SuperMatrix *, SLU::SuperMatrix *,
74 void *,
int, SLU::SuperMatrix *, SLU::SuperMatrix *,
75 float *,
float *,
float *,
float *,
76 #ifdef HAVE_AMESOS2_SUPERLU5_API
79 SLU::mem_usage_t *, SLU::SuperLUStat_t *,
int *);
81 sgstrf (SLU::superlu_options_t*, SLU::SuperMatrix*,
82 int,
int,
int*,
void *,
int,
int *,
int *,
83 SLU::SuperMatrix *, SLU::SuperMatrix *,
84 #ifdef HAVE_AMESOS2_SUPERLU5_API
87 SLU::SuperLUStat_t*,
int *);
89 sgsisx(SLU::superlu_options_t *, SLU::SuperMatrix *,
int *,
int *,
int *,
90 char *,
float *,
float *, SLU::SuperMatrix *, SLU::SuperMatrix *,
91 void *,
int, SLU::SuperMatrix *, SLU::SuperMatrix *,
93 #ifdef HAVE_AMESOS2_SUPERLU5_API
96 SLU::mem_usage_t *, SLU::SuperLUStat_t *,
int *);
98 sgsitrf (SLU::superlu_options_t*, SLU::SuperMatrix*,
99 int,
int,
int*,
void *,
int,
int *,
int *,
100 SLU::SuperMatrix *, SLU::SuperMatrix *,
101 #ifdef HAVE_AMESOS2_SUPERLU5_API
104 SLU::SuperLUStat_t*,
int *);
106 sCreate_CompCol_Matrix(SLU::SuperMatrix *,
int,
int,
int,
float *,
107 int *,
int *, SLU::Stype_t, SLU::Dtype_t, SLU::Mtype_t);
109 sCreate_CompRow_Matrix(SLU::SuperMatrix *,
int,
int,
int,
float *,
110 int *,
int *, SLU::Stype_t, SLU::Dtype_t, SLU::Mtype_t);
112 sCreate_Dense_Matrix(SLU::SuperMatrix *,
int,
int,
float *,
int,
113 SLU::Stype_t, SLU::Dtype_t, SLU::Mtype_t);
116 sgsequ (SLU::SuperMatrix *,
float *,
float *,
float *,
117 float *,
float *,
int *);
120 slaqgs (SLU::SuperMatrix *,
float *,
float *,
float,
121 float,
float,
char *);
128 extern double dlangs (
char *, SLU::SuperMatrix *);
130 extern void dgscon (
char *, SuperMatrix *, SuperMatrix *,
131 double,
double *, SuperLUStat_t*,
int *);
134 dCompRow_to_CompCol(
int,
int,
int,
double*,
int*,
int*,
135 double **,
int **,
int **);
137 dgssvx(SLU::superlu_options_t *, SLU::SuperMatrix *,
int *,
int *,
int *,
138 char *,
double *,
double *, SLU::SuperMatrix *, SLU::SuperMatrix *,
139 void *,
int, SLU::SuperMatrix *, SLU::SuperMatrix *,
140 double *,
double *,
double *,
double *,
141 #ifdef HAVE_AMESOS2_SUPERLU5_API
144 SLU::mem_usage_t *, SLU::SuperLUStat_t *,
int *);
146 dgstrf (SLU::superlu_options_t*, SLU::SuperMatrix*,
147 int,
int,
int*,
void *,
int,
int *,
int *,
148 SLU::SuperMatrix *, SLU::SuperMatrix *,
149 #ifdef HAVE_AMESOS2_SUPERLU5_API
152 SLU::SuperLUStat_t*,
int *);
154 dgsisx(SLU::superlu_options_t *, SLU::SuperMatrix *,
int *,
int *,
int *,
155 char *,
double *,
double *, SLU::SuperMatrix *, SLU::SuperMatrix *,
156 void *,
int, SLU::SuperMatrix *, SLU::SuperMatrix *,
158 #ifdef HAVE_AMESOS2_SUPERLU5_API
161 SLU::mem_usage_t *, SLU::SuperLUStat_t *,
int *);
163 dgsitrf (SLU::superlu_options_t*, SLU::SuperMatrix*,
164 int,
int,
int*,
void *,
int,
int *,
int *,
165 SLU::SuperMatrix *, SLU::SuperMatrix *,
166 #ifdef HAVE_AMESOS2_SUPERLU5_API
169 SLU::SuperLUStat_t*,
int *);
171 dCreate_CompCol_Matrix(SLU::SuperMatrix *,
int,
int,
int,
double *,
172 int *,
int *, SLU::Stype_t, SLU::Dtype_t, SLU::Mtype_t);
174 dCreate_CompRow_Matrix(SLU::SuperMatrix *,
int,
int,
int,
double *,
175 int *,
int *, SLU::Stype_t, SLU::Dtype_t, SLU::Mtype_t);
177 dCreate_Dense_Matrix(SLU::SuperMatrix *,
int,
int,
double *,
int,
178 SLU::Stype_t, SLU::Dtype_t, SLU::Mtype_t);
181 dlaqgs (SLU::SuperMatrix *,
double *,
double *,
double,
182 double,
double,
char *);
185 dgsequ (SLU::SuperMatrix *,
double *,
double *,
double *,
186 double *,
double *,
int *);
191 #ifdef HAVE_TEUCHOS_COMPLEX
194 extern float clangs (
char *, SLU::SuperMatrix *);
196 extern void cgscon (
char *, SuperMatrix *, SuperMatrix *,
197 float,
float *, SuperLUStat_t*,
int *);
200 cCompRow_to_CompCol(
int,
int,
int, complex*,
int*,
int*,
201 complex **,
int **,
int **);
203 cgssvx(SLU::superlu_options_t *, SLU::SuperMatrix *,
int *,
int *,
int *,
204 char *,
float *,
float *, SLU::SuperMatrix *, SLU::SuperMatrix *,
205 void *,
int, SLU::SuperMatrix *, SLU::SuperMatrix *,
206 float *,
float *,
float *,
float *,
207 #ifdef HAVE_AMESOS2_SUPERLU5_API
210 SLU::mem_usage_t *, SLU::SuperLUStat_t *,
int *);
212 cgstrf (SLU::superlu_options_t*, SLU::SuperMatrix*,
213 int,
int,
int*,
void *,
int,
int *,
int *,
214 SLU::SuperMatrix *, SLU::SuperMatrix *,
215 #ifdef HAVE_AMESOS2_SUPERLU5_API
218 SLU::SuperLUStat_t*,
int *);
220 cgsisx(SLU::superlu_options_t *, SLU::SuperMatrix *,
int *,
int *,
int *,
221 char *,
float *,
float *, SLU::SuperMatrix *, SLU::SuperMatrix *,
222 void *,
int, SLU::SuperMatrix *, SLU::SuperMatrix *,
224 #ifdef HAVE_AMESOS2_SUPERLU5_API
227 SLU::mem_usage_t *, SLU::SuperLUStat_t *,
int *);
229 cgsitrf (SLU::superlu_options_t*, SLU::SuperMatrix*,
230 int,
int,
int*,
void *,
int,
int *,
int *,
231 SLU::SuperMatrix *, SLU::SuperMatrix *,
232 #ifdef HAVE_AMESOS2_SUPERLU5_API
235 SLU::SuperLUStat_t*,
int *);
237 cCreate_CompCol_Matrix(SLU::SuperMatrix *,
int,
int,
int, complex *,
238 int *,
int *, SLU::Stype_t, SLU::Dtype_t, SLU::Mtype_t);
240 cCreate_CompRow_Matrix(SLU::SuperMatrix *,
int,
int,
int, complex *,
241 int *,
int *, SLU::Stype_t, SLU::Dtype_t, SLU::Mtype_t);
243 cCreate_Dense_Matrix(SLU::SuperMatrix *,
int,
int, complex *,
int,
244 SLU::Stype_t, SLU::Dtype_t, SLU::Mtype_t);
247 cgsequ (SLU::SuperMatrix *,
float *,
float *,
float *,
248 float *,
float *,
int *);
251 claqgs (SLU::SuperMatrix *,
float *,
float *,
float,
252 float,
float,
char *);
259 extern double zlangs (
char *, SLU::SuperMatrix *);
261 extern void zgscon (
char *, SuperMatrix *, SuperMatrix *,
262 double,
double *, SuperLUStat_t*,
int *);
265 zCompRow_to_CompCol(
int,
int,
int, doublecomplex*,
int*,
int*,
266 doublecomplex **,
int **,
int **);
268 zgssvx(SLU::superlu_options_t *, SLU::SuperMatrix *,
int *,
int *,
int *,
269 char *,
double *,
double *, SLU::SuperMatrix *, SLU::SuperMatrix *,
270 void *,
int, SLU::SuperMatrix *, SLU::SuperMatrix *,
271 double *,
double *,
double *,
double *,
272 #ifdef HAVE_AMESOS2_SUPERLU5_API
275 SLU::mem_usage_t *, SLU::SuperLUStat_t *,
int *);
277 zgstrf (SLU::superlu_options_t*, SLU::SuperMatrix*,
278 int,
int,
int*,
void *,
int,
int *,
int *,
279 SLU::SuperMatrix *, SLU::SuperMatrix *,
280 #ifdef HAVE_AMESOS2_SUPERLU5_API
283 SLU::SuperLUStat_t*,
int *);
285 zgsisx(SLU::superlu_options_t *, SLU::SuperMatrix *,
int *,
int *,
int *,
286 char *,
double *,
double *, SLU::SuperMatrix *, SLU::SuperMatrix *,
287 void *,
int, SLU::SuperMatrix *, SLU::SuperMatrix *,
289 #ifdef HAVE_AMESOS2_SUPERLU5_API
292 SLU::mem_usage_t *, SLU::SuperLUStat_t *,
int *);
294 zgsitrf (SLU::superlu_options_t*, SLU::SuperMatrix*,
295 int,
int,
int*,
void *,
int,
int *,
int *,
296 SLU::SuperMatrix *, SLU::SuperMatrix *,
297 #ifdef HAVE_AMESOS2_SUPERLU5_API
300 SLU::SuperLUStat_t*,
int *);
302 zCreate_CompCol_Matrix(SLU::SuperMatrix *,
int,
int,
int, doublecomplex *,
303 int *,
int *, SLU::Stype_t, SLU::Dtype_t, SLU::Mtype_t);
305 zCreate_CompRow_Matrix(SLU::SuperMatrix *,
int,
int,
int, doublecomplex *,
306 int *,
int *, SLU::Stype_t, SLU::Dtype_t, SLU::Mtype_t);
308 zCreate_Dense_Matrix(SLU::SuperMatrix *,
int,
int, doublecomplex *,
int,
309 SLU::Stype_t, SLU::Dtype_t, SLU::Mtype_t);
312 zgsequ (SLU::SuperMatrix *,
double *,
double *,
double *,
313 double *,
double *,
int *);
316 zlaqgs (SLU::SuperMatrix *,
double *,
double *,
double,
317 double,
double,
char *);
321 #endif // HAVE_TEUCHOS_COMPLEX
359 struct FunctionMap<Superlu,float>
361 typedef TypeMap<Superlu,float> type_map;
363 static float langs(
char *norm, SLU::SuperMatrix *A)
365 return SLU::S::slangs(norm, A);
368 static void gscon (
char *norm, SLU::SuperMatrix *L, SLU::SuperMatrix *U,
369 float anorm,
float *rcond, SLU::SuperLUStat_t *stat,
int *info)
371 SLU::S::sgscon (norm, L, U, anorm, rcond, stat, info);
377 static void gssvx(SLU::superlu_options_t* options, SLU::SuperMatrix* A,
378 int* perm_c,
int* perm_r,
int* etree,
char* equed,
float* R,
float* C,
379 SLU::SuperMatrix* L, SLU::SuperMatrix* U,
void* work,
int lwork,
380 SLU::SuperMatrix* B, SLU::SuperMatrix* X,
float* recip_pivot_growth,
381 float* rcond,
float* ferr,
float* berr,
382 #ifdef HAVE_AMESOS2_SUPERLU5_API
385 SLU::mem_usage_t* mem_usage,
386 SLU::SuperLUStat_t* stat,
int* info)
388 SLU::S::sgssvx(options, A, perm_c, perm_r, etree, equed, R, C, L, U, work,
389 lwork, B, X, recip_pivot_growth, rcond, ferr, berr,
390 #ifdef HAVE_AMESOS2_SUPERLU5_API
393 mem_usage, stat, info);
396 static void gsisx(SLU::superlu_options_t* options, SLU::SuperMatrix* A,
397 int* perm_c,
int* perm_r,
int* etree,
char* equed,
float* R,
float* C,
398 SLU::SuperMatrix* L, SLU::SuperMatrix* U,
void* work,
int lwork,
399 SLU::SuperMatrix* B, SLU::SuperMatrix* X,
float* recip_pivot_growth,
401 #ifdef HAVE_AMESOS2_SUPERLU5_API
404 SLU::mem_usage_t* mem_usage,
405 SLU::SuperLUStat_t* stat,
int* info)
407 SLU::S::sgsisx(options, A, perm_c, perm_r, etree, equed, R, C, L, U, work,
408 lwork, B, X, recip_pivot_growth, rcond,
409 #ifdef HAVE_AMESOS2_SUPERLU5_API
412 mem_usage, stat, info);
434 static void gstrf(SLU::superlu_options_t* options, SLU::SuperMatrix* AC,
435 int relax,
int panel_size,
int* etree,
void* work,
436 int lwork,
int* perm_c,
int* perm_r, SLU::SuperMatrix* L,
438 #ifdef HAVE_AMESOS2_SUPERLU5_API
441 SLU::SuperLUStat_t* stat,
int* info)
443 SLU::S::sgstrf(options, AC, relax, panel_size, etree,
444 work, lwork, perm_c, perm_r, L, U,
445 #ifdef HAVE_AMESOS2_SUPERLU5_API
451 static void gsitrf(SLU::superlu_options_t* options, SLU::SuperMatrix* AC,
452 int relax,
int panel_size,
int* etree,
void* work,
453 int lwork,
int* perm_c,
int* perm_r, SLU::SuperMatrix* L,
455 #ifdef HAVE_AMESOS2_SUPERLU5_API
458 SLU::SuperLUStat_t* stat,
int* info)
460 SLU::S::sgsitrf(options, AC, relax, panel_size, etree,
461 work, lwork, perm_c, perm_r, L, U,
462 #ifdef HAVE_AMESOS2_SUPERLU5_API
471 template<
class view_t>
472 static void create_CompCol_Matrix(SLU::SuperMatrix* A,
int m,
int n,
int nnz,
473 Teuchos::Array<float> & convert_nzval, view_t & nzval,
474 int* rowind,
int* colptr,
475 SLU::Stype_t stype, SLU::Dtype_t dtype, SLU::Mtype_t mtype)
478 SLU::S::sCreate_CompCol_Matrix(A, m, n, nnz, nzval.data(), rowind, colptr,
479 stype, dtype, mtype);
485 static void create_CompRow_Matrix(SLU::SuperMatrix* A,
int m,
int n,
486 int nnz,
float* nzval,
int* rowind,
int* colptr,
487 SLU::Stype_t stype, SLU::Dtype_t dtype, SLU::Mtype_t mtype)
489 SLU::S::sCreate_CompRow_Matrix(A, m, n, nnz, nzval, rowind, colptr,
490 stype, dtype, mtype);
502 template<
class view_t>
503 static void create_Dense_Matrix(SLU::SuperMatrix* X,
int m,
int n,
504 Teuchos::Array<float> & convert_x, view_t & x,
505 int ldx, SLU::Stype_t stype,
506 SLU::Dtype_t dtype, SLU::Mtype_t mtype)
509 SLU::S::sCreate_Dense_Matrix(X, m, n, x.data(), ldx, stype, dtype, mtype);
512 template<
class view_t>
513 static void convert_back_Dense_Matrix(
514 Teuchos::Array<float> & convert_x, view_t & x)
522 static void gsequ(SLU::SuperMatrix* A,
float* R,
float* C,
523 float* rowcnd,
float* colcnd,
float* amax,
int* info)
525 SLU::S::sgsequ(A, R, C, rowcnd, colcnd, amax, info);
542 static void laqgs(SLU::SuperMatrix* A,
float* R,
float* C,
543 float rowcnd,
float colcnd,
float amax,
char* equed)
545 SLU::S::slaqgs(A, R, C, rowcnd, colcnd, amax, equed);
551 struct FunctionMap<Superlu,double>
553 typedef TypeMap<Superlu,double> type_map;
555 static double langs(
char *norm, SLU::SuperMatrix *A)
557 return SLU::D::dlangs(norm, A);
560 static void gscon (
char *norm, SLU::SuperMatrix *L, SLU::SuperMatrix *U,
561 double anorm,
double *rcond, SLU::SuperLUStat_t *stat,
int *info)
563 SLU::D::dgscon (norm, L, U, anorm, rcond, stat, info);
566 static void gssvx(SLU::superlu_options_t* options, SLU::SuperMatrix* A,
567 int* perm_c,
int* perm_r,
int* etree,
char* equed,
double* R,
double* C,
568 SLU::SuperMatrix* L, SLU::SuperMatrix* U,
void* work,
int lwork,
569 SLU::SuperMatrix* B, SLU::SuperMatrix* X,
double* recip_pivot_growth,
570 double* rcond,
double* ferr,
double* berr,
571 #ifdef HAVE_AMESOS2_SUPERLU5_API
574 SLU::mem_usage_t* mem_usage,
575 SLU::SuperLUStat_t* stat,
int* info)
577 SLU::D::dgssvx(options, A, perm_c, perm_r, etree, equed, R, C, L, U, work,
578 lwork, B, X, recip_pivot_growth, rcond, ferr, berr,
579 #ifdef HAVE_AMESOS2_SUPERLU5_API
582 mem_usage, stat, info);
585 static void gstrf(SLU::superlu_options_t* options, SLU::SuperMatrix* AC,
586 int relax,
int panel_size,
int* etree,
void* work,
int lwork,
int* perm_c,
587 int* perm_r, SLU::SuperMatrix* L, SLU::SuperMatrix* U,
588 #ifdef HAVE_AMESOS2_SUPERLU5_API
591 SLU::SuperLUStat_t* stat,
int* info)
593 SLU::D::dgstrf(options, AC, relax, panel_size, etree,
594 work, lwork, perm_c, perm_r, L, U,
595 #ifdef HAVE_AMESOS2_SUPERLU5_API
601 static void gsisx(SLU::superlu_options_t* options, SLU::SuperMatrix* A,
602 int* perm_c,
int* perm_r,
int* etree,
char* equed,
double* R,
double* C,
603 SLU::SuperMatrix* L, SLU::SuperMatrix* U,
void* work,
int lwork,
604 SLU::SuperMatrix* B, SLU::SuperMatrix* X,
double* recip_pivot_growth,
606 #ifdef HAVE_AMESOS2_SUPERLU5_API
609 SLU::mem_usage_t* mem_usage,
610 SLU::SuperLUStat_t* stat,
int* info)
612 SLU::D::dgsisx(options, A, perm_c, perm_r, etree, equed, R, C, L, U, work,
613 lwork, B, X, recip_pivot_growth, rcond,
614 #ifdef HAVE_AMESOS2_SUPERLU5_API
617 mem_usage, stat, info);
620 static void gsitrf(SLU::superlu_options_t* options, SLU::SuperMatrix* AC,
621 int relax,
int panel_size,
int* etree,
void* work,
int lwork,
int* perm_c,
622 int* perm_r, SLU::SuperMatrix* L, SLU::SuperMatrix* U,
623 #ifdef HAVE_AMESOS2_SUPERLU5_API
626 SLU::SuperLUStat_t* stat,
int* info)
628 SLU::D::dgsitrf(options, AC, relax, panel_size, etree,
629 work, lwork, perm_c, perm_r, L, U,
630 #ifdef HAVE_AMESOS2_SUPERLU5_API
636 template<
class view_t>
637 static void create_CompCol_Matrix(SLU::SuperMatrix* A,
int m,
int n,
int nnz,
638 Teuchos::Array<double> & convert_nzval, view_t & nzval,
639 int* rowind,
int* colptr,
640 SLU::Stype_t stype, SLU::Dtype_t dtype, SLU::Mtype_t mtype)
643 SLU::D::dCreate_CompCol_Matrix(A, m, n, nnz, nzval.data(), rowind, colptr,
644 stype, dtype, mtype);
647 static void create_CompRow_Matrix(SLU::SuperMatrix* A,
int m,
int n,
648 int nnz,
double* nzval,
int* rowind,
int* colptr,
649 SLU::Stype_t stype, SLU::Dtype_t dtype, SLU::Mtype_t mtype)
651 SLU::D::dCreate_CompRow_Matrix(A, m, n, nnz, nzval, rowind, colptr,
652 stype, dtype, mtype);
655 template<
class view_t>
656 static void create_Dense_Matrix(SLU::SuperMatrix* X,
int m,
int n,
657 Teuchos::Array<double> & convert_x, view_t & x,
658 int ldx, SLU::Stype_t stype,
659 SLU::Dtype_t dtype, SLU::Mtype_t mtype)
662 SLU::D::dCreate_Dense_Matrix(X, m, n, x.data(), ldx, stype, dtype, mtype);
665 template<
class view_t>
666 static void convert_back_Dense_Matrix(
667 Teuchos::Array<double> & convert_x, view_t & x)
672 static void gsequ(SLU::SuperMatrix* A,
double* R,
double* C,
673 double* rowcnd,
double* colcnd,
double* amax,
int* info)
675 SLU::D::dgsequ(A, R, C, rowcnd, colcnd, amax, info);
678 static void laqgs(SLU::SuperMatrix* A,
double* R,
double* C,
679 double rowcnd,
double colcnd,
double amax,
char* equed)
681 SLU::D::dlaqgs(A, R, C, rowcnd, colcnd, amax, equed);
687 #ifdef HAVE_TEUCHOS_COMPLEX
690 struct FunctionMap<Superlu, Kokkos::complex<float>>
693 static float langs(
char *norm, SLU::SuperMatrix *A)
695 return SLU::C::clangs(norm, A);
698 static void gscon (
char *norm, SLU::SuperMatrix *L, SLU::SuperMatrix *U,
699 float anorm,
float *rcond, SLU::SuperLUStat_t *stat,
int *info)
701 SLU::C::cgscon (norm, L, U, anorm, rcond, stat, info);
704 static void gssvx(SLU::superlu_options_t* options, SLU::SuperMatrix* A,
705 int* perm_c,
int* perm_r,
int* etree,
char* equed,
float* R,
float* C,
706 SLU::SuperMatrix* L, SLU::SuperMatrix* U,
void* work,
int lwork,
707 SLU::SuperMatrix* B, SLU::SuperMatrix* X,
float* recip_pivot_growth,
708 float* rcond,
float* ferr,
float* berr,
709 #ifdef HAVE_AMESOS2_SUPERLU5_API
712 SLU::mem_usage_t* mem_usage,
713 SLU::SuperLUStat_t* stat,
int* info)
715 SLU::C::cgssvx(options, A, perm_c, perm_r, etree, equed, R, C, L, U, work,
716 lwork, B, X, recip_pivot_growth, rcond, ferr, berr,
717 #ifdef HAVE_AMESOS2_SUPERLU5_API
720 mem_usage, stat, info);
723 static void gstrf(SLU::superlu_options_t* options, SLU::SuperMatrix* AC,
724 int relax,
int panel_size,
int* etree,
void* work,
int lwork,
int* perm_c,
725 int* perm_r, SLU::SuperMatrix* L, SLU::SuperMatrix* U,
726 #ifdef HAVE_AMESOS2_SUPERLU5_API
729 SLU::SuperLUStat_t* stat,
int* info)
731 SLU::C::cgstrf(options, AC, relax, panel_size, etree,
732 work, lwork, perm_c, perm_r, L, U,
733 #ifdef HAVE_AMESOS2_SUPERLU5_API
739 static void gsisx(SLU::superlu_options_t* options, SLU::SuperMatrix* A,
740 int* perm_c,
int* perm_r,
int* etree,
char* equed,
float* R,
float* C,
741 SLU::SuperMatrix* L, SLU::SuperMatrix* U,
void* work,
int lwork,
742 SLU::SuperMatrix* B, SLU::SuperMatrix* X,
float* recip_pivot_growth,
744 #ifdef HAVE_AMESOS2_SUPERLU5_API
747 SLU::mem_usage_t* mem_usage,
748 SLU::SuperLUStat_t* stat,
int* info)
750 SLU::C::cgsisx(options, A, perm_c, perm_r, etree, equed, R, C, L, U, work,
751 lwork, B, X, recip_pivot_growth, rcond,
752 #ifdef HAVE_AMESOS2_SUPERLU5_API
755 mem_usage, stat, info);
758 static void gsitrf(SLU::superlu_options_t* options, SLU::SuperMatrix* AC,
759 int relax,
int panel_size,
int* etree,
void* work,
int lwork,
int* perm_c,
760 int* perm_r, SLU::SuperMatrix* L, SLU::SuperMatrix* U,
761 #ifdef HAVE_AMESOS2_SUPERLU5_API
764 SLU::SuperLUStat_t* stat,
int* info)
766 SLU::C::cgsitrf(options, AC, relax, panel_size, etree,
767 work, lwork, perm_c, perm_r, L, U,
768 #ifdef HAVE_AMESOS2_SUPERLU5_API
774 template<
class view_t>
775 static void create_CompCol_Matrix(SLU::SuperMatrix* A,
int m,
int n,
int nnz,
776 Teuchos::Array<SLU::C::complex> & convert_nzval, view_t & nzval,
777 int* rowind,
int* colptr,
778 SLU::Stype_t stype, SLU::Dtype_t dtype, SLU::Mtype_t mtype)
780 convert_nzval.resize(nnz);
781 for(
int i = 0; i < nnz; ++i) {
782 convert_nzval[i] = Teuchos::as<SLU::C::complex>(nzval(i));
784 SLU::C::cCreate_CompCol_Matrix(A, m, n, nnz, convert_nzval.data(), rowind, colptr,
785 stype, dtype, mtype);
788 static void create_CompRow_Matrix(SLU::SuperMatrix* A,
int m,
int n,
int nnz,
789 SLU::C::complex* nzval,
int* rowind,
int* colptr,
790 SLU::Stype_t stype, SLU::Dtype_t dtype, SLU::Mtype_t mtype)
792 SLU::C::cCreate_CompRow_Matrix(A, m, n, nnz, nzval, rowind, colptr,
793 stype, dtype, mtype);
796 template<
class view_t>
797 static void create_Dense_Matrix(SLU::SuperMatrix* X,
int m,
int n,
798 Teuchos::Array<SLU::C::complex> & convert_x, view_t & x,
799 int ldx, SLU::Stype_t stype,
800 SLU::Dtype_t dtype, SLU::Mtype_t mtype)
802 convert_x.resize(m * n);
804 for(
int j = 0; j < n; ++j) {
805 for(
int i = 0; i < m; ++i) {
806 convert_x[write_index++] = Teuchos::as<SLU::C::complex>(x(i,j));
809 SLU::C::cCreate_Dense_Matrix(X, m, n, convert_x.data(), ldx, stype, dtype, mtype);
812 template<
class view_t>
813 static void convert_back_Dense_Matrix(
814 Teuchos::Array<SLU::C::complex> & convert_x, view_t & x)
817 for(
int j = 0; j < static_cast<int>(x.extent(1)); ++j) {
818 for(
int i = 0; i < static_cast<int>(x.extent(0)); ++i) {
819 x(i,j) = Teuchos::as<Kokkos::complex<float>>(convert_x[read_index++]);
824 static void gsequ(SLU::SuperMatrix* A,
float* R,
float* C,
825 float* rowcnd,
float* colcnd,
float* amax,
int* info)
827 SLU::C::cgsequ(A, R, C, rowcnd, colcnd, amax, info);
830 static void laqgs(SLU::SuperMatrix* A,
float* R,
float* C,
831 float rowcnd,
float colcnd,
float amax,
char* equed)
833 SLU::C::claqgs(A, R, C, rowcnd, colcnd, amax, equed);
839 struct FunctionMap<Superlu,Kokkos::complex<double>>
842 static double langs(
char *norm, SLU::SuperMatrix *A)
844 return SLU::Z::zlangs(norm, A);
847 static void gscon (
char *norm, SLU::SuperMatrix *L, SLU::SuperMatrix *U,
848 double anorm,
double *rcond, SLU::SuperLUStat_t *stat,
int *info)
850 SLU::Z::zgscon (norm, L, U, anorm, rcond, stat, info);
853 static void gssvx(SLU::superlu_options_t* options, SLU::SuperMatrix* A,
854 int* perm_c,
int* perm_r,
int* etree,
char* equed,
double* R,
double* C,
855 SLU::SuperMatrix* L, SLU::SuperMatrix* U,
void* work,
int lwork,
856 SLU::SuperMatrix* B, SLU::SuperMatrix* X,
double* recip_pivot_growth,
857 double* rcond,
double* ferr,
double* berr,
858 #ifdef HAVE_AMESOS2_SUPERLU5_API
861 SLU::mem_usage_t* mem_usage,
862 SLU::SuperLUStat_t* stat,
int* info)
864 SLU::Z::zgssvx(options, A, perm_c, perm_r, etree, equed, R, C, L, U, work,
865 lwork, B, X, recip_pivot_growth, rcond, ferr, berr,
866 #ifdef HAVE_AMESOS2_SUPERLU5_API
869 mem_usage, stat, info);
872 static void gstrf(SLU::superlu_options_t* options, SLU::SuperMatrix* AC,
873 int relax,
int panel_size,
int* etree,
void* work,
int lwork,
int* perm_c,
874 int* perm_r, SLU::SuperMatrix* L, SLU::SuperMatrix* U,
875 #ifdef HAVE_AMESOS2_SUPERLU5_API
878 SLU::SuperLUStat_t* stat,
int* info)
880 SLU::Z::zgstrf(options, AC, relax, panel_size, etree,
881 work, lwork, perm_c, perm_r, L, U,
882 #ifdef HAVE_AMESOS2_SUPERLU5_API
888 static void gsisx(SLU::superlu_options_t* options, SLU::SuperMatrix* A,
889 int* perm_c,
int* perm_r,
int* etree,
char* equed,
double* R,
double* C,
890 SLU::SuperMatrix* L, SLU::SuperMatrix* U,
void* work,
int lwork,
891 SLU::SuperMatrix* B, SLU::SuperMatrix* X,
double* recip_pivot_growth,
893 #ifdef HAVE_AMESOS2_SUPERLU5_API
896 SLU::mem_usage_t* mem_usage,
897 SLU::SuperLUStat_t* stat,
int* info)
899 SLU::Z::zgsisx(options, A, perm_c, perm_r, etree, equed, R, C, L, U, work,
900 lwork, B, X, recip_pivot_growth, rcond,
901 #ifdef HAVE_AMESOS2_SUPERLU5_API
904 mem_usage, stat, info);
907 static void gsitrf(SLU::superlu_options_t* options, SLU::SuperMatrix* AC,
908 int relax,
int panel_size,
int* etree,
void* work,
int lwork,
int* perm_c,
909 int* perm_r, SLU::SuperMatrix* L, SLU::SuperMatrix* U,
910 #ifdef HAVE_AMESOS2_SUPERLU5_API
913 SLU::SuperLUStat_t* stat,
int* info)
915 SLU::Z::zgsitrf(options, AC, relax, panel_size, etree,
916 work, lwork, perm_c, perm_r, L, U,
917 #ifdef HAVE_AMESOS2_SUPERLU5_API
923 template<
class view_t>
924 static void create_CompCol_Matrix(SLU::SuperMatrix* A,
int m,
int n,
int nnz,
925 Teuchos::Array<SLU::Z::doublecomplex> & convert_nzval, view_t & nzval,
926 int* rowind,
int* colptr,
927 SLU::Stype_t stype, SLU::Dtype_t dtype, SLU::Mtype_t mtype)
929 convert_nzval.resize(nnz);
930 for(
int i = 0; i < nnz; ++i) {
931 convert_nzval[i] = Teuchos::as<SLU::Z::doublecomplex>(nzval(i));
933 SLU::Z::zCreate_CompCol_Matrix(A, m, n, nnz, convert_nzval.data(), rowind, colptr,
934 stype, dtype, mtype);
936 TEUCHOS_TEST_FOR_EXCEPTION( A == NULL,
938 "Supermatrix A not initialized properly!");
942 static void create_CompRow_Matrix(SLU::SuperMatrix* A,
int m,
int n,
int nnz,
943 SLU::Z::doublecomplex* nzval,
int* rowind,
int* colptr,
944 SLU::Stype_t stype, SLU::Dtype_t dtype, SLU::Mtype_t mtype)
946 SLU::Z::zCreate_CompRow_Matrix(A, m, n, nnz, nzval, rowind, colptr,
947 stype, dtype, mtype);
949 TEUCHOS_TEST_FOR_EXCEPTION( A == NULL,
951 "Supermatrix A not initialized properly!");
954 template<
class view_t>
955 static void create_Dense_Matrix(SLU::SuperMatrix* X,
int m,
int n,
956 Teuchos::Array<SLU::Z::doublecomplex> & convert_x, view_t & x,
957 int ldx, SLU::Stype_t stype,
958 SLU::Dtype_t dtype, SLU::Mtype_t mtype)
960 convert_x.resize(m * n);
962 for(
int j = 0; j < n; ++j) {
963 for(
int i = 0; i < m; ++i) {
964 convert_x[write_index++] = Teuchos::as<SLU::Z::doublecomplex>(x(i,j));
967 SLU::Z::zCreate_Dense_Matrix(X, m, n, convert_x.data(), ldx, stype, dtype, mtype);
970 template<
class view_t>
971 static void convert_back_Dense_Matrix(
972 Teuchos::Array<SLU::Z::doublecomplex> & convert_x, view_t & x)
975 for(
int j = 0; j < static_cast<int>(x.extent(1)); ++j) {
976 for(
int i = 0; i < static_cast<int>(x.extent(0)); ++i) {
977 x(i,j) = Teuchos::as<Kokkos::complex<double>>(convert_x[read_index++]);
982 static void gsequ(SLU::SuperMatrix* A,
double* R,
double* C,
983 double* rowcnd,
double* colcnd,
double* amax,
int* info)
985 SLU::Z::zgsequ(A, R, C, rowcnd, colcnd, amax, info);
988 static void laqgs(SLU::SuperMatrix* A,
double* R,
double* C,
989 double rowcnd,
double colcnd,
double amax,
char* equed)
991 SLU::Z::zlaqgs(A, R, C, rowcnd, colcnd, amax, equed);
994 #endif // HAVE_TEUCHOS_COMPLEX
1001 #endif // AMESOS2_SUPERLU_FUNCTIONMAP_HPP
Declaration of Function mapping class for Amesos2.
Provides definition of SuperLU types as well as conversions and type traits.