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"
65 extern float slangs (
char *, SLU::SuperMatrix *);
67 extern void sgscon (
char *, SuperMatrix *, SuperMatrix *,
68 float,
float *, SuperLUStat_t*,
int *);
71 sCompRow_to_CompCol(
int,
int,
int,
float*,
int*,
int*,
72 float **,
int **,
int **);
74 sgssvx(SLU::superlu_options_t *, SLU::SuperMatrix *,
int *,
int *,
int *,
75 char *,
float *,
float *, SLU::SuperMatrix *, SLU::SuperMatrix *,
76 void *,
int, SLU::SuperMatrix *, SLU::SuperMatrix *,
77 float *,
float *,
float *,
float *,
78 #ifdef HAVE_AMESOS2_SUPERLU5_API
81 SLU::mem_usage_t *, SLU::SuperLUStat_t *,
int *);
83 sgstrf (SLU::superlu_options_t*, SLU::SuperMatrix*,
84 int,
int,
int*,
void *,
int,
int *,
int *,
85 SLU::SuperMatrix *, SLU::SuperMatrix *,
86 #ifdef HAVE_AMESOS2_SUPERLU5_API
89 SLU::SuperLUStat_t*,
int *);
91 sgsisx(SLU::superlu_options_t *, SLU::SuperMatrix *,
int *,
int *,
int *,
92 char *,
float *,
float *, SLU::SuperMatrix *, SLU::SuperMatrix *,
93 void *,
int, SLU::SuperMatrix *, SLU::SuperMatrix *,
95 #ifdef HAVE_AMESOS2_SUPERLU5_API
98 SLU::mem_usage_t *, SLU::SuperLUStat_t *,
int *);
100 sgsitrf (SLU::superlu_options_t*, SLU::SuperMatrix*,
101 int,
int,
int*,
void *,
int,
int *,
int *,
102 SLU::SuperMatrix *, SLU::SuperMatrix *,
103 #ifdef HAVE_AMESOS2_SUPERLU5_API
106 SLU::SuperLUStat_t*,
int *);
108 sCreate_CompCol_Matrix(SLU::SuperMatrix *,
int,
int,
int,
float *,
109 int *,
int *, SLU::Stype_t, SLU::Dtype_t, SLU::Mtype_t);
111 sCreate_CompRow_Matrix(SLU::SuperMatrix *,
int,
int,
int,
float *,
112 int *,
int *, SLU::Stype_t, SLU::Dtype_t, SLU::Mtype_t);
114 sCreate_Dense_Matrix(SLU::SuperMatrix *,
int,
int,
float *,
int,
115 SLU::Stype_t, SLU::Dtype_t, SLU::Mtype_t);
118 sgsequ (SLU::SuperMatrix *,
float *,
float *,
float *,
119 float *,
float *,
int *);
122 slaqgs (SLU::SuperMatrix *,
float *,
float *,
float,
123 float,
float,
char *);
130 extern double dlangs (
char *, SLU::SuperMatrix *);
132 extern void dgscon (
char *, SuperMatrix *, SuperMatrix *,
133 double,
double *, SuperLUStat_t*,
int *);
136 dCompRow_to_CompCol(
int,
int,
int,
double*,
int*,
int*,
137 double **,
int **,
int **);
139 dgssvx(SLU::superlu_options_t *, SLU::SuperMatrix *,
int *,
int *,
int *,
140 char *,
double *,
double *, SLU::SuperMatrix *, SLU::SuperMatrix *,
141 void *,
int, SLU::SuperMatrix *, SLU::SuperMatrix *,
142 double *,
double *,
double *,
double *,
143 #ifdef HAVE_AMESOS2_SUPERLU5_API
146 SLU::mem_usage_t *, SLU::SuperLUStat_t *,
int *);
148 dgstrf (SLU::superlu_options_t*, SLU::SuperMatrix*,
149 int,
int,
int*,
void *,
int,
int *,
int *,
150 SLU::SuperMatrix *, SLU::SuperMatrix *,
151 #ifdef HAVE_AMESOS2_SUPERLU5_API
154 SLU::SuperLUStat_t*,
int *);
156 dgsisx(SLU::superlu_options_t *, SLU::SuperMatrix *,
int *,
int *,
int *,
157 char *,
double *,
double *, SLU::SuperMatrix *, SLU::SuperMatrix *,
158 void *,
int, SLU::SuperMatrix *, SLU::SuperMatrix *,
160 #ifdef HAVE_AMESOS2_SUPERLU5_API
163 SLU::mem_usage_t *, SLU::SuperLUStat_t *,
int *);
165 dgsitrf (SLU::superlu_options_t*, SLU::SuperMatrix*,
166 int,
int,
int*,
void *,
int,
int *,
int *,
167 SLU::SuperMatrix *, SLU::SuperMatrix *,
168 #ifdef HAVE_AMESOS2_SUPERLU5_API
171 SLU::SuperLUStat_t*,
int *);
173 dCreate_CompCol_Matrix(SLU::SuperMatrix *,
int,
int,
int,
double *,
174 int *,
int *, SLU::Stype_t, SLU::Dtype_t, SLU::Mtype_t);
176 dCreate_CompRow_Matrix(SLU::SuperMatrix *,
int,
int,
int,
double *,
177 int *,
int *, SLU::Stype_t, SLU::Dtype_t, SLU::Mtype_t);
179 dCreate_Dense_Matrix(SLU::SuperMatrix *,
int,
int,
double *,
int,
180 SLU::Stype_t, SLU::Dtype_t, SLU::Mtype_t);
183 dlaqgs (SLU::SuperMatrix *,
double *,
double *,
double,
184 double,
double,
char *);
187 dgsequ (SLU::SuperMatrix *,
double *,
double *,
double *,
188 double *,
double *,
int *);
193 #ifdef HAVE_TEUCHOS_COMPLEX
196 extern float clangs (
char *, SLU::SuperMatrix *);
198 extern void cgscon (
char *, SuperMatrix *, SuperMatrix *,
199 float,
float *, SuperLUStat_t*,
int *);
202 cCompRow_to_CompCol(
int,
int,
int, complex*,
int*,
int*,
203 complex **,
int **,
int **);
205 cgssvx(SLU::superlu_options_t *, SLU::SuperMatrix *,
int *,
int *,
int *,
206 char *,
float *,
float *, SLU::SuperMatrix *, SLU::SuperMatrix *,
207 void *,
int, SLU::SuperMatrix *, SLU::SuperMatrix *,
208 float *,
float *,
float *,
float *,
209 #ifdef HAVE_AMESOS2_SUPERLU5_API
212 SLU::mem_usage_t *, SLU::SuperLUStat_t *,
int *);
214 cgstrf (SLU::superlu_options_t*, SLU::SuperMatrix*,
215 int,
int,
int*,
void *,
int,
int *,
int *,
216 SLU::SuperMatrix *, SLU::SuperMatrix *,
217 #ifdef HAVE_AMESOS2_SUPERLU5_API
220 SLU::SuperLUStat_t*,
int *);
222 cgsisx(SLU::superlu_options_t *, SLU::SuperMatrix *,
int *,
int *,
int *,
223 char *,
float *,
float *, SLU::SuperMatrix *, SLU::SuperMatrix *,
224 void *,
int, SLU::SuperMatrix *, SLU::SuperMatrix *,
226 #ifdef HAVE_AMESOS2_SUPERLU5_API
229 SLU::mem_usage_t *, SLU::SuperLUStat_t *,
int *);
231 cgsitrf (SLU::superlu_options_t*, SLU::SuperMatrix*,
232 int,
int,
int*,
void *,
int,
int *,
int *,
233 SLU::SuperMatrix *, SLU::SuperMatrix *,
234 #ifdef HAVE_AMESOS2_SUPERLU5_API
237 SLU::SuperLUStat_t*,
int *);
239 cCreate_CompCol_Matrix(SLU::SuperMatrix *,
int,
int,
int, complex *,
240 int *,
int *, SLU::Stype_t, SLU::Dtype_t, SLU::Mtype_t);
242 cCreate_CompRow_Matrix(SLU::SuperMatrix *,
int,
int,
int, complex *,
243 int *,
int *, SLU::Stype_t, SLU::Dtype_t, SLU::Mtype_t);
245 cCreate_Dense_Matrix(SLU::SuperMatrix *,
int,
int, complex *,
int,
246 SLU::Stype_t, SLU::Dtype_t, SLU::Mtype_t);
249 cgsequ (SLU::SuperMatrix *,
float *,
float *,
float *,
250 float *,
float *,
int *);
253 claqgs (SLU::SuperMatrix *,
float *,
float *,
float,
254 float,
float,
char *);
261 extern double zlangs (
char *, SLU::SuperMatrix *);
263 extern void zgscon (
char *, SuperMatrix *, SuperMatrix *,
264 double,
double *, SuperLUStat_t*,
int *);
267 zCompRow_to_CompCol(
int,
int,
int, doublecomplex*,
int*,
int*,
268 doublecomplex **,
int **,
int **);
270 zgssvx(SLU::superlu_options_t *, SLU::SuperMatrix *,
int *,
int *,
int *,
271 char *,
double *,
double *, SLU::SuperMatrix *, SLU::SuperMatrix *,
272 void *,
int, SLU::SuperMatrix *, SLU::SuperMatrix *,
273 double *,
double *,
double *,
double *,
274 #ifdef HAVE_AMESOS2_SUPERLU5_API
277 SLU::mem_usage_t *, SLU::SuperLUStat_t *,
int *);
279 zgstrf (SLU::superlu_options_t*, SLU::SuperMatrix*,
280 int,
int,
int*,
void *,
int,
int *,
int *,
281 SLU::SuperMatrix *, SLU::SuperMatrix *,
282 #ifdef HAVE_AMESOS2_SUPERLU5_API
285 SLU::SuperLUStat_t*,
int *);
287 zgsisx(SLU::superlu_options_t *, SLU::SuperMatrix *,
int *,
int *,
int *,
288 char *,
double *,
double *, SLU::SuperMatrix *, SLU::SuperMatrix *,
289 void *,
int, SLU::SuperMatrix *, SLU::SuperMatrix *,
291 #ifdef HAVE_AMESOS2_SUPERLU5_API
294 SLU::mem_usage_t *, SLU::SuperLUStat_t *,
int *);
296 zgsitrf (SLU::superlu_options_t*, SLU::SuperMatrix*,
297 int,
int,
int*,
void *,
int,
int *,
int *,
298 SLU::SuperMatrix *, SLU::SuperMatrix *,
299 #ifdef HAVE_AMESOS2_SUPERLU5_API
302 SLU::SuperLUStat_t*,
int *);
304 zCreate_CompCol_Matrix(SLU::SuperMatrix *,
int,
int,
int, doublecomplex *,
305 int *,
int *, SLU::Stype_t, SLU::Dtype_t, SLU::Mtype_t);
307 zCreate_CompRow_Matrix(SLU::SuperMatrix *,
int,
int,
int, doublecomplex *,
308 int *,
int *, SLU::Stype_t, SLU::Dtype_t, SLU::Mtype_t);
310 zCreate_Dense_Matrix(SLU::SuperMatrix *,
int,
int, doublecomplex *,
int,
311 SLU::Stype_t, SLU::Dtype_t, SLU::Mtype_t);
314 zgsequ (SLU::SuperMatrix *,
double *,
double *,
double *,
315 double *,
double *,
int *);
318 zlaqgs (SLU::SuperMatrix *,
double *,
double *,
double,
319 double,
double,
char *);
323 #endif // HAVE_TEUCHOS_COMPLEX
361 struct FunctionMap<Superlu,float>
363 typedef TypeMap<Superlu,float> type_map;
365 static float langs(
char *norm, SLU::SuperMatrix *A)
367 return SLU::S::slangs(norm, A);
370 static void gscon (
char *norm, SLU::SuperMatrix *L, SLU::SuperMatrix *U,
371 float anorm,
float *rcond, SLU::SuperLUStat_t *stat,
int *info)
373 SLU::S::sgscon (norm, L, U, anorm, rcond, stat, info);
379 static void gssvx(SLU::superlu_options_t* options, SLU::SuperMatrix* A,
380 int* perm_c,
int* perm_r,
int* etree,
char* equed,
float* R,
float* C,
381 SLU::SuperMatrix* L, SLU::SuperMatrix* U,
void* work,
int lwork,
382 SLU::SuperMatrix* B, SLU::SuperMatrix* X,
float* recip_pivot_growth,
383 float* rcond,
float* ferr,
float* berr,
384 #ifdef HAVE_AMESOS2_SUPERLU5_API
387 SLU::mem_usage_t* mem_usage,
388 SLU::SuperLUStat_t* stat,
int* info)
390 SLU::S::sgssvx(options, A, perm_c, perm_r, etree, equed, R, C, L, U, work,
391 lwork, B, X, recip_pivot_growth, rcond, ferr, berr,
392 #ifdef HAVE_AMESOS2_SUPERLU5_API
395 mem_usage, stat, info);
398 static void gsisx(SLU::superlu_options_t* options, SLU::SuperMatrix* A,
399 int* perm_c,
int* perm_r,
int* etree,
char* equed,
float* R,
float* C,
400 SLU::SuperMatrix* L, SLU::SuperMatrix* U,
void* work,
int lwork,
401 SLU::SuperMatrix* B, SLU::SuperMatrix* X,
float* recip_pivot_growth,
403 #ifdef HAVE_AMESOS2_SUPERLU5_API
406 SLU::mem_usage_t* mem_usage,
407 SLU::SuperLUStat_t* stat,
int* info)
409 SLU::S::sgsisx(options, A, perm_c, perm_r, etree, equed, R, C, L, U, work,
410 lwork, B, X, recip_pivot_growth, rcond,
411 #ifdef HAVE_AMESOS2_SUPERLU5_API
414 mem_usage, stat, info);
436 static void gstrf(SLU::superlu_options_t* options, SLU::SuperMatrix* AC,
437 int relax,
int panel_size,
int* etree,
void* work,
438 int lwork,
int* perm_c,
int* perm_r, SLU::SuperMatrix* L,
440 #ifdef HAVE_AMESOS2_SUPERLU5_API
443 SLU::SuperLUStat_t* stat,
int* info)
445 SLU::S::sgstrf(options, AC, relax, panel_size, etree,
446 work, lwork, perm_c, perm_r, L, U,
447 #ifdef HAVE_AMESOS2_SUPERLU5_API
453 static void gsitrf(SLU::superlu_options_t* options, SLU::SuperMatrix* AC,
454 int relax,
int panel_size,
int* etree,
void* work,
455 int lwork,
int* perm_c,
int* perm_r, SLU::SuperMatrix* L,
457 #ifdef HAVE_AMESOS2_SUPERLU5_API
460 SLU::SuperLUStat_t* stat,
int* info)
462 SLU::S::sgsitrf(options, AC, relax, panel_size, etree,
463 work, lwork, perm_c, perm_r, L, U,
464 #ifdef HAVE_AMESOS2_SUPERLU5_API
473 template<
class view_t>
474 static void create_CompCol_Matrix(SLU::SuperMatrix* A,
int m,
int n,
int nnz,
475 Teuchos::Array<float> & convert_nzval, view_t & nzval,
476 int* rowind,
int* colptr,
477 SLU::Stype_t stype, SLU::Dtype_t dtype, SLU::Mtype_t mtype)
480 SLU::S::sCreate_CompCol_Matrix(A, m, n, nnz, nzval.data(), rowind, colptr,
481 stype, dtype, mtype);
487 static void create_CompRow_Matrix(SLU::SuperMatrix* A,
int m,
int n,
488 int nnz,
float* nzval,
int* rowind,
int* colptr,
489 SLU::Stype_t stype, SLU::Dtype_t dtype, SLU::Mtype_t mtype)
491 SLU::S::sCreate_CompRow_Matrix(A, m, n, nnz, nzval, rowind, colptr,
492 stype, dtype, mtype);
504 template<
class view_t>
505 static void create_Dense_Matrix(SLU::SuperMatrix* X,
int m,
int n,
506 Teuchos::Array<float> & convert_x, view_t & x,
507 int ldx, SLU::Stype_t stype,
508 SLU::Dtype_t dtype, SLU::Mtype_t mtype)
511 SLU::S::sCreate_Dense_Matrix(X, m, n, x.data(), ldx, stype, dtype, mtype);
514 template<
class view_t>
515 static void convert_back_Dense_Matrix(
516 Teuchos::Array<float> & convert_x, view_t & x)
524 static void gsequ(SLU::SuperMatrix* A,
float* R,
float* C,
525 float* rowcnd,
float* colcnd,
float* amax,
int* info)
527 SLU::S::sgsequ(A, R, C, rowcnd, colcnd, amax, info);
544 static void laqgs(SLU::SuperMatrix* A,
float* R,
float* C,
545 float rowcnd,
float colcnd,
float amax,
char* equed)
547 SLU::S::slaqgs(A, R, C, rowcnd, colcnd, amax, equed);
553 struct FunctionMap<Superlu,double>
555 typedef TypeMap<Superlu,double> type_map;
557 static double langs(
char *norm, SLU::SuperMatrix *A)
559 return SLU::D::dlangs(norm, A);
562 static void gscon (
char *norm, SLU::SuperMatrix *L, SLU::SuperMatrix *U,
563 double anorm,
double *rcond, SLU::SuperLUStat_t *stat,
int *info)
565 SLU::D::dgscon (norm, L, U, anorm, rcond, stat, info);
568 static void gssvx(SLU::superlu_options_t* options, SLU::SuperMatrix* A,
569 int* perm_c,
int* perm_r,
int* etree,
char* equed,
double* R,
double* C,
570 SLU::SuperMatrix* L, SLU::SuperMatrix* U,
void* work,
int lwork,
571 SLU::SuperMatrix* B, SLU::SuperMatrix* X,
double* recip_pivot_growth,
572 double* rcond,
double* ferr,
double* berr,
573 #ifdef HAVE_AMESOS2_SUPERLU5_API
576 SLU::mem_usage_t* mem_usage,
577 SLU::SuperLUStat_t* stat,
int* info)
579 SLU::D::dgssvx(options, A, perm_c, perm_r, etree, equed, R, C, L, U, work,
580 lwork, B, X, recip_pivot_growth, rcond, ferr, berr,
581 #ifdef HAVE_AMESOS2_SUPERLU5_API
584 mem_usage, stat, info);
587 static void gstrf(SLU::superlu_options_t* options, SLU::SuperMatrix* AC,
588 int relax,
int panel_size,
int* etree,
void* work,
int lwork,
int* perm_c,
589 int* perm_r, SLU::SuperMatrix* L, SLU::SuperMatrix* U,
590 #ifdef HAVE_AMESOS2_SUPERLU5_API
593 SLU::SuperLUStat_t* stat,
int* info)
595 SLU::D::dgstrf(options, AC, relax, panel_size, etree,
596 work, lwork, perm_c, perm_r, L, U,
597 #ifdef HAVE_AMESOS2_SUPERLU5_API
603 static void gsisx(SLU::superlu_options_t* options, SLU::SuperMatrix* A,
604 int* perm_c,
int* perm_r,
int* etree,
char* equed,
double* R,
double* C,
605 SLU::SuperMatrix* L, SLU::SuperMatrix* U,
void* work,
int lwork,
606 SLU::SuperMatrix* B, SLU::SuperMatrix* X,
double* recip_pivot_growth,
608 #ifdef HAVE_AMESOS2_SUPERLU5_API
611 SLU::mem_usage_t* mem_usage,
612 SLU::SuperLUStat_t* stat,
int* info)
614 SLU::D::dgsisx(options, A, perm_c, perm_r, etree, equed, R, C, L, U, work,
615 lwork, B, X, recip_pivot_growth, rcond,
616 #ifdef HAVE_AMESOS2_SUPERLU5_API
619 mem_usage, stat, info);
622 static void gsitrf(SLU::superlu_options_t* options, SLU::SuperMatrix* AC,
623 int relax,
int panel_size,
int* etree,
void* work,
int lwork,
int* perm_c,
624 int* perm_r, SLU::SuperMatrix* L, SLU::SuperMatrix* U,
625 #ifdef HAVE_AMESOS2_SUPERLU5_API
628 SLU::SuperLUStat_t* stat,
int* info)
630 SLU::D::dgsitrf(options, AC, relax, panel_size, etree,
631 work, lwork, perm_c, perm_r, L, U,
632 #ifdef HAVE_AMESOS2_SUPERLU5_API
638 template<
class view_t>
639 static void create_CompCol_Matrix(SLU::SuperMatrix* A,
int m,
int n,
int nnz,
640 Teuchos::Array<double> & convert_nzval, view_t & nzval,
641 int* rowind,
int* colptr,
642 SLU::Stype_t stype, SLU::Dtype_t dtype, SLU::Mtype_t mtype)
645 SLU::D::dCreate_CompCol_Matrix(A, m, n, nnz, nzval.data(), rowind, colptr,
646 stype, dtype, mtype);
649 static void create_CompRow_Matrix(SLU::SuperMatrix* A,
int m,
int n,
650 int nnz,
double* nzval,
int* rowind,
int* colptr,
651 SLU::Stype_t stype, SLU::Dtype_t dtype, SLU::Mtype_t mtype)
653 SLU::D::dCreate_CompRow_Matrix(A, m, n, nnz, nzval, rowind, colptr,
654 stype, dtype, mtype);
657 template<
class view_t>
658 static void create_Dense_Matrix(SLU::SuperMatrix* X,
int m,
int n,
659 Teuchos::Array<double> & convert_x, view_t & x,
660 int ldx, SLU::Stype_t stype,
661 SLU::Dtype_t dtype, SLU::Mtype_t mtype)
664 SLU::D::dCreate_Dense_Matrix(X, m, n, x.data(), ldx, stype, dtype, mtype);
667 template<
class view_t>
668 static void convert_back_Dense_Matrix(
669 Teuchos::Array<double> & convert_x, view_t & x)
674 static void gsequ(SLU::SuperMatrix* A,
double* R,
double* C,
675 double* rowcnd,
double* colcnd,
double* amax,
int* info)
677 SLU::D::dgsequ(A, R, C, rowcnd, colcnd, amax, info);
680 static void laqgs(SLU::SuperMatrix* A,
double* R,
double* C,
681 double rowcnd,
double colcnd,
double amax,
char* equed)
683 SLU::D::dlaqgs(A, R, C, rowcnd, colcnd, amax, equed);
689 #ifdef HAVE_TEUCHOS_COMPLEX
692 struct FunctionMap<Superlu, Kokkos::complex<float>>
695 static float langs(
char *norm, SLU::SuperMatrix *A)
697 return SLU::C::clangs(norm, A);
700 static void gscon (
char *norm, SLU::SuperMatrix *L, SLU::SuperMatrix *U,
701 float anorm,
float *rcond, SLU::SuperLUStat_t *stat,
int *info)
703 SLU::C::cgscon (norm, L, U, anorm, rcond, stat, info);
706 static void gssvx(SLU::superlu_options_t* options, SLU::SuperMatrix* A,
707 int* perm_c,
int* perm_r,
int* etree,
char* equed,
float* R,
float* C,
708 SLU::SuperMatrix* L, SLU::SuperMatrix* U,
void* work,
int lwork,
709 SLU::SuperMatrix* B, SLU::SuperMatrix* X,
float* recip_pivot_growth,
710 float* rcond,
float* ferr,
float* berr,
711 #ifdef HAVE_AMESOS2_SUPERLU5_API
714 SLU::mem_usage_t* mem_usage,
715 SLU::SuperLUStat_t* stat,
int* info)
717 SLU::C::cgssvx(options, A, perm_c, perm_r, etree, equed, R, C, L, U, work,
718 lwork, B, X, recip_pivot_growth, rcond, ferr, berr,
719 #ifdef HAVE_AMESOS2_SUPERLU5_API
722 mem_usage, stat, info);
725 static void gstrf(SLU::superlu_options_t* options, SLU::SuperMatrix* AC,
726 int relax,
int panel_size,
int* etree,
void* work,
int lwork,
int* perm_c,
727 int* perm_r, SLU::SuperMatrix* L, SLU::SuperMatrix* U,
728 #ifdef HAVE_AMESOS2_SUPERLU5_API
731 SLU::SuperLUStat_t* stat,
int* info)
733 SLU::C::cgstrf(options, AC, relax, panel_size, etree,
734 work, lwork, perm_c, perm_r, L, U,
735 #ifdef HAVE_AMESOS2_SUPERLU5_API
741 static void gsisx(SLU::superlu_options_t* options, SLU::SuperMatrix* A,
742 int* perm_c,
int* perm_r,
int* etree,
char* equed,
float* R,
float* C,
743 SLU::SuperMatrix* L, SLU::SuperMatrix* U,
void* work,
int lwork,
744 SLU::SuperMatrix* B, SLU::SuperMatrix* X,
float* recip_pivot_growth,
746 #ifdef HAVE_AMESOS2_SUPERLU5_API
749 SLU::mem_usage_t* mem_usage,
750 SLU::SuperLUStat_t* stat,
int* info)
752 SLU::C::cgsisx(options, A, perm_c, perm_r, etree, equed, R, C, L, U, work,
753 lwork, B, X, recip_pivot_growth, rcond,
754 #ifdef HAVE_AMESOS2_SUPERLU5_API
757 mem_usage, stat, info);
760 static void gsitrf(SLU::superlu_options_t* options, SLU::SuperMatrix* AC,
761 int relax,
int panel_size,
int* etree,
void* work,
int lwork,
int* perm_c,
762 int* perm_r, SLU::SuperMatrix* L, SLU::SuperMatrix* U,
763 #ifdef HAVE_AMESOS2_SUPERLU5_API
766 SLU::SuperLUStat_t* stat,
int* info)
768 SLU::C::cgsitrf(options, AC, relax, panel_size, etree,
769 work, lwork, perm_c, perm_r, L, U,
770 #ifdef HAVE_AMESOS2_SUPERLU5_API
776 template<
class view_t>
777 static void create_CompCol_Matrix(SLU::SuperMatrix* A,
int m,
int n,
int nnz,
778 Teuchos::Array<SLU::C::complex> & convert_nzval, view_t & nzval,
779 int* rowind,
int* colptr,
780 SLU::Stype_t stype, SLU::Dtype_t dtype, SLU::Mtype_t mtype)
782 convert_nzval.resize(nnz);
783 for(
int i = 0; i < nnz; ++i) {
784 convert_nzval[i] = Teuchos::as<SLU::C::complex>(nzval(i));
786 SLU::C::cCreate_CompCol_Matrix(A, m, n, nnz, convert_nzval.data(), rowind, colptr,
787 stype, dtype, mtype);
790 static void create_CompRow_Matrix(SLU::SuperMatrix* A,
int m,
int n,
int nnz,
791 SLU::C::complex* nzval,
int* rowind,
int* colptr,
792 SLU::Stype_t stype, SLU::Dtype_t dtype, SLU::Mtype_t mtype)
794 SLU::C::cCreate_CompRow_Matrix(A, m, n, nnz, nzval, rowind, colptr,
795 stype, dtype, mtype);
798 template<
class view_t>
799 static void create_Dense_Matrix(SLU::SuperMatrix* X,
int m,
int n,
800 Teuchos::Array<SLU::C::complex> & convert_x, view_t & x,
801 int ldx, SLU::Stype_t stype,
802 SLU::Dtype_t dtype, SLU::Mtype_t mtype)
804 convert_x.resize(m * n);
806 for(
int j = 0; j < n; ++j) {
807 for(
int i = 0; i < m; ++i) {
808 convert_x[write_index++] = Teuchos::as<SLU::C::complex>(x(i,j));
811 SLU::C::cCreate_Dense_Matrix(X, m, n, convert_x.data(), ldx, stype, dtype, mtype);
814 template<
class view_t>
815 static void convert_back_Dense_Matrix(
816 Teuchos::Array<SLU::C::complex> & convert_x, view_t & x)
819 for(
int j = 0; j < static_cast<int>(x.extent(1)); ++j) {
820 for(
int i = 0; i < static_cast<int>(x.extent(0)); ++i) {
821 x(i,j) = Teuchos::as<Kokkos::complex<float>>(convert_x[read_index++]);
826 static void gsequ(SLU::SuperMatrix* A,
float* R,
float* C,
827 float* rowcnd,
float* colcnd,
float* amax,
int* info)
829 SLU::C::cgsequ(A, R, C, rowcnd, colcnd, amax, info);
832 static void laqgs(SLU::SuperMatrix* A,
float* R,
float* C,
833 float rowcnd,
float colcnd,
float amax,
char* equed)
835 SLU::C::claqgs(A, R, C, rowcnd, colcnd, amax, equed);
841 struct FunctionMap<Superlu,Kokkos::complex<double>>
844 static double langs(
char *norm, SLU::SuperMatrix *A)
846 return SLU::Z::zlangs(norm, A);
849 static void gscon (
char *norm, SLU::SuperMatrix *L, SLU::SuperMatrix *U,
850 double anorm,
double *rcond, SLU::SuperLUStat_t *stat,
int *info)
852 SLU::Z::zgscon (norm, L, U, anorm, rcond, stat, info);
855 static void gssvx(SLU::superlu_options_t* options, SLU::SuperMatrix* A,
856 int* perm_c,
int* perm_r,
int* etree,
char* equed,
double* R,
double* C,
857 SLU::SuperMatrix* L, SLU::SuperMatrix* U,
void* work,
int lwork,
858 SLU::SuperMatrix* B, SLU::SuperMatrix* X,
double* recip_pivot_growth,
859 double* rcond,
double* ferr,
double* berr,
860 #ifdef HAVE_AMESOS2_SUPERLU5_API
863 SLU::mem_usage_t* mem_usage,
864 SLU::SuperLUStat_t* stat,
int* info)
866 SLU::Z::zgssvx(options, A, perm_c, perm_r, etree, equed, R, C, L, U, work,
867 lwork, B, X, recip_pivot_growth, rcond, ferr, berr,
868 #ifdef HAVE_AMESOS2_SUPERLU5_API
871 mem_usage, stat, info);
874 static void gstrf(SLU::superlu_options_t* options, SLU::SuperMatrix* AC,
875 int relax,
int panel_size,
int* etree,
void* work,
int lwork,
int* perm_c,
876 int* perm_r, SLU::SuperMatrix* L, SLU::SuperMatrix* U,
877 #ifdef HAVE_AMESOS2_SUPERLU5_API
880 SLU::SuperLUStat_t* stat,
int* info)
882 SLU::Z::zgstrf(options, AC, relax, panel_size, etree,
883 work, lwork, perm_c, perm_r, L, U,
884 #ifdef HAVE_AMESOS2_SUPERLU5_API
890 static void gsisx(SLU::superlu_options_t* options, SLU::SuperMatrix* A,
891 int* perm_c,
int* perm_r,
int* etree,
char* equed,
double* R,
double* C,
892 SLU::SuperMatrix* L, SLU::SuperMatrix* U,
void* work,
int lwork,
893 SLU::SuperMatrix* B, SLU::SuperMatrix* X,
double* recip_pivot_growth,
895 #ifdef HAVE_AMESOS2_SUPERLU5_API
898 SLU::mem_usage_t* mem_usage,
899 SLU::SuperLUStat_t* stat,
int* info)
901 SLU::Z::zgsisx(options, A, perm_c, perm_r, etree, equed, R, C, L, U, work,
902 lwork, B, X, recip_pivot_growth, rcond,
903 #ifdef HAVE_AMESOS2_SUPERLU5_API
906 mem_usage, stat, info);
909 static void gsitrf(SLU::superlu_options_t* options, SLU::SuperMatrix* AC,
910 int relax,
int panel_size,
int* etree,
void* work,
int lwork,
int* perm_c,
911 int* perm_r, SLU::SuperMatrix* L, SLU::SuperMatrix* U,
912 #ifdef HAVE_AMESOS2_SUPERLU5_API
915 SLU::SuperLUStat_t* stat,
int* info)
917 SLU::Z::zgsitrf(options, AC, relax, panel_size, etree,
918 work, lwork, perm_c, perm_r, L, U,
919 #ifdef HAVE_AMESOS2_SUPERLU5_API
925 template<
class view_t>
926 static void create_CompCol_Matrix(SLU::SuperMatrix* A,
int m,
int n,
int nnz,
927 Teuchos::Array<SLU::Z::doublecomplex> & convert_nzval, view_t & nzval,
928 int* rowind,
int* colptr,
929 SLU::Stype_t stype, SLU::Dtype_t dtype, SLU::Mtype_t mtype)
931 convert_nzval.resize(nnz);
932 for(
int i = 0; i < nnz; ++i) {
933 convert_nzval[i] = Teuchos::as<SLU::Z::doublecomplex>(nzval(i));
935 SLU::Z::zCreate_CompCol_Matrix(A, m, n, nnz, convert_nzval.data(), rowind, colptr,
936 stype, dtype, mtype);
938 TEUCHOS_TEST_FOR_EXCEPTION( A == NULL,
940 "Supermatrix A not initialized properly!");
944 static void create_CompRow_Matrix(SLU::SuperMatrix* A,
int m,
int n,
int nnz,
945 SLU::Z::doublecomplex* nzval,
int* rowind,
int* colptr,
946 SLU::Stype_t stype, SLU::Dtype_t dtype, SLU::Mtype_t mtype)
948 SLU::Z::zCreate_CompRow_Matrix(A, m, n, nnz, nzval, rowind, colptr,
949 stype, dtype, mtype);
951 TEUCHOS_TEST_FOR_EXCEPTION( A == NULL,
953 "Supermatrix A not initialized properly!");
956 template<
class view_t>
957 static void create_Dense_Matrix(SLU::SuperMatrix* X,
int m,
int n,
958 Teuchos::Array<SLU::Z::doublecomplex> & convert_x, view_t & x,
959 int ldx, SLU::Stype_t stype,
960 SLU::Dtype_t dtype, SLU::Mtype_t mtype)
962 convert_x.resize(m * n);
964 for(
int j = 0; j < n; ++j) {
965 for(
int i = 0; i < m; ++i) {
966 convert_x[write_index++] = Teuchos::as<SLU::Z::doublecomplex>(x(i,j));
969 SLU::Z::zCreate_Dense_Matrix(X, m, n, convert_x.data(), ldx, stype, dtype, mtype);
972 template<
class view_t>
973 static void convert_back_Dense_Matrix(
974 Teuchos::Array<SLU::Z::doublecomplex> & convert_x, view_t & x)
977 for(
int j = 0; j < static_cast<int>(x.extent(1)); ++j) {
978 for(
int i = 0; i < static_cast<int>(x.extent(0)); ++i) {
979 x(i,j) = Teuchos::as<Kokkos::complex<double>>(convert_x[read_index++]);
984 static void gsequ(SLU::SuperMatrix* A,
double* R,
double* C,
985 double* rowcnd,
double* colcnd,
double* amax,
int* info)
987 SLU::Z::zgsequ(A, R, C, rowcnd, colcnd, amax, info);
990 static void laqgs(SLU::SuperMatrix* A,
double* R,
double* C,
991 double rowcnd,
double colcnd,
double amax,
char* equed)
993 SLU::Z::zlaqgs(A, R, C, rowcnd, colcnd, amax, equed);
996 #endif // HAVE_TEUCHOS_COMPLEX
1003 #endif // AMESOS2_SUPERLU_FUNCTIONMAP_HPP
Declaration of Function mapping class for Amesos2.
Provides definition of SuperLU types as well as conversions and type traits.