Amesos2 - Direct Sparse Solver Interfaces  Version of the Day
Amesos2_Superludist_FunctionMap.hpp
Go to the documentation of this file.
1 // @HEADER
2 // *****************************************************************************
3 // Amesos2: Templated Direct Sparse Solver Package
4 //
5 // Copyright 2011 NTESS and the Amesos2 contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9 
19 #ifndef AMESOS2_SUPERLUDIST_FUNCTIONMAP_HPP
20 #define AMESOS2_SUPERLUDIST_FUNCTIONMAP_HPP
21 
22 #ifdef HAVE_TEUCHOS_COMPLEX
23 #include <complex>
24 #endif
25 
26 #include "Amesos2_config.h"
27 #include "Amesos2_FunctionMap.hpp"
28 #include "Amesos2_MatrixAdapter.hpp"
30 
31 
32 // Declarations of SuperLU_DIST types and namespace are found in
33 // Superludist_TypeMap.hpp
34 
35 #define AMESOS2_SLUD_GET_DIAG_SCALE(eq) (((eq)=='N') ? SLUD::NOEQUIL : ((eq)=='R') ? SLUD::ROW : ((eq)=='C') ? SLUD::COL : SLUD::BOTH)
36 
37 #define AMESOS2_SLUD_GET_EQUED(ds) (((ds)==SLUD::NOEQUIL) ? 'N' : ((ds)==SLUD::ROW) ? 'R' : ((ds)==SLUD::COL) ? 'C' : 'B')
38 
39 namespace Amesos2 {
40 
41  template <class Matrix, class Vector> class Superludist;
42 
43  SLUD::DiagScale_t get_diag_scale(char eq);
44  char get_equed(SLUD::DiagScale_t ds);
45 
46 
47  /* ==================== Specializations ====================
48  *
49  * \cond SuperLU_DIST_function_specializations
50  */
51 
74  template <>
75  struct FunctionMap<Superludist,double>
76  {
77  typedef TypeMap<Superludist,double> type_map;
78 
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,
94  int* info)
95  {
96  SLUD::D::pdgstrf(options, m, n, anorm, LU, grid, stat, info);
97  }
98 
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)
116 #else
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)
122 #endif
123  {
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);
127 #else
128  SLUD::D::pdgstrs(n, lu_struct, scale_perm_struct, grid, B, l_numrows,
129  fst_global_row, ldb, nrhs, solve_struct, stat, info);
130 #endif
131  }
132 
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)
146 
147  {
148  SLUD::D::pdgstrs_Bglobal(options, n, lu_struct, grid, B, ldb, nrhs, stat, info);
149  }
150 #else
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)
155 
156  {
157  SLUD::D::pdgstrs_Bglobal(n, lu_struct, grid, B, ldb, nrhs, stat, info);
158  }
159 #endif
160 
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)
181 #else
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)
189 #endif
190  {
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);
194 #else
195  SLUD::D::pdgsrfs(n, A, anorm, lu_struct, scale_perm, grid, B, ldb,
196  X, ldx, nrhs, solve_struct, berr, stat, info);
197 #endif
198  }
199 
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)
214  {
215  SLUD::D::pdgsrfs_ABXglobal(options, n, A, anorm, lu_struct, grid, B, ldb,
216  X, ldx, nrhs, berr, stat, info);
217  }
218 #else
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)
224  {
225  SLUD::D::pdgsrfs_ABXglobal(n, A, anorm, lu_struct, grid, B, ldb,
226  X, ldx, nrhs, berr, stat, info);
227  }
228 #endif
229 
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)
240  {
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);
245  }
246 
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)
259  {
260  SLUD::D::dCreate_CompCol_Matrix_dist(A, numrows, numcols, nnz,
261  nzval, rowind, colptr,
262  storage_t, data_t, mat_t);
263  }
264 
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)
276  {
277  SLUD::D::dCreate_Dense_Matrix_dist(X, m, n, x, ldx, stype, dtype, mtype);
278  }
279 
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)
284  {
285  SLUD::D::pdPermute_Dense_Matrix(fst_row, m_loc, row_to_proc, perm,
286  X, ldx, B, ldb, nrhs, grid);
287  }
288 
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)
300  {
301  SLUD::D::pdgsequ(A, r, c, rowcnd, colcnd, amax, info, grid);
302  }
303 
308  static void gsequ(SLUD::SuperMatrix* A, double* r, double* c,
309  double* rowcnd, double* colcnd, double* amax, SLUD::int_t* info)
310  {
311  SLUD::D::dgsequ_dist(A, r, c, rowcnd, colcnd, amax, info);
312  }
313 
317  static void laqgs_loc(SLUD::SuperMatrix* A, double* r, double* c,
318  double rowcnd, double colcnd, double amax,
319  SLUD::DiagScale_t* equed)
320  {
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);
324  }
325 
339  static void laqgs(SLUD::SuperMatrix* A, double* r, double* c,
340  double rowcnd, double colcnd, double amax, SLUD::DiagScale_t* equed)
341  {
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);
345  }
346 
347  /*
348  * This version suitable for A in NCPformat
349  */
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)
355  {
356  SLUD::D::ddistribute(options, n, A, glu_freeable, lu, grid);
357  }
358 #else
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)
362  {
363  SLUD::D::ddistribute(fact, n, A, glu_freeable, lu, grid);
364  }
365 #endif
366 
367  /*
368  * This version suitable for A in NR_loc format.
369  *
370  * This routine should be used in the case where fact ==
371  * SamePattern_SameRowPerm, otherwise dist_psymbtonum should be
372  * called.o
373  */
374 #if (SUPERLU_DIST_MAJOR_VERSION > 7)
375  static void pdistribute(SLUD::amesos2_superlu_dist_options_t* options,
376  SLUD::int_t n,
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)
385 #else
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)
390 #endif
391  {
392 #if (SUPERLU_DIST_MAJOR_VERSION > 7)
393  SLUD::D::pddistribute(options, n, A, scale_perm, glu_freeable, lu, grid);
394 #else
395  SLUD::D::pddistribute(fact, n, A, scale_perm, glu_freeable, lu, grid);
396 #endif
397  }
398 
399  /*
400  * Distributes the input matrix A onto the 2D process grid based on
401  * the L/U graph data in pslu_freeable. On exit the struct lu
402  * contains the information necessary to perform a numeric
403  * factorization using gstrf.
404  *
405  * This routine should always be called with fact == DOFACT
406  */
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)
418 #else
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)
423 #endif
424  {
425 #if (SUPERLU_DIST_MAJOR_VERSION > 7)
426  SLUD::D::ddist_psymbtonum(options, n, A, scale_perm, pslu_freeable, lu, grid);
427 #else
428  SLUD::D::ddist_psymbtonum(fact, n, A, scale_perm, pslu_freeable, lu, grid);
429 #endif
430  }
431 
432  /*
433  * The parameter norm may be one of:
434  * - 'M' for the max absolute matrix entry value
435  * - '1' for the norm1(A)
436  * - 'I' for the normI(A)
437  * - 'F' for the Frobenius norm of A
438  */
439  static double plangs(char* norm, SLUD::SuperMatrix* A, SLUD::gridinfo_t* grid)
440  {
441  return SLUD::D::pdlangs(norm, A, grid);
442  }
443 
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)
448  {
449  SLUD::D::dSolveInit(options, A, perm_r, perm_c, nrhs, lu, grid, solve_struct);
450  }
451 
452  static void LUstructInit(SLUD::int_t m, SLUD::int_t n,
453  type_map::LUstruct_t* lu)
454  {
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);
461 #else
462 #ifdef HAVE_SUPERLUDIST_LUSTRUCTINIT_2ARG
463  SLUD::D::LUstructInit(n, lu);
464 #else
465  SLUD::D::LUstructInit(m, n, lu);
466 #endif
467 #endif
468  }
469 
470  static void Destroy_LU(SLUD::int_t m, SLUD::gridinfo_t* grid,
471  type_map::LUstruct_t* lu)
472  {
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);
475 #else
476  SLUD::D::Destroy_LU(m, grid, lu);
477 #endif
478  }
479 
480  static void LUstructFree(type_map::LUstruct_t* lu)
481  {
482 #if SUPERLU_DIST_MAJOR_VERSION > 6 || (SUPERLU_DIST_MAJOR_VERSION == 6 && SUPERLU_DIST_MINOR_VERSION > 2)
483  SLUD::D::dLUstructFree(lu);
484 #else
485  SLUD::D::LUstructFree(lu);
486 #endif
487  }
488 
489  static void SolveFinalize(SLUD::amesos2_superlu_dist_options_t* options,
490  type_map::SOLVEstruct_t* solve_struct)
491  {
492  SLUD::D::dSolveFinalize(options, solve_struct);
493  }
494 
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[])
497  {
498  return SLUD::D::dldperm_dist(job, n, nnz, colptr, adjncy, nzval, perm, u, v);
499  }
500  };
501 
502 
503 #if defined(HAVE_TEUCHOS_COMPLEX) && !defined(__clang__)
504  /* The specializations for Teuchos::as<> for SLUD::complex and
505  * SLUD::doublecomplex are provided in Amesos2_Superlu_Type.hpp
506  */
507  template <>
508  struct FunctionMap<Superludist,SLUD::Z::doublecomplex>
509  {
510  typedef TypeMap<Superludist,std::complex<double> > type_map;
511 
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)
515  {
516  SLUD::Z::pzgstrf(options, m, n, anorm, LU, grid, stat, info);
517  }
518 
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)
536 #else
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)
544 #endif
545  {
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);
549 #else
550  SLUD::Z::pzgstrs(n, lu_struct, scale_perm_struct, grid, B, l_numrows,
551  fst_global_row, ldb, nrhs, solve_struct, stat, info);
552 #endif
553  }
554 
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)
560  {
561  SLUD::Z::pzgstrs_Bglobal(options,n, lu_struct, grid, B, ldb, nrhs, stat, info);
562  }
563 #else
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)
567  {
568  SLUD::Z::pzgstrs_Bglobal(n, lu_struct, grid, B, ldb, nrhs, stat, info);
569  }
570 #endif
571 
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)
578  {
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);
583  }
584 
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)
590  {
591  SLUD::Z::zCreate_CompCol_Matrix_dist(A, numrows, numcols, nnz,
592  nzval, rowind, colptr,
593  storage_t, data_t, mat_t);
594  }
595 
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)
599  {
600  SLUD::Z::zCreate_Dense_Matrix_dist(X, m, n, x, ldx, stype, dtype, mtype);
601  }
602 
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)
608  {
609  SLUD::Z::pzPermute_Dense_Matrix(fst_row, m_loc, row_to_proc, perm,
610  X, ldx, B, ldb, nrhs, grid);
611  }
612 
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)
616  {
617  SLUD::Z::pzgsequ(A, r, c, rowcnd, colcnd, amax, info, grid);
618  }
619 
620  static void gsequ(SLUD::SuperMatrix* A, double* r, double* c,
621  double* rowcnd, double* colcnd, double* amax, SLUD::int_t* info)
622  {
623  SLUD::Z::zgsequ_dist(A, r, c, rowcnd, colcnd, amax, info);
624  }
625 
626  static void laqgs_loc(SLUD::SuperMatrix* A, double* r, double* c,
627  double rowcnd, double colcnd, double amax, SLUD::DiagScale_t* equed)
628  {
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);
632  }
633 
634  static void laqgs(SLUD::SuperMatrix* A, double* r, double* c,
635  double rowcnd, double colcnd, double amax, SLUD::DiagScale_t* equed)
636  {
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);
640  }
641 
642 #if (SUPERLU_DIST_MAJOR_VERSION > 7)
643  static void distribute(SLUD::amesos2_superlu_dist_options_t* options,
644  SLUD::int_t n,
645  SLUD::SuperMatrix* A, SLUD::Glu_freeable_t* glu_freeable,
646  type_map::LUstruct_t* lu, SLUD::gridinfo_t* grid)
647  {
648  SLUD::Z::zdistribute(options, n, A, glu_freeable, lu, grid);
649  }
650 #else
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)
654  {
655  SLUD::Z::zdistribute(fact, n, A, glu_freeable, lu, grid);
656  }
657 #endif
658 
659 #if (SUPERLU_DIST_MAJOR_VERSION > 7)
660  static void pdistribute(SLUD::amesos2_superlu_dist_options_t* options,
661  SLUD::int_t n,
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)
670 #else
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)
675 #endif
676  {
677 #if (SUPERLU_DIST_MAJOR_VERSION > 7)
678  SLUD::Z::pzdistribute(options, n, A, scale_perm, glu_freeable, lu, grid);
679 #else
680  SLUD::Z::pzdistribute(fact, n, A, scale_perm, glu_freeable, lu, grid);
681 #endif
682  }
683 
684 #if (SUPERLU_DIST_MAJOR_VERSION > 7)
685  static void dist_psymbtonum(SLUD::amesos2_superlu_dist_options_t* options,
686  SLUD::int_t n,
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)
695 #else
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)
700 #endif
701  {
702 #if (SUPERLU_DIST_MAJOR_VERSION > 7)
703  SLUD::Z::zdist_psymbtonum(options, n, A, scale_perm, pslu_freeable, lu, grid);
704 #else
705  SLUD::Z::zdist_psymbtonum(fact, n, A, scale_perm, pslu_freeable, lu, grid);
706 #endif
707  }
708 
709  static double plangs(char* norm, SLUD::SuperMatrix* A, SLUD::gridinfo_t* grid)
710  {
711  return SLUD::Z::pzlangs(norm, A, grid);
712  }
713 
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)
718  {
719  SLUD::Z::zSolveInit(options, A, perm_r, perm_c, nrhs, lu, grid, solve_struct);
720  }
721 
722  static void LUstructInit(SLUD::int_t m, SLUD::int_t n, type_map::LUstruct_t* lu)
723  {
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);
730 #else
731 #ifdef HAVE_SUPERLUDIST_LUSTRUCTINIT_2ARG
732  SLUD::Z::LUstructInit(n, lu);
733 #else
734  SLUD::Z::LUstructInit(m, n, lu);
735 #endif
736 #endif
737  }
738 
739  static void Destroy_LU(SLUD::int_t m, SLUD::gridinfo_t* grid, type_map::LUstruct_t* lu)
740  {
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);
743 #else
744  SLUD::Z::Destroy_LU(m, grid, lu);
745 #endif
746  }
747 
748  static void LUstructFree(type_map::LUstruct_t* lu)
749  {
750 #if SUPERLU_DIST_MAJOR_VERSION > 6 || (SUPERLU_DIST_MAJOR_VERSION == 6 && SUPERLU_DIST_MINOR_VERSION > 2)
751  SLUD::Z::zLUstructFree(lu);
752 #else
753  SLUD::Z::LUstructFree(lu);
754 #endif
755  }
756 
757  static void SolveFinalize(SLUD::amesos2_superlu_dist_options_t* options,
758  type_map::SOLVEstruct_t* solve_struct)
759  {
760  SLUD::Z::zSolveFinalize(options, solve_struct);
761  }
762 
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[])
765  {
766  return SLUD::Z::zldperm_dist(job, n, nnz, colptr, adjncy, nzval, perm, u, v);
767  }
768  };
769 #endif // HAVE_TEUCHOS_COMPLEX
770 
771 } // end namespace Amesos2
772 
773 
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. ...