Amesos2 - Direct Sparse Solver Interfaces  Version of the Day
Amesos2_Superlu_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_SUPERLU_FUNCTIONMAP_HPP
54 #define AMESOS2_SUPERLU_FUNCTIONMAP_HPP
55 
56 #ifdef HAVE_TEUCHOS_COMPLEX
57 #include <complex>
58 #endif
59 
60 #include "Amesos2_FunctionMap.hpp"
62 
63 
64 /* External definitions of the Superlu functions
65  *
66  * Note that we do include the "slu_*defs.h" files provided for each
67  * data-type. This produces linker warnings, but keeps us from
68  * including SuperLU code in our own code (even if only extern
69  * declarations, which would eliminate linker warnings). This is
70  * because there are several declarations (as of SuperLU 4.1) across
71  * these headers which conflict with each other in C linkage. All of
72  * the conflicting functions, on the other hand, we do not care about.
73  */
74 namespace SLU {
75 
76  extern "C" {
77  typedef int int_t;
78 #include "supermatrix.h"
79 #include "slu_util.h"
80 #include "superlu_enum_consts.h"
81 
82 
83  namespace S { // single-precision real definitions
84 
85 #ifdef HAVE_AMESOS2_SUPERLU5_API
86  typedef struct {
87  int *xsup; /* supernode and column mapping */
88  int *supno;
89  int *lsub; /* compressed L subscripts */
90  int *xlsub;
91  float *lusup; /* L supernodes */
92  int *xlusup;
93  float *ucol; /* U columns */
94  int *usub;
95  int *xusub;
96  int nzlmax; /* current max size of lsub */
97  int nzumax; /* " " " ucol */
98  int nzlumax; /* " " " lusup */
99  int n; /* number of columns in the matrix */
100  LU_space_t MemModel; /* 0 - system malloc'd; 1 - user provided */
101  int num_expansions;
102  ExpHeader *expanders; /* Array of pointers to 4 types of memory */
103  LU_stack_t stack; /* use user supplied memory */
104  } GlobalLU_t;
105 #endif
106 
107  extern void
108  sgssvx(SLU::superlu_options_t *, SLU::SuperMatrix *, int *, int *, int *,
109  char *, float *, float *, SLU::SuperMatrix *, SLU::SuperMatrix *,
110  void *, int, SLU::SuperMatrix *, SLU::SuperMatrix *,
111  float *, float *, float *, float *,
112 #ifdef HAVE_AMESOS2_SUPERLU5_API
113  GlobalLU_t*,
114 #endif
115  SLU::mem_usage_t *, SLU::SuperLUStat_t *, int *);
116  extern void
117  sgstrf (SLU::superlu_options_t*, SLU::SuperMatrix*,
118  int, int, int*, void *, int, int *, int *,
119  SLU::SuperMatrix *, SLU::SuperMatrix *,
120 #ifdef HAVE_AMESOS2_SUPERLU5_API
121  GlobalLU_t*,
122 #endif
123  SLU::SuperLUStat_t*, int *);
124  extern void
125  sgsisx(SLU::superlu_options_t *, SLU::SuperMatrix *, int *, int *, int *,
126  char *, float *, float *, SLU::SuperMatrix *, SLU::SuperMatrix *,
127  void *, int, SLU::SuperMatrix *, SLU::SuperMatrix *,
128  float *, float *,
129 #ifdef HAVE_AMESOS2_SUPERLU5_API
130  GlobalLU_t*,
131 #endif
132  SLU::mem_usage_t *, SLU::SuperLUStat_t *, int *);
133  extern void
134  sgsitrf (SLU::superlu_options_t*, SLU::SuperMatrix*,
135  int, int, int*, void *, int, int *, int *,
136  SLU::SuperMatrix *, SLU::SuperMatrix *,
137 #ifdef HAVE_AMESOS2_SUPERLU5_API
138  GlobalLU_t*,
139 #endif
140  SLU::SuperLUStat_t*, int *);
141  extern void
142  sCreate_CompCol_Matrix(SLU::SuperMatrix *, int, int, int, float *,
143  int *, int *, SLU::Stype_t, SLU::Dtype_t, SLU::Mtype_t);
144  extern void
145  sCreate_CompRow_Matrix(SLU::SuperMatrix *, int, int, int, float *,
146  int *, int *, SLU::Stype_t, SLU::Dtype_t, SLU::Mtype_t);
147  extern void
148  sCreate_Dense_Matrix(SLU::SuperMatrix *, int, int, float *, int,
149  SLU::Stype_t, SLU::Dtype_t, SLU::Mtype_t);
150 
151  extern void
152  sgsequ (SLU::SuperMatrix *, float *, float *, float *,
153  float *, float *, int *);
154 
155  extern void
156  slaqgs (SLU::SuperMatrix *, float *, float *, float,
157  float, float, char *);
158 
159 //#include "slu_sdefs.h"
160  }
161 
162  namespace D { // double-precision real definitions
163 
164 #ifdef HAVE_AMESOS2_SUPERLU5_API
165  typedef struct {
166  int *xsup; /* supernode and column mapping */
167  int *supno;
168  int *lsub; /* compressed L subscripts */
169  int *xlsub;
170  double *lusup; /* L supernodes */
171  int *xlusup;
172  double *ucol; /* U columns */
173  int *usub;
174  int *xusub;
175  int nzlmax; /* current max size of lsub */
176  int nzumax; /* " " " ucol */
177  int nzlumax; /* " " " lusup */
178  int n; /* number of columns in the matrix */
179  LU_space_t MemModel; /* 0 - system malloc'd; 1 - user provided */
180  int num_expansions;
181  ExpHeader *expanders; /* Array of pointers to 4 types of memory */
182  LU_stack_t stack; /* use user supplied memory */
183  } GlobalLU_t;
184 #endif
185 
186  extern void
187  dgssvx(SLU::superlu_options_t *, SLU::SuperMatrix *, int *, int *, int *,
188  char *, double *, double *, SLU::SuperMatrix *, SLU::SuperMatrix *,
189  void *, int, SLU::SuperMatrix *, SLU::SuperMatrix *,
190  double *, double *, double *, double *,
191 #ifdef HAVE_AMESOS2_SUPERLU5_API
192  GlobalLU_t*,
193 #endif
194  SLU::mem_usage_t *, SLU::SuperLUStat_t *, int *);
195  extern void
196  dgstrf (SLU::superlu_options_t*, SLU::SuperMatrix*,
197  int, int, int*, void *, int, int *, int *,
198  SLU::SuperMatrix *, SLU::SuperMatrix *,
199 #ifdef HAVE_AMESOS2_SUPERLU5_API
200  GlobalLU_t*,
201 #endif
202  SLU::SuperLUStat_t*, int *);
203  extern void
204  dgsisx(SLU::superlu_options_t *, SLU::SuperMatrix *, int *, int *, int *,
205  char *, double *, double *, SLU::SuperMatrix *, SLU::SuperMatrix *,
206  void *, int, SLU::SuperMatrix *, SLU::SuperMatrix *,
207  double *, double *,
208 #ifdef HAVE_AMESOS2_SUPERLU5_API
209  GlobalLU_t*,
210 #endif
211  SLU::mem_usage_t *, SLU::SuperLUStat_t *, int *);
212  extern void
213  dgsitrf (SLU::superlu_options_t*, SLU::SuperMatrix*,
214  int, int, int*, void *, int, int *, int *,
215  SLU::SuperMatrix *, SLU::SuperMatrix *,
216 #ifdef HAVE_AMESOS2_SUPERLU5_API
217  GlobalLU_t*,
218 #endif
219  SLU::SuperLUStat_t*, int *);
220  extern void
221  dCreate_CompCol_Matrix(SLU::SuperMatrix *, int, int, int, double *,
222  int *, int *, SLU::Stype_t, SLU::Dtype_t, SLU::Mtype_t);
223  extern void
224  dCreate_CompRow_Matrix(SLU::SuperMatrix *, int, int, int, double *,
225  int *, int *, SLU::Stype_t, SLU::Dtype_t, SLU::Mtype_t);
226  extern void
227  dCreate_Dense_Matrix(SLU::SuperMatrix *, int, int, double *, int,
228  SLU::Stype_t, SLU::Dtype_t, SLU::Mtype_t);
229 
230  extern void
231  dlaqgs (SLU::SuperMatrix *, double *, double *, double,
232  double, double, char *);
233 
234  extern void
235  dgsequ (SLU::SuperMatrix *, double *, double *, double *,
236  double *, double *, int *);
237 
238 //#include "slu_ddefs.h"
239  }
240 
241 #ifdef HAVE_TEUCHOS_COMPLEX
242  namespace C { // single-precision complex definitions
243 
244 #ifdef HAVE_AMESOS2_SUPERLU5_API
245  typedef struct {
246  int *xsup; /* supernode and column mapping */
247  int *supno;
248  int *lsub; /* compressed L subscripts */
249  int *xlsub;
250  complex *lusup; /* L supernodes */
251  int *xlusup;
252  complex *ucol; /* U columns */
253  int *usub;
254  int *xusub;
255  int nzlmax; /* current max size of lsub */
256  int nzumax; /* " " " ucol */
257  int nzlumax; /* " " " lusup */
258  int n; /* number of columns in the matrix */
259  LU_space_t MemModel; /* 0 - system malloc'd; 1 - user provided */
260  int num_expansions;
261  ExpHeader *expanders; /* Array of pointers to 4 types of memory */
262  LU_stack_t stack; /* use user supplied memory */
263  } GlobalLU_t;
264 #endif
265 
266  extern void
267  cgssvx(SLU::superlu_options_t *, SLU::SuperMatrix *, int *, int *, int *,
268  char *, float *, float *, SLU::SuperMatrix *, SLU::SuperMatrix *,
269  void *, int, SLU::SuperMatrix *, SLU::SuperMatrix *,
270  float *, float *, float *, float *,
271 #ifdef HAVE_AMESOS2_SUPERLU5_API
272  GlobalLU_t*,
273 #endif
274  SLU::mem_usage_t *, SLU::SuperLUStat_t *, int *);
275  extern void
276  cgstrf (SLU::superlu_options_t*, SLU::SuperMatrix*,
277  int, int, int*, void *, int, int *, int *,
278  SLU::SuperMatrix *, SLU::SuperMatrix *,
279 #ifdef HAVE_AMESOS2_SUPERLU5_API
280  GlobalLU_t*,
281 #endif
282  SLU::SuperLUStat_t*, int *);
283  extern void
284  cgsisx(SLU::superlu_options_t *, SLU::SuperMatrix *, int *, int *, int *,
285  char *, float *, float *, SLU::SuperMatrix *, SLU::SuperMatrix *,
286  void *, int, SLU::SuperMatrix *, SLU::SuperMatrix *,
287  float *, float *,
288 #ifdef HAVE_AMESOS2_SUPERLU5_API
289  GlobalLU_t*,
290 #endif
291  SLU::mem_usage_t *, SLU::SuperLUStat_t *, int *);
292  extern void
293  cgsitrf (SLU::superlu_options_t*, SLU::SuperMatrix*,
294  int, int, int*, void *, int, int *, int *,
295  SLU::SuperMatrix *, SLU::SuperMatrix *,
296 #ifdef HAVE_AMESOS2_SUPERLU5_API
297  GlobalLU_t*,
298 #endif
299  SLU::SuperLUStat_t*, int *);
300  extern void
301  cCreate_CompCol_Matrix(SLU::SuperMatrix *, int, int, int, complex *,
302  int *, int *, SLU::Stype_t, SLU::Dtype_t, SLU::Mtype_t);
303  extern void
304  cCreate_CompRow_Matrix(SLU::SuperMatrix *, int, int, int, complex *,
305  int *, int *, SLU::Stype_t, SLU::Dtype_t, SLU::Mtype_t);
306  extern void
307  cCreate_Dense_Matrix(SLU::SuperMatrix *, int, int, complex *, int,
308  SLU::Stype_t, SLU::Dtype_t, SLU::Mtype_t);
309 
310  extern void
311  cgsequ (SLU::SuperMatrix *, float *, float *, float *,
312  float *, float *, int *);
313 
314  extern void
315  claqgs (SLU::SuperMatrix *, float *, float *, float,
316  float, float, char *);
317 
318 //#include "slu_cdefs.h"
319  }
320 
321  namespace Z { // double-precision complex definitions
322 
323 #ifdef HAVE_AMESOS2_SUPERLU5_API
324  typedef struct {
325  int *xsup; /* supernode and column mapping */
326  int *supno;
327  int *lsub; /* compressed L subscripts */
328  int *xlsub;
329  doublecomplex *lusup; /* L supernodes */
330  int *xlusup;
331  doublecomplex *ucol; /* U columns */
332  int *usub;
333  int *xusub;
334  int nzlmax; /* current max size of lsub */
335  int nzumax; /* " " " ucol */
336  int nzlumax; /* " " " lusup */
337  int n; /* number of columns in the matrix */
338  LU_space_t MemModel; /* 0 - system malloc'd; 1 - user provided */
339  int num_expansions;
340  ExpHeader *expanders; /* Array of pointers to 4 types of memory */
341  LU_stack_t stack; /* use user supplied memory */
342  } GlobalLU_t;
343 #endif
344 
345  extern void
346  zgssvx(SLU::superlu_options_t *, SLU::SuperMatrix *, int *, int *, int *,
347  char *, double *, double *, SLU::SuperMatrix *, SLU::SuperMatrix *,
348  void *, int, SLU::SuperMatrix *, SLU::SuperMatrix *,
349  double *, double *, double *, double *,
350 #ifdef HAVE_AMESOS2_SUPERLU5_API
351  GlobalLU_t*,
352 #endif
353  SLU::mem_usage_t *, SLU::SuperLUStat_t *, int *);
354  extern void
355  zgstrf (SLU::superlu_options_t*, SLU::SuperMatrix*,
356  int, int, int*, void *, int, int *, int *,
357  SLU::SuperMatrix *, SLU::SuperMatrix *,
358 #ifdef HAVE_AMESOS2_SUPERLU5_API
359  GlobalLU_t*,
360 #endif
361  SLU::SuperLUStat_t*, int *);
362  extern void
363  zgsisx(SLU::superlu_options_t *, SLU::SuperMatrix *, int *, int *, int *,
364  char *, double *, double *, SLU::SuperMatrix *, SLU::SuperMatrix *,
365  void *, int, SLU::SuperMatrix *, SLU::SuperMatrix *,
366  double *, double *,
367 #ifdef HAVE_AMESOS2_SUPERLU5_API
368  GlobalLU_t*,
369 #endif
370  SLU::mem_usage_t *, SLU::SuperLUStat_t *, int *);
371  extern void
372  zgsitrf (SLU::superlu_options_t*, SLU::SuperMatrix*,
373  int, int, int*, void *, int, int *, int *,
374  SLU::SuperMatrix *, SLU::SuperMatrix *,
375 #ifdef HAVE_AMESOS2_SUPERLU5_API
376  GlobalLU_t*,
377 #endif
378  SLU::SuperLUStat_t*, int *);
379  extern void
380  zCreate_CompCol_Matrix(SLU::SuperMatrix *, int, int, int, doublecomplex *,
381  int *, int *, SLU::Stype_t, SLU::Dtype_t, SLU::Mtype_t);
382  extern void
383  zCreate_CompRow_Matrix(SLU::SuperMatrix *, int, int, int, doublecomplex *,
384  int *, int *, SLU::Stype_t, SLU::Dtype_t, SLU::Mtype_t);
385  extern void
386  zCreate_Dense_Matrix(SLU::SuperMatrix *, int, int, doublecomplex *, int,
387  SLU::Stype_t, SLU::Dtype_t, SLU::Mtype_t);
388 
389  extern void
390  zgsequ (SLU::SuperMatrix *, double *, double *, double *,
391  double *, double *, int *);
392 
393  extern void
394  zlaqgs (SLU::SuperMatrix *, double *, double *, double,
395  double, double, char *);
396 
397 //#include "slu_zdefs.h"
398  }
399 #endif // HAVE_TEUCHOS_COMPLEX
400 
401  } // end extern "C"
402 
403 } // end namespace SLU
404 
405 
406 namespace Amesos2 {
407 
408  /* ==================== Specializations ====================
409  *
410  * \cond Superlu_function_specializations
411  */
412 
436  template <>
437  struct FunctionMap<Superlu,float>
438  {
439  typedef TypeMap<Superlu,float> type_map;
440 
441 #ifdef HAVE_AMESOS2_SUPERLU5_API
442  typedef typename SLU::S::GlobalLU_t GlobalLU_type;
443 #endif
444 
448  static void gssvx(SLU::superlu_options_t* options, SLU::SuperMatrix* A,
449  int* perm_c, int* perm_r, int* etree, char* equed, float* R, float* C,
450  SLU::SuperMatrix* L, SLU::SuperMatrix* U, void* work, int lwork,
451  SLU::SuperMatrix* B, SLU::SuperMatrix* X, float* recip_pivot_growth,
452  float* rcond, float* ferr, float* berr,
453 #ifdef HAVE_AMESOS2_SUPERLU5_API
454  GlobalLU_type* lu,
455 #endif
456  SLU::mem_usage_t* mem_usage,
457  SLU::SuperLUStat_t* stat, int* info)
458  {
459  SLU::S::sgssvx(options, A, perm_c, perm_r, etree, equed, R, C, L, U, work,
460  lwork, B, X, recip_pivot_growth, rcond, ferr, berr,
461 #ifdef HAVE_AMESOS2_SUPERLU5_API
462  lu,
463 #endif
464  mem_usage, stat, info);
465  }
466 
467  static void gsisx(SLU::superlu_options_t* options, SLU::SuperMatrix* A,
468  int* perm_c, int* perm_r, int* etree, char* equed, float* R, float* C,
469  SLU::SuperMatrix* L, SLU::SuperMatrix* U, void* work, int lwork,
470  SLU::SuperMatrix* B, SLU::SuperMatrix* X, float* recip_pivot_growth,
471  float* rcond,
472 #ifdef HAVE_AMESOS2_SUPERLU5_API
473  GlobalLU_type* lu,
474 #endif
475  SLU::mem_usage_t* mem_usage,
476  SLU::SuperLUStat_t* stat, int* info)
477  {
478  SLU::S::sgsisx(options, A, perm_c, perm_r, etree, equed, R, C, L, U, work,
479  lwork, B, X, recip_pivot_growth, rcond,
480 #ifdef HAVE_AMESOS2_SUPERLU5_API
481  lu,
482 #endif
483  mem_usage, stat, info);
484  }
485 
505  static void gstrf(SLU::superlu_options_t* options, SLU::SuperMatrix* AC,
506  int relax, int panel_size, int* etree, void* work,
507  int lwork, int* perm_c, int* perm_r, SLU::SuperMatrix* L,
508  SLU::SuperMatrix* U,
509 #ifdef HAVE_AMESOS2_SUPERLU5_API
510  GlobalLU_type* lu,
511 #endif
512  SLU::SuperLUStat_t* stat, int* info)
513  {
514  SLU::S::sgstrf(options, AC, relax, panel_size, etree,
515  work, lwork, perm_c, perm_r, L, U,
516 #ifdef HAVE_AMESOS2_SUPERLU5_API
517  lu,
518 #endif
519  stat, info);
520  }
521 
522  static void gsitrf(SLU::superlu_options_t* options, SLU::SuperMatrix* AC,
523  int relax, int panel_size, int* etree, void* work,
524  int lwork, int* perm_c, int* perm_r, SLU::SuperMatrix* L,
525  SLU::SuperMatrix* U,
526 #ifdef HAVE_AMESOS2_SUPERLU5_API
527  GlobalLU_type* lu,
528 #endif
529  SLU::SuperLUStat_t* stat, int* info)
530  {
531  SLU::S::sgsitrf(options, AC, relax, panel_size, etree,
532  work, lwork, perm_c, perm_r, L, U,
533 #ifdef HAVE_AMESOS2_SUPERLU5_API
534  lu,
535 #endif
536  stat, info);
537  }
538 
542  static void create_CompCol_Matrix(SLU::SuperMatrix* A, int m, int n,
543  int nnz, type_map::type* nzval, int* rowind, int* colptr,
544  SLU::Stype_t stype, SLU::Dtype_t dtype, SLU::Mtype_t mtype)
545  {
546  SLU::S::sCreate_CompCol_Matrix(A, m, n, nnz, nzval, rowind, colptr,
547  stype, dtype, mtype);
548  }
549 
553  static void create_CompRow_Matrix(SLU::SuperMatrix* A, int m, int n,
554  int nnz, type_map::type* nzval, int* rowind, int* colptr,
555  SLU::Stype_t stype, SLU::Dtype_t dtype, SLU::Mtype_t mtype)
556  {
557  SLU::S::sCreate_CompRow_Matrix(A, m, n, nnz, nzval, rowind, colptr,
558  stype, dtype, mtype);
559  }
560 
561 
570  static void create_Dense_Matrix(SLU::SuperMatrix* X, int m, int n,
571  type_map::type* x, int ldx, SLU::Stype_t stype,
572  SLU::Dtype_t dtype, SLU::Mtype_t mtype)
573  {
574  SLU::S::sCreate_Dense_Matrix(X, m, n, x, ldx, stype, dtype, mtype);
575  }
576 
580  static void gsequ(SLU::SuperMatrix* A, float* R, float* C,
581  float* rowcnd, float* colcnd, float* amax, int* info)
582  {
583  SLU::S::sgsequ(A, R, C, rowcnd, colcnd, amax, info);
584  }
585 
600  static void laqgs(SLU::SuperMatrix* A, float* R, float* C,
601  float rowcnd, float colcnd, float amax, char* equed)
602  {
603  SLU::S::slaqgs(A, R, C, rowcnd, colcnd, amax, equed);
604  }
605  };
606 
607 
608  template <>
609  struct FunctionMap<Superlu,double>
610  {
611  typedef TypeMap<Superlu,double> type_map;
612 
613 #ifdef HAVE_AMESOS2_SUPERLU5_API
614  typedef typename SLU::D::GlobalLU_t GlobalLU_type;
615 #endif
616 
617  static void gssvx(SLU::superlu_options_t* options, SLU::SuperMatrix* A,
618  int* perm_c, int* perm_r, int* etree, char* equed, double* R, double* C,
619  SLU::SuperMatrix* L, SLU::SuperMatrix* U, void* work, int lwork,
620  SLU::SuperMatrix* B, SLU::SuperMatrix* X, double* recip_pivot_growth,
621  double* rcond, double* ferr, double* berr,
622 #ifdef HAVE_AMESOS2_SUPERLU5_API
623  GlobalLU_type* lu,
624 #endif
625  SLU::mem_usage_t* mem_usage,
626  SLU::SuperLUStat_t* stat, int* info)
627  {
628  SLU::D::dgssvx(options, A, perm_c, perm_r, etree, equed, R, C, L, U, work,
629  lwork, B, X, recip_pivot_growth, rcond, ferr, berr,
630 #ifdef HAVE_AMESOS2_SUPERLU5_API
631  lu,
632 #endif
633  mem_usage, stat, info);
634  }
635 
636  static void gstrf(SLU::superlu_options_t* options, SLU::SuperMatrix* AC,
637  int relax, int panel_size, int* etree, void* work, int lwork, int* perm_c,
638  int* perm_r, SLU::SuperMatrix* L, SLU::SuperMatrix* U,
639 #ifdef HAVE_AMESOS2_SUPERLU5_API
640  GlobalLU_type* lu,
641 #endif
642  SLU::SuperLUStat_t* stat, int* info)
643  {
644  SLU::D::dgstrf(options, AC, relax, panel_size, etree,
645  work, lwork, perm_c, perm_r, L, U,
646 #ifdef HAVE_AMESOS2_SUPERLU5_API
647  lu,
648 #endif
649  stat, info);
650  }
651 
652  static void gsisx(SLU::superlu_options_t* options, SLU::SuperMatrix* A,
653  int* perm_c, int* perm_r, int* etree, char* equed, double* R, double* C,
654  SLU::SuperMatrix* L, SLU::SuperMatrix* U, void* work, int lwork,
655  SLU::SuperMatrix* B, SLU::SuperMatrix* X, double* recip_pivot_growth,
656  double* rcond,
657 #ifdef HAVE_AMESOS2_SUPERLU5_API
658  GlobalLU_type* lu,
659 #endif
660  SLU::mem_usage_t* mem_usage,
661  SLU::SuperLUStat_t* stat, int* info)
662  {
663  SLU::D::dgsisx(options, A, perm_c, perm_r, etree, equed, R, C, L, U, work,
664  lwork, B, X, recip_pivot_growth, rcond,
665 #ifdef HAVE_AMESOS2_SUPERLU5_API
666  lu,
667 #endif
668  mem_usage, stat, info);
669  }
670 
671  static void gsitrf(SLU::superlu_options_t* options, SLU::SuperMatrix* AC,
672  int relax, int panel_size, int* etree, void* work, int lwork, int* perm_c,
673  int* perm_r, SLU::SuperMatrix* L, SLU::SuperMatrix* U,
674 #ifdef HAVE_AMESOS2_SUPERLU5_API
675  GlobalLU_type* lu,
676 #endif
677  SLU::SuperLUStat_t* stat, int* info)
678  {
679  SLU::D::dgsitrf(options, AC, relax, panel_size, etree,
680  work, lwork, perm_c, perm_r, L, U,
681 #ifdef HAVE_AMESOS2_SUPERLU5_API
682  lu,
683 #endif
684  stat, info);
685  }
686 
687  static void create_CompCol_Matrix(SLU::SuperMatrix* A, int m, int n,
688  int nnz, type_map::type* nzval, int* rowind, int* colptr,
689  SLU::Stype_t stype, SLU::Dtype_t dtype, SLU::Mtype_t mtype)
690  {
691  SLU::D::dCreate_CompCol_Matrix(A, m, n, nnz, nzval, rowind, colptr,
692  stype, dtype, mtype);
693  }
694 
695  static void create_CompRow_Matrix(SLU::SuperMatrix* A, int m, int n,
696  int nnz, type_map::type* nzval, int* rowind, int* colptr,
697  SLU::Stype_t stype, SLU::Dtype_t dtype, SLU::Mtype_t mtype)
698  {
699  SLU::D::dCreate_CompRow_Matrix(A, m, n, nnz, nzval, rowind, colptr,
700  stype, dtype, mtype);
701  }
702 
703  static void create_Dense_Matrix(SLU::SuperMatrix* X, int m,
704  int n, type_map::type* x, int ldx, SLU::Stype_t stype,
705  SLU::Dtype_t dtype, SLU::Mtype_t mtype)
706  {
707  SLU::D::dCreate_Dense_Matrix(X, m, n, x, ldx, stype, dtype, mtype);
708  }
709 
710  static void gsequ(SLU::SuperMatrix* A, double* R, double* C,
711  double* rowcnd, double* colcnd, double* amax, int* info)
712  {
713  SLU::D::dgsequ(A, R, C, rowcnd, colcnd, amax, info);
714  }
715 
716  static void laqgs(SLU::SuperMatrix* A, double* R, double* C,
717  double rowcnd, double colcnd, double amax, char* equed)
718  {
719  SLU::D::dlaqgs(A, R, C, rowcnd, colcnd, amax, equed);
720  }
721 
722  };
723 
724 
725 #ifdef HAVE_TEUCHOS_COMPLEX
726 
727  /* The specializations for Teuchos::as<> for SLU::complex and
728  * SLU::doublecomplex are provided in Amesos2_Superlu_Type.hpp
729  */
730  template <>
731  struct FunctionMap<Superlu,SLU::C::complex>
732  {
733 #ifdef HAVE_AMESOS2_SUPERLU5_API
734  typedef typename SLU::C::GlobalLU_t GlobalLU_type;
735 #endif
736 
737  static void gssvx(SLU::superlu_options_t* options, SLU::SuperMatrix* A,
738  int* perm_c, int* perm_r, int* etree, char* equed, float* R, float* C,
739  SLU::SuperMatrix* L, SLU::SuperMatrix* U, void* work, int lwork,
740  SLU::SuperMatrix* B, SLU::SuperMatrix* X, float* recip_pivot_growth,
741  float* rcond, float* ferr, float* berr,
742 #ifdef HAVE_AMESOS2_SUPERLU5_API
743  GlobalLU_type* lu,
744 #endif
745  SLU::mem_usage_t* mem_usage,
746  SLU::SuperLUStat_t* stat, int* info)
747  {
748  SLU::C::cgssvx(options, A, perm_c, perm_r, etree, equed, R, C, L, U, work,
749  lwork, B, X, recip_pivot_growth, rcond, ferr, berr,
750 #ifdef HAVE_AMESOS2_SUPERLU5_API
751  lu,
752 #endif
753  mem_usage, stat, info);
754  }
755 
756  static void gstrf(SLU::superlu_options_t* options, SLU::SuperMatrix* AC,
757  int relax, int panel_size, int* etree, void* work, int lwork, int* perm_c,
758  int* perm_r, SLU::SuperMatrix* L, SLU::SuperMatrix* U,
759 #ifdef HAVE_AMESOS2_SUPERLU5_API
760  GlobalLU_type* lu,
761 #endif
762  SLU::SuperLUStat_t* stat, int* info)
763  {
764  SLU::C::cgstrf(options, AC, relax, panel_size, etree,
765  work, lwork, perm_c, perm_r, L, U,
766 #ifdef HAVE_AMESOS2_SUPERLU5_API
767  lu,
768 #endif
769  stat, info);
770  }
771 
772  static void gsisx(SLU::superlu_options_t* options, SLU::SuperMatrix* A,
773  int* perm_c, int* perm_r, int* etree, char* equed, float* R, float* C,
774  SLU::SuperMatrix* L, SLU::SuperMatrix* U, void* work, int lwork,
775  SLU::SuperMatrix* B, SLU::SuperMatrix* X, float* recip_pivot_growth,
776  float* rcond,
777 #ifdef HAVE_AMESOS2_SUPERLU5_API
778  GlobalLU_type* lu,
779 #endif
780  SLU::mem_usage_t* mem_usage,
781  SLU::SuperLUStat_t* stat, int* info)
782  {
783  SLU::C::cgsisx(options, A, perm_c, perm_r, etree, equed, R, C, L, U, work,
784  lwork, B, X, recip_pivot_growth, rcond,
785 #ifdef HAVE_AMESOS2_SUPERLU5_API
786  lu,
787 #endif
788  mem_usage, stat, info);
789  }
790 
791  static void gsitrf(SLU::superlu_options_t* options, SLU::SuperMatrix* AC,
792  int relax, int panel_size, int* etree, void* work, int lwork, int* perm_c,
793  int* perm_r, SLU::SuperMatrix* L, SLU::SuperMatrix* U,
794 #ifdef HAVE_AMESOS2_SUPERLU5_API
795  GlobalLU_type* lu,
796 #endif
797  SLU::SuperLUStat_t* stat, int* info)
798  {
799  SLU::C::cgsitrf(options, AC, relax, panel_size, etree,
800  work, lwork, perm_c, perm_r, L, U,
801 #ifdef HAVE_AMESOS2_SUPERLU5_API
802  lu,
803 #endif
804  stat, info);
805  }
806 
807  static void create_CompCol_Matrix(SLU::SuperMatrix* A, int m, int n, int nnz,
808  SLU::C::complex* nzval, int* rowind, int* colptr,
809  SLU::Stype_t stype, SLU::Dtype_t dtype, SLU::Mtype_t mtype)
810  {
811  SLU::C::cCreate_CompCol_Matrix(A, m, n, nnz, nzval, rowind, colptr,
812  stype, dtype, mtype);
813  }
814 
815  static void create_CompRow_Matrix(SLU::SuperMatrix* A, int m, int n, int nnz,
816  SLU::C::complex* nzval, int* rowind, int* colptr,
817  SLU::Stype_t stype, SLU::Dtype_t dtype, SLU::Mtype_t mtype)
818  {
819  SLU::C::cCreate_CompRow_Matrix(A, m, n, nnz, nzval, rowind, colptr,
820  stype, dtype, mtype);
821  }
822 
823  static void create_Dense_Matrix(SLU::SuperMatrix* X, int m, int n,
824  SLU::C::complex* x, int ldx, SLU::Stype_t stype,
825  SLU::Dtype_t dtype, SLU::Mtype_t mtype)
826  {
827  SLU::C::cCreate_Dense_Matrix(X, m, n, x, ldx, stype, dtype, mtype);
828  }
829 
830  static void gsequ(SLU::SuperMatrix* A, float* R, float* C,
831  float* rowcnd, float* colcnd, float* amax, int* info)
832  {
833  SLU::C::cgsequ(A, R, C, rowcnd, colcnd, amax, info);
834  }
835 
836  static void laqgs(SLU::SuperMatrix* A, float* R, float* C,
837  float rowcnd, float colcnd, float amax, char* equed)
838  {
839  SLU::C::claqgs(A, R, C, rowcnd, colcnd, amax, equed);
840  }
841  };
842 
843 
844  template <>
845  struct FunctionMap<Superlu,SLU::Z::doublecomplex>
846  {
847 #ifdef HAVE_AMESOS2_SUPERLU5_API
848  typedef typename SLU::Z::GlobalLU_t GlobalLU_type;
849 #endif
850 
851  static void gssvx(SLU::superlu_options_t* options, SLU::SuperMatrix* A,
852  int* perm_c, int* perm_r, int* etree, char* equed, double* R, double* C,
853  SLU::SuperMatrix* L, SLU::SuperMatrix* U, void* work, int lwork,
854  SLU::SuperMatrix* B, SLU::SuperMatrix* X, double* recip_pivot_growth,
855  double* rcond, double* ferr, double* berr,
856 #ifdef HAVE_AMESOS2_SUPERLU5_API
857  GlobalLU_type* lu,
858 #endif
859  SLU::mem_usage_t* mem_usage,
860  SLU::SuperLUStat_t* stat, int* info)
861  {
862  SLU::Z::zgssvx(options, A, perm_c, perm_r, etree, equed, R, C, L, U, work,
863  lwork, B, X, recip_pivot_growth, rcond, ferr, berr,
864 #ifdef HAVE_AMESOS2_SUPERLU5_API
865  lu,
866 #endif
867  mem_usage, stat, info);
868  }
869 
870  static void gstrf(SLU::superlu_options_t* options, SLU::SuperMatrix* AC,
871  int relax, int panel_size, int* etree, void* work, int lwork, int* perm_c,
872  int* perm_r, SLU::SuperMatrix* L, SLU::SuperMatrix* U,
873 #ifdef HAVE_AMESOS2_SUPERLU5_API
874  GlobalLU_type* lu,
875 #endif
876  SLU::SuperLUStat_t* stat, int* info)
877  {
878  SLU::Z::zgstrf(options, AC, relax, panel_size, etree,
879  work, lwork, perm_c, perm_r, L, U,
880 #ifdef HAVE_AMESOS2_SUPERLU5_API
881  lu,
882 #endif
883  stat, info);
884  }
885 
886  static void gsisx(SLU::superlu_options_t* options, SLU::SuperMatrix* A,
887  int* perm_c, int* perm_r, int* etree, char* equed, double* R, double* C,
888  SLU::SuperMatrix* L, SLU::SuperMatrix* U, void* work, int lwork,
889  SLU::SuperMatrix* B, SLU::SuperMatrix* X, double* recip_pivot_growth,
890  double* rcond,
891 #ifdef HAVE_AMESOS2_SUPERLU5_API
892  GlobalLU_type* lu,
893 #endif
894  SLU::mem_usage_t* mem_usage,
895  SLU::SuperLUStat_t* stat, int* info)
896  {
897  SLU::Z::zgsisx(options, A, perm_c, perm_r, etree, equed, R, C, L, U, work,
898  lwork, B, X, recip_pivot_growth, rcond,
899 #ifdef HAVE_AMESOS2_SUPERLU5_API
900  lu,
901 #endif
902  mem_usage, stat, info);
903  }
904 
905  static void gsitrf(SLU::superlu_options_t* options, SLU::SuperMatrix* AC,
906  int relax, int panel_size, int* etree, void* work, int lwork, int* perm_c,
907  int* perm_r, SLU::SuperMatrix* L, SLU::SuperMatrix* U,
908 #ifdef HAVE_AMESOS2_SUPERLU5_API
909  GlobalLU_type* lu,
910 #endif
911  SLU::SuperLUStat_t* stat, int* info)
912  {
913  SLU::Z::zgsitrf(options, AC, relax, panel_size, etree,
914  work, lwork, perm_c, perm_r, L, U,
915 #ifdef HAVE_AMESOS2_SUPERLU5_API
916  lu,
917 #endif
918  stat, info);
919  }
920 
921  static void create_CompCol_Matrix(SLU::SuperMatrix* A, int m, int n, int nnz,
922  SLU::Z::doublecomplex* nzval, int* rowind, int* colptr,
923  SLU::Stype_t stype, SLU::Dtype_t dtype, SLU::Mtype_t mtype)
924  {
925  SLU::Z::zCreate_CompCol_Matrix(A, m, n, nnz, nzval, rowind, colptr,
926  stype, dtype, mtype);
927 
928  TEUCHOS_TEST_FOR_EXCEPTION( A == NULL,
929  std::runtime_error,
930  "Supermatrix A not initialized properly!");
931  }
932 
933 
934  static void create_CompRow_Matrix(SLU::SuperMatrix* A, int m, int n, int nnz,
935  SLU::Z::doublecomplex* nzval, int* rowind, int* colptr,
936  SLU::Stype_t stype, SLU::Dtype_t dtype, SLU::Mtype_t mtype)
937  {
938  SLU::Z::zCreate_CompRow_Matrix(A, m, n, nnz, nzval, rowind, colptr,
939  stype, dtype, mtype);
940 
941  TEUCHOS_TEST_FOR_EXCEPTION( A == NULL,
942  std::runtime_error,
943  "Supermatrix A not initialized properly!");
944  }
945 
946  static void create_Dense_Matrix(SLU::SuperMatrix* X, int m, int n,
947  SLU::Z::doublecomplex* x, int ldx, SLU::Stype_t stype,
948  SLU::Dtype_t dtype, SLU::Mtype_t mtype)
949  {
950  SLU::Z::zCreate_Dense_Matrix(X, m, n, x, ldx, stype, dtype, mtype);
951  }
952 
953  static void gsequ(SLU::SuperMatrix* A, double* R, double* C,
954  double* rowcnd, double* colcnd, double* amax, int* info)
955  {
956  SLU::Z::zgsequ(A, R, C, rowcnd, colcnd, amax, info);
957  }
958 
959  static void laqgs(SLU::SuperMatrix* A, double* R, double* C,
960  double rowcnd, double colcnd, double amax, char* equed)
961  {
962  SLU::Z::zlaqgs(A, R, C, rowcnd, colcnd, amax, equed);
963  }
964  };
965 #endif // HAVE_TEUCHOS_COMPLEX
966 
967  /* \endcond Superlu_function_specializations */
968 
969 
970 } // end namespace Amesos2
971 
972 #endif // AMESOS2_SUPERLU_FUNCTIONMAP_HPP
Declaration of Function mapping class for Amesos2.
Provides definition of SuperLU types as well as conversions and type traits.