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 
81  namespace S { // single-precision real definitions
82  extern void
83  sgssvx(SLU::superlu_options_t *, SLU::SuperMatrix *, int *, int *, int *,
84  char *, float *, float *, SLU::SuperMatrix *, SLU::SuperMatrix *,
85  void *, int, SLU::SuperMatrix *, SLU::SuperMatrix *,
86  float *, float *, float *, float *,
87  SLU::mem_usage_t *, SLU::SuperLUStat_t *, int *);
88  extern void
89  sgstrf (SLU::superlu_options_t*, SLU::SuperMatrix*,
90  int, int, int*, void *, int, int *, int *,
91  SLU::SuperMatrix *, SLU::SuperMatrix *, SLU::SuperLUStat_t*, int *);
92  extern void
93  sgsisx(SLU::superlu_options_t *, SLU::SuperMatrix *, int *, int *, int *,
94  char *, float *, float *, SLU::SuperMatrix *, SLU::SuperMatrix *,
95  void *, int, SLU::SuperMatrix *, SLU::SuperMatrix *,
96  float *, float *, SLU::mem_usage_t *, SLU::SuperLUStat_t *, int *);
97  extern void
98  sgsitrf (SLU::superlu_options_t*, SLU::SuperMatrix*,
99  int, int, int*, void *, int, int *, int *,
100  SLU::SuperMatrix *, SLU::SuperMatrix *, SLU::SuperLUStat_t*, int *);
101  extern void
102  sCreate_CompCol_Matrix(SLU::SuperMatrix *, int, int, int, float *,
103  int *, int *, SLU::Stype_t, SLU::Dtype_t, SLU::Mtype_t);
104  extern void
105  sCreate_CompRow_Matrix(SLU::SuperMatrix *, int, int, int, float *,
106  int *, int *, SLU::Stype_t, SLU::Dtype_t, SLU::Mtype_t);
107  extern void
108  sCreate_Dense_Matrix(SLU::SuperMatrix *, int, int, float *, int,
109  SLU::Stype_t, SLU::Dtype_t, SLU::Mtype_t);
110 
111  extern void
112  sgsequ (SLU::SuperMatrix *, float *, float *, float *,
113  float *, float *, int *);
114 
115  extern void
116  slaqgs (SLU::SuperMatrix *, float *, float *, float,
117  float, float, char *);
118 
119 //#include "slu_sdefs.h"
120  }
121 
122  namespace D { // double-precision real definitions
123  extern void
124  dgssvx(SLU::superlu_options_t *, SLU::SuperMatrix *, int *, int *, int *,
125  char *, double *, double *, SLU::SuperMatrix *, SLU::SuperMatrix *,
126  void *, int, SLU::SuperMatrix *, SLU::SuperMatrix *,
127  double *, double *, double *, double *,
128  SLU::mem_usage_t *, SLU::SuperLUStat_t *, int *);
129  extern void
130  dgstrf (SLU::superlu_options_t*, SLU::SuperMatrix*,
131  int, int, int*, void *, int, int *, int *,
132  SLU::SuperMatrix *, SLU::SuperMatrix *, SLU::SuperLUStat_t*, int *);
133  extern void
134  dgsisx(SLU::superlu_options_t *, SLU::SuperMatrix *, int *, int *, int *,
135  char *, double *, double *, SLU::SuperMatrix *, SLU::SuperMatrix *,
136  void *, int, SLU::SuperMatrix *, SLU::SuperMatrix *,
137  double *, double *, SLU::mem_usage_t *, SLU::SuperLUStat_t *, int *);
138  extern void
139  dgsitrf (SLU::superlu_options_t*, SLU::SuperMatrix*,
140  int, int, int*, void *, int, int *, int *,
141  SLU::SuperMatrix *, SLU::SuperMatrix *, SLU::SuperLUStat_t*, int *);
142  extern void
143  dCreate_CompCol_Matrix(SLU::SuperMatrix *, int, int, int, double *,
144  int *, int *, SLU::Stype_t, SLU::Dtype_t, SLU::Mtype_t);
145  extern void
146  dCreate_CompRow_Matrix(SLU::SuperMatrix *, int, int, int, double *,
147  int *, int *, SLU::Stype_t, SLU::Dtype_t, SLU::Mtype_t);
148  extern void
149  dCreate_Dense_Matrix(SLU::SuperMatrix *, int, int, double *, int,
150  SLU::Stype_t, SLU::Dtype_t, SLU::Mtype_t);
151 
152  extern void
153  dlaqgs (SLU::SuperMatrix *, double *, double *, double,
154  double, double, char *);
155 
156  extern void
157  dgsequ (SLU::SuperMatrix *, double *, double *, double *,
158  double *, double *, int *);
159 
160 //#include "slu_ddefs.h"
161  }
162 
163 #ifdef HAVE_TEUCHOS_COMPLEX
164  namespace C { // single-precision complex definitions
165  extern void
166  cgssvx(SLU::superlu_options_t *, SLU::SuperMatrix *, int *, int *, int *,
167  char *, float *, float *, SLU::SuperMatrix *, SLU::SuperMatrix *,
168  void *, int, SLU::SuperMatrix *, SLU::SuperMatrix *,
169  float *, float *, float *, float *,
170  SLU::mem_usage_t *, SLU::SuperLUStat_t *, int *);
171  extern void
172  cgstrf (SLU::superlu_options_t*, SLU::SuperMatrix*,
173  int, int, int*, void *, int, int *, int *,
174  SLU::SuperMatrix *, SLU::SuperMatrix *, SLU::SuperLUStat_t*, int *);
175  extern void
176  cgsisx(SLU::superlu_options_t *, SLU::SuperMatrix *, int *, int *, int *,
177  char *, float *, float *, SLU::SuperMatrix *, SLU::SuperMatrix *,
178  void *, int, SLU::SuperMatrix *, SLU::SuperMatrix *,
179  float *, float *, SLU::mem_usage_t *, SLU::SuperLUStat_t *, int *);
180  extern void
181  cgsitrf (SLU::superlu_options_t*, SLU::SuperMatrix*,
182  int, int, int*, void *, int, int *, int *,
183  SLU::SuperMatrix *, SLU::SuperMatrix *, SLU::SuperLUStat_t*, int *);
184  extern void
185  cCreate_CompCol_Matrix(SLU::SuperMatrix *, int, int, int, complex *,
186  int *, int *, SLU::Stype_t, SLU::Dtype_t, SLU::Mtype_t);
187  extern void
188  cCreate_CompRow_Matrix(SLU::SuperMatrix *, int, int, int, complex *,
189  int *, int *, SLU::Stype_t, SLU::Dtype_t, SLU::Mtype_t);
190  extern void
191  cCreate_Dense_Matrix(SLU::SuperMatrix *, int, int, complex *, int,
192  SLU::Stype_t, SLU::Dtype_t, SLU::Mtype_t);
193 
194  extern void
195  cgsequ (SLU::SuperMatrix *, float *, float *, float *,
196  float *, float *, int *);
197 
198  extern void
199  claqgs (SLU::SuperMatrix *, float *, float *, float,
200  float, float, char *);
201 
202 //#include "slu_cdefs.h"
203  }
204 
205  namespace Z { // double-precision complex definitions
206  extern void
207  zgssvx(SLU::superlu_options_t *, SLU::SuperMatrix *, int *, int *, int *,
208  char *, double *, double *, SLU::SuperMatrix *, SLU::SuperMatrix *,
209  void *, int, SLU::SuperMatrix *, SLU::SuperMatrix *,
210  double *, double *, double *, double *,
211  SLU::mem_usage_t *, SLU::SuperLUStat_t *, int *);
212  extern void
213  zgstrf (SLU::superlu_options_t*, SLU::SuperMatrix*,
214  int, int, int*, void *, int, int *, int *,
215  SLU::SuperMatrix *, SLU::SuperMatrix *, SLU::SuperLUStat_t*, int *);
216  extern void
217  zgsisx(SLU::superlu_options_t *, SLU::SuperMatrix *, int *, int *, int *,
218  char *, double *, double *, SLU::SuperMatrix *, SLU::SuperMatrix *,
219  void *, int, SLU::SuperMatrix *, SLU::SuperMatrix *,
220  double *, double *, SLU::mem_usage_t *, SLU::SuperLUStat_t *, int *);
221  extern void
222  zgsitrf (SLU::superlu_options_t*, SLU::SuperMatrix*,
223  int, int, int*, void *, int, int *, int *,
224  SLU::SuperMatrix *, SLU::SuperMatrix *, SLU::SuperLUStat_t*, int *);
225  extern void
226  zCreate_CompCol_Matrix(SLU::SuperMatrix *, int, int, int, doublecomplex *,
227  int *, int *, SLU::Stype_t, SLU::Dtype_t, SLU::Mtype_t);
228  extern void
229  zCreate_CompRow_Matrix(SLU::SuperMatrix *, int, int, int, doublecomplex *,
230  int *, int *, SLU::Stype_t, SLU::Dtype_t, SLU::Mtype_t);
231  extern void
232  zCreate_Dense_Matrix(SLU::SuperMatrix *, int, int, doublecomplex *, int,
233  SLU::Stype_t, SLU::Dtype_t, SLU::Mtype_t);
234 
235  extern void
236  zgsequ (SLU::SuperMatrix *, double *, double *, double *,
237  double *, double *, int *);
238 
239  extern void
240  zlaqgs (SLU::SuperMatrix *, double *, double *, double,
241  double, double, char *);
242 
243 //#include "slu_zdefs.h"
244  }
245 #endif // HAVE_TEUCHOS_COMPLEX
246 
247  } // end extern "C"
248 
249 } // end namespace SLU
250 
251 
252 namespace Amesos2 {
253 
254  /* ==================== Specializations ====================
255  *
256  * \cond Superlu_function_specializations
257  */
258 
282  template <>
283  struct FunctionMap<Superlu,float>
284  {
285  typedef TypeMap<Superlu,float> type_map;
286 
290  static void gssvx(SLU::superlu_options_t* options, SLU::SuperMatrix* A,
291  int* perm_c, int* perm_r, int* etree, char* equed, float* R, float* C,
292  SLU::SuperMatrix* L, SLU::SuperMatrix* U, void* work, int lwork,
293  SLU::SuperMatrix* B, SLU::SuperMatrix* X, float* recip_pivot_growth,
294  float* rcond, float* ferr, float* berr, SLU::mem_usage_t* mem_usage,
295  SLU::SuperLUStat_t* stat, int* info)
296  {
297  SLU::S::sgssvx(options, A, perm_c, perm_r, etree, equed, R, C, L, U, work,
298  lwork, B, X, recip_pivot_growth, rcond, ferr, berr, mem_usage, stat, info);
299  }
300 
301  static void gsisx(SLU::superlu_options_t* options, SLU::SuperMatrix* A,
302  int* perm_c, int* perm_r, int* etree, char* equed, float* R, float* C,
303  SLU::SuperMatrix* L, SLU::SuperMatrix* U, void* work, int lwork,
304  SLU::SuperMatrix* B, SLU::SuperMatrix* X, float* recip_pivot_growth,
305  float* rcond, SLU::mem_usage_t* mem_usage,
306  SLU::SuperLUStat_t* stat, int* info)
307  {
308  SLU::S::sgsisx(options, A, perm_c, perm_r, etree, equed, R, C, L, U, work,
309  lwork, B, X, recip_pivot_growth, rcond, mem_usage, stat, info);
310  }
311 
331  static void gstrf(SLU::superlu_options_t* options, SLU::SuperMatrix* AC,
332  int relax, int panel_size, int* etree, void* work,
333  int lwork, int* perm_c, int* perm_r, SLU::SuperMatrix* L,
334  SLU::SuperMatrix* U, SLU::SuperLUStat_t* stat, int* info)
335  {
336  SLU::S::sgstrf(options, AC, relax, panel_size, etree,
337  work, lwork, perm_c, perm_r, L, U, stat, info);
338  }
339 
340  static void gsitrf(SLU::superlu_options_t* options, SLU::SuperMatrix* AC,
341  int relax, int panel_size, int* etree, void* work,
342  int lwork, int* perm_c, int* perm_r, SLU::SuperMatrix* L,
343  SLU::SuperMatrix* U, SLU::SuperLUStat_t* stat, int* info)
344  {
345  SLU::S::sgsitrf(options, AC, relax, panel_size, etree,
346  work, lwork, perm_c, perm_r, L, U, stat, info);
347  }
348 
352  static void create_CompCol_Matrix(SLU::SuperMatrix* A, int m, int n,
353  int nnz, type_map::type* nzval, int* rowind, int* colptr,
354  SLU::Stype_t stype, SLU::Dtype_t dtype, SLU::Mtype_t mtype)
355  {
356  SLU::S::sCreate_CompCol_Matrix(A, m, n, nnz, nzval, rowind, colptr,
357  stype, dtype, mtype);
358  }
359 
363  static void create_CompRow_Matrix(SLU::SuperMatrix* A, int m, int n,
364  int nnz, type_map::type* nzval, int* rowind, int* colptr,
365  SLU::Stype_t stype, SLU::Dtype_t dtype, SLU::Mtype_t mtype)
366  {
367  SLU::S::sCreate_CompRow_Matrix(A, m, n, nnz, nzval, rowind, colptr,
368  stype, dtype, mtype);
369  }
370 
371 
380  static void create_Dense_Matrix(SLU::SuperMatrix* X, int m, int n,
381  type_map::type* x, int ldx, SLU::Stype_t stype,
382  SLU::Dtype_t dtype, SLU::Mtype_t mtype)
383  {
384  SLU::S::sCreate_Dense_Matrix(X, m, n, x, ldx, stype, dtype, mtype);
385  }
386 
390  static void gsequ(SLU::SuperMatrix* A, float* R, float* C,
391  float* rowcnd, float* colcnd, float* amax, int* info)
392  {
393  SLU::S::sgsequ(A, R, C, rowcnd, colcnd, amax, info);
394  }
395 
410  static void laqgs(SLU::SuperMatrix* A, float* R, float* C,
411  float rowcnd, float colcnd, float amax, char* equed)
412  {
413  SLU::S::slaqgs(A, R, C, rowcnd, colcnd, amax, equed);
414  }
415  };
416 
417 
418  template <>
419  struct FunctionMap<Superlu,double>
420  {
421  typedef TypeMap<Superlu,double> type_map;
422 
423  static void gssvx(SLU::superlu_options_t* options, SLU::SuperMatrix* A,
424  int* perm_c, int* perm_r, int* etree, char* equed, double* R, double* C,
425  SLU::SuperMatrix* L, SLU::SuperMatrix* U, void* work, int lwork,
426  SLU::SuperMatrix* B, SLU::SuperMatrix* X, double* recip_pivot_growth,
427  double* rcond, double* ferr, double* berr, SLU::mem_usage_t* mem_usage,
428  SLU::SuperLUStat_t* stat, int* info)
429  {
430  SLU::D::dgssvx(options, A, perm_c, perm_r, etree, equed, R, C, L, U, work,
431  lwork, B, X, recip_pivot_growth, rcond, ferr, berr, mem_usage, stat, info);
432  }
433 
434  static void gstrf(SLU::superlu_options_t* options, SLU::SuperMatrix* AC,
435  int relax, int panel_size, int* etree, void* work, int lwork, int* perm_c,
436  int* perm_r, SLU::SuperMatrix* L, SLU::SuperMatrix* U,
437  SLU::SuperLUStat_t* stat, int* info)
438  {
439  SLU::D::dgstrf(options, AC, relax, panel_size, etree,
440  work, lwork, perm_c, perm_r, L, U, stat, info);
441  }
442 
443  static void gsisx(SLU::superlu_options_t* options, SLU::SuperMatrix* A,
444  int* perm_c, int* perm_r, int* etree, char* equed, double* R, double* C,
445  SLU::SuperMatrix* L, SLU::SuperMatrix* U, void* work, int lwork,
446  SLU::SuperMatrix* B, SLU::SuperMatrix* X, double* recip_pivot_growth,
447  double* rcond, SLU::mem_usage_t* mem_usage,
448  SLU::SuperLUStat_t* stat, int* info)
449  {
450  SLU::D::dgsisx(options, A, perm_c, perm_r, etree, equed, R, C, L, U, work,
451  lwork, B, X, recip_pivot_growth, rcond, mem_usage, stat, info);
452  }
453 
454  static void gsitrf(SLU::superlu_options_t* options, SLU::SuperMatrix* AC,
455  int relax, int panel_size, int* etree, void* work, int lwork, int* perm_c,
456  int* perm_r, SLU::SuperMatrix* L, SLU::SuperMatrix* U,
457  SLU::SuperLUStat_t* stat, int* info)
458  {
459  SLU::D::dgsitrf(options, AC, relax, panel_size, etree,
460  work, lwork, perm_c, perm_r, L, U, stat, info);
461  }
462 
463  static void create_CompCol_Matrix(SLU::SuperMatrix* A, int m, int n,
464  int nnz, type_map::type* nzval, int* rowind, int* colptr,
465  SLU::Stype_t stype, SLU::Dtype_t dtype, SLU::Mtype_t mtype)
466  {
467  SLU::D::dCreate_CompCol_Matrix(A, m, n, nnz, nzval, rowind, colptr,
468  stype, dtype, mtype);
469  }
470 
471  static void create_CompRow_Matrix(SLU::SuperMatrix* A, int m, int n,
472  int nnz, type_map::type* nzval, int* rowind, int* colptr,
473  SLU::Stype_t stype, SLU::Dtype_t dtype, SLU::Mtype_t mtype)
474  {
475  SLU::D::dCreate_CompRow_Matrix(A, m, n, nnz, nzval, rowind, colptr,
476  stype, dtype, mtype);
477  }
478 
479  static void create_Dense_Matrix(SLU::SuperMatrix* X, int m,
480  int n, type_map::type* x, int ldx, SLU::Stype_t stype,
481  SLU::Dtype_t dtype, SLU::Mtype_t mtype)
482  {
483  SLU::D::dCreate_Dense_Matrix(X, m, n, x, ldx, stype, dtype, mtype);
484  }
485 
486  static void gsequ(SLU::SuperMatrix* A, double* R, double* C,
487  double* rowcnd, double* colcnd, double* amax, int* info)
488  {
489  SLU::D::dgsequ(A, R, C, rowcnd, colcnd, amax, info);
490  }
491 
492  static void laqgs(SLU::SuperMatrix* A, double* R, double* C,
493  double rowcnd, double colcnd, double amax, char* equed)
494  {
495  SLU::D::dlaqgs(A, R, C, rowcnd, colcnd, amax, equed);
496  }
497 
498  };
499 
500 
501 #ifdef HAVE_TEUCHOS_COMPLEX
502 
503  /* The specializations for Teuchos::as<> for SLU::complex and
504  * SLU::doublecomplex are provided in Amesos2_Superlu_Type.hpp
505  */
506  template <>
507  struct FunctionMap<Superlu,SLU::C::complex>
508  {
509  static void gssvx(SLU::superlu_options_t* options, SLU::SuperMatrix* A,
510  int* perm_c, int* perm_r, int* etree, char* equed, float* R, float* C,
511  SLU::SuperMatrix* L, SLU::SuperMatrix* U, void* work, int lwork,
512  SLU::SuperMatrix* B, SLU::SuperMatrix* X, float* recip_pivot_growth,
513  float* rcond, float* ferr, float* berr, SLU::mem_usage_t* mem_usage,
514  SLU::SuperLUStat_t* stat, int* info)
515  {
516  SLU::C::cgssvx(options, A, perm_c, perm_r, etree, equed, R, C, L, U, work,
517  lwork, B, X, recip_pivot_growth, rcond, ferr, berr, mem_usage, stat, info);
518  }
519 
520  static void gstrf(SLU::superlu_options_t* options, SLU::SuperMatrix* AC,
521  int relax, int panel_size, int* etree, void* work, int lwork, int* perm_c,
522  int* perm_r, SLU::SuperMatrix* L, SLU::SuperMatrix* U,
523  SLU::SuperLUStat_t* stat, int* info)
524  {
525  SLU::C::cgstrf(options, AC, relax, panel_size, etree,
526  work, lwork, perm_c, perm_r, L, U, stat, info);
527  }
528 
529  static void gsisx(SLU::superlu_options_t* options, SLU::SuperMatrix* A,
530  int* perm_c, int* perm_r, int* etree, char* equed, float* R, float* C,
531  SLU::SuperMatrix* L, SLU::SuperMatrix* U, void* work, int lwork,
532  SLU::SuperMatrix* B, SLU::SuperMatrix* X, float* recip_pivot_growth,
533  float* rcond, SLU::mem_usage_t* mem_usage,
534  SLU::SuperLUStat_t* stat, int* info)
535  {
536  SLU::C::cgsisx(options, A, perm_c, perm_r, etree, equed, R, C, L, U, work,
537  lwork, B, X, recip_pivot_growth, rcond, mem_usage, stat, info);
538  }
539 
540  static void gsitrf(SLU::superlu_options_t* options, SLU::SuperMatrix* AC,
541  int relax, int panel_size, int* etree, void* work, int lwork, int* perm_c,
542  int* perm_r, SLU::SuperMatrix* L, SLU::SuperMatrix* U,
543  SLU::SuperLUStat_t* stat, int* info)
544  {
545  SLU::C::cgsitrf(options, AC, relax, panel_size, etree,
546  work, lwork, perm_c, perm_r, L, U, stat, info);
547  }
548 
549  static void create_CompCol_Matrix(SLU::SuperMatrix* A, int m, int n, int nnz,
550  SLU::C::complex* nzval, int* rowind, int* colptr,
551  SLU::Stype_t stype, SLU::Dtype_t dtype, SLU::Mtype_t mtype)
552  {
553  SLU::C::cCreate_CompCol_Matrix(A, m, n, nnz, nzval, rowind, colptr,
554  stype, dtype, mtype);
555  }
556 
557  static void create_CompRow_Matrix(SLU::SuperMatrix* A, int m, int n, int nnz,
558  SLU::C::complex* nzval, int* rowind, int* colptr,
559  SLU::Stype_t stype, SLU::Dtype_t dtype, SLU::Mtype_t mtype)
560  {
561  SLU::C::cCreate_CompRow_Matrix(A, m, n, nnz, nzval, rowind, colptr,
562  stype, dtype, mtype);
563  }
564 
565  static void create_Dense_Matrix(SLU::SuperMatrix* X, int m, int n,
566  SLU::C::complex* x, int ldx, SLU::Stype_t stype,
567  SLU::Dtype_t dtype, SLU::Mtype_t mtype)
568  {
569  SLU::C::cCreate_Dense_Matrix(X, m, n, x, ldx, stype, dtype, mtype);
570  }
571 
572  static void gsequ(SLU::SuperMatrix* A, float* R, float* C,
573  float* rowcnd, float* colcnd, float* amax, int* info)
574  {
575  SLU::C::cgsequ(A, R, C, rowcnd, colcnd, amax, info);
576  }
577 
578  static void laqgs(SLU::SuperMatrix* A, float* R, float* C,
579  float rowcnd, float colcnd, float amax, char* equed)
580  {
581  SLU::C::claqgs(A, R, C, rowcnd, colcnd, amax, equed);
582  }
583  };
584 
585 
586  template <>
587  struct FunctionMap<Superlu,SLU::Z::doublecomplex>
588  {
589  static void gssvx(SLU::superlu_options_t* options, SLU::SuperMatrix* A,
590  int* perm_c, int* perm_r, int* etree, char* equed, double* R, double* C,
591  SLU::SuperMatrix* L, SLU::SuperMatrix* U, void* work, int lwork,
592  SLU::SuperMatrix* B, SLU::SuperMatrix* X, double* recip_pivot_growth,
593  double* rcond, double* ferr, double* berr, SLU::mem_usage_t* mem_usage,
594  SLU::SuperLUStat_t* stat, int* info)
595  {
596  SLU::Z::zgssvx(options, A, perm_c, perm_r, etree, equed, R, C, L, U, work,
597  lwork, B, X, recip_pivot_growth, rcond, ferr, berr, mem_usage, stat, info);
598  }
599 
600  static void gstrf(SLU::superlu_options_t* options, SLU::SuperMatrix* AC,
601  int relax, int panel_size, int* etree, void* work, int lwork, int* perm_c,
602  int* perm_r, SLU::SuperMatrix* L, SLU::SuperMatrix* U,
603  SLU::SuperLUStat_t* stat, int* info)
604  {
605  SLU::Z::zgstrf(options, AC, relax, panel_size, etree,
606  work, lwork, perm_c, perm_r, L, U, stat, info);
607  }
608 
609  static void gsisx(SLU::superlu_options_t* options, SLU::SuperMatrix* A,
610  int* perm_c, int* perm_r, int* etree, char* equed, double* R, double* C,
611  SLU::SuperMatrix* L, SLU::SuperMatrix* U, void* work, int lwork,
612  SLU::SuperMatrix* B, SLU::SuperMatrix* X, double* recip_pivot_growth,
613  double* rcond, SLU::mem_usage_t* mem_usage,
614  SLU::SuperLUStat_t* stat, int* info)
615  {
616  SLU::Z::zgsisx(options, A, perm_c, perm_r, etree, equed, R, C, L, U, work,
617  lwork, B, X, recip_pivot_growth, rcond, mem_usage, stat, info);
618  }
619 
620  static void gsitrf(SLU::superlu_options_t* options, SLU::SuperMatrix* AC,
621  int relax, int panel_size, int* etree, void* work, int lwork, int* perm_c,
622  int* perm_r, SLU::SuperMatrix* L, SLU::SuperMatrix* U,
623  SLU::SuperLUStat_t* stat, int* info)
624  {
625  SLU::Z::zgsitrf(options, AC, relax, panel_size, etree,
626  work, lwork, perm_c, perm_r, L, U, stat, info);
627  }
628 
629  static void create_CompCol_Matrix(SLU::SuperMatrix* A, int m, int n, int nnz,
630  SLU::Z::doublecomplex* nzval, int* rowind, int* colptr,
631  SLU::Stype_t stype, SLU::Dtype_t dtype, SLU::Mtype_t mtype)
632  {
633  SLU::Z::zCreate_CompCol_Matrix(A, m, n, nnz, nzval, rowind, colptr,
634  stype, dtype, mtype);
635 
636  TEUCHOS_TEST_FOR_EXCEPTION( A == NULL,
637  std::runtime_error,
638  "Supermatrix A not initialized properly!");
639  }
640 
641 
642  static void create_CompRow_Matrix(SLU::SuperMatrix* A, int m, int n, int nnz,
643  SLU::Z::doublecomplex* nzval, int* rowind, int* colptr,
644  SLU::Stype_t stype, SLU::Dtype_t dtype, SLU::Mtype_t mtype)
645  {
646  SLU::Z::zCreate_CompRow_Matrix(A, m, n, nnz, nzval, rowind, colptr,
647  stype, dtype, mtype);
648 
649  TEUCHOS_TEST_FOR_EXCEPTION( A == NULL,
650  std::runtime_error,
651  "Supermatrix A not initialized properly!");
652  }
653 
654  static void create_Dense_Matrix(SLU::SuperMatrix* X, int m, int n,
655  SLU::Z::doublecomplex* x, int ldx, SLU::Stype_t stype,
656  SLU::Dtype_t dtype, SLU::Mtype_t mtype)
657  {
658  SLU::Z::zCreate_Dense_Matrix(X, m, n, x, ldx, stype, dtype, mtype);
659  }
660 
661  static void gsequ(SLU::SuperMatrix* A, double* R, double* C,
662  double* rowcnd, double* colcnd, double* amax, int* info)
663  {
664  SLU::Z::zgsequ(A, R, C, rowcnd, colcnd, amax, info);
665  }
666 
667  static void laqgs(SLU::SuperMatrix* A, double* R, double* C,
668  double rowcnd, double colcnd, double amax, char* equed)
669  {
670  SLU::Z::zlaqgs(A, R, C, rowcnd, colcnd, amax, equed);
671  }
672  };
673 #endif // HAVE_TEUCHOS_COMPLEX
674 
675  /* \endcond Superlu_function_specializations */
676 
677 
678 } // end namespace Amesos2
679 
680 #endif // AMESOS2_SUPERLU_FUNCTIONMAP_HPP
Declaration of Function mapping class for Amesos2.
Definition: Amesos2_AbstractConcreteMatrixAdapter.hpp:48
Provides definition of SuperLU types as well as conversions and type traits.
Definition: Amesos2_Superlu_FunctionMap.hpp:74