Amesos2 - Direct Sparse Solver Interfaces  Version of the Day
Amesos2_Superludist_FunctionMap.hpp
Go to the documentation of this file.
1 // @HEADER
2 //
3 // ***********************************************************************
4 //
5 // Amesos2: Templated Direct Sparse Solver Package
6 // Copyright 2011 Sandia Corporation
7 //
8 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
9 // the U.S. Government retains certain rights in this software.
10 //
11 // Redistribution and use in source and binary forms, with or without
12 // modification, are permitted provided that the following conditions are
13 // met:
14 //
15 // 1. Redistributions of source code must retain the above copyright
16 // notice, this list of conditions and the following disclaimer.
17 //
18 // 2. Redistributions in binary form must reproduce the above copyright
19 // notice, this list of conditions and the following disclaimer in the
20 // documentation and/or other materials provided with the distribution.
21 //
22 // 3. Neither the name of the Corporation nor the names of the
23 // contributors may be used to endorse or promote products derived from
24 // this software without specific prior written permission.
25 //
26 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
27 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
30 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
31 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
32 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
33 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
34 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
35 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
36 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 //
38 // Questions? Contact Michael A. Heroux (maherou@sandia.gov)
39 //
40 // ***********************************************************************
41 //
42 // @HEADER
43 
53 #ifndef AMESOS2_SUPERLUDIST_FUNCTIONMAP_HPP
54 #define AMESOS2_SUPERLUDIST_FUNCTIONMAP_HPP
55 
56 #ifdef HAVE_TEUCHOS_COMPLEX
57 #include <complex>
58 #endif
59 
60 #include "Amesos2_config.h"
61 #include "Amesos2_FunctionMap.hpp"
62 #include "Amesos2_MatrixAdapter.hpp"
64 
65 
66 // Declarations of SuperLU_DIST types and namespace are found in
67 // Superludist_TypeMap.hpp
68 
69 #define AMESOS2_SLUD_GET_DIAG_SCALE(eq) (((eq)=='N') ? SLUD::NOEQUIL : ((eq)=='R') ? SLUD::ROW : ((eq)=='C') ? SLUD::COL : SLUD::BOTH)
70 
71 #define AMESOS2_SLUD_GET_EQUED(ds) (((ds)==SLUD::NOEQUIL) ? 'N' : ((ds)==SLUD::ROW) ? 'R' : ((ds)==SLUD::COL) ? 'C' : 'B')
72 
73 namespace Amesos2 {
74 
75  template <class Matrix, class Vector> class Superludist;
76 
77  SLUD::DiagScale_t get_diag_scale(char eq);
78  char get_equed(SLUD::DiagScale_t ds);
79 
80 
81  /* ==================== Specializations ====================
82  *
83  * \cond SuperLU_DIST_function_specializations
84  */
85 
108  template <>
109  struct FunctionMap<Superludist,double>
110  {
111  typedef TypeMap<Superludist,double> type_map;
112 
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,
128  int* info)
129  {
130  SLUD::D::pdgstrf(options, m, n, anorm, LU, grid, stat, info);
131  }
132 
137 #if SUPERLU_DIST_MAJOR_VERSION > 6 || (SUPERLU_DIST_MAJOR_VERSION == 6 && SUPERLU_DIST_MINOR_VERSION > 2)
138  static void gstrs(SLUD::int_t n, type_map::LUstruct_t* lu_struct,
139  SLUD::D::dScalePermstruct_t* scale_perm_struct, SLUD::gridinfo_t* grid,
140  type_map::type* B, SLUD::int_t l_numrows, SLUD::int_t fst_global_row,
141  SLUD::int_t ldb, int nrhs, type_map::SOLVEstruct_t* solve_struct,
142  SLUD::SuperLUStat_t* stat, int* info)
143 #else
144  static void gstrs(SLUD::int_t n, type_map::LUstruct_t* lu_struct,
145  SLUD::ScalePermstruct_t* scale_perm_struct, SLUD::gridinfo_t* grid,
146  type_map::type* B, SLUD::int_t l_numrows, SLUD::int_t fst_global_row,
147  SLUD::int_t ldb, int nrhs, type_map::SOLVEstruct_t* solve_struct,
148  SLUD::SuperLUStat_t* stat, int* info)
149 #endif
150  {
151  SLUD::D::pdgstrs(n, lu_struct, scale_perm_struct, grid, B, l_numrows,
152  fst_global_row, ldb, nrhs, solve_struct, stat, info);
153  }
154 
162  static void gstrs_Bglobal(SLUD::int_t n, type_map::LUstruct_t* lu_struct,
163  SLUD::gridinfo_t* grid, type_map::type* B,
164  SLUD::int_t ldb, int nrhs,
165  SLUD::SuperLUStat_t* stat, int* info)
166  {
167  SLUD::D::pdgstrs_Bglobal(n, lu_struct, grid, B, ldb, nrhs, stat, info);
168  }
169 
173 #if 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  SLUD::D::pdgsrfs(n, A, anorm, lu_struct, scale_perm, grid, B, ldb,
192  X, ldx, nrhs, solve_struct, berr, stat, info);
193  }
194 
202  static void gsrfs_ABXglobal(SLUD::int_t n, SLUD::SuperMatrix* A, double anorm,
203  type_map::LUstruct_t* lu_struct, SLUD::gridinfo_t* grid,
204  type_map::type* B, SLUD::int_t ldb, type_map::type* X,
205  SLUD::int_t ldx, int nrhs, double* berr,
206  SLUD::SuperLUStat_t* stat, int* info)
207  {
208  SLUD::D::pdgsrfs_ABXglobal(n, A, anorm, lu_struct, grid, B, ldb,
209  X, ldx, nrhs, berr, stat, info);
210  }
211 
216  static void create_CompRowLoc_Matrix(SLUD::SuperMatrix* A, SLUD::int_t g_numrows,
217  SLUD::int_t g_numcols, SLUD::int_t l_nnz,
218  SLUD::int_t l_numrows, SLUD::int_t fst_global_row,
219  type_map::type* nzval, SLUD::int_t* colind,
220  SLUD::int_t* rowptr, SLUD::Stype_t storage_t,
221  SLUD::Dtype_t data_t, SLUD::Mtype_t mat_t)
222  {
223  SLUD::D::dCreate_CompRowLoc_Matrix_dist(A, g_numrows, g_numcols, l_nnz,
224  l_numrows, fst_global_row,
225  nzval, colind, rowptr,
226  storage_t, data_t, mat_t);
227  }
228 
236  static void create_CompCol_Matrix(SLUD::SuperMatrix* A, SLUD::int_t numrows,
237  SLUD::int_t numcols, SLUD::int_t nnz,
238  type_map::type* nzval, SLUD::int_t* rowind,
239  SLUD::int_t* colptr, SLUD::Stype_t storage_t,
240  SLUD::Dtype_t data_t, SLUD::Mtype_t mat_t)
241  {
242  SLUD::D::dCreate_CompCol_Matrix_dist(A, numrows, numcols, nnz,
243  nzval, rowind, colptr,
244  storage_t, data_t, mat_t);
245  }
246 
255  static void create_Dense_Matrix(SLUD::SuperMatrix* X, int m, int n,
256  type_map::type* x, int ldx, SLUD::Stype_t stype,
257  SLUD::Dtype_t dtype, SLUD::Mtype_t mtype)
258  {
259  SLUD::D::dCreate_Dense_Matrix_dist(X, m, n, x, ldx, stype, dtype, mtype);
260  }
261 
262  static void permute_Dense_Matrix(SLUD::int_t fst_row, SLUD::int_t m_loc,
263  SLUD::int_t* row_to_proc, SLUD::int_t* perm,
264  type_map::type* X, int ldx, type_map::type* B,
265  int ldb, int nrhs, SLUD::gridinfo_t* grid)
266  {
267  SLUD::D::pdPermute_Dense_Matrix(fst_row, m_loc, row_to_proc, perm,
268  X, ldx, B, ldb, nrhs, grid);
269  }
270 
279  static void gsequ_loc(SLUD::SuperMatrix* A, double* r, double* c,
280  double* rowcnd, double* colcnd, double* amax, SLUD::int_t* info,
281  SLUD::gridinfo_t* grid)
282  {
283  SLUD::D::pdgsequ(A, r, c, rowcnd, colcnd, amax, info, grid);
284  }
285 
290  static void gsequ(SLUD::SuperMatrix* A, double* r, double* c,
291  double* rowcnd, double* colcnd, double* amax, SLUD::int_t* info)
292  {
293  SLUD::D::dgsequ_dist(A, r, c, rowcnd, colcnd, amax, info);
294  }
295 
299  static void laqgs_loc(SLUD::SuperMatrix* A, double* r, double* c,
300  double rowcnd, double colcnd, double amax,
301  SLUD::DiagScale_t* equed)
302  {
303  char eq = AMESOS2_SLUD_GET_EQUED(*equed);
304  SLUD::D::pdlaqgs(A, r, c, rowcnd, colcnd, amax, &eq);
305  *equed = AMESOS2_SLUD_GET_DIAG_SCALE(eq);
306  }
307 
321  static void laqgs(SLUD::SuperMatrix* A, double* r, double* c,
322  double rowcnd, double colcnd, double amax, SLUD::DiagScale_t* equed)
323  {
324  char eq = AMESOS2_SLUD_GET_EQUED(*equed);
325  SLUD::D::dlaqgs_dist(A, r, c, rowcnd, colcnd, amax, &eq);
326  *equed = AMESOS2_SLUD_GET_DIAG_SCALE(eq);
327  }
328 
329  /*
330  * This version suitable for A in NCPformat
331  */
332  static void distribute(SLUD::fact_t fact, SLUD::int_t n,
333  SLUD::SuperMatrix* A, SLUD::Glu_freeable_t* glu_freeable,
334  type_map::LUstruct_t* lu, SLUD::gridinfo_t* grid)
335  {
336  SLUD::D::ddistribute(fact, n, A, glu_freeable, lu, grid);
337  }
338 
339  /*
340  * This version suitable for A in NR_loc format.
341  *
342  * This routine should be used in the case where fact ==
343  * SamePattern_SameRowPerm, otherwise dist_psymbtonum should be
344  * called.o
345  */
346 #if SUPERLU_DIST_MAJOR_VERSION > 6 || (SUPERLU_DIST_MAJOR_VERSION == 6 && SUPERLU_DIST_MINOR_VERSION > 2)
347  static void pdistribute(SLUD::fact_t fact, SLUD::int_t n,
348  SLUD::SuperMatrix* A, SLUD::D::dScalePermstruct_t* scale_perm,
349  SLUD::Glu_freeable_t* glu_freeable, type_map::LUstruct_t* lu,
350  SLUD::gridinfo_t* grid)
351 #else
352  static void pdistribute(SLUD::fact_t fact, SLUD::int_t n,
353  SLUD::SuperMatrix* A, SLUD::ScalePermstruct_t* scale_perm,
354  SLUD::Glu_freeable_t* glu_freeable, type_map::LUstruct_t* lu,
355  SLUD::gridinfo_t* grid)
356 #endif
357  {
358  SLUD::D::pddistribute(fact, n, A, scale_perm, glu_freeable, lu, grid);
359  }
360 
361  /*
362  * Distributes the input matrix A onto the 2D process grid based on
363  * the L/U graph data in pslu_freeable. On exit the struct lu
364  * contains the information necessary to perform a numeric
365  * factorization using gstrf.
366  *
367  * This routine should always be called with fact == DOFACT
368  */
369 #if SUPERLU_DIST_MAJOR_VERSION > 6 || (SUPERLU_DIST_MAJOR_VERSION == 6 && SUPERLU_DIST_MINOR_VERSION > 2)
370  static void dist_psymbtonum(SLUD::fact_t fact, SLUD::int_t n, SLUD::SuperMatrix* A,
371  SLUD::D::dScalePermstruct_t* scale_perm,
372  SLUD::Pslu_freeable_t* pslu_freeable,
373  type_map::LUstruct_t* lu, SLUD::gridinfo_t* grid)
374 #else
375  static void dist_psymbtonum(SLUD::fact_t fact, SLUD::int_t n, SLUD::SuperMatrix* A,
376  SLUD::ScalePermstruct_t* scale_perm,
377  SLUD::Pslu_freeable_t* pslu_freeable,
378  type_map::LUstruct_t* lu, SLUD::gridinfo_t* grid)
379 #endif
380  {
381  SLUD::D::ddist_psymbtonum(fact, n, A, scale_perm, pslu_freeable, lu, grid);
382  }
383 
384  /*
385  * The parameter norm may be one of:
386  * - 'M' for the max absolute matrix entry value
387  * - '1' for the norm1(A)
388  * - 'I' for the normI(A)
389  * - 'F' for the Frobenius norm of A
390  */
391  static double plangs(char* norm, SLUD::SuperMatrix* A, SLUD::gridinfo_t* grid)
392  {
393  return SLUD::D::pdlangs(norm, A, grid);
394  }
395 
396  static void SolveInit(SLUD::amesos2_superlu_dist_options_t* options, SLUD::SuperMatrix* A,
397  SLUD::int_t* perm_r, SLUD::int_t* perm_c, SLUD::int_t nrhs,
398  type_map::LUstruct_t* lu, SLUD::gridinfo_t* grid,
399  type_map::SOLVEstruct_t* solve_struct)
400  {
401  SLUD::D::dSolveInit(options, A, perm_r, perm_c, nrhs, lu, grid, solve_struct);
402  }
403 
404  static void LUstructInit(SLUD::int_t m, SLUD::int_t n,
405  type_map::LUstruct_t* lu)
406  {
409 #if SUPERLU_DIST_MAJOR_VERSION > 6 || (SUPERLU_DIST_MAJOR_VERSION == 6 && SUPERLU_DIST_MINOR_VERSION > 2)
410  SLUD::D::dLUstructInit(n, lu);
411 #elif defined(AMESOS2_ENABLES_SUPERLUDIST_VERSION5_AND_HIGHER)
412  SLUD::D::LUstructInit(n, lu);
413 #else
414 #ifdef HAVE_SUPERLUDIST_LUSTRUCTINIT_2ARG
415  SLUD::D::LUstructInit(n, lu);
416 #else
417  SLUD::D::LUstructInit(m, n, lu);
418 #endif
419 #endif
420  }
421 
422  static void Destroy_LU(SLUD::int_t m, SLUD::gridinfo_t* grid,
423  type_map::LUstruct_t* lu)
424  {
425 #if SUPERLU_DIST_MAJOR_VERSION > 6 || (SUPERLU_DIST_MAJOR_VERSION == 6 && SUPERLU_DIST_MINOR_VERSION > 2)
426  SLUD::D::dDestroy_LU(m, grid, lu);
427 #else
428  SLUD::D::Destroy_LU(m, grid, lu);
429 #endif
430  }
431 
432  static void LUstructFree(type_map::LUstruct_t* lu)
433  {
434 #if SUPERLU_DIST_MAJOR_VERSION > 6 || (SUPERLU_DIST_MAJOR_VERSION == 6 && SUPERLU_DIST_MINOR_VERSION > 2)
435  SLUD::D::dLUstructFree(lu);
436 #else
437  SLUD::D::LUstructFree(lu);
438 #endif
439  }
440 
441  static void SolveFinalize(SLUD::amesos2_superlu_dist_options_t* options,
442  type_map::SOLVEstruct_t* solve_struct)
443  {
444  SLUD::D::dSolveFinalize(options, solve_struct);
445  }
446  };
447 
448 
449 #if defined(HAVE_TEUCHOS_COMPLEX) && !defined(__clang__)
450  /* The specializations for Teuchos::as<> for SLUD::complex and
451  * SLUD::doublecomplex are provided in Amesos2_Superlu_Type.hpp
452  */
453  template <>
454  struct FunctionMap<Superludist,SLUD::Z::doublecomplex>
455  {
456  typedef TypeMap<Superludist,std::complex<double> > type_map;
457 
458  static void gstrf(SLUD::amesos2_superlu_dist_options_t* options, int m, int n, double anorm,
459  type_map::LUstruct_t* LU, SLUD::gridinfo_t* grid,
460  SLUD::SuperLUStat_t* stat, int* info)
461  {
462  SLUD::Z::pzgstrf(options, m, n, anorm, LU, grid, stat, info);
463  }
464 
465 #if SUPERLU_DIST_MAJOR_VERSION > 6 || (SUPERLU_DIST_MAJOR_VERSION == 6 && SUPERLU_DIST_MINOR_VERSION > 2)
466  static void gstrs(SLUD::int_t n, type_map::LUstruct_t* lu_struct,
467  SLUD::Z::zScalePermstruct_t* scale_perm_struct,
468  SLUD::gridinfo_t* grid, type_map::type* B,
469  SLUD::int_t l_numrows, SLUD::int_t fst_global_row,
470  SLUD::int_t ldb, int nrhs,
471  type_map::SOLVEstruct_t* solve_struct,
472  SLUD::SuperLUStat_t* stat, int* info)
473 #else
474  static void gstrs(SLUD::int_t n, type_map::LUstruct_t* lu_struct,
475  SLUD::ScalePermstruct_t* scale_perm_struct,
476  SLUD::gridinfo_t* grid, type_map::type* B,
477  SLUD::int_t l_numrows, SLUD::int_t fst_global_row,
478  SLUD::int_t ldb, int nrhs,
479  type_map::SOLVEstruct_t* solve_struct,
480 #endif
481  {
482  SLUD::Z::pzgstrs(n, lu_struct, scale_perm_struct, grid, B, l_numrows,
483  fst_global_row, ldb, nrhs, solve_struct, stat, info);
484  }
485 
486  static void gstrs_Bglobal(SLUD::int_t n, type_map::LUstruct_t* lu_struct,
487  SLUD::gridinfo_t* grid, type_map::type* B,
488  SLUD::int_t ldb, int nrhs, SLUD::SuperLUStat_t* stat, int* info)
489  {
490  SLUD::Z::pzgstrs_Bglobal(n, lu_struct, grid, B, ldb, nrhs, stat, info);
491  }
492 
493  static void create_CompRowLoc_Matrix(SLUD::SuperMatrix* A, SLUD::int_t g_numrows,
494  SLUD::int_t g_numcols, SLUD::int_t l_nnz,
495  SLUD::int_t l_numrows, SLUD::int_t fst_global_row,
496  type_map::type* nzval, SLUD::int_t* colind,
497  SLUD::int_t* rowptr, SLUD::Stype_t storage_t,
498  SLUD::Dtype_t data_t, SLUD::Mtype_t mat_t)
499  {
500  SLUD::Z::zCreate_CompRowLoc_Matrix_dist(A, g_numrows, g_numcols, l_nnz,
501  l_numrows, fst_global_row,
502  nzval, colind, rowptr,
503  storage_t, data_t, mat_t);
504  }
505 
506  static void create_CompCol_Matrix(SLUD::SuperMatrix* A, SLUD::int_t numrows,
507  SLUD::int_t numcols, SLUD::int_t nnz,
508  type_map::type* nzval, SLUD::int_t* rowind,
509  SLUD::int_t* colptr, SLUD::Stype_t storage_t,
510  SLUD::Dtype_t data_t, SLUD::Mtype_t mat_t)
511  {
512  SLUD::Z::zCreate_CompCol_Matrix_dist(A, numrows, numcols, nnz,
513  nzval, rowind, colptr,
514  storage_t, data_t, mat_t);
515  }
516 
517  static void create_Dense_Matrix(SLUD::SuperMatrix* X, int m, int n,
518  TypeMap<Superludist,std::complex<double> >::type* x, int ldx,
519  SLUD::Stype_t stype, SLUD::Dtype_t dtype, SLUD::Mtype_t mtype)
520  {
521  SLUD::Z::zCreate_Dense_Matrix_dist(X, m, n, x, ldx, stype, dtype, mtype);
522  }
523 
524  static void permute_Dense_Matrix(SLUD::int_t fst_row, SLUD::int_t m_loc,
525  SLUD::int_t* row_to_proc, SLUD::int_t* perm,
526  type_map::type* X, int ldx,
527  type_map::type* B, int ldb,
528  int nrhs, SLUD::gridinfo_t* grid)
529  {
530  SLUD::Z::pzPermute_Dense_Matrix(fst_row, m_loc, row_to_proc, perm,
531  X, ldx, B, ldb, nrhs, grid);
532  }
533 
534  static void gsequ_loc(SLUD::SuperMatrix* A, double* r, double* c,
535  double* rowcnd, double* colcnd, double* amax, int* info,
536  SLUD::gridinfo_t* grid)
537  {
538  SLUD::Z::pzgsequ(A, r, c, rowcnd, colcnd, amax, info, grid);
539  }
540 
541  static void gsequ(SLUD::SuperMatrix* A, double* r, double* c,
542  double* rowcnd, double* colcnd, double* amax, int* info)
543  {
544  SLUD::Z::zgsequ_dist(A, r, c, rowcnd, colcnd, amax, info);
545  }
546 
547  static void laqgs_loc(SLUD::SuperMatrix* A, double* r, double* c,
548  double rowcnd, double colcnd, double amax, SLUD::DiagScale_t* equed)
549  {
550  char eq = AMESOS2_SLUD_GET_EQUED(*equed);
551  SLUD::Z::pzlaqgs(A, r, c, rowcnd, colcnd, amax, &eq);
552  *equed = AMESOS2_SLUD_GET_DIAG_SCALE(eq);
553  }
554 
555  static void laqgs(SLUD::SuperMatrix* A, double* r, double* c,
556  double rowcnd, double colcnd, double amax, SLUD::DiagScale_t* equed)
557  {
558  char eq = AMESOS2_SLUD_GET_EQUED(*equed);
559  SLUD::Z::zlaqgs_dist(A, r, c, rowcnd, colcnd, amax, &eq);
560  *equed = AMESOS2_SLUD_GET_DIAG_SCALE(eq);
561  }
562 
563  static void distribute(SLUD::fact_t fact, SLUD::int_t n,
564  SLUD::SuperMatrix* A, SLUD::Glu_freeable_t* glu_freeable,
565  type_map::LUstruct_t* lu, SLUD::gridinfo_t* grid)
566  {
567  SLUD::Z::zdistribute(fact, n, A, glu_freeable, lu, grid);
568  }
569 
570 #if SUPERLU_DIST_MAJOR_VERSION > 6 || (SUPERLU_DIST_MAJOR_VERSION == 6 && SUPERLU_DIST_MINOR_VERSION > 2)
571  static void pdistribute(SLUD::fact_t fact, SLUD::int_t n,
572  SLUD::SuperMatrix* A, SLUD::Z::zScalePermstruct_t* scale_perm,
573  SLUD::Glu_freeable_t* glu_freeable, type_map::LUstruct_t* lu,
574  SLUD::gridinfo_t* grid)
575 #else
576  static void pdistribute(SLUD::fact_t fact, SLUD::int_t n,
577  SLUD::SuperMatrix* A, SLUD::ScalePermstruct_t* scale_perm,
578  SLUD::Glu_freeable_t* glu_freeable, type_map::LUstruct_t* lu,
579  SLUD::gridinfo_t* grid)
580 #endif
581  {
582  SLUD::Z::pzdistribute(fact, n, A, scale_perm, glu_freeable, lu, grid);
583  }
584 
585 #if SUPERLU_DIST_MAJOR_VERSION > 6 || (SUPERLU_DIST_MAJOR_VERSION == 6 && SUPERLU_DIST_MINOR_VERSION > 2)
586  static void dist_psymbtonum(SLUD::fact_t fact, SLUD::int_t n,
587  SLUD::SuperMatrix* A, SLUD::Z::zScalePermstruct_t* scale_perm,
588  SLUD::Pslu_freeable_t* pslu_freeable, type_map::LUstruct_t* lu,
589  SLUD::gridinfo_t* grid)
590 #else
591  static void dist_psymbtonum(SLUD::fact_t fact, SLUD::int_t n,
592  SLUD::SuperMatrix* A, SLUD::ScalePermstruct_t* scale_perm,
593  SLUD::Pslu_freeable_t* pslu_freeable, type_map::LUstruct_t* lu,
594  SLUD::gridinfo_t* grid)
595 #endif
596  {
597  SLUD::Z::zdist_psymbtonum(fact, n, A, scale_perm, pslu_freeable, lu, grid);
598  }
599 
600  static double plangs(char* norm, SLUD::SuperMatrix* A, SLUD::gridinfo_t* grid)
601  {
602  return SLUD::Z::pzlangs(norm, A, grid);
603  }
604 
605  static void SolveInit(SLUD::amesos2_superlu_dist_options_t* options, SLUD::SuperMatrix* A,
606  SLUD::int_t* perm_r, SLUD::int_t* perm_c, SLUD::int_t nrhs,
607  type_map::LUstruct_t* lu, SLUD::gridinfo_t* grid,
608  type_map::SOLVEstruct_t* solve_struct)
609  {
610  SLUD::Z::zSolveInit(options, A, perm_r, perm_c, nrhs, lu, grid, solve_struct);
611  }
612 
613  static void LUstructInit(SLUD::int_t m, SLUD::int_t n, type_map::LUstruct_t* lu)
614  {
617 #if SUPERLU_DIST_MAJOR_VERSION > 6 || (SUPERLU_DIST_MAJOR_VERSION == 6 && SUPERLU_DIST_MINOR_VERSION > 2)
618  SLUD::Z::zLUstructInit(n, lu);
619 #elif defined(AMESOS2_ENABLES_SUPERLUDIST_VERSION5_AND_HIGHER)
620  SLUD::Z::LUstructInit(n, lu);
621 #else
622 #ifdef HAVE_SUPERLUDIST_LUSTRUCTINIT_2ARG
623  SLUD::Z::LUstructInit(n, lu);
624 #else
625  SLUD::Z::LUstructInit(m, n, lu);
626 #endif
627 #endif
628  }
629 
630  static void Destroy_LU(SLUD::int_t m, SLUD::gridinfo_t* grid, type_map::LUstruct_t* lu)
631  {
632 #if SUPERLU_DIST_MAJOR_VERSION > 6 || (SUPERLU_DIST_MAJOR_VERSION == 6 && SUPERLU_DIST_MINOR_VERSION > 2)
633  SLUD::Z::zDestroy_LU(m, grid, lu);
634 #else
635  SLUD::Z::Destroy_LU(m, grid, lu);
636 #endif
637  }
638 
639  static void LUstructFree(type_map::LUstruct_t* lu)
640  {
641 #if SUPERLU_DIST_MAJOR_VERSION > 6 || (SUPERLU_DIST_MAJOR_VERSION == 6 && SUPERLU_DIST_MINOR_VERSION > 2)
642  SLUD::Z::zLUstructFree(lu);
643 #else
644  SLUD::Z::LUstructFree(lu);
645 #endif
646  }
647 
648  static void SolveFinalize(SLUD::amesos2_superlu_dist_options_t* options,
649  type_map::SOLVEstruct_t* solve_struct)
650  {
651  SLUD::Z::zSolveFinalize(options, solve_struct);
652  }
653  };
654 #endif // HAVE_TEUCHOS_COMPLEX
655 
656 } // end namespace Amesos2
657 
658 
659 #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. ...