dune-istl  2.4
superlu.hh
Go to the documentation of this file.
1 // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 // vi: set et ts=4 sw=2 sts=2:
3 #ifndef DUNE_ISTL_SUPERLU_HH
4 #define DUNE_ISTL_SUPERLU_HH
5 
6 #if HAVE_SUPERLU
7 #ifdef TRUE
8 #undef TRUE
9 #endif
10 #ifdef FALSE
11 #undef FALSE
12 #endif
13 #ifndef SUPERLU_NTYPE
14 #define SUPERLU_NTYPE 1
15 #endif
16 #ifdef SUPERLU_POST_2005_VERSION
17 
18 #if SUPERLU_NTYPE==0
19 #include "slu_sdefs.h"
20 #endif
21 
22 #if SUPERLU_NTYPE==1
23 #include "slu_ddefs.h"
24 #endif
25 
26 #if SUPERLU_NTYPE==2
27 #include "slu_cdefs.h"
28 #endif
29 
30 #if SUPERLU_NTYPE>=3
31 #include "slu_zdefs.h"
32 #endif
33 
34 #else
35 
36 #if SUPERLU_NTYPE==0
37 #include "ssp_defs.h"
38 #endif
39 
40 #if SUPERLU_NTYPE==1
41 #include "dsp_defs.h"
42 #warning Support for SuperLU older than SuperLU 3.0 from August 2005 is deprecated.
43 #endif
44 
45 #if SUPERLU_NTYPE==2
46 #include "csp_defs.h"
47 #endif
48 
49 #if SUPERLU_NTYPE>=3
50 #include "zsp_defs.h"
51 #endif
52 
53 #endif
54 #include "solvers.hh"
55 #include "supermatrix.hh"
56 #include <algorithm>
57 #include <functional>
58 #include "bcrsmatrix.hh"
59 #include "bvector.hh"
60 #include "istlexception.hh"
61 #include <dune/common/fmatrix.hh>
62 #include <dune/common/fvector.hh>
63 #include <dune/common/stdstreams.hh>
64 #include <dune/istl/solvertype.hh>
65 
66 namespace Dune
67 {
68 
79  template<class Matrix>
80  class SuperLU
81  {};
82 
83  template<class M, class T, class TM, class TD, class TA>
85 
86  template<class T, bool tag>
88 
89  template<class T>
91  {};
92 
93  template<class T>
95  {};
96 
97  template<class T>
99  {};
100 
101  template<class T>
103  {};
104 
105 #if SUPERLU_NTYPE==0
106  template<>
107  struct SuperLUDenseMatChooser<float>
108  {
109  static void create(SuperMatrix *mat, int n, int m, float *dat, int n1,
110  Stype_t stype, Dtype_t dtype, Mtype_t mtype)
111  {
112  sCreate_Dense_Matrix(mat, n, m, dat, n1, stype, dtype, mtype);
113 
114  }
115 
116  static void destroy(SuperMatrix*)
117  {}
118 
119  };
120  template<>
121  struct SuperLUSolveChooser<float>
122  {
123  static void solve(superlu_options_t *options, SuperMatrix *mat, int *perm_c, int *perm_r, int *etree,
124  char *equed, float *R, float *C, SuperMatrix *L, SuperMatrix *U,
125  void *work, int lwork, SuperMatrix *B, SuperMatrix *X,
126  float *rpg, float *rcond, float *ferr, float *berr,
127  mem_usage_t *memusage, SuperLUStat_t *stat, int *info)
128  {
129  sgssvx(options, mat, perm_c, perm_r, etree, equed, R, C,
130  L, U, work, lwork, B, X, rpg, rcond, ferr, berr,
131  memusage, stat, info);
132  }
133  };
134 
135  template<>
136  struct QuerySpaceChooser<float>
137  {
138  static void querySpace(SuperMatrix* L, SuperMatrix* U, mem_usage_t* memusage)
139  {
140  sQuerySpace(L,U,memusage);
141  }
142  };
143 
144 #endif
145 
146 #if SUPERLU_NTYPE==1
147 
148  template<>
149  struct SuperLUDenseMatChooser<double>
150  {
151  static void create(SuperMatrix *mat, int n, int m, double *dat, int n1,
152  Stype_t stype, Dtype_t dtype, Mtype_t mtype)
153  {
154  dCreate_Dense_Matrix(mat, n, m, dat, n1, stype, dtype, mtype);
155 
156  }
157 
158  static void destroy(SuperMatrix * /* mat */)
159  {}
160  };
161  template<>
162  struct SuperLUSolveChooser<double>
163  {
164  static void solve(superlu_options_t *options, SuperMatrix *mat, int *perm_c, int *perm_r, int *etree,
165  char *equed, double *R, double *C, SuperMatrix *L, SuperMatrix *U,
166  void *work, int lwork, SuperMatrix *B, SuperMatrix *X,
167  double *rpg, double *rcond, double *ferr, double *berr,
168  mem_usage_t *memusage, SuperLUStat_t *stat, int *info)
169  {
170  dgssvx(options, mat, perm_c, perm_r, etree, equed, R, C,
171  L, U, work, lwork, B, X, rpg, rcond, ferr, berr,
172  memusage, stat, info);
173  }
174  };
175 
176  template<>
177  struct QuerySpaceChooser<double>
178  {
179  static void querySpace(SuperMatrix* L, SuperMatrix* U, mem_usage_t* memusage)
180  {
181  dQuerySpace(L,U,memusage);
182  }
183  };
184 #endif
185 
186 #if SUPERLU_NTYPE>=3
187  template<>
188  struct SuperLUDenseMatChooser<std::complex<double> >
189  {
190  static void create(SuperMatrix *mat, int n, int m, std::complex<double> *dat, int n1,
191  Stype_t stype, Dtype_t dtype, Mtype_t mtype)
192  {
193  zCreate_Dense_Matrix(mat, n, m, reinterpret_cast<doublecomplex*>(dat), n1, stype, dtype, mtype);
194 
195  }
196 
197  static void destroy(SuperMatrix*)
198  {}
199  };
200 
201  template<>
202  struct SuperLUSolveChooser<std::complex<double> >
203  {
204  static void solve(superlu_options_t *options, SuperMatrix *mat, int *perm_c, int *perm_r, int *etree,
205  char *equed, double *R, double *C, SuperMatrix *L, SuperMatrix *U,
206  void *work, int lwork, SuperMatrix *B, SuperMatrix *X,
207  double *rpg, double *rcond, double *ferr, double *berr,
208  mem_usage_t *memusage, SuperLUStat_t *stat, int *info)
209  {
210  zgssvx(options, mat, perm_c, perm_r, etree, equed, R, C,
211  L, U, work, lwork, B, X, rpg, rcond, ferr, berr,
212  memusage, stat, info);
213  }
214  };
215 
216  template<>
217  struct QuerySpaceChooser<std::complex<double> >
218  {
219  static void querySpace(SuperMatrix* L, SuperMatrix* U, mem_usage_t* memusage)
220  {
221  zQuerySpace(L,U,memusage);
222  }
223  };
224 #endif
225 
226 #if SUPERLU_NTYPE==2
227  template<>
228  struct SuperLUDenseMatChooser<std::complex<float> >
229  {
230  static void create(SuperMatrix *mat, int n, int m, std::complex<float> *dat, int n1,
231  Stype_t stype, Dtype_t dtype, Mtype_t mtype)
232  {
233  cCreate_Dense_Matrix(mat, n, m, reinterpret_cast< ::complex*>(dat), n1, stype, dtype, mtype);
234 
235  }
236 
237  static void destroy(SuperMatrix* /* mat */)
238  {}
239  };
240 
241  template<>
242  struct SuperLUSolveChooser<std::complex<float> >
243  {
244  static void solve(superlu_options_t *options, SuperMatrix *mat, int *perm_c, int *perm_r, int *etree,
245  char *equed, float *R, float *C, SuperMatrix *L, SuperMatrix *U,
246  void *work, int lwork, SuperMatrix *B, SuperMatrix *X,
247  float *rpg, float *rcond, float *ferr, float *berr,
248  mem_usage_t *memusage, SuperLUStat_t *stat, int *info)
249  {
250  cgssvx(options, mat, perm_c, perm_r, etree, equed, R, C,
251  L, U, work, lwork, B, X, rpg, rcond, ferr, berr,
252  memusage, stat, info);
253  }
254  };
255 
256  template<>
257  struct QuerySpaceChooser<std::complex<float> >
258  {
259  static void querySpace(SuperMatrix* L, SuperMatrix* U, mem_usage_t* memusage)
260  {
261  cQuerySpace(L,U,memusage);
262  }
263  };
264 #endif
265 
279  template<typename T, typename A, int n, int m>
280  class SuperLU<BCRSMatrix<FieldMatrix<T,n,m>,A > >
281  : public InverseOperator<
282  BlockVector<FieldVector<T,m>,
283  typename A::template rebind<FieldVector<T,m> >::other>,
284  BlockVector<FieldVector<T,n>,
285  typename A::template rebind<FieldVector<T,n> >::other> >
286  {
287  public:
290  typedef Dune::BCRSMatrix<FieldMatrix<T,n,m>,A> matrix_type;
296  typedef Dune::BlockVector<
297  FieldVector<T,m>,
298  typename A::template rebind<FieldVector<T,m> >::other> domain_type;
300  typedef Dune::BlockVector<
301  FieldVector<T,n>,
302  typename A::template rebind<FieldVector<T,n> >::other> range_type;
317  explicit SuperLU(const Matrix& mat, bool verbose=false,
318  bool reusevector=true);
325  SuperLU();
326 
327  ~SuperLU();
328 
332  void apply(domain_type& x, range_type& b, InverseOperatorResult& res);
333 
337  void apply (domain_type& x, range_type& b, double reduction, InverseOperatorResult& res)
338  {
339  DUNE_UNUSED_PARAMETER(reduction);
340  apply(x,b,res);
341  }
342 
346  void apply(T* x, T* b);
347 
349  void setMatrix(const Matrix& mat);
350 
351  typename SuperLUMatrix::size_type nnz() const
352  {
353  return mat.nnz();
354  }
355 
356  template<class S>
357  void setSubMatrix(const Matrix& mat, const S& rowIndexSet);
358 
359  void setVerbosity(bool v);
360 
365  void free();
366 
367  const char* name() { return "SuperLU"; }
368  private:
369  friend class std::mem_fun_ref_t<void,SuperLU>;
370  template<class M,class X, class TM, class TD, class T1>
371  friend class SeqOverlappingSchwarz;
372  friend struct SeqOverlappingSchwarzAssemblerHelper<SuperLU<Matrix>,true>;
373 
374  SuperLUMatrix& getInternalMatrix() { return mat; }
375 
377  void decompose();
378 
379  SuperLUMatrix mat;
380  SuperMatrix L, U, B, X;
381  int *perm_c, *perm_r, *etree;
382  typename GetSuperLUType<T>::float_type *R, *C;
383  T *bstore;
384  superlu_options_t options;
385  char equed;
386  void *work;
387  int lwork;
388  bool first, verbose, reusevector;
389  };
390 
391  template<typename T, typename A, int n, int m>
392  SuperLU<BCRSMatrix<FieldMatrix<T,n,m>,A> >
393  ::~SuperLU()
394  {
395  if(mat.N()+mat.M()>0)
396  free();
397  }
398 
399  template<typename T, typename A, int n, int m>
400  void SuperLU<BCRSMatrix<FieldMatrix<T,n,m>,A> >::free()
401  {
402  delete[] perm_c;
403  delete[] perm_r;
404  delete[] etree;
405  delete[] R;
406  delete[] C;
407  if(lwork>=0) {
408  Destroy_SuperNode_Matrix(&L);
409  Destroy_CompCol_Matrix(&U);
410  }
411  lwork=0;
412  if(!first && reusevector) {
413  SUPERLU_FREE(B.Store);
414  SUPERLU_FREE(X.Store);
415  }
416  mat.free();
417  }
418 
419  template<typename T, typename A, int n, int m>
420  SuperLU<BCRSMatrix<FieldMatrix<T,n,m>,A> >
421  ::SuperLU(const Matrix& mat_, bool verbose_, bool reusevector_)
422  : work(0), lwork(0), first(true), verbose(verbose_),
423  reusevector(reusevector_)
424  {
425  setMatrix(mat_);
426 
427  }
428  template<typename T, typename A, int n, int m>
429  SuperLU<BCRSMatrix<FieldMatrix<T,n,m>,A> >::SuperLU()
430  : work(0), lwork(0),verbose(false),
431  reusevector(false)
432  {}
433  template<typename T, typename A, int n, int m>
434  void SuperLU<BCRSMatrix<FieldMatrix<T,n,m>,A> >::setVerbosity(bool v)
435  {
436  verbose=v;
437  }
438 
439  template<typename T, typename A, int n, int m>
440  void SuperLU<BCRSMatrix<FieldMatrix<T,n,m>,A> >::setMatrix(const Matrix& mat_)
441  {
442  if(mat.N()+mat.M()>0) {
443  free();
444  }
445  lwork=0;
446  work=0;
447  //a=&mat_;
448  mat=mat_;
449  decompose();
450  }
451 
452  template<typename T, typename A, int n, int m>
453  template<class S>
454  void SuperLU<BCRSMatrix<FieldMatrix<T,n,m>,A> >::setSubMatrix(const Matrix& mat_,
455  const S& mrs)
456  {
457  if(mat.N()+mat.M()>0) {
458  free();
459  }
460  lwork=0;
461  work=0;
462  //a=&mat_;
463  mat.setMatrix(mat_,mrs);
464  decompose();
465  }
466 
467  template<typename T, typename A, int n, int m>
468  void SuperLU<BCRSMatrix<FieldMatrix<T,n,m>,A> >::decompose()
469  {
470 
471  first = true;
472  perm_c = new int[mat.M()];
473  perm_r = new int[mat.N()];
474  etree = new int[mat.M()];
475  R = new typename GetSuperLUType<T>::float_type[mat.N()];
476  C = new typename GetSuperLUType<T>::float_type[mat.M()];
477 
478  set_default_options(&options);
479  // Do the factorization
480  B.ncol=0;
481  B.Stype=SLU_DN;
482  B.Dtype=GetSuperLUType<T>::type;
483  B.Mtype= SLU_GE;
484  DNformat fakeFormat;
485  fakeFormat.lda=mat.N();
486  B.Store=&fakeFormat;
487  X.Stype=SLU_DN;
488  X.Dtype=GetSuperLUType<T>::type;
489  X.Mtype= SLU_GE;
490  X.ncol=0;
491  X.Store=&fakeFormat;
492 
493  typename GetSuperLUType<T>::float_type rpg, rcond, ferr=1e10, berr=1e10;
494  int info;
495  mem_usage_t memusage;
496  SuperLUStat_t stat;
497 
498  StatInit(&stat);
499  SuperLUSolveChooser<T>::solve(&options, &static_cast<SuperMatrix&>(mat), perm_c, perm_r, etree, &equed, R, C,
500  &L, &U, work, lwork, &B, &X, &rpg, &rcond, &ferr,
501  &berr, &memusage, &stat, &info);
502 
503  if(verbose) {
504  dinfo<<"LU factorization: dgssvx() returns info "<< info<<std::endl;
505 
506  if ( info == 0 || info == n+1 ) {
507 
508  if ( options.PivotGrowth )
509  dinfo<<"Recip. pivot growth = "<<rpg<<std::endl;
510  if ( options.ConditionNumber )
511  dinfo<<"Recip. condition number = %e\n"<< rcond<<std::endl;
512  SCformat* Lstore = (SCformat *) L.Store;
513  NCformat* Ustore = (NCformat *) U.Store;
514  dinfo<<"No of nonzeros in factor L = "<< Lstore->nnz<<std::endl;
515  dinfo<<"No of nonzeros in factor U = "<< Ustore->nnz<<std::endl;
516  dinfo<<"No of nonzeros in L+U = "<< Lstore->nnz + Ustore->nnz - n<<std::endl;
517  QuerySpaceChooser<T>::querySpace(&L, &U, &memusage);
518  dinfo<<"L\\U MB "<<memusage.for_lu/1e6<<" \ttotal MB needed "<<memusage.total_needed/1e6
519  <<" \texpansions ";
520 
521 #ifdef HAVE_MEM_USAGE_T_EXPANSIONS
522  std::cout<<memusage.expansions<<std::endl;
523 #else
524  std::cout<<stat.expansions<<std::endl;
525 #endif
526  } else if ( info > 0 && lwork == -1 ) {
527  dinfo<<"** Estimated memory: "<< info - n<<std::endl;
528  }
529  if ( options.PrintStat ) StatPrint(&stat);
530  }
531  StatFree(&stat);
532  /*
533  NCformat* Ustore = (NCformat *) U.Store;
534  int k=0;
535  dPrint_CompCol_Matrix("U", &U);
536  for(int i=0; i < U.ncol; ++i, ++k){
537  std::cout<<i<<": ";
538  for(int c=Ustore->colptr[i]; c < Ustore->colptr[i+1]; ++c)
539  //if(Ustore->rowind[c]==i)
540  std::cout<<Ustore->rowind[c]<<"->"<<((double*)Ustore->nzval)[c]<<" ";
541  if(k==0){
542  //
543  k=-1;
544  }std::cout<<std::endl;
545  }
546  dPrint_SuperNode_Matrix("L", &L);
547  for(int i=0; i < U.ncol; ++i, ++k){
548  std::cout<<i<<": ";
549  for(int c=Ustore->colptr[i]; c < Ustore->colptr[i+1]; ++c)
550  //if(Ustore->rowind[c]==i)
551  std::cout<<Ustore->rowind[c]<<"->"<<((double*)Ustore->nzval)[c]<<" ";
552  if(k==0){
553  //
554  k=-1;
555  }std::cout<<std::endl;
556  } */
557  options.Fact = FACTORED;
558  }
559 
560  template<typename T, typename A, int n, int m>
561  void SuperLU<BCRSMatrix<FieldMatrix<T,n,m>,A> >
563  {
564  if(mat.M()+mat.N()==0)
565  DUNE_THROW(ISTLError, "Matrix of SuperLU is null!");
566 
567  SuperMatrix* mB = &B;
568  SuperMatrix* mX = &X;
569  SuperMatrix rB, rX;
570  if (reusevector) {
571  if(first) {
572  SuperLUDenseMatChooser<T>::create(&B, (int)mat.N(), 1, reinterpret_cast<T*>(&b[0]), (int)mat.N(), SLU_DN, GetSuperLUType<T>::type, SLU_GE);
573  SuperLUDenseMatChooser<T>::create(&X, (int)mat.N(), 1, reinterpret_cast<T*>(&x[0]), (int)mat.N(), SLU_DN, GetSuperLUType<T>::type, SLU_GE);
574  first=false;
575  }else{
576  ((DNformat*) B.Store)->nzval=&b[0];
577  ((DNformat*)X.Store)->nzval=&x[0];
578  }
579  } else {
580  SuperLUDenseMatChooser<T>::create(&rB, (int)mat.N(), 1, reinterpret_cast<T*>(&b[0]), (int)mat.N(), SLU_DN, GetSuperLUType<T>::type, SLU_GE);
581  SuperLUDenseMatChooser<T>::create(&rX, (int)mat.N(), 1, reinterpret_cast<T*>(&x[0]), (int)mat.N(), SLU_DN, GetSuperLUType<T>::type, SLU_GE);
582  mB = &rB;
583  mX = &rX;
584  }
585  typename GetSuperLUType<T>::float_type rpg, rcond, ferr=1e10, berr;
586  int info;
587  mem_usage_t memusage;
588  SuperLUStat_t stat;
589  /* Initialize the statistics variables. */
590  StatInit(&stat);
591  /*
592  range_type d=b;
593  a->usmv(-1, x, d);
594 
595  double def0=d.two_norm();
596  */
597 #ifdef SUPERLU_MIN_VERSION_4_3
598  options.IterRefine=SLU_DOUBLE;
599 #else
600  options.IterRefine=DOUBLE;
601 #endif
602 
603  SuperLUSolveChooser<T>::solve(&options, &static_cast<SuperMatrix&>(mat), perm_c, perm_r, etree, &equed, R, C,
604  &L, &U, work, lwork, mB, mX, &rpg, &rcond, &ferr, &berr,
605  &memusage, &stat, &info);
606 
607  res.iterations=1;
608 
609  /*
610  if(options.Equil==YES)
611  // undo scaling of right hand side
612  std::transform(reinterpret_cast<T*>(&b[0]),reinterpret_cast<T*>(&b[0])+mat.M(),
613  C, reinterpret_cast<T*>(&d[0]), std::divides<T>());
614  else
615  d=b;
616  a->usmv(-1, x, d);
617  res.reduction=d.two_norm()/def0;
618  res.conv_rate = res.reduction;
619  res.converged=(res.reduction<1e-10||d.two_norm()<1e-18);
620  */
621  res.converged=true;
622 
623  if(verbose) {
624 
625  dinfo<<"Triangular solve: dgssvx() returns info "<< info<<std::endl;
626 
627  if ( info == 0 || info == n+1 ) {
628 
629  if ( options.IterRefine ) {
630  std::cout<<"Iterative Refinement: steps="
631  <<stat.RefineSteps<<" FERR="<<ferr<<" BERR="<<berr<<std::endl;
632  }else
633  std::cout<<" FERR="<<ferr<<" BERR="<<berr<<std::endl;
634  } else if ( info > 0 && lwork == -1 ) {
635  std::cout<<"** Estimated memory: "<< info - n<<" bytes"<<std::endl;
636  }
637 
638  if ( options.PrintStat ) StatPrint(&stat);
639  }
640  StatFree(&stat);
641  if (!reusevector) {
642  SUPERLU_FREE(rB.Store);
643  SUPERLU_FREE(rX.Store);
644  }
645  }
646 
647  template<typename T, typename A, int n, int m>
648  void SuperLU<BCRSMatrix<FieldMatrix<T,n,m>,A> >
649  ::apply(T* x, T* b)
650  {
651  if(mat.N()+mat.M()==0)
652  DUNE_THROW(ISTLError, "Matrix of SuperLU is null!");
653 
654  SuperMatrix* mB = &B;
655  SuperMatrix* mX = &X;
656  SuperMatrix rB, rX;
657  if (reusevector) {
658  if(first) {
659  SuperLUDenseMatChooser<T>::create(&B, mat.N(), 1, b, mat.N(), SLU_DN, GetSuperLUType<T>::type, SLU_GE);
660  SuperLUDenseMatChooser<T>::create(&X, mat.N(), 1, x, mat.N(), SLU_DN, GetSuperLUType<T>::type, SLU_GE);
661  first=false;
662  }else{
663  ((DNformat*) B.Store)->nzval=b;
664  ((DNformat*)X.Store)->nzval=x;
665  }
666  } else {
667  SuperLUDenseMatChooser<T>::create(&rB, mat.N(), 1, b, mat.N(), SLU_DN, GetSuperLUType<T>::type, SLU_GE);
668  SuperLUDenseMatChooser<T>::create(&rX, mat.N(), 1, x, mat.N(), SLU_DN, GetSuperLUType<T>::type, SLU_GE);
669  mB = &rB;
670  mX = &rX;
671  }
672 
673  typename GetSuperLUType<T>::float_type rpg, rcond, ferr=1e10, berr;
674  int info;
675  mem_usage_t memusage;
676  SuperLUStat_t stat;
677  /* Initialize the statistics variables. */
678  StatInit(&stat);
679 
680 #ifdef SUPERLU_MIN_VERSION_4_3
681  options.IterRefine=SLU_DOUBLE;
682 #else
683  options.IterRefine=DOUBLE;
684 #endif
685 
686  SuperLUSolveChooser<T>::solve(&options, &static_cast<SuperMatrix&>(mat), perm_c, perm_r, etree, &equed, R, C,
687  &L, &U, work, lwork, mB, mX, &rpg, &rcond, &ferr, &berr,
688  &memusage, &stat, &info);
689 
690  if(verbose) {
691  dinfo<<"Triangular solve: dgssvx() returns info "<< info<<std::endl;
692 
693  if ( info == 0 || info == n+1 ) {
694 
695  if ( options.IterRefine ) {
696  dinfo<<"Iterative Refinement: steps="
697  <<stat.RefineSteps<<" FERR="<<ferr<<" BERR="<<berr<<std::endl;
698  }else
699  dinfo<<" FERR="<<ferr<<" BERR="<<berr<<std::endl;
700  } else if ( info > 0 && lwork == -1 ) {
701  dinfo<<"** Estimated memory: "<< info - n<<" bytes"<<std::endl;
702  }
703  if ( options.PrintStat ) StatPrint(&stat);
704  }
705 
706  StatFree(&stat);
707  if (!reusevector) {
708  SUPERLU_FREE(rB.Store);
709  SUPERLU_FREE(rX.Store);
710  }
711  }
714  template<typename T, typename A, int n, int m>
716  {
717  enum { value=true};
718  };
719 
720  template<typename T, typename A, int n, int m>
722  {
723  enum { value = true };
724  };
725 }
726 
727 // undefine macros from SuperLU's slu_util.h
728 #undef FIRSTCOL_OF_SNODE
729 #undef NO_MARKER
730 #undef NUM_TEMPV
731 #undef USER_ABORT
732 #undef USER_MALLOC
733 #undef SUPERLU_MALLOC
734 #undef USER_FREE
735 #undef SUPERLU_FREE
736 #undef CHECK_MALLOC
737 #undef SUPERLU_MAX
738 #undef SUPERLU_MIN
739 #undef L_SUB_START
740 #undef L_SUB
741 #undef L_NZ_START
742 #undef L_FST_SUPC
743 #undef U_NZ_START
744 #undef U_SUB
745 #undef TRUE
746 #undef FALSE
747 #undef EMPTY
748 #undef NODROP
749 #undef DROP_BASIC
750 #undef DROP_PROWS
751 #undef DROP_COLUMN
752 #undef DROP_AREA
753 #undef DROP_SECONDARY
754 #undef DROP_DYNAMIC
755 #undef DROP_INTERP
756 #undef MILU_ALPHA
757 
758 #endif // HAVE_SUPERLU
759 #endif // DUNE_SUPERLU_HH
whether the solver internally uses column compressed storage
Definition: solvertype.hh:34
STL namespace.
Dune::SuperLUMatrix< Matrix > SuperLUMatrix
The corresponding SuperLU Matrix type.
Definition: superlu.hh:292
SuperLUMatrix::size_type nnz() const
Definition: superlu.hh:351
Implementation of the BCRSMatrix class.
Definition: basearray.hh:19
static void create(SuperMatrix *mat, int n, int m, double *dat, int n1, Stype_t stype, Dtype_t dtype, Mtype_t mtype)
Definition: superlu.hh:151
This file implements a vector space as a tensor product of a given vector space. The number of compon...
derive error class from the base class in common
Definition: istlexception.hh:16
Matrix & mat
Definition: matrixmatrix.hh:343
Dune::BlockVector< FieldVector< T, m >, typename A::template rebind< FieldVector< T, m > >::other > domain_type
The type of the domain of the solver.
Definition: superlu.hh:298
size_type M() const
Return the number of columns.
Definition: matrix.hh:165
Definition: supermatrix.hh:214
A vector of blocks with memory management.
Definition: bvector.hh:252
int iterations
Number of iterations.
Definition: solver.hh:50
const char * name()
Definition: superlu.hh:367
Definition: superlu.hh:102
A sparse block matrix with compressed row storage.
Definition: bcrsmatrix.hh:412
Definition: overlappingschwarz.hh:690
Definition: superlu.hh:98
Matrix & A
Definition: matrixmatrix.hh:216
void apply(domain_type &x, range_type &b, double reduction, InverseOperatorResult &res)
apply inverse operator, with given convergence criteria.
Definition: superlu.hh:337
SuperMatrixInitializer< BCRSMatrix< FieldMatrix< T, n, m >, A > > MatrixInitializer
Type of an associated initializer class.
Definition: superlu.hh:294
Definition: superlu.hh:94
Whether this is a direct solver.
Definition: solvertype.hh:22
Definition: superlu.hh:80
Dune::BCRSMatrix< FieldMatrix< T, n, m >, A > matrix_type
Definition: superlu.hh:290
Definition: supermatrix.hh:167
size_type N() const
Return the number of rows.
Definition: matrix.hh:160
Definition: matrixutils.hh:24
Sequential overlapping Schwarz preconditioner.
Definition: colcompmatrix.hh:157
Abstract base class for all solvers.
Definition: solver.hh:79
Dune::BlockVector< FieldVector< T, n >, typename A::template rebind< FieldVector< T, n > >::other > range_type
The type of the range of the solver.
Definition: superlu.hh:302
static void querySpace(SuperMatrix *L, SuperMatrix *U, mem_usage_t *memusage)
Definition: superlu.hh:179
Definition: solvertype.hh:13
static void destroy(SuperMatrix *)
Definition: superlu.hh:158
Templates characterizing the type of a solver.
Definition: solvertype.hh:27
bool converged
True if convergence criterion has been met.
Definition: solver.hh:56
Dune::BCRSMatrix< FieldMatrix< T, n, m >, A > Matrix
The matrix type.
Definition: superlu.hh:289
Statistics about the application of an inverse operator.
Definition: solver.hh:31
static void solve(superlu_options_t *options, SuperMatrix *mat, int *perm_c, int *perm_r, int *etree, char *equed, double *R, double *C, SuperMatrix *L, SuperMatrix *U, void *work, int lwork, SuperMatrix *B, SuperMatrix *X, double *rpg, double *rcond, double *ferr, double *berr, mem_usage_t *memusage, SuperLUStat_t *stat, int *info)
Definition: superlu.hh:164
Definition: superlu.hh:90
Implementations of the inverse operator interface.