19 #ifndef AMESOS2_SUPERLUDIST_FUNCTIONMAP_HPP
20 #define AMESOS2_SUPERLUDIST_FUNCTIONMAP_HPP
22 #ifdef HAVE_TEUCHOS_COMPLEX
26 #include "Amesos2_config.h"
28 #include "Amesos2_MatrixAdapter.hpp"
35 #define AMESOS2_SLUD_GET_DIAG_SCALE(eq) (((eq)=='N') ? SLUD::NOEQUIL : ((eq)=='R') ? SLUD::ROW : ((eq)=='C') ? SLUD::COL : SLUD::BOTH)
37 #define AMESOS2_SLUD_GET_EQUED(ds) (((ds)==SLUD::NOEQUIL) ? 'N' : ((ds)==SLUD::ROW) ? 'R' : ((ds)==SLUD::COL) ? 'C' : 'B')
41 template <
class Matrix,
class Vector>
class Superludist;
43 SLUD::DiagScale_t get_diag_scale(
char eq);
44 char get_equed(SLUD::DiagScale_t ds);
75 struct FunctionMap<Superludist,double>
77 typedef TypeMap<Superludist,double> type_map;
92 static void gstrf(SLUD::amesos2_superlu_dist_options_t* options,
int m,
int n,
double anorm,
93 type_map::LUstruct_t* LU, SLUD::gridinfo_t* grid, SLUD::SuperLUStat_t* stat,
96 SLUD::D::pdgstrf(options, m, n, anorm, LU, grid, stat, info);
103 #if (SUPERLU_DIST_MAJOR_VERSION > 7)
104 static void gstrs(SLUD::amesos2_superlu_dist_options_t* options,
105 SLUD::int_t n, type_map::LUstruct_t* lu_struct,
106 SLUD::D::dScalePermstruct_t* scale_perm_struct, SLUD::gridinfo_t* grid,
107 type_map::type* B, SLUD::int_t l_numrows, SLUD::int_t fst_global_row,
108 SLUD::int_t ldb,
int nrhs, type_map::SOLVEstruct_t* solve_struct,
109 SLUD::SuperLUStat_t* stat,
int* info)
110 #elif SUPERLU_DIST_MAJOR_VERSION > 6 || (SUPERLU_DIST_MAJOR_VERSION == 6 && SUPERLU_DIST_MINOR_VERSION > 2)
111 static void gstrs(SLUD::int_t n, type_map::LUstruct_t* lu_struct,
112 SLUD::D::dScalePermstruct_t* scale_perm_struct, SLUD::gridinfo_t* grid,
113 type_map::type* B, SLUD::int_t l_numrows, SLUD::int_t fst_global_row,
114 SLUD::int_t ldb,
int nrhs, type_map::SOLVEstruct_t* solve_struct,
115 SLUD::SuperLUStat_t* stat,
int* info)
117 static void gstrs(SLUD::int_t n, type_map::LUstruct_t* lu_struct,
118 SLUD::ScalePermstruct_t* scale_perm_struct, SLUD::gridinfo_t* grid,
119 type_map::type* B, SLUD::int_t l_numrows, SLUD::int_t fst_global_row,
120 SLUD::int_t ldb,
int nrhs, type_map::SOLVEstruct_t* solve_struct,
121 SLUD::SuperLUStat_t* stat,
int* info)
124 #if (SUPERLU_DIST_MAJOR_VERSION > 7)
125 SLUD::D::pdgstrs(options, n, lu_struct, scale_perm_struct, grid, B, l_numrows,
126 fst_global_row, ldb, nrhs, solve_struct, stat, info);
128 SLUD::D::pdgstrs(n, lu_struct, scale_perm_struct, grid, B, l_numrows,
129 fst_global_row, ldb, nrhs, solve_struct, stat, info);
140 #if (SUPERLU_DIST_MAJOR_VERSION > 7)
141 static void gstrs_Bglobal(SLUD::amesos2_superlu_dist_options_t* options,
142 SLUD::int_t n, type_map::LUstruct_t* lu_struct,
143 SLUD::gridinfo_t* grid, type_map::type* B,
144 SLUD::int_t ldb,
int nrhs,
145 SLUD::SuperLUStat_t* stat,
int* info)
148 SLUD::D::pdgstrs_Bglobal(options, n, lu_struct, grid, B, ldb, nrhs, stat, info);
151 static void gstrs_Bglobal(SLUD::int_t n, type_map::LUstruct_t* lu_struct,
152 SLUD::gridinfo_t* grid, type_map::type* B,
153 SLUD::int_t ldb,
int nrhs,
154 SLUD::SuperLUStat_t* stat,
int* info)
157 SLUD::D::pdgstrs_Bglobal(n, lu_struct, grid, B, ldb, nrhs, stat, info);
164 #if (SUPERLU_DIST_MAJOR_VERSION > 7)
165 static void gsrfs(SLUD::amesos2_superlu_dist_options_t* options,
166 SLUD::int_t n, SLUD::SuperMatrix* A,
double anorm,
167 type_map::LUstruct_t* lu_struct,
168 SLUD::D::dScalePermstruct_t* scale_perm,
169 SLUD::gridinfo_t* grid, type_map::type* B, SLUD::int_t ldb,
170 type_map::type* X, SLUD::int_t ldx,
int nrhs,
171 type_map::SOLVEstruct_t* solve_struct,
double* berr,
172 SLUD::SuperLUStat_t* stat,
int* info)
173 #elif SUPERLU_DIST_MAJOR_VERSION > 6 || (SUPERLU_DIST_MAJOR_VERSION == 6 && SUPERLU_DIST_MINOR_VERSION > 2)
174 static void gsrfs(SLUD::int_t n, SLUD::SuperMatrix* A,
double anorm,
175 type_map::LUstruct_t* lu_struct,
176 SLUD::D::dScalePermstruct_t* scale_perm,
177 SLUD::gridinfo_t* grid, type_map::type* B, SLUD::int_t ldb,
178 type_map::type* X, SLUD::int_t ldx,
int nrhs,
179 type_map::SOLVEstruct_t* solve_struct,
double* berr,
180 SLUD::SuperLUStat_t* stat,
int* info)
182 static void gsrfs(SLUD::int_t n, SLUD::SuperMatrix* A,
double anorm,
183 type_map::LUstruct_t* lu_struct,
184 SLUD::ScalePermstruct_t* scale_perm,
185 SLUD::gridinfo_t* grid, type_map::type* B, SLUD::int_t ldb,
186 type_map::type* X, SLUD::int_t ldx,
int nrhs,
187 type_map::SOLVEstruct_t* solve_struct,
double* berr,
188 SLUD::SuperLUStat_t* stat,
int* info)
191 #if (SUPERLU_DIST_MAJOR_VERSION > 7)
192 SLUD::D::pdgsrfs(options, n, A, anorm, lu_struct, scale_perm, grid, B, ldb,
193 X, ldx, nrhs, solve_struct, berr, stat, info);
195 SLUD::D::pdgsrfs(n, A, anorm, lu_struct, scale_perm, grid, B, ldb,
196 X, ldx, nrhs, solve_struct, berr, stat, info);
207 #if (SUPERLU_DIST_MAJOR_VERSION > 7)
208 static void gsrfs_ABXglobal(SLUD::amesos2_superlu_dist_options_t* options,
209 SLUD::int_t n, SLUD::SuperMatrix* A,
double anorm,
210 type_map::LUstruct_t* lu_struct, SLUD::gridinfo_t* grid,
211 type_map::type* B, SLUD::int_t ldb, type_map::type* X,
212 SLUD::int_t ldx,
int nrhs,
double* berr,
213 SLUD::SuperLUStat_t* stat,
int* info)
215 SLUD::D::pdgsrfs_ABXglobal(options, n, A, anorm, lu_struct, grid, B, ldb,
216 X, ldx, nrhs, berr, stat, info);
219 static void gsrfs_ABXglobal(SLUD::int_t n, SLUD::SuperMatrix* A,
double anorm,
220 type_map::LUstruct_t* lu_struct, SLUD::gridinfo_t* grid,
221 type_map::type* B, SLUD::int_t ldb, type_map::type* X,
222 SLUD::int_t ldx,
int nrhs,
double* berr,
223 SLUD::SuperLUStat_t* stat,
int* info)
225 SLUD::D::pdgsrfs_ABXglobal(n, A, anorm, lu_struct, grid, B, ldb,
226 X, ldx, nrhs, berr, stat, info);
234 static void create_CompRowLoc_Matrix(SLUD::SuperMatrix* A, SLUD::int_t g_numrows,
235 SLUD::int_t g_numcols, SLUD::int_t l_nnz,
236 SLUD::int_t l_numrows, SLUD::int_t fst_global_row,
237 type_map::type* nzval, SLUD::int_t* colind,
238 SLUD::int_t* rowptr, SLUD::Stype_t storage_t,
239 SLUD::Dtype_t data_t, SLUD::Mtype_t mat_t)
241 SLUD::D::dCreate_CompRowLoc_Matrix_dist(A, g_numrows, g_numcols, l_nnz,
242 l_numrows, fst_global_row,
243 nzval, colind, rowptr,
244 storage_t, data_t, mat_t);
254 static void create_CompCol_Matrix(SLUD::SuperMatrix* A, SLUD::int_t numrows,
255 SLUD::int_t numcols, SLUD::int_t nnz,
256 type_map::type* nzval, SLUD::int_t* rowind,
257 SLUD::int_t* colptr, SLUD::Stype_t storage_t,
258 SLUD::Dtype_t data_t, SLUD::Mtype_t mat_t)
260 SLUD::D::dCreate_CompCol_Matrix_dist(A, numrows, numcols, nnz,
261 nzval, rowind, colptr,
262 storage_t, data_t, mat_t);
273 static void create_Dense_Matrix(SLUD::SuperMatrix* X,
int m,
int n,
274 type_map::type* x,
int ldx, SLUD::Stype_t stype,
275 SLUD::Dtype_t dtype, SLUD::Mtype_t mtype)
277 SLUD::D::dCreate_Dense_Matrix_dist(X, m, n, x, ldx, stype, dtype, mtype);
280 static void permute_Dense_Matrix(SLUD::int_t fst_row, SLUD::int_t m_loc,
281 SLUD::int_t* row_to_proc, SLUD::int_t* perm,
282 type_map::type* X,
int ldx, type_map::type* B,
283 int ldb,
int nrhs, SLUD::gridinfo_t* grid)
285 SLUD::D::pdPermute_Dense_Matrix(fst_row, m_loc, row_to_proc, perm,
286 X, ldx, B, ldb, nrhs, grid);
297 static void gsequ_loc(SLUD::SuperMatrix* A,
double* r,
double* c,
298 double* rowcnd,
double* colcnd,
double* amax, SLUD::int_t* info,
299 SLUD::gridinfo_t* grid)
301 SLUD::D::pdgsequ(A, r, c, rowcnd, colcnd, amax, info, grid);
308 static void gsequ(SLUD::SuperMatrix* A,
double* r,
double* c,
309 double* rowcnd,
double* colcnd,
double* amax, SLUD::int_t* info)
311 SLUD::D::dgsequ_dist(A, r, c, rowcnd, colcnd, amax, info);
317 static void laqgs_loc(SLUD::SuperMatrix* A,
double* r,
double* c,
318 double rowcnd,
double colcnd,
double amax,
319 SLUD::DiagScale_t* equed)
321 char eq = AMESOS2_SLUD_GET_EQUED(*equed);
322 SLUD::D::pdlaqgs(A, r, c, rowcnd, colcnd, amax, &eq);
323 *equed = AMESOS2_SLUD_GET_DIAG_SCALE(eq);
339 static void laqgs(SLUD::SuperMatrix* A,
double* r,
double* c,
340 double rowcnd,
double colcnd,
double amax, SLUD::DiagScale_t* equed)
342 char eq = AMESOS2_SLUD_GET_EQUED(*equed);
343 SLUD::D::dlaqgs_dist(A, r, c, rowcnd, colcnd, amax, &eq);
344 *equed = AMESOS2_SLUD_GET_DIAG_SCALE(eq);
350 #if (SUPERLU_DIST_MAJOR_VERSION > 7)
351 static void distribute(SLUD::amesos2_superlu_dist_options_t* options,
352 SLUD::fact_t fact, SLUD::int_t n,
353 SLUD::SuperMatrix* A, SLUD::Glu_freeable_t* glu_freeable,
354 type_map::LUstruct_t* lu, SLUD::gridinfo_t* grid)
356 SLUD::D::ddistribute(options, n, A, glu_freeable, lu, grid);
359 static void distribute(SLUD::fact_t fact, SLUD::int_t n,
360 SLUD::SuperMatrix* A, SLUD::Glu_freeable_t* glu_freeable,
361 type_map::LUstruct_t* lu, SLUD::gridinfo_t* grid)
363 SLUD::D::ddistribute(fact, n, A, glu_freeable, lu, grid);
374 #if (SUPERLU_DIST_MAJOR_VERSION > 7)
375 static void pdistribute(SLUD::amesos2_superlu_dist_options_t* options,
377 SLUD::SuperMatrix* A, SLUD::D::dScalePermstruct_t* scale_perm,
378 SLUD::Glu_freeable_t* glu_freeable, type_map::LUstruct_t* lu,
379 SLUD::gridinfo_t* grid)
380 #elif SUPERLU_DIST_MAJOR_VERSION > 6 || (SUPERLU_DIST_MAJOR_VERSION == 6 && SUPERLU_DIST_MINOR_VERSION > 2)
381 static void pdistribute(SLUD::fact_t fact, SLUD::int_t n,
382 SLUD::SuperMatrix* A, SLUD::D::dScalePermstruct_t* scale_perm,
383 SLUD::Glu_freeable_t* glu_freeable, type_map::LUstruct_t* lu,
384 SLUD::gridinfo_t* grid)
386 static void pdistribute(SLUD::fact_t fact, SLUD::int_t n,
387 SLUD::SuperMatrix* A, SLUD::ScalePermstruct_t* scale_perm,
388 SLUD::Glu_freeable_t* glu_freeable, type_map::LUstruct_t* lu,
389 SLUD::gridinfo_t* grid)
392 #if (SUPERLU_DIST_MAJOR_VERSION > 7)
393 SLUD::D::pddistribute(options, n, A, scale_perm, glu_freeable, lu, grid);
395 SLUD::D::pddistribute(fact, n, A, scale_perm, glu_freeable, lu, grid);
407 #if (SUPERLU_DIST_MAJOR_VERSION > 7)
408 static void dist_psymbtonum(SLUD::amesos2_superlu_dist_options_t* options,
409 SLUD::int_t n, SLUD::SuperMatrix* A,
410 SLUD::D::dScalePermstruct_t* scale_perm,
411 SLUD::Pslu_freeable_t* pslu_freeable,
412 type_map::LUstruct_t* lu, SLUD::gridinfo_t* grid)
413 #elif SUPERLU_DIST_MAJOR_VERSION > 6 || (SUPERLU_DIST_MAJOR_VERSION == 6 && SUPERLU_DIST_MINOR_VERSION > 2)
414 static void dist_psymbtonum(SLUD::fact_t fact, SLUD::int_t n, SLUD::SuperMatrix* A,
415 SLUD::D::dScalePermstruct_t* scale_perm,
416 SLUD::Pslu_freeable_t* pslu_freeable,
417 type_map::LUstruct_t* lu, SLUD::gridinfo_t* grid)
419 static void dist_psymbtonum(SLUD::fact_t fact, SLUD::int_t n, SLUD::SuperMatrix* A,
420 SLUD::ScalePermstruct_t* scale_perm,
421 SLUD::Pslu_freeable_t* pslu_freeable,
422 type_map::LUstruct_t* lu, SLUD::gridinfo_t* grid)
425 #if (SUPERLU_DIST_MAJOR_VERSION > 7)
426 SLUD::D::ddist_psymbtonum(options, n, A, scale_perm, pslu_freeable, lu, grid);
428 SLUD::D::ddist_psymbtonum(fact, n, A, scale_perm, pslu_freeable, lu, grid);
439 static double plangs(
char* norm, SLUD::SuperMatrix* A, SLUD::gridinfo_t* grid)
441 return SLUD::D::pdlangs(norm, A, grid);
444 static void SolveInit(SLUD::amesos2_superlu_dist_options_t* options, SLUD::SuperMatrix* A,
445 SLUD::int_t* perm_r, SLUD::int_t* perm_c, SLUD::int_t nrhs,
446 type_map::LUstruct_t* lu, SLUD::gridinfo_t* grid,
447 type_map::SOLVEstruct_t* solve_struct)
449 SLUD::D::dSolveInit(options, A, perm_r, perm_c, nrhs, lu, grid, solve_struct);
452 static void LUstructInit(SLUD::int_t m, SLUD::int_t n,
453 type_map::LUstruct_t* lu)
457 #if SUPERLU_DIST_MAJOR_VERSION > 6 || (SUPERLU_DIST_MAJOR_VERSION == 6 && SUPERLU_DIST_MINOR_VERSION > 2)
458 SLUD::D::dLUstructInit(n, lu);
459 #elif defined(AMESOS2_ENABLES_SUPERLUDIST_VERSION5_AND_HIGHER)
460 SLUD::D::LUstructInit(n, lu);
462 #ifdef HAVE_SUPERLUDIST_LUSTRUCTINIT_2ARG
463 SLUD::D::LUstructInit(n, lu);
465 SLUD::D::LUstructInit(m, n, lu);
470 static void Destroy_LU(SLUD::int_t m, SLUD::gridinfo_t* grid,
471 type_map::LUstruct_t* lu)
473 #if SUPERLU_DIST_MAJOR_VERSION > 6 || (SUPERLU_DIST_MAJOR_VERSION == 6 && SUPERLU_DIST_MINOR_VERSION > 2)
474 SLUD::D::dDestroy_LU(m, grid, lu);
476 SLUD::D::Destroy_LU(m, grid, lu);
480 static void LUstructFree(type_map::LUstruct_t* lu)
482 #if SUPERLU_DIST_MAJOR_VERSION > 6 || (SUPERLU_DIST_MAJOR_VERSION == 6 && SUPERLU_DIST_MINOR_VERSION > 2)
483 SLUD::D::dLUstructFree(lu);
485 SLUD::D::LUstructFree(lu);
489 static void SolveFinalize(SLUD::amesos2_superlu_dist_options_t* options,
490 type_map::SOLVEstruct_t* solve_struct)
492 SLUD::D::dSolveFinalize(options, solve_struct);
495 static int ldperm_dist(
int job,
int n, SLUD::int_t nnz, SLUD::int_t colptr[], SLUD::int_t adjncy[],
496 double nzval[], SLUD::int_t *perm,
double u[],
double v[])
498 return SLUD::D::dldperm_dist(job, n, nnz, colptr, adjncy, nzval, perm, u, v);
503 #if defined(HAVE_TEUCHOS_COMPLEX) && !defined(__clang__)
508 struct FunctionMap<Superludist,SLUD::Z::doublecomplex>
510 typedef TypeMap<Superludist,std::complex<double> > type_map;
512 static void gstrf(SLUD::amesos2_superlu_dist_options_t* options,
int m,
int n,
double anorm,
513 type_map::LUstruct_t* LU, SLUD::gridinfo_t* grid,
514 SLUD::SuperLUStat_t* stat,
int* info)
516 SLUD::Z::pzgstrf(options, m, n, anorm, LU, grid, stat, info);
519 #if (SUPERLU_DIST_MAJOR_VERSION > 7)
520 static void gstrs(SLUD::amesos2_superlu_dist_options_t* options,
521 SLUD::int_t n, type_map::LUstruct_t* lu_struct,
522 SLUD::Z::zScalePermstruct_t* scale_perm_struct,
523 SLUD::gridinfo_t* grid, type_map::type* B,
524 SLUD::int_t l_numrows, SLUD::int_t fst_global_row,
525 SLUD::int_t ldb,
int nrhs,
526 type_map::SOLVEstruct_t* solve_struct,
527 SLUD::SuperLUStat_t* stat,
int* info)
528 #elif SUPERLU_DIST_MAJOR_VERSION > 6 || (SUPERLU_DIST_MAJOR_VERSION == 6 && SUPERLU_DIST_MINOR_VERSION > 2)
529 static void gstrs(SLUD::int_t n, type_map::LUstruct_t* lu_struct,
530 SLUD::Z::zScalePermstruct_t* scale_perm_struct,
531 SLUD::gridinfo_t* grid, type_map::type* B,
532 SLUD::int_t l_numrows, SLUD::int_t fst_global_row,
533 SLUD::int_t ldb,
int nrhs,
534 type_map::SOLVEstruct_t* solve_struct,
535 SLUD::SuperLUStat_t* stat,
int* info)
537 static void gstrs(SLUD::int_t n, type_map::LUstruct_t* lu_struct,
538 SLUD::ScalePermstruct_t* scale_perm_struct,
539 SLUD::gridinfo_t* grid, type_map::type* B,
540 SLUD::int_t l_numrows, SLUD::int_t fst_global_row,
541 SLUD::int_t ldb,
int nrhs,
542 type_map::SOLVEstruct_t* solve_struct,
543 SLUD::SuperLUStat_t* stat,
int* info)
546 #if (SUPERLU_DIST_MAJOR_VERSION > 7)
547 SLUD::Z::pzgstrs(options, n, lu_struct, scale_perm_struct, grid, B, l_numrows,
548 fst_global_row, ldb, nrhs, solve_struct, stat, info);
550 SLUD::Z::pzgstrs(n, lu_struct, scale_perm_struct, grid, B, l_numrows,
551 fst_global_row, ldb, nrhs, solve_struct, stat, info);
555 #if (SUPERLU_DIST_MAJOR_VERSION > 7)
556 static void gstrs_Bglobal(SLUD::amesos2_superlu_dist_options_t* options,
557 SLUD::int_t n, type_map::LUstruct_t* lu_struct,
558 SLUD::gridinfo_t* grid, type_map::type* B,
559 SLUD::int_t ldb,
int nrhs, SLUD::SuperLUStat_t* stat,
int* info)
561 SLUD::Z::pzgstrs_Bglobal(options,n, lu_struct, grid, B, ldb, nrhs, stat, info);
564 static void gstrs_Bglobal(SLUD::int_t n, type_map::LUstruct_t* lu_struct,
565 SLUD::gridinfo_t* grid, type_map::type* B,
566 SLUD::int_t ldb,
int nrhs, SLUD::SuperLUStat_t* stat,
int* info)
568 SLUD::Z::pzgstrs_Bglobal(n, lu_struct, grid, B, ldb, nrhs, stat, info);
572 static void create_CompRowLoc_Matrix(SLUD::SuperMatrix* A, SLUD::int_t g_numrows,
573 SLUD::int_t g_numcols, SLUD::int_t l_nnz,
574 SLUD::int_t l_numrows, SLUD::int_t fst_global_row,
575 type_map::type* nzval, SLUD::int_t* colind,
576 SLUD::int_t* rowptr, SLUD::Stype_t storage_t,
577 SLUD::Dtype_t data_t, SLUD::Mtype_t mat_t)
579 SLUD::Z::zCreate_CompRowLoc_Matrix_dist(A, g_numrows, g_numcols, l_nnz,
580 l_numrows, fst_global_row,
581 nzval, colind, rowptr,
582 storage_t, data_t, mat_t);
585 static void create_CompCol_Matrix(SLUD::SuperMatrix* A, SLUD::int_t numrows,
586 SLUD::int_t numcols, SLUD::int_t nnz,
587 type_map::type* nzval, SLUD::int_t* rowind,
588 SLUD::int_t* colptr, SLUD::Stype_t storage_t,
589 SLUD::Dtype_t data_t, SLUD::Mtype_t mat_t)
591 SLUD::Z::zCreate_CompCol_Matrix_dist(A, numrows, numcols, nnz,
592 nzval, rowind, colptr,
593 storage_t, data_t, mat_t);
596 static void create_Dense_Matrix(SLUD::SuperMatrix* X,
int m,
int n,
597 TypeMap<Superludist,std::complex<double> >::type* x,
int ldx,
598 SLUD::Stype_t stype, SLUD::Dtype_t dtype, SLUD::Mtype_t mtype)
600 SLUD::Z::zCreate_Dense_Matrix_dist(X, m, n, x, ldx, stype, dtype, mtype);
603 static void permute_Dense_Matrix(SLUD::int_t fst_row, SLUD::int_t m_loc,
604 SLUD::int_t* row_to_proc, SLUD::int_t* perm,
605 type_map::type* X,
int ldx,
606 type_map::type* B,
int ldb,
607 int nrhs, SLUD::gridinfo_t* grid)
609 SLUD::Z::pzPermute_Dense_Matrix(fst_row, m_loc, row_to_proc, perm,
610 X, ldx, B, ldb, nrhs, grid);
613 static void gsequ_loc(SLUD::SuperMatrix* A,
double* r,
double* c,
614 double* rowcnd,
double* colcnd,
double* amax, SLUD::int_t* info,
615 SLUD::gridinfo_t* grid)
617 SLUD::Z::pzgsequ(A, r, c, rowcnd, colcnd, amax, info, grid);
620 static void gsequ(SLUD::SuperMatrix* A,
double* r,
double* c,
621 double* rowcnd,
double* colcnd,
double* amax, SLUD::int_t* info)
623 SLUD::Z::zgsequ_dist(A, r, c, rowcnd, colcnd, amax, info);
626 static void laqgs_loc(SLUD::SuperMatrix* A,
double* r,
double* c,
627 double rowcnd,
double colcnd,
double amax, SLUD::DiagScale_t* equed)
629 char eq = AMESOS2_SLUD_GET_EQUED(*equed);
630 SLUD::Z::pzlaqgs(A, r, c, rowcnd, colcnd, amax, &eq);
631 *equed = AMESOS2_SLUD_GET_DIAG_SCALE(eq);
634 static void laqgs(SLUD::SuperMatrix* A,
double* r,
double* c,
635 double rowcnd,
double colcnd,
double amax, SLUD::DiagScale_t* equed)
637 char eq = AMESOS2_SLUD_GET_EQUED(*equed);
638 SLUD::Z::zlaqgs_dist(A, r, c, rowcnd, colcnd, amax, &eq);
639 *equed = AMESOS2_SLUD_GET_DIAG_SCALE(eq);
642 #if (SUPERLU_DIST_MAJOR_VERSION > 7)
643 static void distribute(SLUD::amesos2_superlu_dist_options_t* options,
645 SLUD::SuperMatrix* A, SLUD::Glu_freeable_t* glu_freeable,
646 type_map::LUstruct_t* lu, SLUD::gridinfo_t* grid)
648 SLUD::Z::zdistribute(options, n, A, glu_freeable, lu, grid);
651 static void distribute(SLUD::fact_t fact, SLUD::int_t n,
652 SLUD::SuperMatrix* A, SLUD::Glu_freeable_t* glu_freeable,
653 type_map::LUstruct_t* lu, SLUD::gridinfo_t* grid)
655 SLUD::Z::zdistribute(fact, n, A, glu_freeable, lu, grid);
659 #if (SUPERLU_DIST_MAJOR_VERSION > 7)
660 static void pdistribute(SLUD::amesos2_superlu_dist_options_t* options,
662 SLUD::SuperMatrix* A, SLUD::Z::zScalePermstruct_t* scale_perm,
663 SLUD::Glu_freeable_t* glu_freeable, type_map::LUstruct_t* lu,
664 SLUD::gridinfo_t* grid)
665 #elif SUPERLU_DIST_MAJOR_VERSION > 6 || (SUPERLU_DIST_MAJOR_VERSION == 6 && SUPERLU_DIST_MINOR_VERSION > 2)
666 static void pdistribute(SLUD::fact_t fact, SLUD::int_t n,
667 SLUD::SuperMatrix* A, SLUD::Z::zScalePermstruct_t* scale_perm,
668 SLUD::Glu_freeable_t* glu_freeable, type_map::LUstruct_t* lu,
669 SLUD::gridinfo_t* grid)
671 static void pdistribute(SLUD::fact_t fact, SLUD::int_t n,
672 SLUD::SuperMatrix* A, SLUD::ScalePermstruct_t* scale_perm,
673 SLUD::Glu_freeable_t* glu_freeable, type_map::LUstruct_t* lu,
674 SLUD::gridinfo_t* grid)
677 #if (SUPERLU_DIST_MAJOR_VERSION > 7)
678 SLUD::Z::pzdistribute(options, n, A, scale_perm, glu_freeable, lu, grid);
680 SLUD::Z::pzdistribute(fact, n, A, scale_perm, glu_freeable, lu, grid);
684 #if (SUPERLU_DIST_MAJOR_VERSION > 7)
685 static void dist_psymbtonum(SLUD::amesos2_superlu_dist_options_t* options,
687 SLUD::SuperMatrix* A, SLUD::Z::zScalePermstruct_t* scale_perm,
688 SLUD::Pslu_freeable_t* pslu_freeable, type_map::LUstruct_t* lu,
689 SLUD::gridinfo_t* grid)
690 #elif SUPERLU_DIST_MAJOR_VERSION > 6 || (SUPERLU_DIST_MAJOR_VERSION == 6 && SUPERLU_DIST_MINOR_VERSION > 2)
691 static void dist_psymbtonum(SLUD::fact_t fact, SLUD::int_t n,
692 SLUD::SuperMatrix* A, SLUD::Z::zScalePermstruct_t* scale_perm,
693 SLUD::Pslu_freeable_t* pslu_freeable, type_map::LUstruct_t* lu,
694 SLUD::gridinfo_t* grid)
696 static void dist_psymbtonum(SLUD::fact_t fact, SLUD::int_t n,
697 SLUD::SuperMatrix* A, SLUD::ScalePermstruct_t* scale_perm,
698 SLUD::Pslu_freeable_t* pslu_freeable, type_map::LUstruct_t* lu,
699 SLUD::gridinfo_t* grid)
702 #if (SUPERLU_DIST_MAJOR_VERSION > 7)
703 SLUD::Z::zdist_psymbtonum(options, n, A, scale_perm, pslu_freeable, lu, grid);
705 SLUD::Z::zdist_psymbtonum(fact, n, A, scale_perm, pslu_freeable, lu, grid);
709 static double plangs(
char* norm, SLUD::SuperMatrix* A, SLUD::gridinfo_t* grid)
711 return SLUD::Z::pzlangs(norm, A, grid);
714 static void SolveInit(SLUD::amesos2_superlu_dist_options_t* options, SLUD::SuperMatrix* A,
715 SLUD::int_t* perm_r, SLUD::int_t* perm_c, SLUD::int_t nrhs,
716 type_map::LUstruct_t* lu, SLUD::gridinfo_t* grid,
717 type_map::SOLVEstruct_t* solve_struct)
719 SLUD::Z::zSolveInit(options, A, perm_r, perm_c, nrhs, lu, grid, solve_struct);
722 static void LUstructInit(SLUD::int_t m, SLUD::int_t n, type_map::LUstruct_t* lu)
726 #if SUPERLU_DIST_MAJOR_VERSION > 6 || (SUPERLU_DIST_MAJOR_VERSION == 6 && SUPERLU_DIST_MINOR_VERSION > 2)
727 SLUD::Z::zLUstructInit(n, lu);
728 #elif defined(AMESOS2_ENABLES_SUPERLUDIST_VERSION5_AND_HIGHER)
729 SLUD::Z::LUstructInit(n, lu);
731 #ifdef HAVE_SUPERLUDIST_LUSTRUCTINIT_2ARG
732 SLUD::Z::LUstructInit(n, lu);
734 SLUD::Z::LUstructInit(m, n, lu);
739 static void Destroy_LU(SLUD::int_t m, SLUD::gridinfo_t* grid, type_map::LUstruct_t* lu)
741 #if SUPERLU_DIST_MAJOR_VERSION > 6 || (SUPERLU_DIST_MAJOR_VERSION == 6 && SUPERLU_DIST_MINOR_VERSION > 2)
742 SLUD::Z::zDestroy_LU(m, grid, lu);
744 SLUD::Z::Destroy_LU(m, grid, lu);
748 static void LUstructFree(type_map::LUstruct_t* lu)
750 #if SUPERLU_DIST_MAJOR_VERSION > 6 || (SUPERLU_DIST_MAJOR_VERSION == 6 && SUPERLU_DIST_MINOR_VERSION > 2)
751 SLUD::Z::zLUstructFree(lu);
753 SLUD::Z::LUstructFree(lu);
757 static void SolveFinalize(SLUD::amesos2_superlu_dist_options_t* options,
758 type_map::SOLVEstruct_t* solve_struct)
760 SLUD::Z::zSolveFinalize(options, solve_struct);
763 static int ldperm_dist(
int job,
int n, SLUD::int_t nnz, SLUD::int_t colptr[], SLUD::int_t adjncy[],
764 SLUD::Z::doublecomplex nzval[], SLUD::int_t *perm,
double u[],
double v[])
766 return SLUD::Z::zldperm_dist(job, n, nnz, colptr, adjncy, nzval, perm, u, v);
769 #endif // HAVE_TEUCHOS_COMPLEX
774 #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. ...