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"
84 #ifdef HAVE_AMESOS2_SUPERLU5_API
101 ExpHeader *expanders;
107 sCompRow_to_CompCol(
int,
int,
int,
float*,
int*,
int*,
108 float **,
int **,
int **);
110 sgssvx(SLU::superlu_options_t *, SLU::SuperMatrix *,
int *,
int *,
int *,
111 char *,
float *,
float *, SLU::SuperMatrix *, SLU::SuperMatrix *,
112 void *,
int, SLU::SuperMatrix *, SLU::SuperMatrix *,
113 float *,
float *,
float *,
float *,
114 #ifdef HAVE_AMESOS2_SUPERLU5_API
117 SLU::mem_usage_t *, SLU::SuperLUStat_t *,
int *);
119 sgstrf (SLU::superlu_options_t*, SLU::SuperMatrix*,
120 int,
int,
int*,
void *,
int,
int *,
int *,
121 SLU::SuperMatrix *, SLU::SuperMatrix *,
122 #ifdef HAVE_AMESOS2_SUPERLU5_API
125 SLU::SuperLUStat_t*,
int *);
127 sgsisx(SLU::superlu_options_t *, SLU::SuperMatrix *,
int *,
int *,
int *,
128 char *,
float *,
float *, SLU::SuperMatrix *, SLU::SuperMatrix *,
129 void *,
int, SLU::SuperMatrix *, SLU::SuperMatrix *,
131 #ifdef HAVE_AMESOS2_SUPERLU5_API
134 SLU::mem_usage_t *, SLU::SuperLUStat_t *,
int *);
136 sgsitrf (SLU::superlu_options_t*, SLU::SuperMatrix*,
137 int,
int,
int*,
void *,
int,
int *,
int *,
138 SLU::SuperMatrix *, SLU::SuperMatrix *,
139 #ifdef HAVE_AMESOS2_SUPERLU5_API
142 SLU::SuperLUStat_t*,
int *);
144 sCreate_CompCol_Matrix(SLU::SuperMatrix *,
int,
int,
int,
float *,
145 int *,
int *, SLU::Stype_t, SLU::Dtype_t, SLU::Mtype_t);
147 sCreate_CompRow_Matrix(SLU::SuperMatrix *,
int,
int,
int,
float *,
148 int *,
int *, SLU::Stype_t, SLU::Dtype_t, SLU::Mtype_t);
150 sCreate_Dense_Matrix(SLU::SuperMatrix *,
int,
int,
float *,
int,
151 SLU::Stype_t, SLU::Dtype_t, SLU::Mtype_t);
154 sgsequ (SLU::SuperMatrix *,
float *,
float *,
float *,
155 float *,
float *,
int *);
158 slaqgs (SLU::SuperMatrix *,
float *,
float *,
float,
159 float,
float,
char *);
166 #ifdef HAVE_AMESOS2_SUPERLU5_API
183 ExpHeader *expanders;
189 dCompRow_to_CompCol(
int,
int,
int,
double*,
int*,
int*,
190 double **,
int **,
int **);
192 dgssvx(SLU::superlu_options_t *, SLU::SuperMatrix *,
int *,
int *,
int *,
193 char *,
double *,
double *, SLU::SuperMatrix *, SLU::SuperMatrix *,
194 void *,
int, SLU::SuperMatrix *, SLU::SuperMatrix *,
195 double *,
double *,
double *,
double *,
196 #ifdef HAVE_AMESOS2_SUPERLU5_API
199 SLU::mem_usage_t *, SLU::SuperLUStat_t *,
int *);
201 dgstrf (SLU::superlu_options_t*, SLU::SuperMatrix*,
202 int,
int,
int*,
void *,
int,
int *,
int *,
203 SLU::SuperMatrix *, SLU::SuperMatrix *,
204 #ifdef HAVE_AMESOS2_SUPERLU5_API
207 SLU::SuperLUStat_t*,
int *);
209 dgsisx(SLU::superlu_options_t *, SLU::SuperMatrix *,
int *,
int *,
int *,
210 char *,
double *,
double *, SLU::SuperMatrix *, SLU::SuperMatrix *,
211 void *,
int, SLU::SuperMatrix *, SLU::SuperMatrix *,
213 #ifdef HAVE_AMESOS2_SUPERLU5_API
216 SLU::mem_usage_t *, SLU::SuperLUStat_t *,
int *);
218 dgsitrf (SLU::superlu_options_t*, SLU::SuperMatrix*,
219 int,
int,
int*,
void *,
int,
int *,
int *,
220 SLU::SuperMatrix *, SLU::SuperMatrix *,
221 #ifdef HAVE_AMESOS2_SUPERLU5_API
224 SLU::SuperLUStat_t*,
int *);
226 dCreate_CompCol_Matrix(SLU::SuperMatrix *,
int,
int,
int,
double *,
227 int *,
int *, SLU::Stype_t, SLU::Dtype_t, SLU::Mtype_t);
229 dCreate_CompRow_Matrix(SLU::SuperMatrix *,
int,
int,
int,
double *,
230 int *,
int *, SLU::Stype_t, SLU::Dtype_t, SLU::Mtype_t);
232 dCreate_Dense_Matrix(SLU::SuperMatrix *,
int,
int,
double *,
int,
233 SLU::Stype_t, SLU::Dtype_t, SLU::Mtype_t);
236 dlaqgs (SLU::SuperMatrix *,
double *,
double *,
double,
237 double,
double,
char *);
240 dgsequ (SLU::SuperMatrix *,
double *,
double *,
double *,
241 double *,
double *,
int *);
246 #ifdef HAVE_TEUCHOS_COMPLEX
249 #ifdef HAVE_AMESOS2_SUPERLU5_API
266 ExpHeader *expanders;
272 cCompRow_to_CompCol(
int,
int,
int, complex*,
int*,
int*,
273 complex **,
int **,
int **);
275 cgssvx(SLU::superlu_options_t *, SLU::SuperMatrix *,
int *,
int *,
int *,
276 char *,
float *,
float *, SLU::SuperMatrix *, SLU::SuperMatrix *,
277 void *,
int, SLU::SuperMatrix *, SLU::SuperMatrix *,
278 float *,
float *,
float *,
float *,
279 #ifdef HAVE_AMESOS2_SUPERLU5_API
282 SLU::mem_usage_t *, SLU::SuperLUStat_t *,
int *);
284 cgstrf (SLU::superlu_options_t*, SLU::SuperMatrix*,
285 int,
int,
int*,
void *,
int,
int *,
int *,
286 SLU::SuperMatrix *, SLU::SuperMatrix *,
287 #ifdef HAVE_AMESOS2_SUPERLU5_API
290 SLU::SuperLUStat_t*,
int *);
292 cgsisx(SLU::superlu_options_t *, SLU::SuperMatrix *,
int *,
int *,
int *,
293 char *,
float *,
float *, SLU::SuperMatrix *, SLU::SuperMatrix *,
294 void *,
int, SLU::SuperMatrix *, SLU::SuperMatrix *,
296 #ifdef HAVE_AMESOS2_SUPERLU5_API
299 SLU::mem_usage_t *, SLU::SuperLUStat_t *,
int *);
301 cgsitrf (SLU::superlu_options_t*, SLU::SuperMatrix*,
302 int,
int,
int*,
void *,
int,
int *,
int *,
303 SLU::SuperMatrix *, SLU::SuperMatrix *,
304 #ifdef HAVE_AMESOS2_SUPERLU5_API
307 SLU::SuperLUStat_t*,
int *);
309 cCreate_CompCol_Matrix(SLU::SuperMatrix *,
int,
int,
int, complex *,
310 int *,
int *, SLU::Stype_t, SLU::Dtype_t, SLU::Mtype_t);
312 cCreate_CompRow_Matrix(SLU::SuperMatrix *,
int,
int,
int, complex *,
313 int *,
int *, SLU::Stype_t, SLU::Dtype_t, SLU::Mtype_t);
315 cCreate_Dense_Matrix(SLU::SuperMatrix *,
int,
int, complex *,
int,
316 SLU::Stype_t, SLU::Dtype_t, SLU::Mtype_t);
319 cgsequ (SLU::SuperMatrix *,
float *,
float *,
float *,
320 float *,
float *,
int *);
323 claqgs (SLU::SuperMatrix *,
float *,
float *,
float,
324 float,
float,
char *);
331 #ifdef HAVE_AMESOS2_SUPERLU5_API
337 doublecomplex *lusup;
348 ExpHeader *expanders;
354 zCompRow_to_CompCol(
int,
int,
int, doublecomplex*,
int*,
int*,
355 doublecomplex **,
int **,
int **);
357 zgssvx(SLU::superlu_options_t *, SLU::SuperMatrix *,
int *,
int *,
int *,
358 char *,
double *,
double *, SLU::SuperMatrix *, SLU::SuperMatrix *,
359 void *,
int, SLU::SuperMatrix *, SLU::SuperMatrix *,
360 double *,
double *,
double *,
double *,
361 #ifdef HAVE_AMESOS2_SUPERLU5_API
364 SLU::mem_usage_t *, SLU::SuperLUStat_t *,
int *);
366 zgstrf (SLU::superlu_options_t*, SLU::SuperMatrix*,
367 int,
int,
int*,
void *,
int,
int *,
int *,
368 SLU::SuperMatrix *, SLU::SuperMatrix *,
369 #ifdef HAVE_AMESOS2_SUPERLU5_API
372 SLU::SuperLUStat_t*,
int *);
374 zgsisx(SLU::superlu_options_t *, SLU::SuperMatrix *,
int *,
int *,
int *,
375 char *,
double *,
double *, SLU::SuperMatrix *, SLU::SuperMatrix *,
376 void *,
int, SLU::SuperMatrix *, SLU::SuperMatrix *,
378 #ifdef HAVE_AMESOS2_SUPERLU5_API
381 SLU::mem_usage_t *, SLU::SuperLUStat_t *,
int *);
383 zgsitrf (SLU::superlu_options_t*, SLU::SuperMatrix*,
384 int,
int,
int*,
void *,
int,
int *,
int *,
385 SLU::SuperMatrix *, SLU::SuperMatrix *,
386 #ifdef HAVE_AMESOS2_SUPERLU5_API
389 SLU::SuperLUStat_t*,
int *);
391 zCreate_CompCol_Matrix(SLU::SuperMatrix *,
int,
int,
int, doublecomplex *,
392 int *,
int *, SLU::Stype_t, SLU::Dtype_t, SLU::Mtype_t);
394 zCreate_CompRow_Matrix(SLU::SuperMatrix *,
int,
int,
int, doublecomplex *,
395 int *,
int *, SLU::Stype_t, SLU::Dtype_t, SLU::Mtype_t);
397 zCreate_Dense_Matrix(SLU::SuperMatrix *,
int,
int, doublecomplex *,
int,
398 SLU::Stype_t, SLU::Dtype_t, SLU::Mtype_t);
401 zgsequ (SLU::SuperMatrix *,
double *,
double *,
double *,
402 double *,
double *,
int *);
405 zlaqgs (SLU::SuperMatrix *,
double *,
double *,
double,
406 double,
double,
char *);
410 #endif // HAVE_TEUCHOS_COMPLEX
448 struct FunctionMap<Superlu,float>
450 typedef TypeMap<Superlu,float> type_map;
452 #ifdef HAVE_AMESOS2_SUPERLU5_API
453 typedef typename SLU::S::GlobalLU_t GlobalLU_type;
459 static void gssvx(SLU::superlu_options_t* options, SLU::SuperMatrix* A,
460 int* perm_c,
int* perm_r,
int* etree,
char* equed,
float* R,
float* C,
461 SLU::SuperMatrix* L, SLU::SuperMatrix* U,
void* work,
int lwork,
462 SLU::SuperMatrix* B, SLU::SuperMatrix* X,
float* recip_pivot_growth,
463 float* rcond,
float* ferr,
float* berr,
464 #ifdef HAVE_AMESOS2_SUPERLU5_API
467 SLU::mem_usage_t* mem_usage,
468 SLU::SuperLUStat_t* stat,
int* info)
470 SLU::S::sgssvx(options, A, perm_c, perm_r, etree, equed, R, C, L, U, work,
471 lwork, B, X, recip_pivot_growth, rcond, ferr, berr,
472 #ifdef HAVE_AMESOS2_SUPERLU5_API
475 mem_usage, stat, info);
478 static void gsisx(SLU::superlu_options_t* options, SLU::SuperMatrix* A,
479 int* perm_c,
int* perm_r,
int* etree,
char* equed,
float* R,
float* C,
480 SLU::SuperMatrix* L, SLU::SuperMatrix* U,
void* work,
int lwork,
481 SLU::SuperMatrix* B, SLU::SuperMatrix* X,
float* recip_pivot_growth,
483 #ifdef HAVE_AMESOS2_SUPERLU5_API
486 SLU::mem_usage_t* mem_usage,
487 SLU::SuperLUStat_t* stat,
int* info)
489 SLU::S::sgsisx(options, A, perm_c, perm_r, etree, equed, R, C, L, U, work,
490 lwork, B, X, recip_pivot_growth, rcond,
491 #ifdef HAVE_AMESOS2_SUPERLU5_API
494 mem_usage, stat, info);
516 static void gstrf(SLU::superlu_options_t* options, SLU::SuperMatrix* AC,
517 int relax,
int panel_size,
int* etree,
void* work,
518 int lwork,
int* perm_c,
int* perm_r, SLU::SuperMatrix* L,
520 #ifdef HAVE_AMESOS2_SUPERLU5_API
523 SLU::SuperLUStat_t* stat,
int* info)
525 SLU::S::sgstrf(options, AC, relax, panel_size, etree,
526 work, lwork, perm_c, perm_r, L, U,
527 #ifdef HAVE_AMESOS2_SUPERLU5_API
533 static void gsitrf(SLU::superlu_options_t* options, SLU::SuperMatrix* AC,
534 int relax,
int panel_size,
int* etree,
void* work,
535 int lwork,
int* perm_c,
int* perm_r, SLU::SuperMatrix* L,
537 #ifdef HAVE_AMESOS2_SUPERLU5_API
540 SLU::SuperLUStat_t* stat,
int* info)
542 SLU::S::sgsitrf(options, AC, relax, panel_size, etree,
543 work, lwork, perm_c, perm_r, L, U,
544 #ifdef HAVE_AMESOS2_SUPERLU5_API
553 template<
class view_t>
554 static void create_CompCol_Matrix(SLU::SuperMatrix* A,
int m,
int n,
int nnz,
555 Teuchos::Array<float> & convert_nzval, view_t & nzval,
556 int* rowind,
int* colptr,
557 SLU::Stype_t stype, SLU::Dtype_t dtype, SLU::Mtype_t mtype)
560 SLU::S::sCreate_CompCol_Matrix(A, m, n, nnz, nzval.data(), rowind, colptr,
561 stype, dtype, mtype);
567 static void create_CompRow_Matrix(SLU::SuperMatrix* A,
int m,
int n,
568 int nnz,
float* nzval,
int* rowind,
int* colptr,
569 SLU::Stype_t stype, SLU::Dtype_t dtype, SLU::Mtype_t mtype)
571 SLU::S::sCreate_CompRow_Matrix(A, m, n, nnz, nzval, rowind, colptr,
572 stype, dtype, mtype);
584 template<
class view_t>
585 static void create_Dense_Matrix(SLU::SuperMatrix* X,
int m,
int n,
586 Teuchos::Array<float> & convert_x, view_t & x,
587 int ldx, SLU::Stype_t stype,
588 SLU::Dtype_t dtype, SLU::Mtype_t mtype)
591 SLU::S::sCreate_Dense_Matrix(X, m, n, x.data(), ldx, stype, dtype, mtype);
594 template<
class view_t>
595 static void convert_back_Dense_Matrix(
596 Teuchos::Array<float> & convert_x, view_t & x)
604 static void gsequ(SLU::SuperMatrix* A,
float* R,
float* C,
605 float* rowcnd,
float* colcnd,
float* amax,
int* info)
607 SLU::S::sgsequ(A, R, C, rowcnd, colcnd, amax, info);
624 static void laqgs(SLU::SuperMatrix* A,
float* R,
float* C,
625 float rowcnd,
float colcnd,
float amax,
char* equed)
627 SLU::S::slaqgs(A, R, C, rowcnd, colcnd, amax, equed);
633 struct FunctionMap<Superlu,double>
635 typedef TypeMap<Superlu,double> type_map;
637 #ifdef HAVE_AMESOS2_SUPERLU5_API
638 typedef typename SLU::D::GlobalLU_t GlobalLU_type;
641 static void gssvx(SLU::superlu_options_t* options, SLU::SuperMatrix* A,
642 int* perm_c,
int* perm_r,
int* etree,
char* equed,
double* R,
double* C,
643 SLU::SuperMatrix* L, SLU::SuperMatrix* U,
void* work,
int lwork,
644 SLU::SuperMatrix* B, SLU::SuperMatrix* X,
double* recip_pivot_growth,
645 double* rcond,
double* ferr,
double* berr,
646 #ifdef HAVE_AMESOS2_SUPERLU5_API
649 SLU::mem_usage_t* mem_usage,
650 SLU::SuperLUStat_t* stat,
int* info)
652 SLU::D::dgssvx(options, A, perm_c, perm_r, etree, equed, R, C, L, U, work,
653 lwork, B, X, recip_pivot_growth, rcond, ferr, berr,
654 #ifdef HAVE_AMESOS2_SUPERLU5_API
657 mem_usage, stat, info);
660 static void gstrf(SLU::superlu_options_t* options, SLU::SuperMatrix* AC,
661 int relax,
int panel_size,
int* etree,
void* work,
int lwork,
int* perm_c,
662 int* perm_r, SLU::SuperMatrix* L, SLU::SuperMatrix* U,
663 #ifdef HAVE_AMESOS2_SUPERLU5_API
666 SLU::SuperLUStat_t* stat,
int* info)
668 SLU::D::dgstrf(options, AC, relax, panel_size, etree,
669 work, lwork, perm_c, perm_r, L, U,
670 #ifdef HAVE_AMESOS2_SUPERLU5_API
676 static void gsisx(SLU::superlu_options_t* options, SLU::SuperMatrix* A,
677 int* perm_c,
int* perm_r,
int* etree,
char* equed,
double* R,
double* C,
678 SLU::SuperMatrix* L, SLU::SuperMatrix* U,
void* work,
int lwork,
679 SLU::SuperMatrix* B, SLU::SuperMatrix* X,
double* recip_pivot_growth,
681 #ifdef HAVE_AMESOS2_SUPERLU5_API
684 SLU::mem_usage_t* mem_usage,
685 SLU::SuperLUStat_t* stat,
int* info)
687 SLU::D::dgsisx(options, A, perm_c, perm_r, etree, equed, R, C, L, U, work,
688 lwork, B, X, recip_pivot_growth, rcond,
689 #ifdef HAVE_AMESOS2_SUPERLU5_API
692 mem_usage, stat, info);
695 static void gsitrf(SLU::superlu_options_t* options, SLU::SuperMatrix* AC,
696 int relax,
int panel_size,
int* etree,
void* work,
int lwork,
int* perm_c,
697 int* perm_r, SLU::SuperMatrix* L, SLU::SuperMatrix* U,
698 #ifdef HAVE_AMESOS2_SUPERLU5_API
701 SLU::SuperLUStat_t* stat,
int* info)
703 SLU::D::dgsitrf(options, AC, relax, panel_size, etree,
704 work, lwork, perm_c, perm_r, L, U,
705 #ifdef HAVE_AMESOS2_SUPERLU5_API
711 template<
class view_t>
712 static void create_CompCol_Matrix(SLU::SuperMatrix* A,
int m,
int n,
int nnz,
713 Teuchos::Array<double> & convert_nzval, view_t & nzval,
714 int* rowind,
int* colptr,
715 SLU::Stype_t stype, SLU::Dtype_t dtype, SLU::Mtype_t mtype)
718 SLU::D::dCreate_CompCol_Matrix(A, m, n, nnz, nzval.data(), rowind, colptr,
719 stype, dtype, mtype);
722 static void create_CompRow_Matrix(SLU::SuperMatrix* A,
int m,
int n,
723 int nnz,
double* nzval,
int* rowind,
int* colptr,
724 SLU::Stype_t stype, SLU::Dtype_t dtype, SLU::Mtype_t mtype)
726 SLU::D::dCreate_CompRow_Matrix(A, m, n, nnz, nzval, rowind, colptr,
727 stype, dtype, mtype);
730 template<
class view_t>
731 static void create_Dense_Matrix(SLU::SuperMatrix* X,
int m,
int n,
732 Teuchos::Array<double> & convert_x, view_t & x,
733 int ldx, SLU::Stype_t stype,
734 SLU::Dtype_t dtype, SLU::Mtype_t mtype)
737 SLU::D::dCreate_Dense_Matrix(X, m, n, x.data(), ldx, stype, dtype, mtype);
740 template<
class view_t>
741 static void convert_back_Dense_Matrix(
742 Teuchos::Array<double> & convert_x, view_t & x)
747 static void gsequ(SLU::SuperMatrix* A,
double* R,
double* C,
748 double* rowcnd,
double* colcnd,
double* amax,
int* info)
750 SLU::D::dgsequ(A, R, C, rowcnd, colcnd, amax, info);
753 static void laqgs(SLU::SuperMatrix* A,
double* R,
double* C,
754 double rowcnd,
double colcnd,
double amax,
char* equed)
756 SLU::D::dlaqgs(A, R, C, rowcnd, colcnd, amax, equed);
762 #ifdef HAVE_TEUCHOS_COMPLEX
765 struct FunctionMap<Superlu, Kokkos::complex<float>>
767 #ifdef HAVE_AMESOS2_SUPERLU5_API
768 typedef typename SLU::C::GlobalLU_t GlobalLU_type;
771 static void gssvx(SLU::superlu_options_t* options, SLU::SuperMatrix* A,
772 int* perm_c,
int* perm_r,
int* etree,
char* equed,
float* R,
float* C,
773 SLU::SuperMatrix* L, SLU::SuperMatrix* U,
void* work,
int lwork,
774 SLU::SuperMatrix* B, SLU::SuperMatrix* X,
float* recip_pivot_growth,
775 float* rcond,
float* ferr,
float* berr,
776 #ifdef HAVE_AMESOS2_SUPERLU5_API
779 SLU::mem_usage_t* mem_usage,
780 SLU::SuperLUStat_t* stat,
int* info)
782 SLU::C::cgssvx(options, A, perm_c, perm_r, etree, equed, R, C, L, U, work,
783 lwork, B, X, recip_pivot_growth, rcond, ferr, berr,
784 #ifdef HAVE_AMESOS2_SUPERLU5_API
787 mem_usage, stat, info);
790 static void gstrf(SLU::superlu_options_t* options, SLU::SuperMatrix* AC,
791 int relax,
int panel_size,
int* etree,
void* work,
int lwork,
int* perm_c,
792 int* perm_r, SLU::SuperMatrix* L, SLU::SuperMatrix* U,
793 #ifdef HAVE_AMESOS2_SUPERLU5_API
796 SLU::SuperLUStat_t* stat,
int* info)
798 SLU::C::cgstrf(options, AC, relax, panel_size, etree,
799 work, lwork, perm_c, perm_r, L, U,
800 #ifdef HAVE_AMESOS2_SUPERLU5_API
806 static void gsisx(SLU::superlu_options_t* options, SLU::SuperMatrix* A,
807 int* perm_c,
int* perm_r,
int* etree,
char* equed,
float* R,
float* C,
808 SLU::SuperMatrix* L, SLU::SuperMatrix* U,
void* work,
int lwork,
809 SLU::SuperMatrix* B, SLU::SuperMatrix* X,
float* recip_pivot_growth,
811 #ifdef HAVE_AMESOS2_SUPERLU5_API
814 SLU::mem_usage_t* mem_usage,
815 SLU::SuperLUStat_t* stat,
int* info)
817 SLU::C::cgsisx(options, A, perm_c, perm_r, etree, equed, R, C, L, U, work,
818 lwork, B, X, recip_pivot_growth, rcond,
819 #ifdef HAVE_AMESOS2_SUPERLU5_API
822 mem_usage, stat, info);
825 static void gsitrf(SLU::superlu_options_t* options, SLU::SuperMatrix* AC,
826 int relax,
int panel_size,
int* etree,
void* work,
int lwork,
int* perm_c,
827 int* perm_r, SLU::SuperMatrix* L, SLU::SuperMatrix* U,
828 #ifdef HAVE_AMESOS2_SUPERLU5_API
831 SLU::SuperLUStat_t* stat,
int* info)
833 SLU::C::cgsitrf(options, AC, relax, panel_size, etree,
834 work, lwork, perm_c, perm_r, L, U,
835 #ifdef HAVE_AMESOS2_SUPERLU5_API
841 template<
class view_t>
842 static void create_CompCol_Matrix(SLU::SuperMatrix* A,
int m,
int n,
int nnz,
843 Teuchos::Array<SLU::C::complex> & convert_nzval, view_t & nzval,
844 int* rowind,
int* colptr,
845 SLU::Stype_t stype, SLU::Dtype_t dtype, SLU::Mtype_t mtype)
847 convert_nzval.resize(nnz);
848 for(
int i = 0; i < nnz; ++i) {
849 convert_nzval[i] = Teuchos::as<SLU::C::complex>(nzval(i));
851 SLU::C::cCreate_CompCol_Matrix(A, m, n, nnz, convert_nzval.data(), rowind, colptr,
852 stype, dtype, mtype);
855 static void create_CompRow_Matrix(SLU::SuperMatrix* A,
int m,
int n,
int nnz,
856 SLU::C::complex* nzval,
int* rowind,
int* colptr,
857 SLU::Stype_t stype, SLU::Dtype_t dtype, SLU::Mtype_t mtype)
859 SLU::C::cCreate_CompRow_Matrix(A, m, n, nnz, nzval, rowind, colptr,
860 stype, dtype, mtype);
863 template<
class view_t>
864 static void create_Dense_Matrix(SLU::SuperMatrix* X,
int m,
int n,
865 Teuchos::Array<SLU::C::complex> & convert_x, view_t & x,
866 int ldx, SLU::Stype_t stype,
867 SLU::Dtype_t dtype, SLU::Mtype_t mtype)
869 convert_x.resize(m * n);
871 for(
int j = 0; j < n; ++j) {
872 for(
int i = 0; i < m; ++i) {
873 convert_x[write_index++] = Teuchos::as<SLU::C::complex>(x(i,j));
876 SLU::C::cCreate_Dense_Matrix(X, m, n, convert_x.data(), ldx, stype, dtype, mtype);
879 template<
class view_t>
880 static void convert_back_Dense_Matrix(
881 Teuchos::Array<SLU::C::complex> & convert_x, view_t & x)
884 for(
int j = 0; j < static_cast<int>(x.extent(1)); ++j) {
885 for(
int i = 0; i < static_cast<int>(x.extent(0)); ++i) {
886 x(i,j) = Teuchos::as<Kokkos::complex<float>>(convert_x[read_index++]);
891 static void gsequ(SLU::SuperMatrix* A,
float* R,
float* C,
892 float* rowcnd,
float* colcnd,
float* amax,
int* info)
894 SLU::C::cgsequ(A, R, C, rowcnd, colcnd, amax, info);
897 static void laqgs(SLU::SuperMatrix* A,
float* R,
float* C,
898 float rowcnd,
float colcnd,
float amax,
char* equed)
900 SLU::C::claqgs(A, R, C, rowcnd, colcnd, amax, equed);
906 struct FunctionMap<Superlu,Kokkos::complex<double>>
908 #ifdef HAVE_AMESOS2_SUPERLU5_API
909 typedef typename SLU::Z::GlobalLU_t GlobalLU_type;
912 static void gssvx(SLU::superlu_options_t* options, SLU::SuperMatrix* A,
913 int* perm_c,
int* perm_r,
int* etree,
char* equed,
double* R,
double* C,
914 SLU::SuperMatrix* L, SLU::SuperMatrix* U,
void* work,
int lwork,
915 SLU::SuperMatrix* B, SLU::SuperMatrix* X,
double* recip_pivot_growth,
916 double* rcond,
double* ferr,
double* berr,
917 #ifdef HAVE_AMESOS2_SUPERLU5_API
920 SLU::mem_usage_t* mem_usage,
921 SLU::SuperLUStat_t* stat,
int* info)
923 SLU::Z::zgssvx(options, A, perm_c, perm_r, etree, equed, R, C, L, U, work,
924 lwork, B, X, recip_pivot_growth, rcond, ferr, berr,
925 #ifdef HAVE_AMESOS2_SUPERLU5_API
928 mem_usage, stat, info);
931 static void gstrf(SLU::superlu_options_t* options, SLU::SuperMatrix* AC,
932 int relax,
int panel_size,
int* etree,
void* work,
int lwork,
int* perm_c,
933 int* perm_r, SLU::SuperMatrix* L, SLU::SuperMatrix* U,
934 #ifdef HAVE_AMESOS2_SUPERLU5_API
937 SLU::SuperLUStat_t* stat,
int* info)
939 SLU::Z::zgstrf(options, AC, relax, panel_size, etree,
940 work, lwork, perm_c, perm_r, L, U,
941 #ifdef HAVE_AMESOS2_SUPERLU5_API
947 static void gsisx(SLU::superlu_options_t* options, SLU::SuperMatrix* A,
948 int* perm_c,
int* perm_r,
int* etree,
char* equed,
double* R,
double* C,
949 SLU::SuperMatrix* L, SLU::SuperMatrix* U,
void* work,
int lwork,
950 SLU::SuperMatrix* B, SLU::SuperMatrix* X,
double* recip_pivot_growth,
952 #ifdef HAVE_AMESOS2_SUPERLU5_API
955 SLU::mem_usage_t* mem_usage,
956 SLU::SuperLUStat_t* stat,
int* info)
958 SLU::Z::zgsisx(options, A, perm_c, perm_r, etree, equed, R, C, L, U, work,
959 lwork, B, X, recip_pivot_growth, rcond,
960 #ifdef HAVE_AMESOS2_SUPERLU5_API
963 mem_usage, stat, info);
966 static void gsitrf(SLU::superlu_options_t* options, SLU::SuperMatrix* AC,
967 int relax,
int panel_size,
int* etree,
void* work,
int lwork,
int* perm_c,
968 int* perm_r, SLU::SuperMatrix* L, SLU::SuperMatrix* U,
969 #ifdef HAVE_AMESOS2_SUPERLU5_API
972 SLU::SuperLUStat_t* stat,
int* info)
974 SLU::Z::zgsitrf(options, AC, relax, panel_size, etree,
975 work, lwork, perm_c, perm_r, L, U,
976 #ifdef HAVE_AMESOS2_SUPERLU5_API
982 template<
class view_t>
983 static void create_CompCol_Matrix(SLU::SuperMatrix* A,
int m,
int n,
int nnz,
984 Teuchos::Array<SLU::Z::doublecomplex> & convert_nzval, view_t & nzval,
985 int* rowind,
int* colptr,
986 SLU::Stype_t stype, SLU::Dtype_t dtype, SLU::Mtype_t mtype)
988 convert_nzval.resize(nnz);
989 for(
int i = 0; i < nnz; ++i) {
990 convert_nzval[i] = Teuchos::as<SLU::Z::doublecomplex>(nzval(i));
992 SLU::Z::zCreate_CompCol_Matrix(A, m, n, nnz, convert_nzval.data(), rowind, colptr,
993 stype, dtype, mtype);
995 TEUCHOS_TEST_FOR_EXCEPTION( A == NULL,
997 "Supermatrix A not initialized properly!");
1001 static void create_CompRow_Matrix(SLU::SuperMatrix* A,
int m,
int n,
int nnz,
1002 SLU::Z::doublecomplex* nzval,
int* rowind,
int* colptr,
1003 SLU::Stype_t stype, SLU::Dtype_t dtype, SLU::Mtype_t mtype)
1005 SLU::Z::zCreate_CompRow_Matrix(A, m, n, nnz, nzval, rowind, colptr,
1006 stype, dtype, mtype);
1008 TEUCHOS_TEST_FOR_EXCEPTION( A == NULL,
1010 "Supermatrix A not initialized properly!");
1013 template<
class view_t>
1014 static void create_Dense_Matrix(SLU::SuperMatrix* X,
int m,
int n,
1015 Teuchos::Array<SLU::Z::doublecomplex> & convert_x, view_t & x,
1016 int ldx, SLU::Stype_t stype,
1017 SLU::Dtype_t dtype, SLU::Mtype_t mtype)
1019 convert_x.resize(m * n);
1020 int write_index = 0;
1021 for(
int j = 0; j < n; ++j) {
1022 for(
int i = 0; i < m; ++i) {
1023 convert_x[write_index++] = Teuchos::as<SLU::Z::doublecomplex>(x(i,j));
1026 SLU::Z::zCreate_Dense_Matrix(X, m, n, convert_x.data(), ldx, stype, dtype, mtype);
1029 template<
class view_t>
1030 static void convert_back_Dense_Matrix(
1031 Teuchos::Array<SLU::Z::doublecomplex> & convert_x, view_t & x)
1034 for(
int j = 0; j < static_cast<int>(x.extent(1)); ++j) {
1035 for(
int i = 0; i < static_cast<int>(x.extent(0)); ++i) {
1036 x(i,j) = Teuchos::as<Kokkos::complex<double>>(convert_x[read_index++]);
1041 static void gsequ(SLU::SuperMatrix* A,
double* R,
double* C,
1042 double* rowcnd,
double* colcnd,
double* amax,
int* info)
1044 SLU::Z::zgsequ(A, R, C, rowcnd, colcnd, amax, info);
1047 static void laqgs(SLU::SuperMatrix* A,
double* R,
double* C,
1048 double rowcnd,
double colcnd,
double amax,
char* equed)
1050 SLU::Z::zlaqgs(A, R, C, rowcnd, colcnd, amax, equed);
1053 #endif // HAVE_TEUCHOS_COMPLEX
1060 #endif // AMESOS2_SUPERLU_FUNCTIONMAP_HPP
Declaration of Function mapping class for Amesos2.
Provides definition of SuperLU types as well as conversions and type traits.