53 #ifndef AMESOS2_SUPERLU_FUNCTIONMAP_HPP
54 #define AMESOS2_SUPERLU_FUNCTIONMAP_HPP
56 #ifdef HAVE_TEUCHOS_COMPLEX
78 #include "supermatrix.h"
80 #include "superlu_enum_consts.h"
97 extern float slangs (
char *, SLU::SuperMatrix *);
99 extern void sgscon (
char *, SuperMatrix *, SuperMatrix *,
100 float,
float *, SuperLUStat_t*,
int *);
103 sCompRow_to_CompCol(
int,
int,
int,
float*,
int*,
int*,
104 float **,
int **,
int **);
106 sgssvx(SLU::superlu_options_t *, SLU::SuperMatrix *,
int *,
int *,
int *,
107 char *,
float *,
float *, SLU::SuperMatrix *, SLU::SuperMatrix *,
108 void *,
int, SLU::SuperMatrix *, SLU::SuperMatrix *,
109 float *,
float *,
float *,
float *,
110 #ifdef HAVE_AMESOS2_SUPERLU5_API
113 SLU::mem_usage_t *, SLU::SuperLUStat_t *,
int *);
115 sgstrf (SLU::superlu_options_t*, SLU::SuperMatrix*,
116 int,
int,
int*,
void *,
int,
int *,
int *,
117 SLU::SuperMatrix *, SLU::SuperMatrix *,
118 #ifdef HAVE_AMESOS2_SUPERLU5_API
121 SLU::SuperLUStat_t*,
int *);
123 sgsisx(SLU::superlu_options_t *, SLU::SuperMatrix *,
int *,
int *,
int *,
124 char *,
float *,
float *, SLU::SuperMatrix *, SLU::SuperMatrix *,
125 void *,
int, SLU::SuperMatrix *, SLU::SuperMatrix *,
127 #ifdef HAVE_AMESOS2_SUPERLU5_API
130 SLU::mem_usage_t *, SLU::SuperLUStat_t *,
int *);
132 sgsitrf (SLU::superlu_options_t*, SLU::SuperMatrix*,
133 int,
int,
int*,
void *,
int,
int *,
int *,
134 SLU::SuperMatrix *, SLU::SuperMatrix *,
135 #ifdef HAVE_AMESOS2_SUPERLU5_API
138 SLU::SuperLUStat_t*,
int *);
140 sCreate_CompCol_Matrix(SLU::SuperMatrix *,
int,
int,
int,
float *,
141 int *,
int *, SLU::Stype_t, SLU::Dtype_t, SLU::Mtype_t);
143 sCreate_CompRow_Matrix(SLU::SuperMatrix *,
int,
int,
int,
float *,
144 int *,
int *, SLU::Stype_t, SLU::Dtype_t, SLU::Mtype_t);
146 sCreate_Dense_Matrix(SLU::SuperMatrix *,
int,
int,
float *,
int,
147 SLU::Stype_t, SLU::Dtype_t, SLU::Mtype_t);
150 sgsequ (SLU::SuperMatrix *,
float *,
float *,
float *,
151 float *,
float *,
int *);
154 slaqgs (SLU::SuperMatrix *,
float *,
float *,
float,
155 float,
float,
char *);
162 extern double dlangs (
char *, SLU::SuperMatrix *);
164 extern void dgscon (
char *, SuperMatrix *, SuperMatrix *,
165 double,
double *, SuperLUStat_t*,
int *);
168 dCompRow_to_CompCol(
int,
int,
int,
double*,
int*,
int*,
169 double **,
int **,
int **);
171 dgssvx(SLU::superlu_options_t *, SLU::SuperMatrix *,
int *,
int *,
int *,
172 char *,
double *,
double *, SLU::SuperMatrix *, SLU::SuperMatrix *,
173 void *,
int, SLU::SuperMatrix *, SLU::SuperMatrix *,
174 double *,
double *,
double *,
double *,
175 #ifdef HAVE_AMESOS2_SUPERLU5_API
178 SLU::mem_usage_t *, SLU::SuperLUStat_t *,
int *);
180 dgstrf (SLU::superlu_options_t*, SLU::SuperMatrix*,
181 int,
int,
int*,
void *,
int,
int *,
int *,
182 SLU::SuperMatrix *, SLU::SuperMatrix *,
183 #ifdef HAVE_AMESOS2_SUPERLU5_API
186 SLU::SuperLUStat_t*,
int *);
188 dgsisx(SLU::superlu_options_t *, SLU::SuperMatrix *,
int *,
int *,
int *,
189 char *,
double *,
double *, SLU::SuperMatrix *, SLU::SuperMatrix *,
190 void *,
int, SLU::SuperMatrix *, SLU::SuperMatrix *,
192 #ifdef HAVE_AMESOS2_SUPERLU5_API
195 SLU::mem_usage_t *, SLU::SuperLUStat_t *,
int *);
197 dgsitrf (SLU::superlu_options_t*, SLU::SuperMatrix*,
198 int,
int,
int*,
void *,
int,
int *,
int *,
199 SLU::SuperMatrix *, SLU::SuperMatrix *,
200 #ifdef HAVE_AMESOS2_SUPERLU5_API
203 SLU::SuperLUStat_t*,
int *);
205 dCreate_CompCol_Matrix(SLU::SuperMatrix *,
int,
int,
int,
double *,
206 int *,
int *, SLU::Stype_t, SLU::Dtype_t, SLU::Mtype_t);
208 dCreate_CompRow_Matrix(SLU::SuperMatrix *,
int,
int,
int,
double *,
209 int *,
int *, SLU::Stype_t, SLU::Dtype_t, SLU::Mtype_t);
211 dCreate_Dense_Matrix(SLU::SuperMatrix *,
int,
int,
double *,
int,
212 SLU::Stype_t, SLU::Dtype_t, SLU::Mtype_t);
215 dlaqgs (SLU::SuperMatrix *,
double *,
double *,
double,
216 double,
double,
char *);
219 dgsequ (SLU::SuperMatrix *,
double *,
double *,
double *,
220 double *,
double *,
int *);
225 #ifdef HAVE_TEUCHOS_COMPLEX
228 extern float clangs (
char *, SLU::SuperMatrix *);
230 extern void cgscon (
char *, SuperMatrix *, SuperMatrix *,
231 float,
float *, SuperLUStat_t*,
int *);
234 cCompRow_to_CompCol(
int,
int,
int, complex*,
int*,
int*,
235 complex **,
int **,
int **);
237 cgssvx(SLU::superlu_options_t *, SLU::SuperMatrix *,
int *,
int *,
int *,
238 char *,
float *,
float *, SLU::SuperMatrix *, SLU::SuperMatrix *,
239 void *,
int, SLU::SuperMatrix *, SLU::SuperMatrix *,
240 float *,
float *,
float *,
float *,
241 #ifdef HAVE_AMESOS2_SUPERLU5_API
244 SLU::mem_usage_t *, SLU::SuperLUStat_t *,
int *);
246 cgstrf (SLU::superlu_options_t*, SLU::SuperMatrix*,
247 int,
int,
int*,
void *,
int,
int *,
int *,
248 SLU::SuperMatrix *, SLU::SuperMatrix *,
249 #ifdef HAVE_AMESOS2_SUPERLU5_API
252 SLU::SuperLUStat_t*,
int *);
254 cgsisx(SLU::superlu_options_t *, SLU::SuperMatrix *,
int *,
int *,
int *,
255 char *,
float *,
float *, SLU::SuperMatrix *, SLU::SuperMatrix *,
256 void *,
int, SLU::SuperMatrix *, SLU::SuperMatrix *,
258 #ifdef HAVE_AMESOS2_SUPERLU5_API
261 SLU::mem_usage_t *, SLU::SuperLUStat_t *,
int *);
263 cgsitrf (SLU::superlu_options_t*, SLU::SuperMatrix*,
264 int,
int,
int*,
void *,
int,
int *,
int *,
265 SLU::SuperMatrix *, SLU::SuperMatrix *,
266 #ifdef HAVE_AMESOS2_SUPERLU5_API
269 SLU::SuperLUStat_t*,
int *);
271 cCreate_CompCol_Matrix(SLU::SuperMatrix *,
int,
int,
int, complex *,
272 int *,
int *, SLU::Stype_t, SLU::Dtype_t, SLU::Mtype_t);
274 cCreate_CompRow_Matrix(SLU::SuperMatrix *,
int,
int,
int, complex *,
275 int *,
int *, SLU::Stype_t, SLU::Dtype_t, SLU::Mtype_t);
277 cCreate_Dense_Matrix(SLU::SuperMatrix *,
int,
int, complex *,
int,
278 SLU::Stype_t, SLU::Dtype_t, SLU::Mtype_t);
281 cgsequ (SLU::SuperMatrix *,
float *,
float *,
float *,
282 float *,
float *,
int *);
285 claqgs (SLU::SuperMatrix *,
float *,
float *,
float,
286 float,
float,
char *);
293 extern double zlangs (
char *, SLU::SuperMatrix *);
295 extern void zgscon (
char *, SuperMatrix *, SuperMatrix *,
296 double,
double *, SuperLUStat_t*,
int *);
299 zCompRow_to_CompCol(
int,
int,
int, doublecomplex*,
int*,
int*,
300 doublecomplex **,
int **,
int **);
302 zgssvx(SLU::superlu_options_t *, SLU::SuperMatrix *,
int *,
int *,
int *,
303 char *,
double *,
double *, SLU::SuperMatrix *, SLU::SuperMatrix *,
304 void *,
int, SLU::SuperMatrix *, SLU::SuperMatrix *,
305 double *,
double *,
double *,
double *,
306 #ifdef HAVE_AMESOS2_SUPERLU5_API
309 SLU::mem_usage_t *, SLU::SuperLUStat_t *,
int *);
311 zgstrf (SLU::superlu_options_t*, SLU::SuperMatrix*,
312 int,
int,
int*,
void *,
int,
int *,
int *,
313 SLU::SuperMatrix *, SLU::SuperMatrix *,
314 #ifdef HAVE_AMESOS2_SUPERLU5_API
317 SLU::SuperLUStat_t*,
int *);
319 zgsisx(SLU::superlu_options_t *, SLU::SuperMatrix *,
int *,
int *,
int *,
320 char *,
double *,
double *, SLU::SuperMatrix *, SLU::SuperMatrix *,
321 void *,
int, SLU::SuperMatrix *, SLU::SuperMatrix *,
323 #ifdef HAVE_AMESOS2_SUPERLU5_API
326 SLU::mem_usage_t *, SLU::SuperLUStat_t *,
int *);
328 zgsitrf (SLU::superlu_options_t*, SLU::SuperMatrix*,
329 int,
int,
int*,
void *,
int,
int *,
int *,
330 SLU::SuperMatrix *, SLU::SuperMatrix *,
331 #ifdef HAVE_AMESOS2_SUPERLU5_API
334 SLU::SuperLUStat_t*,
int *);
336 zCreate_CompCol_Matrix(SLU::SuperMatrix *,
int,
int,
int, doublecomplex *,
337 int *,
int *, SLU::Stype_t, SLU::Dtype_t, SLU::Mtype_t);
339 zCreate_CompRow_Matrix(SLU::SuperMatrix *,
int,
int,
int, doublecomplex *,
340 int *,
int *, SLU::Stype_t, SLU::Dtype_t, SLU::Mtype_t);
342 zCreate_Dense_Matrix(SLU::SuperMatrix *,
int,
int, doublecomplex *,
int,
343 SLU::Stype_t, SLU::Dtype_t, SLU::Mtype_t);
346 zgsequ (SLU::SuperMatrix *,
double *,
double *,
double *,
347 double *,
double *,
int *);
350 zlaqgs (SLU::SuperMatrix *,
double *,
double *,
double,
351 double,
double,
char *);
355 #endif // HAVE_TEUCHOS_COMPLEX
393 struct FunctionMap<Superlu,float>
395 typedef TypeMap<Superlu,float> type_map;
397 static float langs(
char *norm, SLU::SuperMatrix *A)
399 return SLU::S::slangs(norm, A);
402 static void gscon (
char *norm, SLU::SuperMatrix *L, SLU::SuperMatrix *U,
403 float anorm,
float *rcond, SLU::SuperLUStat_t *stat,
int *info)
405 SLU::S::sgscon (norm, L, U, anorm, rcond, stat, info);
411 static void gssvx(SLU::superlu_options_t* options, SLU::SuperMatrix* A,
412 int* perm_c,
int* perm_r,
int* etree,
char* equed,
float* R,
float* C,
413 SLU::SuperMatrix* L, SLU::SuperMatrix* U,
void* work,
int lwork,
414 SLU::SuperMatrix* B, SLU::SuperMatrix* X,
float* recip_pivot_growth,
415 float* rcond,
float* ferr,
float* berr,
416 #ifdef HAVE_AMESOS2_SUPERLU5_API
419 SLU::mem_usage_t* mem_usage,
420 SLU::SuperLUStat_t* stat,
int* info)
422 SLU::S::sgssvx(options, A, perm_c, perm_r, etree, equed, R, C, L, U, work,
423 lwork, B, X, recip_pivot_growth, rcond, ferr, berr,
424 #ifdef HAVE_AMESOS2_SUPERLU5_API
427 mem_usage, stat, info);
430 static void gsisx(SLU::superlu_options_t* options, SLU::SuperMatrix* A,
431 int* perm_c,
int* perm_r,
int* etree,
char* equed,
float* R,
float* C,
432 SLU::SuperMatrix* L, SLU::SuperMatrix* U,
void* work,
int lwork,
433 SLU::SuperMatrix* B, SLU::SuperMatrix* X,
float* recip_pivot_growth,
435 #ifdef HAVE_AMESOS2_SUPERLU5_API
438 SLU::mem_usage_t* mem_usage,
439 SLU::SuperLUStat_t* stat,
int* info)
441 SLU::S::sgsisx(options, A, perm_c, perm_r, etree, equed, R, C, L, U, work,
442 lwork, B, X, recip_pivot_growth, rcond,
443 #ifdef HAVE_AMESOS2_SUPERLU5_API
446 mem_usage, stat, info);
468 static void gstrf(SLU::superlu_options_t* options, SLU::SuperMatrix* AC,
469 int relax,
int panel_size,
int* etree,
void* work,
470 int lwork,
int* perm_c,
int* perm_r, SLU::SuperMatrix* L,
472 #ifdef HAVE_AMESOS2_SUPERLU5_API
475 SLU::SuperLUStat_t* stat,
int* info)
477 SLU::S::sgstrf(options, AC, relax, panel_size, etree,
478 work, lwork, perm_c, perm_r, L, U,
479 #ifdef HAVE_AMESOS2_SUPERLU5_API
485 static void gsitrf(SLU::superlu_options_t* options, SLU::SuperMatrix* AC,
486 int relax,
int panel_size,
int* etree,
void* work,
487 int lwork,
int* perm_c,
int* perm_r, SLU::SuperMatrix* L,
489 #ifdef HAVE_AMESOS2_SUPERLU5_API
492 SLU::SuperLUStat_t* stat,
int* info)
494 SLU::S::sgsitrf(options, AC, relax, panel_size, etree,
495 work, lwork, perm_c, perm_r, L, U,
496 #ifdef HAVE_AMESOS2_SUPERLU5_API
505 template<
class view_t>
506 static void create_CompCol_Matrix(SLU::SuperMatrix* A,
int m,
int n,
int nnz,
507 Teuchos::Array<float> & convert_nzval, view_t & nzval,
508 int* rowind,
int* colptr,
509 SLU::Stype_t stype, SLU::Dtype_t dtype, SLU::Mtype_t mtype)
512 SLU::S::sCreate_CompCol_Matrix(A, m, n, nnz, nzval.data(), rowind, colptr,
513 stype, dtype, mtype);
519 static void create_CompRow_Matrix(SLU::SuperMatrix* A,
int m,
int n,
520 int nnz,
float* nzval,
int* rowind,
int* colptr,
521 SLU::Stype_t stype, SLU::Dtype_t dtype, SLU::Mtype_t mtype)
523 SLU::S::sCreate_CompRow_Matrix(A, m, n, nnz, nzval, rowind, colptr,
524 stype, dtype, mtype);
536 template<
class view_t>
537 static void create_Dense_Matrix(SLU::SuperMatrix* X,
int m,
int n,
538 Teuchos::Array<float> & convert_x, view_t & x,
539 int ldx, SLU::Stype_t stype,
540 SLU::Dtype_t dtype, SLU::Mtype_t mtype)
543 SLU::S::sCreate_Dense_Matrix(X, m, n, x.data(), ldx, stype, dtype, mtype);
546 template<
class view_t>
547 static void convert_back_Dense_Matrix(
548 Teuchos::Array<float> & convert_x, view_t & x)
556 static void gsequ(SLU::SuperMatrix* A,
float* R,
float* C,
557 float* rowcnd,
float* colcnd,
float* amax,
int* info)
559 SLU::S::sgsequ(A, R, C, rowcnd, colcnd, amax, info);
576 static void laqgs(SLU::SuperMatrix* A,
float* R,
float* C,
577 float rowcnd,
float colcnd,
float amax,
char* equed)
579 SLU::S::slaqgs(A, R, C, rowcnd, colcnd, amax, equed);
585 struct FunctionMap<Superlu,double>
587 typedef TypeMap<Superlu,double> type_map;
589 static double langs(
char *norm, SLU::SuperMatrix *A)
591 return SLU::D::dlangs(norm, A);
594 static void gscon (
char *norm, SLU::SuperMatrix *L, SLU::SuperMatrix *U,
595 double anorm,
double *rcond, SLU::SuperLUStat_t *stat,
int *info)
597 SLU::D::dgscon (norm, L, U, anorm, rcond, stat, info);
600 static void gssvx(SLU::superlu_options_t* options, SLU::SuperMatrix* A,
601 int* perm_c,
int* perm_r,
int* etree,
char* equed,
double* R,
double* C,
602 SLU::SuperMatrix* L, SLU::SuperMatrix* U,
void* work,
int lwork,
603 SLU::SuperMatrix* B, SLU::SuperMatrix* X,
double* recip_pivot_growth,
604 double* rcond,
double* ferr,
double* berr,
605 #ifdef HAVE_AMESOS2_SUPERLU5_API
608 SLU::mem_usage_t* mem_usage,
609 SLU::SuperLUStat_t* stat,
int* info)
611 SLU::D::dgssvx(options, A, perm_c, perm_r, etree, equed, R, C, L, U, work,
612 lwork, B, X, recip_pivot_growth, rcond, ferr, berr,
613 #ifdef HAVE_AMESOS2_SUPERLU5_API
616 mem_usage, stat, info);
619 static void gstrf(SLU::superlu_options_t* options, SLU::SuperMatrix* AC,
620 int relax,
int panel_size,
int* etree,
void* work,
int lwork,
int* perm_c,
621 int* perm_r, SLU::SuperMatrix* L, SLU::SuperMatrix* U,
622 #ifdef HAVE_AMESOS2_SUPERLU5_API
625 SLU::SuperLUStat_t* stat,
int* info)
627 SLU::D::dgstrf(options, AC, relax, panel_size, etree,
628 work, lwork, perm_c, perm_r, L, U,
629 #ifdef HAVE_AMESOS2_SUPERLU5_API
635 static void gsisx(SLU::superlu_options_t* options, SLU::SuperMatrix* A,
636 int* perm_c,
int* perm_r,
int* etree,
char* equed,
double* R,
double* C,
637 SLU::SuperMatrix* L, SLU::SuperMatrix* U,
void* work,
int lwork,
638 SLU::SuperMatrix* B, SLU::SuperMatrix* X,
double* recip_pivot_growth,
640 #ifdef HAVE_AMESOS2_SUPERLU5_API
643 SLU::mem_usage_t* mem_usage,
644 SLU::SuperLUStat_t* stat,
int* info)
646 SLU::D::dgsisx(options, A, perm_c, perm_r, etree, equed, R, C, L, U, work,
647 lwork, B, X, recip_pivot_growth, rcond,
648 #ifdef HAVE_AMESOS2_SUPERLU5_API
651 mem_usage, stat, info);
654 static void gsitrf(SLU::superlu_options_t* options, SLU::SuperMatrix* AC,
655 int relax,
int panel_size,
int* etree,
void* work,
int lwork,
int* perm_c,
656 int* perm_r, SLU::SuperMatrix* L, SLU::SuperMatrix* U,
657 #ifdef HAVE_AMESOS2_SUPERLU5_API
660 SLU::SuperLUStat_t* stat,
int* info)
662 SLU::D::dgsitrf(options, AC, relax, panel_size, etree,
663 work, lwork, perm_c, perm_r, L, U,
664 #ifdef HAVE_AMESOS2_SUPERLU5_API
670 template<
class view_t>
671 static void create_CompCol_Matrix(SLU::SuperMatrix* A,
int m,
int n,
int nnz,
672 Teuchos::Array<double> & convert_nzval, view_t & nzval,
673 int* rowind,
int* colptr,
674 SLU::Stype_t stype, SLU::Dtype_t dtype, SLU::Mtype_t mtype)
677 SLU::D::dCreate_CompCol_Matrix(A, m, n, nnz, nzval.data(), rowind, colptr,
678 stype, dtype, mtype);
681 static void create_CompRow_Matrix(SLU::SuperMatrix* A,
int m,
int n,
682 int nnz,
double* nzval,
int* rowind,
int* colptr,
683 SLU::Stype_t stype, SLU::Dtype_t dtype, SLU::Mtype_t mtype)
685 SLU::D::dCreate_CompRow_Matrix(A, m, n, nnz, nzval, rowind, colptr,
686 stype, dtype, mtype);
689 template<
class view_t>
690 static void create_Dense_Matrix(SLU::SuperMatrix* X,
int m,
int n,
691 Teuchos::Array<double> & convert_x, view_t & x,
692 int ldx, SLU::Stype_t stype,
693 SLU::Dtype_t dtype, SLU::Mtype_t mtype)
696 SLU::D::dCreate_Dense_Matrix(X, m, n, x.data(), ldx, stype, dtype, mtype);
699 template<
class view_t>
700 static void convert_back_Dense_Matrix(
701 Teuchos::Array<double> & convert_x, view_t & x)
706 static void gsequ(SLU::SuperMatrix* A,
double* R,
double* C,
707 double* rowcnd,
double* colcnd,
double* amax,
int* info)
709 SLU::D::dgsequ(A, R, C, rowcnd, colcnd, amax, info);
712 static void laqgs(SLU::SuperMatrix* A,
double* R,
double* C,
713 double rowcnd,
double colcnd,
double amax,
char* equed)
715 SLU::D::dlaqgs(A, R, C, rowcnd, colcnd, amax, equed);
721 #ifdef HAVE_TEUCHOS_COMPLEX
724 struct FunctionMap<Superlu, Kokkos::complex<float>>
727 static float langs(
char *norm, SLU::SuperMatrix *A)
729 return SLU::C::clangs(norm, A);
732 static void gscon (
char *norm, SLU::SuperMatrix *L, SLU::SuperMatrix *U,
733 float anorm,
float *rcond, SLU::SuperLUStat_t *stat,
int *info)
735 SLU::C::cgscon (norm, L, U, anorm, rcond, stat, info);
738 static void gssvx(SLU::superlu_options_t* options, SLU::SuperMatrix* A,
739 int* perm_c,
int* perm_r,
int* etree,
char* equed,
float* R,
float* C,
740 SLU::SuperMatrix* L, SLU::SuperMatrix* U,
void* work,
int lwork,
741 SLU::SuperMatrix* B, SLU::SuperMatrix* X,
float* recip_pivot_growth,
742 float* rcond,
float* ferr,
float* berr,
743 #ifdef HAVE_AMESOS2_SUPERLU5_API
746 SLU::mem_usage_t* mem_usage,
747 SLU::SuperLUStat_t* stat,
int* info)
749 SLU::C::cgssvx(options, A, perm_c, perm_r, etree, equed, R, C, L, U, work,
750 lwork, B, X, recip_pivot_growth, rcond, ferr, berr,
751 #ifdef HAVE_AMESOS2_SUPERLU5_API
754 mem_usage, stat, info);
757 static void gstrf(SLU::superlu_options_t* options, SLU::SuperMatrix* AC,
758 int relax,
int panel_size,
int* etree,
void* work,
int lwork,
int* perm_c,
759 int* perm_r, SLU::SuperMatrix* L, SLU::SuperMatrix* U,
760 #ifdef HAVE_AMESOS2_SUPERLU5_API
763 SLU::SuperLUStat_t* stat,
int* info)
765 SLU::C::cgstrf(options, AC, relax, panel_size, etree,
766 work, lwork, perm_c, perm_r, L, U,
767 #ifdef HAVE_AMESOS2_SUPERLU5_API
773 static void gsisx(SLU::superlu_options_t* options, SLU::SuperMatrix* A,
774 int* perm_c,
int* perm_r,
int* etree,
char* equed,
float* R,
float* C,
775 SLU::SuperMatrix* L, SLU::SuperMatrix* U,
void* work,
int lwork,
776 SLU::SuperMatrix* B, SLU::SuperMatrix* X,
float* recip_pivot_growth,
778 #ifdef HAVE_AMESOS2_SUPERLU5_API
781 SLU::mem_usage_t* mem_usage,
782 SLU::SuperLUStat_t* stat,
int* info)
784 SLU::C::cgsisx(options, A, perm_c, perm_r, etree, equed, R, C, L, U, work,
785 lwork, B, X, recip_pivot_growth, rcond,
786 #ifdef HAVE_AMESOS2_SUPERLU5_API
789 mem_usage, stat, info);
792 static void gsitrf(SLU::superlu_options_t* options, SLU::SuperMatrix* AC,
793 int relax,
int panel_size,
int* etree,
void* work,
int lwork,
int* perm_c,
794 int* perm_r, SLU::SuperMatrix* L, SLU::SuperMatrix* U,
795 #ifdef HAVE_AMESOS2_SUPERLU5_API
798 SLU::SuperLUStat_t* stat,
int* info)
800 SLU::C::cgsitrf(options, AC, relax, panel_size, etree,
801 work, lwork, perm_c, perm_r, L, U,
802 #ifdef HAVE_AMESOS2_SUPERLU5_API
808 template<
class view_t>
809 static void create_CompCol_Matrix(SLU::SuperMatrix* A,
int m,
int n,
int nnz,
810 Teuchos::Array<SLU::C::complex> & convert_nzval, view_t & nzval,
811 int* rowind,
int* colptr,
812 SLU::Stype_t stype, SLU::Dtype_t dtype, SLU::Mtype_t mtype)
814 convert_nzval.resize(nnz);
815 for(
int i = 0; i < nnz; ++i) {
816 convert_nzval[i] = Teuchos::as<SLU::C::complex>(nzval(i));
818 SLU::C::cCreate_CompCol_Matrix(A, m, n, nnz, convert_nzval.data(), rowind, colptr,
819 stype, dtype, mtype);
822 static void create_CompRow_Matrix(SLU::SuperMatrix* A,
int m,
int n,
int nnz,
823 SLU::C::complex* nzval,
int* rowind,
int* colptr,
824 SLU::Stype_t stype, SLU::Dtype_t dtype, SLU::Mtype_t mtype)
826 SLU::C::cCreate_CompRow_Matrix(A, m, n, nnz, nzval, rowind, colptr,
827 stype, dtype, mtype);
830 template<
class view_t>
831 static void create_Dense_Matrix(SLU::SuperMatrix* X,
int m,
int n,
832 Teuchos::Array<SLU::C::complex> & convert_x, view_t & x,
833 int ldx, SLU::Stype_t stype,
834 SLU::Dtype_t dtype, SLU::Mtype_t mtype)
836 convert_x.resize(m * n);
838 for(
int j = 0; j < n; ++j) {
839 for(
int i = 0; i < m; ++i) {
840 convert_x[write_index++] = Teuchos::as<SLU::C::complex>(x(i,j));
843 SLU::C::cCreate_Dense_Matrix(X, m, n, convert_x.data(), ldx, stype, dtype, mtype);
846 template<
class view_t>
847 static void convert_back_Dense_Matrix(
848 Teuchos::Array<SLU::C::complex> & convert_x, view_t & x)
851 for(
int j = 0; j < static_cast<int>(x.extent(1)); ++j) {
852 for(
int i = 0; i < static_cast<int>(x.extent(0)); ++i) {
853 x(i,j) = Teuchos::as<Kokkos::complex<float>>(convert_x[read_index++]);
858 static void gsequ(SLU::SuperMatrix* A,
float* R,
float* C,
859 float* rowcnd,
float* colcnd,
float* amax,
int* info)
861 SLU::C::cgsequ(A, R, C, rowcnd, colcnd, amax, info);
864 static void laqgs(SLU::SuperMatrix* A,
float* R,
float* C,
865 float rowcnd,
float colcnd,
float amax,
char* equed)
867 SLU::C::claqgs(A, R, C, rowcnd, colcnd, amax, equed);
873 struct FunctionMap<Superlu,Kokkos::complex<double>>
876 static double langs(
char *norm, SLU::SuperMatrix *A)
878 return SLU::Z::zlangs(norm, A);
881 static void gscon (
char *norm, SLU::SuperMatrix *L, SLU::SuperMatrix *U,
882 double anorm,
double *rcond, SLU::SuperLUStat_t *stat,
int *info)
884 SLU::Z::zgscon (norm, L, U, anorm, rcond, stat, info);
887 static void gssvx(SLU::superlu_options_t* options, SLU::SuperMatrix* A,
888 int* perm_c,
int* perm_r,
int* etree,
char* equed,
double* R,
double* C,
889 SLU::SuperMatrix* L, SLU::SuperMatrix* U,
void* work,
int lwork,
890 SLU::SuperMatrix* B, SLU::SuperMatrix* X,
double* recip_pivot_growth,
891 double* rcond,
double* ferr,
double* berr,
892 #ifdef HAVE_AMESOS2_SUPERLU5_API
895 SLU::mem_usage_t* mem_usage,
896 SLU::SuperLUStat_t* stat,
int* info)
898 SLU::Z::zgssvx(options, A, perm_c, perm_r, etree, equed, R, C, L, U, work,
899 lwork, B, X, recip_pivot_growth, rcond, ferr, berr,
900 #ifdef HAVE_AMESOS2_SUPERLU5_API
903 mem_usage, stat, info);
906 static void gstrf(SLU::superlu_options_t* options, SLU::SuperMatrix* AC,
907 int relax,
int panel_size,
int* etree,
void* work,
int lwork,
int* perm_c,
908 int* perm_r, SLU::SuperMatrix* L, SLU::SuperMatrix* U,
909 #ifdef HAVE_AMESOS2_SUPERLU5_API
912 SLU::SuperLUStat_t* stat,
int* info)
914 SLU::Z::zgstrf(options, AC, relax, panel_size, etree,
915 work, lwork, perm_c, perm_r, L, U,
916 #ifdef HAVE_AMESOS2_SUPERLU5_API
922 static void gsisx(SLU::superlu_options_t* options, SLU::SuperMatrix* A,
923 int* perm_c,
int* perm_r,
int* etree,
char* equed,
double* R,
double* C,
924 SLU::SuperMatrix* L, SLU::SuperMatrix* U,
void* work,
int lwork,
925 SLU::SuperMatrix* B, SLU::SuperMatrix* X,
double* recip_pivot_growth,
927 #ifdef HAVE_AMESOS2_SUPERLU5_API
930 SLU::mem_usage_t* mem_usage,
931 SLU::SuperLUStat_t* stat,
int* info)
933 SLU::Z::zgsisx(options, A, perm_c, perm_r, etree, equed, R, C, L, U, work,
934 lwork, B, X, recip_pivot_growth, rcond,
935 #ifdef HAVE_AMESOS2_SUPERLU5_API
938 mem_usage, stat, info);
941 static void gsitrf(SLU::superlu_options_t* options, SLU::SuperMatrix* AC,
942 int relax,
int panel_size,
int* etree,
void* work,
int lwork,
int* perm_c,
943 int* perm_r, SLU::SuperMatrix* L, SLU::SuperMatrix* U,
944 #ifdef HAVE_AMESOS2_SUPERLU5_API
947 SLU::SuperLUStat_t* stat,
int* info)
949 SLU::Z::zgsitrf(options, AC, relax, panel_size, etree,
950 work, lwork, perm_c, perm_r, L, U,
951 #ifdef HAVE_AMESOS2_SUPERLU5_API
957 template<
class view_t>
958 static void create_CompCol_Matrix(SLU::SuperMatrix* A,
int m,
int n,
int nnz,
959 Teuchos::Array<SLU::Z::doublecomplex> & convert_nzval, view_t & nzval,
960 int* rowind,
int* colptr,
961 SLU::Stype_t stype, SLU::Dtype_t dtype, SLU::Mtype_t mtype)
963 convert_nzval.resize(nnz);
964 for(
int i = 0; i < nnz; ++i) {
965 convert_nzval[i] = Teuchos::as<SLU::Z::doublecomplex>(nzval(i));
967 SLU::Z::zCreate_CompCol_Matrix(A, m, n, nnz, convert_nzval.data(), rowind, colptr,
968 stype, dtype, mtype);
970 TEUCHOS_TEST_FOR_EXCEPTION( A == NULL,
972 "Supermatrix A not initialized properly!");
976 static void create_CompRow_Matrix(SLU::SuperMatrix* A,
int m,
int n,
int nnz,
977 SLU::Z::doublecomplex* nzval,
int* rowind,
int* colptr,
978 SLU::Stype_t stype, SLU::Dtype_t dtype, SLU::Mtype_t mtype)
980 SLU::Z::zCreate_CompRow_Matrix(A, m, n, nnz, nzval, rowind, colptr,
981 stype, dtype, mtype);
983 TEUCHOS_TEST_FOR_EXCEPTION( A == NULL,
985 "Supermatrix A not initialized properly!");
988 template<
class view_t>
989 static void create_Dense_Matrix(SLU::SuperMatrix* X,
int m,
int n,
990 Teuchos::Array<SLU::Z::doublecomplex> & convert_x, view_t & x,
991 int ldx, SLU::Stype_t stype,
992 SLU::Dtype_t dtype, SLU::Mtype_t mtype)
994 convert_x.resize(m * n);
996 for(
int j = 0; j < n; ++j) {
997 for(
int i = 0; i < m; ++i) {
998 convert_x[write_index++] = Teuchos::as<SLU::Z::doublecomplex>(x(i,j));
1001 SLU::Z::zCreate_Dense_Matrix(X, m, n, convert_x.data(), ldx, stype, dtype, mtype);
1004 template<
class view_t>
1005 static void convert_back_Dense_Matrix(
1006 Teuchos::Array<SLU::Z::doublecomplex> & convert_x, view_t & x)
1009 for(
int j = 0; j < static_cast<int>(x.extent(1)); ++j) {
1010 for(
int i = 0; i < static_cast<int>(x.extent(0)); ++i) {
1011 x(i,j) = Teuchos::as<Kokkos::complex<double>>(convert_x[read_index++]);
1016 static void gsequ(SLU::SuperMatrix* A,
double* R,
double* C,
1017 double* rowcnd,
double* colcnd,
double* amax,
int* info)
1019 SLU::Z::zgsequ(A, R, C, rowcnd, colcnd, amax, info);
1022 static void laqgs(SLU::SuperMatrix* A,
double* R,
double* C,
1023 double rowcnd,
double colcnd,
double amax,
char* equed)
1025 SLU::Z::zlaqgs(A, R, C, rowcnd, colcnd, amax, equed);
1028 #endif // HAVE_TEUCHOS_COMPLEX
1035 #endif // AMESOS2_SUPERLU_FUNCTIONMAP_HPP
Declaration of Function mapping class for Amesos2.
Provides definition of SuperLU types as well as conversions and type traits.