53 #ifndef AMESOS2_SUPERLUDIST_FUNCTIONMAP_HPP
54 #define AMESOS2_SUPERLUDIST_FUNCTIONMAP_HPP
56 #ifdef HAVE_TEUCHOS_COMPLEX
60 #include "Amesos2_config.h"
62 #include "Amesos2_MatrixAdapter.hpp"
69 #define AMESOS2_SLUD_GET_DIAG_SCALE(eq) (((eq)=='N') ? SLUD::NOEQUIL : ((eq)=='R') ? SLUD::ROW : ((eq)=='C') ? SLUD::COL : SLUD::BOTH)
71 #define AMESOS2_SLUD_GET_EQUED(ds) (((ds)==SLUD::NOEQUIL) ? 'N' : ((ds)==SLUD::ROW) ? 'R' : ((ds)==SLUD::COL) ? 'C' : 'B')
75 template <
class Matrix,
class Vector>
class Superludist;
77 SLUD::DiagScale_t get_diag_scale(
char eq);
78 char get_equed(SLUD::DiagScale_t ds);
109 struct FunctionMap<Superludist,double>
111 typedef TypeMap<Superludist,double> type_map;
126 static void gstrf(SLUD::amesos2_superlu_dist_options_t* options,
int m,
int n,
double anorm,
127 type_map::LUstruct_t* LU, SLUD::gridinfo_t* grid, SLUD::SuperLUStat_t* stat,
130 SLUD::D::pdgstrf(options, m, n, anorm, LU, grid, stat, info);
137 #if (SUPERLU_DIST_MAJOR_VERSION > 7)
138 static void gstrs(SLUD::amesos2_superlu_dist_options_t* options,
139 SLUD::int_t n, type_map::LUstruct_t* lu_struct,
140 SLUD::D::dScalePermstruct_t* scale_perm_struct, SLUD::gridinfo_t* grid,
141 type_map::type* B, SLUD::int_t l_numrows, SLUD::int_t fst_global_row,
142 SLUD::int_t ldb,
int nrhs, type_map::SOLVEstruct_t* solve_struct,
143 SLUD::SuperLUStat_t* stat,
int* info)
144 #elif SUPERLU_DIST_MAJOR_VERSION > 6 || (SUPERLU_DIST_MAJOR_VERSION == 6 && SUPERLU_DIST_MINOR_VERSION > 2)
145 static void gstrs(SLUD::int_t n, type_map::LUstruct_t* lu_struct,
146 SLUD::D::dScalePermstruct_t* scale_perm_struct, SLUD::gridinfo_t* grid,
147 type_map::type* B, SLUD::int_t l_numrows, SLUD::int_t fst_global_row,
148 SLUD::int_t ldb,
int nrhs, type_map::SOLVEstruct_t* solve_struct,
149 SLUD::SuperLUStat_t* stat,
int* info)
151 static void gstrs(SLUD::int_t n, type_map::LUstruct_t* lu_struct,
152 SLUD::ScalePermstruct_t* scale_perm_struct, SLUD::gridinfo_t* grid,
153 type_map::type* B, SLUD::int_t l_numrows, SLUD::int_t fst_global_row,
154 SLUD::int_t ldb,
int nrhs, type_map::SOLVEstruct_t* solve_struct,
155 SLUD::SuperLUStat_t* stat,
int* info)
158 #if (SUPERLU_DIST_MAJOR_VERSION > 7)
159 SLUD::D::pdgstrs(options, n, lu_struct, scale_perm_struct, grid, B, l_numrows,
160 fst_global_row, ldb, nrhs, solve_struct, stat, info);
162 SLUD::D::pdgstrs(n, lu_struct, scale_perm_struct, grid, B, l_numrows,
163 fst_global_row, ldb, nrhs, solve_struct, stat, info);
174 #if (SUPERLU_DIST_MAJOR_VERSION > 7)
175 static void gstrs_Bglobal(SLUD::amesos2_superlu_dist_options_t* options,
176 SLUD::int_t n, type_map::LUstruct_t* lu_struct,
177 SLUD::gridinfo_t* grid, type_map::type* B,
178 SLUD::int_t ldb,
int nrhs,
179 SLUD::SuperLUStat_t* stat,
int* info)
182 SLUD::D::pdgstrs_Bglobal(options, n, lu_struct, grid, B, ldb, nrhs, stat, info);
185 static void gstrs_Bglobal(SLUD::int_t n, type_map::LUstruct_t* lu_struct,
186 SLUD::gridinfo_t* grid, type_map::type* B,
187 SLUD::int_t ldb,
int nrhs,
188 SLUD::SuperLUStat_t* stat,
int* info)
191 SLUD::D::pdgstrs_Bglobal(n, lu_struct, grid, B, ldb, nrhs, stat, info);
198 #if (SUPERLU_DIST_MAJOR_VERSION > 7)
199 static void gsrfs(SLUD::amesos2_superlu_dist_options_t* options,
200 SLUD::int_t n, SLUD::SuperMatrix* A,
double anorm,
201 type_map::LUstruct_t* lu_struct,
202 SLUD::D::dScalePermstruct_t* scale_perm,
203 SLUD::gridinfo_t* grid, type_map::type* B, SLUD::int_t ldb,
204 type_map::type* X, SLUD::int_t ldx,
int nrhs,
205 type_map::SOLVEstruct_t* solve_struct,
double* berr,
206 SLUD::SuperLUStat_t* stat,
int* info)
207 #elif SUPERLU_DIST_MAJOR_VERSION > 6 || (SUPERLU_DIST_MAJOR_VERSION == 6 && SUPERLU_DIST_MINOR_VERSION > 2)
208 static void gsrfs(SLUD::int_t n, SLUD::SuperMatrix* A,
double anorm,
209 type_map::LUstruct_t* lu_struct,
210 SLUD::D::dScalePermstruct_t* scale_perm,
211 SLUD::gridinfo_t* grid, type_map::type* B, SLUD::int_t ldb,
212 type_map::type* X, SLUD::int_t ldx,
int nrhs,
213 type_map::SOLVEstruct_t* solve_struct,
double* berr,
214 SLUD::SuperLUStat_t* stat,
int* info)
216 static void gsrfs(SLUD::int_t n, SLUD::SuperMatrix* A,
double anorm,
217 type_map::LUstruct_t* lu_struct,
218 SLUD::ScalePermstruct_t* scale_perm,
219 SLUD::gridinfo_t* grid, type_map::type* B, SLUD::int_t ldb,
220 type_map::type* X, SLUD::int_t ldx,
int nrhs,
221 type_map::SOLVEstruct_t* solve_struct,
double* berr,
222 SLUD::SuperLUStat_t* stat,
int* info)
225 #if (SUPERLU_DIST_MAJOR_VERSION > 7)
226 SLUD::D::pdgsrfs(options, n, A, anorm, lu_struct, scale_perm, grid, B, ldb,
227 X, ldx, nrhs, solve_struct, berr, stat, info);
229 SLUD::D::pdgsrfs(n, A, anorm, lu_struct, scale_perm, grid, B, ldb,
230 X, ldx, nrhs, solve_struct, berr, stat, info);
241 #if (SUPERLU_DIST_MAJOR_VERSION > 7)
242 static void gsrfs_ABXglobal(SLUD::amesos2_superlu_dist_options_t* options,
243 SLUD::int_t n, SLUD::SuperMatrix* A,
double anorm,
244 type_map::LUstruct_t* lu_struct, SLUD::gridinfo_t* grid,
245 type_map::type* B, SLUD::int_t ldb, type_map::type* X,
246 SLUD::int_t ldx,
int nrhs,
double* berr,
247 SLUD::SuperLUStat_t* stat,
int* info)
249 SLUD::D::pdgsrfs_ABXglobal(options, n, A, anorm, lu_struct, grid, B, ldb,
250 X, ldx, nrhs, berr, stat, info);
253 static void gsrfs_ABXglobal(SLUD::int_t n, SLUD::SuperMatrix* A,
double anorm,
254 type_map::LUstruct_t* lu_struct, SLUD::gridinfo_t* grid,
255 type_map::type* B, SLUD::int_t ldb, type_map::type* X,
256 SLUD::int_t ldx,
int nrhs,
double* berr,
257 SLUD::SuperLUStat_t* stat,
int* info)
259 SLUD::D::pdgsrfs_ABXglobal(n, A, anorm, lu_struct, grid, B, ldb,
260 X, ldx, nrhs, berr, stat, info);
268 static void create_CompRowLoc_Matrix(SLUD::SuperMatrix* A, SLUD::int_t g_numrows,
269 SLUD::int_t g_numcols, SLUD::int_t l_nnz,
270 SLUD::int_t l_numrows, SLUD::int_t fst_global_row,
271 type_map::type* nzval, SLUD::int_t* colind,
272 SLUD::int_t* rowptr, SLUD::Stype_t storage_t,
273 SLUD::Dtype_t data_t, SLUD::Mtype_t mat_t)
275 SLUD::D::dCreate_CompRowLoc_Matrix_dist(A, g_numrows, g_numcols, l_nnz,
276 l_numrows, fst_global_row,
277 nzval, colind, rowptr,
278 storage_t, data_t, mat_t);
288 static void create_CompCol_Matrix(SLUD::SuperMatrix* A, SLUD::int_t numrows,
289 SLUD::int_t numcols, SLUD::int_t nnz,
290 type_map::type* nzval, SLUD::int_t* rowind,
291 SLUD::int_t* colptr, SLUD::Stype_t storage_t,
292 SLUD::Dtype_t data_t, SLUD::Mtype_t mat_t)
294 SLUD::D::dCreate_CompCol_Matrix_dist(A, numrows, numcols, nnz,
295 nzval, rowind, colptr,
296 storage_t, data_t, mat_t);
307 static void create_Dense_Matrix(SLUD::SuperMatrix* X,
int m,
int n,
308 type_map::type* x,
int ldx, SLUD::Stype_t stype,
309 SLUD::Dtype_t dtype, SLUD::Mtype_t mtype)
311 SLUD::D::dCreate_Dense_Matrix_dist(X, m, n, x, ldx, stype, dtype, mtype);
314 static void permute_Dense_Matrix(SLUD::int_t fst_row, SLUD::int_t m_loc,
315 SLUD::int_t* row_to_proc, SLUD::int_t* perm,
316 type_map::type* X,
int ldx, type_map::type* B,
317 int ldb,
int nrhs, SLUD::gridinfo_t* grid)
319 SLUD::D::pdPermute_Dense_Matrix(fst_row, m_loc, row_to_proc, perm,
320 X, ldx, B, ldb, nrhs, grid);
331 static void gsequ_loc(SLUD::SuperMatrix* A,
double* r,
double* c,
332 double* rowcnd,
double* colcnd,
double* amax, SLUD::int_t* info,
333 SLUD::gridinfo_t* grid)
335 SLUD::D::pdgsequ(A, r, c, rowcnd, colcnd, amax, info, grid);
342 static void gsequ(SLUD::SuperMatrix* A,
double* r,
double* c,
343 double* rowcnd,
double* colcnd,
double* amax, SLUD::int_t* info)
345 SLUD::D::dgsequ_dist(A, r, c, rowcnd, colcnd, amax, info);
351 static void laqgs_loc(SLUD::SuperMatrix* A,
double* r,
double* c,
352 double rowcnd,
double colcnd,
double amax,
353 SLUD::DiagScale_t* equed)
355 char eq = AMESOS2_SLUD_GET_EQUED(*equed);
356 SLUD::D::pdlaqgs(A, r, c, rowcnd, colcnd, amax, &eq);
357 *equed = AMESOS2_SLUD_GET_DIAG_SCALE(eq);
373 static void laqgs(SLUD::SuperMatrix* A,
double* r,
double* c,
374 double rowcnd,
double colcnd,
double amax, SLUD::DiagScale_t* equed)
376 char eq = AMESOS2_SLUD_GET_EQUED(*equed);
377 SLUD::D::dlaqgs_dist(A, r, c, rowcnd, colcnd, amax, &eq);
378 *equed = AMESOS2_SLUD_GET_DIAG_SCALE(eq);
384 #if (SUPERLU_DIST_MAJOR_VERSION > 7)
385 static void distribute(SLUD::amesos2_superlu_dist_options_t* options,
386 SLUD::fact_t fact, SLUD::int_t n,
387 SLUD::SuperMatrix* A, SLUD::Glu_freeable_t* glu_freeable,
388 type_map::LUstruct_t* lu, SLUD::gridinfo_t* grid)
390 SLUD::D::ddistribute(options, n, A, glu_freeable, lu, grid);
393 static void distribute(SLUD::fact_t fact, SLUD::int_t n,
394 SLUD::SuperMatrix* A, SLUD::Glu_freeable_t* glu_freeable,
395 type_map::LUstruct_t* lu, SLUD::gridinfo_t* grid)
397 SLUD::D::ddistribute(fact, n, A, glu_freeable, lu, grid);
408 #if (SUPERLU_DIST_MAJOR_VERSION > 7)
409 static void pdistribute(SLUD::amesos2_superlu_dist_options_t* options,
411 SLUD::SuperMatrix* A, SLUD::D::dScalePermstruct_t* scale_perm,
412 SLUD::Glu_freeable_t* glu_freeable, type_map::LUstruct_t* lu,
413 SLUD::gridinfo_t* grid)
414 #elif SUPERLU_DIST_MAJOR_VERSION > 6 || (SUPERLU_DIST_MAJOR_VERSION == 6 && SUPERLU_DIST_MINOR_VERSION > 2)
415 static void pdistribute(SLUD::fact_t fact, SLUD::int_t n,
416 SLUD::SuperMatrix* A, SLUD::D::dScalePermstruct_t* scale_perm,
417 SLUD::Glu_freeable_t* glu_freeable, type_map::LUstruct_t* lu,
418 SLUD::gridinfo_t* grid)
420 static void pdistribute(SLUD::fact_t fact, SLUD::int_t n,
421 SLUD::SuperMatrix* A, SLUD::ScalePermstruct_t* scale_perm,
422 SLUD::Glu_freeable_t* glu_freeable, type_map::LUstruct_t* lu,
423 SLUD::gridinfo_t* grid)
426 #if (SUPERLU_DIST_MAJOR_VERSION > 7)
427 SLUD::D::pddistribute(options, n, A, scale_perm, glu_freeable, lu, grid);
429 SLUD::D::pddistribute(fact, n, A, scale_perm, glu_freeable, lu, grid);
441 #if (SUPERLU_DIST_MAJOR_VERSION > 7)
442 static void dist_psymbtonum(SLUD::amesos2_superlu_dist_options_t* options,
443 SLUD::int_t n, SLUD::SuperMatrix* A,
444 SLUD::D::dScalePermstruct_t* scale_perm,
445 SLUD::Pslu_freeable_t* pslu_freeable,
446 type_map::LUstruct_t* lu, SLUD::gridinfo_t* grid)
447 #elif SUPERLU_DIST_MAJOR_VERSION > 6 || (SUPERLU_DIST_MAJOR_VERSION == 6 && SUPERLU_DIST_MINOR_VERSION > 2)
448 static void dist_psymbtonum(SLUD::fact_t fact, SLUD::int_t n, SLUD::SuperMatrix* A,
449 SLUD::D::dScalePermstruct_t* scale_perm,
450 SLUD::Pslu_freeable_t* pslu_freeable,
451 type_map::LUstruct_t* lu, SLUD::gridinfo_t* grid)
453 static void dist_psymbtonum(SLUD::fact_t fact, SLUD::int_t n, SLUD::SuperMatrix* A,
454 SLUD::ScalePermstruct_t* scale_perm,
455 SLUD::Pslu_freeable_t* pslu_freeable,
456 type_map::LUstruct_t* lu, SLUD::gridinfo_t* grid)
459 #if (SUPERLU_DIST_MAJOR_VERSION > 7)
460 SLUD::D::ddist_psymbtonum(options, n, A, scale_perm, pslu_freeable, lu, grid);
462 SLUD::D::ddist_psymbtonum(fact, n, A, scale_perm, pslu_freeable, lu, grid);
473 static double plangs(
char* norm, SLUD::SuperMatrix* A, SLUD::gridinfo_t* grid)
475 return SLUD::D::pdlangs(norm, A, grid);
478 static void SolveInit(SLUD::amesos2_superlu_dist_options_t* options, SLUD::SuperMatrix* A,
479 SLUD::int_t* perm_r, SLUD::int_t* perm_c, SLUD::int_t nrhs,
480 type_map::LUstruct_t* lu, SLUD::gridinfo_t* grid,
481 type_map::SOLVEstruct_t* solve_struct)
483 SLUD::D::dSolveInit(options, A, perm_r, perm_c, nrhs, lu, grid, solve_struct);
486 static void LUstructInit(SLUD::int_t m, SLUD::int_t n,
487 type_map::LUstruct_t* lu)
491 #if SUPERLU_DIST_MAJOR_VERSION > 6 || (SUPERLU_DIST_MAJOR_VERSION == 6 && SUPERLU_DIST_MINOR_VERSION > 2)
492 SLUD::D::dLUstructInit(n, lu);
493 #elif defined(AMESOS2_ENABLES_SUPERLUDIST_VERSION5_AND_HIGHER)
494 SLUD::D::LUstructInit(n, lu);
496 #ifdef HAVE_SUPERLUDIST_LUSTRUCTINIT_2ARG
497 SLUD::D::LUstructInit(n, lu);
499 SLUD::D::LUstructInit(m, n, lu);
504 static void Destroy_LU(SLUD::int_t m, SLUD::gridinfo_t* grid,
505 type_map::LUstruct_t* lu)
507 #if SUPERLU_DIST_MAJOR_VERSION > 6 || (SUPERLU_DIST_MAJOR_VERSION == 6 && SUPERLU_DIST_MINOR_VERSION > 2)
508 SLUD::D::dDestroy_LU(m, grid, lu);
510 SLUD::D::Destroy_LU(m, grid, lu);
514 static void LUstructFree(type_map::LUstruct_t* lu)
516 #if SUPERLU_DIST_MAJOR_VERSION > 6 || (SUPERLU_DIST_MAJOR_VERSION == 6 && SUPERLU_DIST_MINOR_VERSION > 2)
517 SLUD::D::dLUstructFree(lu);
519 SLUD::D::LUstructFree(lu);
523 static void SolveFinalize(SLUD::amesos2_superlu_dist_options_t* options,
524 type_map::SOLVEstruct_t* solve_struct)
526 SLUD::D::dSolveFinalize(options, solve_struct);
529 static int ldperm_dist(
int job,
int n, SLUD::int_t nnz, SLUD::int_t colptr[], SLUD::int_t adjncy[],
530 double nzval[], SLUD::int_t *perm,
double u[],
double v[])
532 return SLUD::D::dldperm_dist(job, n, nnz, colptr, adjncy, nzval, perm, u, v);
537 #if defined(HAVE_TEUCHOS_COMPLEX) && !defined(__clang__)
542 struct FunctionMap<Superludist,SLUD::Z::doublecomplex>
544 typedef TypeMap<Superludist,std::complex<double> > type_map;
546 static void gstrf(SLUD::amesos2_superlu_dist_options_t* options,
int m,
int n,
double anorm,
547 type_map::LUstruct_t* LU, SLUD::gridinfo_t* grid,
548 SLUD::SuperLUStat_t* stat,
int* info)
550 SLUD::Z::pzgstrf(options, m, n, anorm, LU, grid, stat, info);
553 #if (SUPERLU_DIST_MAJOR_VERSION > 7)
554 static void gstrs(SLUD::amesos2_superlu_dist_options_t* options,
555 SLUD::int_t n, type_map::LUstruct_t* lu_struct,
556 SLUD::Z::zScalePermstruct_t* scale_perm_struct,
557 SLUD::gridinfo_t* grid, type_map::type* B,
558 SLUD::int_t l_numrows, SLUD::int_t fst_global_row,
559 SLUD::int_t ldb,
int nrhs,
560 type_map::SOLVEstruct_t* solve_struct,
561 SLUD::SuperLUStat_t* stat,
int* info)
562 #elif SUPERLU_DIST_MAJOR_VERSION > 6 || (SUPERLU_DIST_MAJOR_VERSION == 6 && SUPERLU_DIST_MINOR_VERSION > 2)
563 static void gstrs(SLUD::int_t n, type_map::LUstruct_t* lu_struct,
564 SLUD::Z::zScalePermstruct_t* scale_perm_struct,
565 SLUD::gridinfo_t* grid, type_map::type* B,
566 SLUD::int_t l_numrows, SLUD::int_t fst_global_row,
567 SLUD::int_t ldb,
int nrhs,
568 type_map::SOLVEstruct_t* solve_struct,
569 SLUD::SuperLUStat_t* stat,
int* info)
571 static void gstrs(SLUD::int_t n, type_map::LUstruct_t* lu_struct,
572 SLUD::ScalePermstruct_t* scale_perm_struct,
573 SLUD::gridinfo_t* grid, type_map::type* B,
574 SLUD::int_t l_numrows, SLUD::int_t fst_global_row,
575 SLUD::int_t ldb,
int nrhs,
576 type_map::SOLVEstruct_t* solve_struct,
577 SLUD::SuperLUStat_t* stat,
int* info)
580 #if (SUPERLU_DIST_MAJOR_VERSION > 7)
581 SLUD::Z::pzgstrs(options, n, lu_struct, scale_perm_struct, grid, B, l_numrows,
582 fst_global_row, ldb, nrhs, solve_struct, stat, info);
584 SLUD::Z::pzgstrs(n, lu_struct, scale_perm_struct, grid, B, l_numrows,
585 fst_global_row, ldb, nrhs, solve_struct, stat, info);
589 #if (SUPERLU_DIST_MAJOR_VERSION > 7)
590 static void gstrs_Bglobal(SLUD::amesos2_superlu_dist_options_t* options,
591 SLUD::int_t n, type_map::LUstruct_t* lu_struct,
592 SLUD::gridinfo_t* grid, type_map::type* B,
593 SLUD::int_t ldb,
int nrhs, SLUD::SuperLUStat_t* stat,
int* info)
595 SLUD::Z::pzgstrs_Bglobal(options,n, lu_struct, grid, B, ldb, nrhs, stat, info);
598 static void gstrs_Bglobal(SLUD::int_t n, type_map::LUstruct_t* lu_struct,
599 SLUD::gridinfo_t* grid, type_map::type* B,
600 SLUD::int_t ldb,
int nrhs, SLUD::SuperLUStat_t* stat,
int* info)
602 SLUD::Z::pzgstrs_Bglobal(n, lu_struct, grid, B, ldb, nrhs, stat, info);
606 static void create_CompRowLoc_Matrix(SLUD::SuperMatrix* A, SLUD::int_t g_numrows,
607 SLUD::int_t g_numcols, SLUD::int_t l_nnz,
608 SLUD::int_t l_numrows, SLUD::int_t fst_global_row,
609 type_map::type* nzval, SLUD::int_t* colind,
610 SLUD::int_t* rowptr, SLUD::Stype_t storage_t,
611 SLUD::Dtype_t data_t, SLUD::Mtype_t mat_t)
613 SLUD::Z::zCreate_CompRowLoc_Matrix_dist(A, g_numrows, g_numcols, l_nnz,
614 l_numrows, fst_global_row,
615 nzval, colind, rowptr,
616 storage_t, data_t, mat_t);
619 static void create_CompCol_Matrix(SLUD::SuperMatrix* A, SLUD::int_t numrows,
620 SLUD::int_t numcols, SLUD::int_t nnz,
621 type_map::type* nzval, SLUD::int_t* rowind,
622 SLUD::int_t* colptr, SLUD::Stype_t storage_t,
623 SLUD::Dtype_t data_t, SLUD::Mtype_t mat_t)
625 SLUD::Z::zCreate_CompCol_Matrix_dist(A, numrows, numcols, nnz,
626 nzval, rowind, colptr,
627 storage_t, data_t, mat_t);
630 static void create_Dense_Matrix(SLUD::SuperMatrix* X,
int m,
int n,
631 TypeMap<Superludist,std::complex<double> >::type* x,
int ldx,
632 SLUD::Stype_t stype, SLUD::Dtype_t dtype, SLUD::Mtype_t mtype)
634 SLUD::Z::zCreate_Dense_Matrix_dist(X, m, n, x, ldx, stype, dtype, mtype);
637 static void permute_Dense_Matrix(SLUD::int_t fst_row, SLUD::int_t m_loc,
638 SLUD::int_t* row_to_proc, SLUD::int_t* perm,
639 type_map::type* X,
int ldx,
640 type_map::type* B,
int ldb,
641 int nrhs, SLUD::gridinfo_t* grid)
643 SLUD::Z::pzPermute_Dense_Matrix(fst_row, m_loc, row_to_proc, perm,
644 X, ldx, B, ldb, nrhs, grid);
647 static void gsequ_loc(SLUD::SuperMatrix* A,
double* r,
double* c,
648 double* rowcnd,
double* colcnd,
double* amax, SLUD::int_t* info,
649 SLUD::gridinfo_t* grid)
651 SLUD::Z::pzgsequ(A, r, c, rowcnd, colcnd, amax, info, grid);
654 static void gsequ(SLUD::SuperMatrix* A,
double* r,
double* c,
655 double* rowcnd,
double* colcnd,
double* amax, SLUD::int_t* info)
657 SLUD::Z::zgsequ_dist(A, r, c, rowcnd, colcnd, amax, info);
660 static void laqgs_loc(SLUD::SuperMatrix* A,
double* r,
double* c,
661 double rowcnd,
double colcnd,
double amax, SLUD::DiagScale_t* equed)
663 char eq = AMESOS2_SLUD_GET_EQUED(*equed);
664 SLUD::Z::pzlaqgs(A, r, c, rowcnd, colcnd, amax, &eq);
665 *equed = AMESOS2_SLUD_GET_DIAG_SCALE(eq);
668 static void laqgs(SLUD::SuperMatrix* A,
double* r,
double* c,
669 double rowcnd,
double colcnd,
double amax, SLUD::DiagScale_t* equed)
671 char eq = AMESOS2_SLUD_GET_EQUED(*equed);
672 SLUD::Z::zlaqgs_dist(A, r, c, rowcnd, colcnd, amax, &eq);
673 *equed = AMESOS2_SLUD_GET_DIAG_SCALE(eq);
676 #if (SUPERLU_DIST_MAJOR_VERSION > 7)
677 static void distribute(SLUD::amesos2_superlu_dist_options_t* options,
679 SLUD::SuperMatrix* A, SLUD::Glu_freeable_t* glu_freeable,
680 type_map::LUstruct_t* lu, SLUD::gridinfo_t* grid)
682 SLUD::Z::zdistribute(options, n, A, glu_freeable, lu, grid);
685 static void distribute(SLUD::fact_t fact, SLUD::int_t n,
686 SLUD::SuperMatrix* A, SLUD::Glu_freeable_t* glu_freeable,
687 type_map::LUstruct_t* lu, SLUD::gridinfo_t* grid)
689 SLUD::Z::zdistribute(fact, n, A, glu_freeable, lu, grid);
693 #if (SUPERLU_DIST_MAJOR_VERSION > 7)
694 static void pdistribute(SLUD::amesos2_superlu_dist_options_t* options,
696 SLUD::SuperMatrix* A, SLUD::Z::zScalePermstruct_t* scale_perm,
697 SLUD::Glu_freeable_t* glu_freeable, type_map::LUstruct_t* lu,
698 SLUD::gridinfo_t* grid)
699 #elif SUPERLU_DIST_MAJOR_VERSION > 6 || (SUPERLU_DIST_MAJOR_VERSION == 6 && SUPERLU_DIST_MINOR_VERSION > 2)
700 static void pdistribute(SLUD::fact_t fact, SLUD::int_t n,
701 SLUD::SuperMatrix* A, SLUD::Z::zScalePermstruct_t* scale_perm,
702 SLUD::Glu_freeable_t* glu_freeable, type_map::LUstruct_t* lu,
703 SLUD::gridinfo_t* grid)
705 static void pdistribute(SLUD::fact_t fact, SLUD::int_t n,
706 SLUD::SuperMatrix* A, SLUD::ScalePermstruct_t* scale_perm,
707 SLUD::Glu_freeable_t* glu_freeable, type_map::LUstruct_t* lu,
708 SLUD::gridinfo_t* grid)
711 #if (SUPERLU_DIST_MAJOR_VERSION > 7)
712 SLUD::Z::pzdistribute(options, n, A, scale_perm, glu_freeable, lu, grid);
714 SLUD::Z::pzdistribute(fact, n, A, scale_perm, glu_freeable, lu, grid);
718 #if (SUPERLU_DIST_MAJOR_VERSION > 7)
719 static void dist_psymbtonum(SLUD::amesos2_superlu_dist_options_t* options,
721 SLUD::SuperMatrix* A, SLUD::Z::zScalePermstruct_t* scale_perm,
722 SLUD::Pslu_freeable_t* pslu_freeable, type_map::LUstruct_t* lu,
723 SLUD::gridinfo_t* grid)
724 #elif SUPERLU_DIST_MAJOR_VERSION > 6 || (SUPERLU_DIST_MAJOR_VERSION == 6 && SUPERLU_DIST_MINOR_VERSION > 2)
725 static void dist_psymbtonum(SLUD::fact_t fact, SLUD::int_t n,
726 SLUD::SuperMatrix* A, SLUD::Z::zScalePermstruct_t* scale_perm,
727 SLUD::Pslu_freeable_t* pslu_freeable, type_map::LUstruct_t* lu,
728 SLUD::gridinfo_t* grid)
730 static void dist_psymbtonum(SLUD::fact_t fact, SLUD::int_t n,
731 SLUD::SuperMatrix* A, SLUD::ScalePermstruct_t* scale_perm,
732 SLUD::Pslu_freeable_t* pslu_freeable, type_map::LUstruct_t* lu,
733 SLUD::gridinfo_t* grid)
736 #if (SUPERLU_DIST_MAJOR_VERSION > 7)
737 SLUD::Z::zdist_psymbtonum(options, n, A, scale_perm, pslu_freeable, lu, grid);
739 SLUD::Z::zdist_psymbtonum(fact, n, A, scale_perm, pslu_freeable, lu, grid);
743 static double plangs(
char* norm, SLUD::SuperMatrix* A, SLUD::gridinfo_t* grid)
745 return SLUD::Z::pzlangs(norm, A, grid);
748 static void SolveInit(SLUD::amesos2_superlu_dist_options_t* options, SLUD::SuperMatrix* A,
749 SLUD::int_t* perm_r, SLUD::int_t* perm_c, SLUD::int_t nrhs,
750 type_map::LUstruct_t* lu, SLUD::gridinfo_t* grid,
751 type_map::SOLVEstruct_t* solve_struct)
753 SLUD::Z::zSolveInit(options, A, perm_r, perm_c, nrhs, lu, grid, solve_struct);
756 static void LUstructInit(SLUD::int_t m, SLUD::int_t n, type_map::LUstruct_t* lu)
760 #if SUPERLU_DIST_MAJOR_VERSION > 6 || (SUPERLU_DIST_MAJOR_VERSION == 6 && SUPERLU_DIST_MINOR_VERSION > 2)
761 SLUD::Z::zLUstructInit(n, lu);
762 #elif defined(AMESOS2_ENABLES_SUPERLUDIST_VERSION5_AND_HIGHER)
763 SLUD::Z::LUstructInit(n, lu);
765 #ifdef HAVE_SUPERLUDIST_LUSTRUCTINIT_2ARG
766 SLUD::Z::LUstructInit(n, lu);
768 SLUD::Z::LUstructInit(m, n, lu);
773 static void Destroy_LU(SLUD::int_t m, SLUD::gridinfo_t* grid, type_map::LUstruct_t* lu)
775 #if SUPERLU_DIST_MAJOR_VERSION > 6 || (SUPERLU_DIST_MAJOR_VERSION == 6 && SUPERLU_DIST_MINOR_VERSION > 2)
776 SLUD::Z::zDestroy_LU(m, grid, lu);
778 SLUD::Z::Destroy_LU(m, grid, lu);
782 static void LUstructFree(type_map::LUstruct_t* lu)
784 #if SUPERLU_DIST_MAJOR_VERSION > 6 || (SUPERLU_DIST_MAJOR_VERSION == 6 && SUPERLU_DIST_MINOR_VERSION > 2)
785 SLUD::Z::zLUstructFree(lu);
787 SLUD::Z::LUstructFree(lu);
791 static void SolveFinalize(SLUD::amesos2_superlu_dist_options_t* options,
792 type_map::SOLVEstruct_t* solve_struct)
794 SLUD::Z::zSolveFinalize(options, solve_struct);
797 static int ldperm_dist(
int job,
int n, SLUD::int_t nnz, SLUD::int_t colptr[], SLUD::int_t adjncy[],
798 SLUD::Z::doublecomplex nzval[], SLUD::int_t *perm,
double u[],
double v[])
800 return SLUD::Z::zldperm_dist(job, n, nnz, colptr, adjncy, nzval, perm, u, v);
803 #endif // HAVE_TEUCHOS_COMPLEX
808 #endif // AMESOS2_SUPERLUDIST_FUNCTIONMAP_HPP
Declaration of Function mapping class for Amesos2.
Provides definition of SuperLU_DIST types as well as conversions and type traits. ...