Dune Core Modules (2.3.1)

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_SUPERLU_HH
4 #define DUNE_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>
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>
84  class SeqOverlappingSchwarz;
85 
86  template<class T, bool tag>
87  struct SeqOverlappingSchwarzAssemblerHelper;
88 
89  template<class T>
90  struct SuperLUSolveChooser
91  {};
92 
93  template<class T>
94  struct SuperLUDenseMatChooser
95  {};
96 
97  template<class T>
98  struct SuperLUQueryChooser
99  {};
100 
101  template<class T>
102  struct QuerySpaceChooser
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 *m)
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 *mat)
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:
294  typedef SuperMatrixInitializer<BCRSMatrix<FieldMatrix<T,n,m>,A> > MatrixInitializer;
296  typedef Dune::BlockVector<
298  typename A::template rebind<FieldVector<T,m> >::other> domain_type;
300  typedef Dune::BlockVector<
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 
375  void decompose();
376 
377  SuperLUMatrix mat;
378  SuperMatrix L, U, B, X;
379  int *perm_c, *perm_r, *etree;
380  typename GetSuperLUType<T>::float_type *R, *C;
381  T *bstore;
382  superlu_options_t options;
383  char equed;
384  void *work;
385  int lwork;
386  bool first, verbose, reusevector;
387  };
388 
389  template<typename T, typename A, int n, int m>
390  SuperLU<BCRSMatrix<FieldMatrix<T,n,m>,A> >
391  ::~SuperLU()
392  {
393  if(mat.N()+mat.M()>0)
394  free();
395  }
396 
397  template<typename T, typename A, int n, int m>
398  void SuperLU<BCRSMatrix<FieldMatrix<T,n,m>,A> >::free()
399  {
400  delete[] perm_c;
401  delete[] perm_r;
402  delete[] etree;
403  delete[] R;
404  delete[] C;
405  if(lwork>=0) {
406  Destroy_SuperNode_Matrix(&L);
407  Destroy_CompCol_Matrix(&U);
408  }
409  lwork=0;
410  if(!first && reusevector) {
411  SUPERLU_FREE(B.Store);
412  SUPERLU_FREE(X.Store);
413  }
414  mat.free();
415  }
416 
417  template<typename T, typename A, int n, int m>
418  SuperLU<BCRSMatrix<FieldMatrix<T,n,m>,A> >
419  ::SuperLU(const Matrix& mat_, bool verbose_, bool reusevector_)
420  : work(0), lwork(0), first(true), verbose(verbose_),
421  reusevector(reusevector_)
422  {
423  setMatrix(mat_);
424 
425  }
426  template<typename T, typename A, int n, int m>
427  SuperLU<BCRSMatrix<FieldMatrix<T,n,m>,A> >::SuperLU()
428  : work(0), lwork(0),verbose(false),
429  reusevector(false)
430  {}
431  template<typename T, typename A, int n, int m>
432  void SuperLU<BCRSMatrix<FieldMatrix<T,n,m>,A> >::setVerbosity(bool v)
433  {
434  verbose=v;
435  }
436 
437  template<typename T, typename A, int n, int m>
438  void SuperLU<BCRSMatrix<FieldMatrix<T,n,m>,A> >::setMatrix(const Matrix& mat_)
439  {
440  if(mat.N()+mat.M()>0) {
441  free();
442  }
443  lwork=0;
444  work=0;
445  //a=&mat_;
446  mat=mat_;
447  decompose();
448  }
449 
450  template<typename T, typename A, int n, int m>
451  template<class S>
452  void SuperLU<BCRSMatrix<FieldMatrix<T,n,m>,A> >::setSubMatrix(const Matrix& mat_,
453  const S& mrs)
454  {
455  if(mat.N()+mat.M()>0) {
456  free();
457  }
458  lwork=0;
459  work=0;
460  //a=&mat_;
461  mat.setMatrix(mat_,mrs);
462  decompose();
463  }
464 
465  template<typename T, typename A, int n, int m>
466  void SuperLU<BCRSMatrix<FieldMatrix<T,n,m>,A> >::decompose()
467  {
468 
469  first = true;
470  perm_c = new int[mat.M()];
471  perm_r = new int[mat.N()];
472  etree = new int[mat.M()];
473  R = new typename GetSuperLUType<T>::float_type[mat.N()];
474  C = new typename GetSuperLUType<T>::float_type[mat.M()];
475 
476  set_default_options(&options);
477  // Do the factorization
478  B.ncol=0;
479  B.Stype=SLU_DN;
480  B.Dtype=GetSuperLUType<T>::type;
481  B.Mtype= SLU_GE;
482  DNformat fakeFormat;
483  fakeFormat.lda=mat.N();
484  B.Store=&fakeFormat;
485  X.Stype=SLU_DN;
486  X.Dtype=GetSuperLUType<T>::type;
487  X.Mtype= SLU_GE;
488  X.ncol=0;
489  X.Store=&fakeFormat;
490 
491  typename GetSuperLUType<T>::float_type rpg, rcond, ferr=1e10, berr=1e10;
492  int info;
493  mem_usage_t memusage;
494  SuperLUStat_t stat;
495 
496  StatInit(&stat);
497  SuperLUSolveChooser<T>::solve(&options, &static_cast<SuperMatrix&>(mat), perm_c, perm_r, etree, &equed, R, C,
498  &L, &U, work, lwork, &B, &X, &rpg, &rcond, &ferr,
499  &berr, &memusage, &stat, &info);
500 
501  if(verbose) {
502  dinfo<<"LU factorization: dgssvx() returns info "<< info<<std::endl;
503 
504  if ( info == 0 || info == n+1 ) {
505 
506  if ( options.PivotGrowth )
507  dinfo<<"Recip. pivot growth = "<<rpg<<std::endl;
508  if ( options.ConditionNumber )
509  dinfo<<"Recip. condition number = %e\n"<< rcond<<std::endl;
510  SCformat* Lstore = (SCformat *) L.Store;
511  NCformat* Ustore = (NCformat *) U.Store;
512  dinfo<<"No of nonzeros in factor L = "<< Lstore->nnz<<std::endl;
513  dinfo<<"No of nonzeros in factor U = "<< Ustore->nnz<<std::endl;
514  dinfo<<"No of nonzeros in L+U = "<< Lstore->nnz + Ustore->nnz - n<<std::endl;
515  QuerySpaceChooser<T>::querySpace(&L, &U, &memusage);
516  dinfo<<"L\\U MB "<<memusage.for_lu/1e6<<" \ttotal MB needed "<<memusage.total_needed/1e6
517  <<" \texpansions ";
518 
519 #ifdef HAVE_MEM_USAGE_T_EXPANSIONS
520  std::cout<<memusage.expansions<<std::endl;
521 #else
522  std::cout<<stat.expansions<<std::endl;
523 #endif
524  } else if ( info > 0 && lwork == -1 ) {
525  dinfo<<"** Estimated memory: "<< info - n<<std::endl;
526  }
527  if ( options.PrintStat ) StatPrint(&stat);
528  }
529  StatFree(&stat);
530  /*
531  NCformat* Ustore = (NCformat *) U.Store;
532  int k=0;
533  dPrint_CompCol_Matrix("U", &U);
534  for(int i=0; i < U.ncol; ++i, ++k){
535  std::cout<<i<<": ";
536  for(int c=Ustore->colptr[i]; c < Ustore->colptr[i+1]; ++c)
537  //if(Ustore->rowind[c]==i)
538  std::cout<<Ustore->rowind[c]<<"->"<<((double*)Ustore->nzval)[c]<<" ";
539  if(k==0){
540  //
541  k=-1;
542  }std::cout<<std::endl;
543  }
544  dPrint_SuperNode_Matrix("L", &L);
545  for(int i=0; i < U.ncol; ++i, ++k){
546  std::cout<<i<<": ";
547  for(int c=Ustore->colptr[i]; c < Ustore->colptr[i+1]; ++c)
548  //if(Ustore->rowind[c]==i)
549  std::cout<<Ustore->rowind[c]<<"->"<<((double*)Ustore->nzval)[c]<<" ";
550  if(k==0){
551  //
552  k=-1;
553  }std::cout<<std::endl;
554  } */
555  options.Fact = FACTORED;
556  }
557 
558  template<typename T, typename A, int n, int m>
559  void SuperLU<BCRSMatrix<FieldMatrix<T,n,m>,A> >
561  {
562  if(mat.M()+mat.N()==0)
563  DUNE_THROW(ISTLError, "Matrix of SuperLU is null!");
564 
565  SuperMatrix* mB = &B;
566  SuperMatrix* mX = &X;
567  SuperMatrix rB, rX;
568  if (reusevector) {
569  if(first) {
570  SuperLUDenseMatChooser<T>::create(&B, (int)mat.N(), 1, reinterpret_cast<T*>(&b[0]), (int)mat.N(), SLU_DN, GetSuperLUType<T>::type, SLU_GE);
571  SuperLUDenseMatChooser<T>::create(&X, (int)mat.N(), 1, reinterpret_cast<T*>(&x[0]), (int)mat.N(), SLU_DN, GetSuperLUType<T>::type, SLU_GE);
572  first=false;
573  }else{
574  ((DNformat*) B.Store)->nzval=&b[0];
575  ((DNformat*)X.Store)->nzval=&x[0];
576  }
577  } else {
578  SuperLUDenseMatChooser<T>::create(&rB, (int)mat.N(), 1, reinterpret_cast<T*>(&b[0]), (int)mat.N(), SLU_DN, GetSuperLUType<T>::type, SLU_GE);
579  SuperLUDenseMatChooser<T>::create(&rX, (int)mat.N(), 1, reinterpret_cast<T*>(&x[0]), (int)mat.N(), SLU_DN, GetSuperLUType<T>::type, SLU_GE);
580  mB = &rB;
581  mX = &rX;
582  }
583  typename GetSuperLUType<T>::float_type rpg, rcond, ferr=1e10, berr;
584  int info;
585  mem_usage_t memusage;
586  SuperLUStat_t stat;
587  /* Initialize the statistics variables. */
588  StatInit(&stat);
589  /*
590  range_type d=b;
591  a->usmv(-1, x, d);
592 
593  double def0=d.two_norm();
594  */
595 #ifdef SUPERLU_MIN_VERSION_4_3
596  options.IterRefine=SLU_DOUBLE;
597 #else
598  options.IterRefine=DOUBLE;
599 #endif
600 
601  SuperLUSolveChooser<T>::solve(&options, &static_cast<SuperMatrix&>(mat), perm_c, perm_r, etree, &equed, R, C,
602  &L, &U, work, lwork, mB, mX, &rpg, &rcond, &ferr, &berr,
603  &memusage, &stat, &info);
604 
605  res.iterations=1;
606 
607  /*
608  if(options.Equil==YES)
609  // undo scaling of right hand side
610  std::transform(reinterpret_cast<T*>(&b[0]),reinterpret_cast<T*>(&b[0])+mat.M(),
611  C, reinterpret_cast<T*>(&d[0]), std::divides<T>());
612  else
613  d=b;
614  a->usmv(-1, x, d);
615  res.reduction=d.two_norm()/def0;
616  res.conv_rate = res.reduction;
617  res.converged=(res.reduction<1e-10||d.two_norm()<1e-18);
618  */
619  res.converged=true;
620 
621  if(verbose) {
622 
623  dinfo<<"Triangular solve: dgssvx() returns info "<< info<<std::endl;
624 
625  if ( info == 0 || info == n+1 ) {
626 
627  if ( options.IterRefine ) {
628  std::cout<<"Iterative Refinement: steps="
629  <<stat.RefineSteps<<" FERR="<<ferr<<" BERR="<<berr<<std::endl;
630  }else
631  std::cout<<" FERR="<<ferr<<" BERR="<<berr<<std::endl;
632  } else if ( info > 0 && lwork == -1 ) {
633  std::cout<<"** Estimated memory: "<< info - n<<" bytes"<<std::endl;
634  }
635 
636  if ( options.PrintStat ) StatPrint(&stat);
637  }
638  StatFree(&stat);
639  if (!reusevector) {
640  SUPERLU_FREE(rB.Store);
641  SUPERLU_FREE(rX.Store);
642  }
643  }
644 
645  template<typename T, typename A, int n, int m>
646  void SuperLU<BCRSMatrix<FieldMatrix<T,n,m>,A> >
647  ::apply(T* x, T* b)
648  {
649  if(mat.N()+mat.M()==0)
650  DUNE_THROW(ISTLError, "Matrix of SuperLU is null!");
651 
652  SuperMatrix* mB = &B;
653  SuperMatrix* mX = &X;
654  SuperMatrix rB, rX;
655  if (reusevector) {
656  if(first) {
657  SuperLUDenseMatChooser<T>::create(&B, mat.N(), 1, b, mat.N(), SLU_DN, GetSuperLUType<T>::type, SLU_GE);
658  SuperLUDenseMatChooser<T>::create(&X, mat.N(), 1, x, mat.N(), SLU_DN, GetSuperLUType<T>::type, SLU_GE);
659  first=false;
660  }else{
661  ((DNformat*) B.Store)->nzval=b;
662  ((DNformat*)X.Store)->nzval=x;
663  }
664  } else {
665  SuperLUDenseMatChooser<T>::create(&rB, mat.N(), 1, b, mat.N(), SLU_DN, GetSuperLUType<T>::type, SLU_GE);
666  SuperLUDenseMatChooser<T>::create(&rX, mat.N(), 1, x, mat.N(), SLU_DN, GetSuperLUType<T>::type, SLU_GE);
667  mB = &rB;
668  mX = &rX;
669  }
670 
671  typename GetSuperLUType<T>::float_type rpg, rcond, ferr=1e10, berr;
672  int info;
673  mem_usage_t memusage;
674  SuperLUStat_t stat;
675  /* Initialize the statistics variables. */
676  StatInit(&stat);
677 
678 #ifdef SUPERLU_MIN_VERSION_4_3
679  options.IterRefine=SLU_DOUBLE;
680 #else
681  options.IterRefine=DOUBLE;
682 #endif
683 
684  SuperLUSolveChooser<T>::solve(&options, &static_cast<SuperMatrix&>(mat), perm_c, perm_r, etree, &equed, R, C,
685  &L, &U, work, lwork, mB, mX, &rpg, &rcond, &ferr, &berr,
686  &memusage, &stat, &info);
687 
688  if(verbose) {
689  dinfo<<"Triangular solve: dgssvx() returns info "<< info<<std::endl;
690 
691  if ( info == 0 || info == n+1 ) {
692 
693  if ( options.IterRefine ) {
694  dinfo<<"Iterative Refinement: steps="
695  <<stat.RefineSteps<<" FERR="<<ferr<<" BERR="<<berr<<std::endl;
696  }else
697  dinfo<<" FERR="<<ferr<<" BERR="<<berr<<std::endl;
698  } else if ( info > 0 && lwork == -1 ) {
699  dinfo<<"** Estimated memory: "<< info - n<<" bytes"<<std::endl;
700  }
701  if ( options.PrintStat ) StatPrint(&stat);
702  }
703 
704  StatFree(&stat);
705  if (!reusevector) {
706  SUPERLU_FREE(rB.Store);
707  SUPERLU_FREE(rX.Store);
708  }
709  }
712  template<typename T, typename A, int n, int m>
713  struct IsDirectSolver<SuperLU<BCRSMatrix<FieldMatrix<T,n,m>,A> > >
714  {
715  enum { value=true};
716  };
717 
718  template<typename T, typename A, int n, int m>
719  struct StoresColumnCompressed<SuperLU<BCRSMatrix<FieldMatrix<T,n,m>,A> > >
720  {
721  enum { value = true };
722  };
723 }
724 
725 #endif // HAVE_SUPERLU
726 #endif // DUNE_SUPERLU_HH
Implementation of the BCRSMatrix class.
This file implements a vector space as a tensor product of a given vector space. The number of compon...
A sparse block matrix with compressed row storage.
Definition: bcrsmatrix.hh:414
A vector of blocks with memory management.
Definition: bvector.hh:254
A dense n x m matrix.
Definition: fmatrix.hh:67
vector space out of a tensor product of fields.
Definition: fvector.hh:92
derive error class from the base class in common
Definition: istlexception.hh:16
Abstract base class for all solvers.
Definition: solver.hh:79
A generic dynamic dense matrix.
Definition: matrix.hh:25
size_type M() const
Return the number of columns.
Definition: matrix.hh:165
size_type N() const
Return the number of rows.
Definition: matrix.hh:160
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
Dune::SuperLUMatrix< Matrix > SuperLUMatrix
The corresponding SuperLU Matrix type.
Definition: superlu.hh:292
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
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
Implements a matrix constructed from a given type representing a field and compile-time given number ...
Implements a vector constructed from a given type representing a field and a compile-time given size.
#define DUNE_THROW(E, m)
Definition: exceptions.hh:244
DInfoType dinfo(std::cout)
Stream for informative output.
Definition: stdstreams.hh:139
Dune namespace.
Definition: alignment.hh:14
Implementations of the inverse operator interface.
Templates characterizing the type of a solver.
Standard Dune debug streams.
Statistics about the application of an inverse operator.
Definition: solver.hh:32
int iterations
Number of iterations.
Definition: solver.hh:50
bool converged
True if convergence criterion has been met.
Definition: solver.hh:56
#define DUNE_UNUSED_PARAMETER(parm)
A macro to mark intentional unused function parameters with.
Definition: unused.hh:18
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.80.0 (May 16, 22:29, 2024)