dune-istl 2.9.0
Loading...
Searching...
No Matches
umfpack.hh
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
3// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
4// vi: set et ts=4 sw=2 sts=2:
5#ifndef DUNE_ISTL_UMFPACK_HH
6#define DUNE_ISTL_UMFPACK_HH
7
8#if HAVE_SUITESPARSE_UMFPACK || defined DOXYGEN
9
10#include<complex>
11#include<type_traits>
12
13#include<umfpack.h>
14
15#include<dune/common/exceptions.hh>
16#include<dune/common/fmatrix.hh>
17#include<dune/common/fvector.hh>
23
24
25
26namespace Dune {
38 // FORWARD DECLARATIONS
39 template<class M, class T, class TM, class TD, class TA>
40 class SeqOverlappingSchwarz;
41
42 template<class T, bool tag>
43 struct SeqOverlappingSchwarzAssemblerHelper;
44
45 // wrapper class for C-Function Calls in the backend. Choose the right function namespace
46 // depending on the template parameter used.
47template<typename SCalar, typename Integer>
49 {
50 static constexpr bool valid = false ;
51 };
52
53 template<>
54 struct UMFPackMethodChooser<double, std::true_type>
55 {
56 static constexpr bool valid = true ;
57
58 template<typename... A>
59 static void defaults(A... args)
60 {
61 umfpack_dl_defaults(args...);
62 }
63 template<typename... A>
64 static void free_numeric(A... args)
65 {
66 umfpack_dl_free_numeric(args...);
67 }
68 template<typename... A>
69 static void free_symbolic(A... args)
70 {
71 umfpack_dl_free_symbolic(args...);
72 }
73 template<typename... A>
74 static int load_numeric(A... args)
75 {
76 return umfpack_dl_load_numeric(args...);
77 }
78 template<typename... A>
79 static void numeric(A... args)
80 {
81 umfpack_dl_numeric(args...);
82 }
83 template<typename... A>
84 static void report_info(A... args)
85 {
86 umfpack_dl_report_info(args...);
87 }
88 template<typename... A>
89 static void report_status(A... args)
90 {
91 umfpack_dl_report_status(args...);
92 }
93 template<typename... A>
94 static int save_numeric(A... args)
95 {
96 return umfpack_dl_save_numeric(args...);
97 }
98 template<typename... A>
99 static void solve(A... args)
100 {
101 umfpack_dl_solve(args...);
102 }
103 template<typename... A>
104 static void symbolic(A... args)
105 {
106 umfpack_dl_symbolic(args...);
107 }
108 };
109
110 template<>
111 struct UMFPackMethodChooser<double, std::false_type>
112 {
113 static constexpr bool valid = true ;
114
115 template<typename... A>
116 static void defaults(A... args)
117 {
118 umfpack_di_defaults(args...);
119 }
120 template<typename... A>
121 static void free_numeric(A... args)
122 {
123 umfpack_di_free_numeric(args...);
124 }
125 template<typename... A>
126 static void free_symbolic(A... args)
127 {
128 umfpack_di_free_symbolic(args...);
129 }
130 template<typename... A>
131 static int load_numeric(A... args)
132 {
133 return umfpack_di_load_numeric(args...);
134 }
135 template<typename... A>
136 static void numeric(A... args)
137 {
138 umfpack_di_numeric(args...);
139 }
140 template<typename... A>
141 static void report_info(A... args)
142 {
143 umfpack_di_report_info(args...);
144 }
145 template<typename... A>
146 static void report_status(A... args)
147 {
148 umfpack_di_report_status(args...);
149 }
150 template<typename... A>
151 static int save_numeric(A... args)
152 {
153 return umfpack_di_save_numeric(args...);
154 }
155 template<typename... A>
156 static void solve(A... args)
157 {
158 umfpack_di_solve(args...);
159 }
160 template<typename... A>
161 static void symbolic(A... args)
162 {
163 umfpack_di_symbolic(args...);
164 }
165 };
166
167 template<>
168 struct UMFPackMethodChooser<std::complex<double>, std::true_type>
169 {
170 static constexpr bool valid = true ;
171
172 using umf_int_type = int64_t;
173
174 template<typename... A>
175 static void defaults(A... args)
176 {
177 umfpack_zl_defaults(args...);
178 }
179 template<typename... A>
180 static void free_numeric(A... args)
181 {
182 umfpack_zl_free_numeric(args...);
183 }
184 template<typename... A>
185 static void free_symbolic(A... args)
186 {
187 umfpack_zl_free_symbolic(args...);
188 }
189 template<typename... A>
190 static int load_numeric(A... args)
191 {
192 return umfpack_zl_load_numeric(args...);
193 }
194 template<typename... A>
195 static void numeric(const umf_int_type* cs, const umf_int_type* ri, const double* val, A... args)
196 {
197 umfpack_zl_numeric(cs,ri,val,NULL,args...);
198 }
199 template<typename... A>
200 static void report_info(A... args)
201 {
202 umfpack_zl_report_info(args...);
203 }
204 template<typename... A>
205 static void report_status(A... args)
206 {
207 umfpack_zl_report_status(args...);
208 }
209 template<typename... A>
210 static int save_numeric(A... args)
211 {
212 return umfpack_zl_save_numeric(args...);
213 }
214 template<typename... A>
215 static void solve(umf_int_type m, const umf_int_type* cs, const umf_int_type* ri, std::complex<double>* val, double* x, const double* b,A... args)
216 {
217 const double* cval = reinterpret_cast<const double*>(val);
218 umfpack_zl_solve(m,cs,ri,cval,NULL,x,NULL,b,NULL,args...);
219 }
220 template<typename... A>
221 static void symbolic(umf_int_type m, umf_int_type n, const umf_int_type* cs, const umf_int_type* ri, const double* val, A... args)
222 {
223 umfpack_zl_symbolic(m,n,cs,ri,val,NULL,args...);
224 }
225 };
226
227
228 template<>
229 struct UMFPackMethodChooser<std::complex<double>, std::false_type>
230 {
231 static constexpr bool valid = true ;
232
233 using umf_int_type = int32_t;
234
235 template<typename... A>
236 static void defaults(A... args)
237 {
238 umfpack_zi_defaults(args...);
239 }
240 template<typename... A>
241 static void free_numeric(A... args)
242 {
243 umfpack_zi_free_numeric(args...);
244 }
245 template<typename... A>
246 static void free_symbolic(A... args)
247 {
248 umfpack_zi_free_symbolic(args...);
249 }
250 template<typename... A>
251 static int load_numeric(A... args)
252 {
253 return umfpack_zi_load_numeric(args...);
254 }
255 template<typename... A>
256 static void numeric(const umf_int_type* cs, const umf_int_type* ri, const double* val, A... args)
257 {
258 umfpack_zi_numeric(cs,ri,val,NULL,args...);
259 }
260 template<typename... A>
261 static void report_info(A... args)
262 {
263 umfpack_zi_report_info(args...);
264 }
265 template<typename... A>
266 static void report_status(A... args)
267 {
268 umfpack_zi_report_status(args...);
269 }
270 template<typename... A>
271 static int save_numeric(A... args)
272 {
273 return umfpack_zi_save_numeric(args...);
274 }
275 template<typename... A>
276 static void solve(umf_int_type m, const umf_int_type* cs, const umf_int_type* ri, std::complex<double>* val, double* x, const double* b,A... args)
277 {
278 const double* cval = reinterpret_cast<const double*>(val);
279 umfpack_zi_solve(m,cs,ri,cval,NULL,x,NULL,b,NULL,args...);
280 }
281 template<typename... A>
282 static void symbolic(umf_int_type m, std::size_t n, const umf_int_type* cs, const umf_int_type* ri, const double* val, A... args)
283 {
284 umfpack_zi_symbolic(m,n,cs,ri,val,NULL,args...);
285 }
286 };
287
288 namespace Impl
289 {
290 template<class M>
291 struct UMFPackVectorChooser
292 {};
293
294 template<typename T, typename A, int n, int m>
295 struct UMFPackVectorChooser<BCRSMatrix<FieldMatrix<T,n,m>,A > >
296 {
298 using domain_type = BlockVector<
299 FieldVector<T,m>,
300 typename std::allocator_traits<A>::template rebind_alloc<FieldVector<T,m> > >;
302 using range_type = BlockVector<
303 FieldVector<T,n>,
304 typename std::allocator_traits<A>::template rebind_alloc<FieldVector<T,n> > >;
305 };
306
307 template<typename T, typename A>
308 struct UMFPackVectorChooser<BCRSMatrix<T,A> >
309 {
311 using domain_type = BlockVector<T, A>;
313 using range_type = BlockVector<T, A>;
314 };
315 }
316
330 template<typename M>
332 : public InverseOperator<
333 typename Impl::UMFPackVectorChooser<M>::domain_type,
334 typename Impl::UMFPackVectorChooser<M>::range_type >
335 {
336 using T = typename M::field_type;
337
338 public:
340 using Matrix = M;
341 using matrix_type = M;
342 using umf_int_type = std::conditional_t<(sizeof(typename M::size_type) == 8), int64_t, int32_t>;
344 typedef ISTL::Impl::BCCSMatrix<typename Matrix::field_type, umf_int_type> UMFPackMatrix;
346 typedef ISTL::Impl::BCCSMatrixInitializer<M, umf_int_type> MatrixInitializer;
348 using domain_type = typename Impl::UMFPackVectorChooser<M>::domain_type;
350 using range_type = typename Impl::UMFPackVectorChooser<M>::range_type;
351
357
366 UMFPack(const Matrix& matrix, int verbose=0) : matrixIsLoaded_(false)
367 {
368 //check whether T is a supported type
369 static_assert((std::is_same<T,double>::value) || (std::is_same<T,std::complex<double> >::value),
370 "Unsupported Type in UMFPack (only double and std::complex<double> supported)");
371 Caller::defaults(UMF_Control);
372 setVerbosity(verbose);
373 setMatrix(matrix);
374 }
375
384 UMFPack(const Matrix& matrix, int verbose, bool) : matrixIsLoaded_(false)
385 {
386 //check whether T is a supported type
387 static_assert((std::is_same<T,double>::value) || (std::is_same<T,std::complex<double> >::value),
388 "Unsupported Type in UMFPack (only double and std::complex<double> supported)");
389 Caller::defaults(UMF_Control);
390 setVerbosity(verbose);
391 setMatrix(matrix);
392 }
393
403 UMFPack(const Matrix& mat_, const ParameterTree& config)
404 : UMFPack(mat_, config.get<int>("verbose", 0))
405 {}
406
409 UMFPack() : matrixIsLoaded_(false), verbosity_(0)
410 {
411 //check whether T is a supported type
412 static_assert((std::is_same<T,double>::value) || (std::is_same<T,std::complex<double> >::value),
413 "Unsupported Type in UMFPack (only double and std::complex<double> supported)");
414 Caller::defaults(UMF_Control);
415 }
416
427 UMFPack(const Matrix& mat_, const char* file, int verbose=0)
428 {
429 //check whether T is a supported type
430 static_assert((std::is_same<T,double>::value) || (std::is_same<T,std::complex<double> >::value),
431 "Unsupported Type in UMFPack (only double and std::complex<double> supported)");
432 Caller::defaults(UMF_Control);
433 setVerbosity(verbose);
434 int errcode = Caller::load_numeric(&UMF_Numeric, const_cast<char*>(file));
435 if ((errcode == UMFPACK_ERROR_out_of_memory) || (errcode == UMFPACK_ERROR_file_IO))
436 {
437 matrixIsLoaded_ = false;
438 setMatrix(mat_);
439 saveDecomposition(file);
440 }
441 else
442 {
443 matrixIsLoaded_ = true;
444 std::cout << "UMFPack decomposition successfully loaded from " << file << std::endl;
445 }
446 }
447
454 UMFPack(const char* file, int verbose=0)
455 {
456 //check whether T is a supported type
457 static_assert((std::is_same<T,double>::value) || (std::is_same<T,std::complex<double> >::value),
458 "Unsupported Type in UMFPack (only double and std::complex<double> supported)");
459 Caller::defaults(UMF_Control);
460 int errcode = Caller::load_numeric(&UMF_Numeric, const_cast<char*>(file));
461 if (errcode == UMFPACK_ERROR_out_of_memory)
462 DUNE_THROW(Dune::Exception, "ran out of memory while loading UMFPack decomposition");
463 if (errcode == UMFPACK_ERROR_file_IO)
464 DUNE_THROW(Dune::Exception, "IO error while loading UMFPack decomposition");
465 matrixIsLoaded_ = true;
466 std::cout << "UMFPack decomposition successfully loaded from " << file << std::endl;
467 setVerbosity(verbose);
468 }
469
470 virtual ~UMFPack()
471 {
472 if ((umfpackMatrix_.N() + umfpackMatrix_.M() > 0) || matrixIsLoaded_)
473 free();
474 }
475
480 {
481 if (umfpackMatrix_.N() != b.dim())
482 DUNE_THROW(Dune::ISTLError, "Size of right-hand-side vector b does not match the number of matrix rows!");
483 if (umfpackMatrix_.M() != x.dim())
484 DUNE_THROW(Dune::ISTLError, "Size of solution vector x does not match the number of matrix columns!");
485 if (b.size() == 0)
486 return;
487
488 double UMF_Apply_Info[UMFPACK_INFO];
489 Caller::solve(UMFPACK_A,
490 umfpackMatrix_.getColStart(),
491 umfpackMatrix_.getRowIndex(),
492 umfpackMatrix_.getValues(),
493 reinterpret_cast<double*>(&x[0]),
494 reinterpret_cast<double*>(&b[0]),
495 UMF_Numeric,
496 UMF_Control,
497 UMF_Apply_Info);
498
499 //this is a direct solver
500 res.iterations = 1;
501 res.converged = true;
502 res.elapsed = UMF_Apply_Info[UMFPACK_SOLVE_WALLTIME];
503
504 printOnApply(UMF_Apply_Info);
505 }
506
510 virtual void apply (domain_type& x, range_type& b, [[maybe_unused]] double reduction, InverseOperatorResult& res)
511 {
512 apply(x,b,res);
513 }
514
520 void apply(T* x, T* b)
521 {
522 double UMF_Apply_Info[UMFPACK_INFO];
523 Caller::solve(UMFPACK_A,
524 umfpackMatrix_.getColStart(),
525 umfpackMatrix_.getRowIndex(),
526 umfpackMatrix_.getValues(),
527 x,
528 b,
529 UMF_Numeric,
530 UMF_Control,
531 UMF_Apply_Info);
532 printOnApply(UMF_Apply_Info);
533 }
534
546 void setOption(unsigned int option, double value)
547 {
548 if (option >= UMFPACK_CONTROL)
549 DUNE_THROW(RangeError, "Requested non-existing UMFPack option");
550
551 UMF_Control[option] = value;
552 }
553
557 void saveDecomposition(const char* file)
558 {
559 int errcode = Caller::save_numeric(UMF_Numeric, const_cast<char*>(file));
560 if (errcode != UMFPACK_OK)
561 DUNE_THROW(Dune::Exception,"IO ERROR while trying to save UMFPack decomposition");
562 }
563
565 void setMatrix(const Matrix& matrix)
566 {
567 if ((umfpackMatrix_.N() + umfpackMatrix_.M() > 0) || matrixIsLoaded_)
568 free();
569 if (matrix.N() == 0 or matrix.M() == 0)
570 return;
571
572 if (umfpackMatrix_.N() + umfpackMatrix_.M() + umfpackMatrix_.nonzeroes() != 0)
573 umfpackMatrix_.free();
574 umfpackMatrix_.setSize(MatrixDimension<Matrix>::rowdim(matrix),
576 ISTL::Impl::BCCSMatrixInitializer<Matrix, umf_int_type> initializer(umfpackMatrix_);
577
578 copyToBCCSMatrix(initializer, matrix);
579
580 decompose();
581 }
582
583 template<class S>
584 void setSubMatrix(const Matrix& _mat, const S& rowIndexSet)
585 {
586 if ((umfpackMatrix_.N() + umfpackMatrix_.M() > 0) || matrixIsLoaded_)
587 free();
588
589 if (umfpackMatrix_.N() + umfpackMatrix_.M() + umfpackMatrix_.nonzeroes() != 0)
590 umfpackMatrix_.free();
591
592 umfpackMatrix_.setSize(rowIndexSet.size()*MatrixDimension<Matrix>::rowdim(_mat) / _mat.N(),
593 rowIndexSet.size()*MatrixDimension<Matrix>::coldim(_mat) / _mat.M());
594 ISTL::Impl::BCCSMatrixInitializer<Matrix, umf_int_type> initializer(umfpackMatrix_);
595
596 copyToBCCSMatrix(initializer, ISTL::Impl::MatrixRowSubset<Matrix,std::set<std::size_t> >(_mat,rowIndexSet));
597
598 decompose();
599 }
600
608 void setVerbosity(int v)
609 {
610 verbosity_ = v;
611 // set the verbosity level in UMFPack
612 if (verbosity_ == 0)
613 UMF_Control[UMFPACK_PRL] = 1;
614 if (verbosity_ == 1)
615 UMF_Control[UMFPACK_PRL] = 2;
616 if (verbosity_ == 2)
617 UMF_Control[UMFPACK_PRL] = 4;
618 }
619
625 {
626 return UMF_Numeric;
627 }
628
634 {
635 return umfpackMatrix_;
636 }
637
642 void free()
643 {
644 if (!matrixIsLoaded_)
645 {
646 Caller::free_symbolic(&UMF_Symbolic);
647 umfpackMatrix_.free();
648 }
649 Caller::free_numeric(&UMF_Numeric);
650 matrixIsLoaded_ = false;
651 }
652
653 const char* name() { return "UMFPACK"; }
654
655 private:
656 typedef typename Dune::UMFPackMethodChooser<T,std::integral_constant<bool, (sizeof(typename M::size_type) == 8)>> Caller;
657
658 template<class Mat,class X, class TM, class TD, class T1>
661
663 void decompose()
664 {
665 double UMF_Decomposition_Info[UMFPACK_INFO];
666 Caller::symbolic(static_cast<umf_int_type>(umfpackMatrix_.N()),
667 static_cast<umf_int_type>(umfpackMatrix_.N()),
668 umfpackMatrix_.getColStart(),
669 umfpackMatrix_.getRowIndex(),
670 reinterpret_cast<double*>(umfpackMatrix_.getValues()),
671 &UMF_Symbolic,
672 UMF_Control,
673 UMF_Decomposition_Info);
674 Caller::numeric(umfpackMatrix_.getColStart(),
675 umfpackMatrix_.getRowIndex(),
676 reinterpret_cast<double*>(umfpackMatrix_.getValues()),
677 UMF_Symbolic,
678 &UMF_Numeric,
679 UMF_Control,
680 UMF_Decomposition_Info);
681 Caller::report_status(UMF_Control,UMF_Decomposition_Info[UMFPACK_STATUS]);
682 if (verbosity_ == 1)
683 {
684 std::cout << "[UMFPack Decomposition]" << std::endl;
685 std::cout << "Wallclock Time taken: " << UMF_Decomposition_Info[UMFPACK_NUMERIC_WALLTIME] << " (CPU Time: " << UMF_Decomposition_Info[UMFPACK_NUMERIC_TIME] << ")" << std::endl;
686 std::cout << "Flops taken: " << UMF_Decomposition_Info[UMFPACK_FLOPS] << std::endl;
687 std::cout << "Peak Memory Usage: " << UMF_Decomposition_Info[UMFPACK_PEAK_MEMORY]*UMF_Decomposition_Info[UMFPACK_SIZE_OF_UNIT] << " bytes" << std::endl;
688 std::cout << "Condition number estimate: " << 1./UMF_Decomposition_Info[UMFPACK_RCOND] << std::endl;
689 std::cout << "Numbers of non-zeroes in decomposition: L: " << UMF_Decomposition_Info[UMFPACK_LNZ] << " U: " << UMF_Decomposition_Info[UMFPACK_UNZ] << std::endl;
690 }
691 if (verbosity_ == 2)
692 {
693 Caller::report_info(UMF_Control,UMF_Decomposition_Info);
694 }
695 }
696
697 void printOnApply(double* UMF_Info)
698 {
699 Caller::report_status(UMF_Control,UMF_Info[UMFPACK_STATUS]);
700 if (verbosity_ > 0)
701 {
702 std::cout << "[UMFPack Solve]" << std::endl;
703 std::cout << "Wallclock Time: " << UMF_Info[UMFPACK_SOLVE_WALLTIME] << " (CPU Time: " << UMF_Info[UMFPACK_SOLVE_TIME] << ")" << std::endl;
704 std::cout << "Flops Taken: " << UMF_Info[UMFPACK_SOLVE_FLOPS] << std::endl;
705 std::cout << "Iterative Refinement steps taken: " << UMF_Info[UMFPACK_IR_TAKEN] << std::endl;
706 std::cout << "Error Estimate: " << UMF_Info[UMFPACK_OMEGA1] << " resp. " << UMF_Info[UMFPACK_OMEGA2] << std::endl;
707 }
708 }
709
710 UMFPackMatrix umfpackMatrix_;
711 bool matrixIsLoaded_;
712 int verbosity_;
713 void *UMF_Symbolic;
714 void *UMF_Numeric;
715 double UMF_Control[UMFPACK_CONTROL];
716 };
717
718 template<typename T, typename A, int n, int m>
720 {
721 enum { value=true};
722 };
723
724 template<typename T, typename A>
726 {
727 enum { value = true };
728 };
729
731 template<class F,class=void> struct isValidBlock : std::false_type{};
732 template<class B> struct isValidBlock<B, std::enable_if_t<std::is_same<typename FieldTraits<B>::real_type,double>::value>> : std::true_type {};
733
734 template<typename TL, typename M>
735 std::shared_ptr<Dune::InverseOperator<typename Dune::TypeListElement<1, TL>::type,
736 typename Dune::TypeListElement<2, TL>::type>>
737 operator() (TL /*tl*/, const M& mat, const Dune::ParameterTree& config,
738 std::enable_if_t<
739 isValidBlock<typename Dune::TypeListElement<1, TL>::type::block_type>::value,int> = 0) const
740 {
741 int verbose = config.get("verbose", 0);
742 return std::make_shared<Dune::UMFPack<M>>(mat,verbose);
743 }
744
745 // second version with SFINAE to validate the template parameters of UMFPack
746 template<typename TL, typename M>
747 std::shared_ptr<Dune::InverseOperator<typename Dune::TypeListElement<1, TL>::type,
748 typename Dune::TypeListElement<2, TL>::type>>
749 operator() (TL /*tl*/, const M& /*mat*/, const Dune::ParameterTree& /*config*/,
750 std::enable_if_t<
751 !isValidBlock<typename Dune::TypeListElement<1, TL>::type::block_type>::value,int> = 0) const
752 {
753 DUNE_THROW(UnsupportedType,
754 "Unsupported Type in UMFPack (only double and std::complex<double> supported)");
755 }
756 };
758} // end namespace Dune
759
760#endif // HAVE_SUITESPARSE_UMFPACK
761
762#endif //DUNE_ISTL_UMFPACK_HH
Templates characterizing the type of a solver.
Implementations of the inverse operator interface.
#define DUNE_REGISTER_DIRECT_SOLVER(name,...)
Definition solverregistry.hh:13
Implementation of the BCRSMatrix class.
static void numeric(const umf_int_type *cs, const umf_int_type *ri, const double *val, A... args)
Definition umfpack.hh:256
void free()
free allocated space.
Definition umfpack.hh:642
static void solve(umf_int_type m, const umf_int_type *cs, const umf_int_type *ri, std::complex< double > *val, double *x, const double *b, A... args)
Definition umfpack.hh:215
virtual void apply(domain_type &x, range_type &b, InverseOperatorResult &res)
Apply inverse operator,.
Definition umfpack.hh:479
ISTL::Impl::BCCSMatrixInitializer< M, umf_int_type > MatrixInitializer
Type of an associated initializer class.
Definition umfpack.hh:346
static void report_info(A... args)
Definition umfpack.hh:200
virtual SolverCategory::Category category() const
Category of the solver (see SolverCategory::Category)
Definition umfpack.hh:353
M matrix_type
Definition umfpack.hh:341
void setMatrix(const Matrix &matrix)
Initialize data from given matrix.
Definition umfpack.hh:565
static int save_numeric(A... args)
Definition umfpack.hh:210
static void numeric(A... args)
Definition umfpack.hh:79
UMFPack(const Matrix &mat_, const ParameterTree &config)
Construct a solver object from a matrix.
Definition umfpack.hh:403
static void symbolic(umf_int_type m, umf_int_type n, const umf_int_type *cs, const umf_int_type *ri, const double *val, A... args)
Definition umfpack.hh:221
std::shared_ptr< Dune::InverseOperator< typename Dune::TypeListElement< 1, TL >::type, typename Dune::TypeListElement< 2, TL >::type > > operator()(TL, const M &mat, const Dune::ParameterTree &config, std::enable_if_t< isValidBlock< typename Dune::TypeListElement< 1, TL >::type::block_type >::value, int >=0) const
Definition umfpack.hh:737
static void report_status(A... args)
Definition umfpack.hh:89
UMFPack(const Matrix &mat_, const char *file, int verbose=0)
Try loading a decomposition from file and do a decomposition if unsuccessful.
Definition umfpack.hh:427
static int load_numeric(A... args)
Definition umfpack.hh:131
static void free_numeric(A... args)
Definition umfpack.hh:64
static void defaults(A... args)
Definition umfpack.hh:175
typename Impl::UMFPackVectorChooser< M >::range_type range_type
The type of the range of the solver.
Definition umfpack.hh:350
static int save_numeric(A... args)
Definition umfpack.hh:271
static void report_info(A... args)
Definition umfpack.hh:84
static void solve(A... args)
Definition umfpack.hh:99
UMFPack()
default constructor
Definition umfpack.hh:409
static int load_numeric(A... args)
Definition umfpack.hh:251
static void symbolic(A... args)
Definition umfpack.hh:161
static void numeric(A... args)
Definition umfpack.hh:136
static void report_info(A... args)
Definition umfpack.hh:141
static void report_status(A... args)
Definition umfpack.hh:205
static void free_symbolic(A... args)
Definition umfpack.hh:69
static void free_symbolic(A... args)
Definition umfpack.hh:185
static void numeric(const umf_int_type *cs, const umf_int_type *ri, const double *val, A... args)
Definition umfpack.hh:195
void setSubMatrix(const Matrix &_mat, const S &rowIndexSet)
Definition umfpack.hh:584
static void solve(A... args)
Definition umfpack.hh:156
static void free_numeric(A... args)
Definition umfpack.hh:180
void apply(T *x, T *b)
additional apply method with c-arrays in analogy to superlu
Definition umfpack.hh:520
static constexpr bool valid
Definition umfpack.hh:50
void setVerbosity(int v)
sets the verbosity level for the UMFPack solver
Definition umfpack.hh:608
UMFPack(const char *file, int verbose=0)
try loading a decomposition from file
Definition umfpack.hh:454
static void defaults(A... args)
Definition umfpack.hh:236
static int save_numeric(A... args)
Definition umfpack.hh:151
static int load_numeric(A... args)
Definition umfpack.hh:74
static void symbolic(A... args)
Definition umfpack.hh:104
virtual ~UMFPack()
Definition umfpack.hh:470
const char * name()
Definition umfpack.hh:653
ISTL::Impl::BCCSMatrix< typename Matrix::field_type, umf_int_type > UMFPackMatrix
The corresponding UMFPack matrix type.
Definition umfpack.hh:344
static void free_symbolic(A... args)
Definition umfpack.hh:126
void saveDecomposition(const char *file)
saves a decomposition to a file
Definition umfpack.hh:557
UMFPackMatrix & getInternalMatrix()
Return the column compress matrix from UMFPack.
Definition umfpack.hh:633
static void free_numeric(A... args)
Definition umfpack.hh:121
static void free_numeric(A... args)
Definition umfpack.hh:241
static void solve(umf_int_type m, const umf_int_type *cs, const umf_int_type *ri, std::complex< double > *val, double *x, const double *b, A... args)
Definition umfpack.hh:276
static void report_status(A... args)
Definition umfpack.hh:146
typename Impl::UMFPackVectorChooser< M >::domain_type domain_type
The type of the domain of the solver.
Definition umfpack.hh:348
UMFPack(const Matrix &matrix, int verbose=0)
Construct a solver object from a matrix.
Definition umfpack.hh:366
static int save_numeric(A... args)
Definition umfpack.hh:94
static void report_info(A... args)
Definition umfpack.hh:261
virtual void apply(domain_type &x, range_type &b, double reduction, InverseOperatorResult &res)
apply inverse operator, with given convergence criteria.
Definition umfpack.hh:510
void setOption(unsigned int option, double value)
Set UMFPack-specific options.
Definition umfpack.hh:546
static void defaults(A... args)
Definition umfpack.hh:59
M Matrix
The matrix type.
Definition umfpack.hh:340
static void symbolic(umf_int_type m, std::size_t n, const umf_int_type *cs, const umf_int_type *ri, const double *val, A... args)
Definition umfpack.hh:282
static void free_symbolic(A... args)
Definition umfpack.hh:246
static void defaults(A... args)
Definition umfpack.hh:116
std::conditional_t<(sizeof(typename M::size_type)==8), int64_t, int32_t > umf_int_type
Definition umfpack.hh:342
static int load_numeric(A... args)
Definition umfpack.hh:190
UMFPack(const Matrix &matrix, int verbose, bool)
Constructor for compatibility with SuperLU standard constructor.
Definition umfpack.hh:384
void * getFactorization()
Return the matrix factorization.
Definition umfpack.hh:624
static void report_status(A... args)
Definition umfpack.hh:266
Matrix & mat
Definition matrixmatrix.hh:347
STL namespace.
Definition allocator.hh:11
PropertyMapTypeSelector< Amg::VertexVisitedTag, Amg::PropertiesGraph< G, Amg::VertexProperties, EP, VM, EM > >::Type get(const Amg::VertexVisitedTag &tag, Amg::PropertiesGraph< G, Amg::VertexProperties, EP, VM, EM > &graph)
Definition dependency.hh:293
Definition matrixutils.hh:211
A sparse block matrix with compressed row storage.
Definition bcrsmatrix.hh:466
derive error class from the base class in common
Definition istlexception.hh:19
Sequential overlapping Schwarz preconditioner.
Definition overlappingschwarz.hh:755
Definition overlappingschwarz.hh:694
Definition matrixutils.hh:27
Statistics about the application of an inverse operator.
Definition solver.hh:48
double elapsed
Elapsed time in seconds.
Definition solver.hh:82
int iterations
Number of iterations.
Definition solver.hh:67
bool converged
True if convergence criterion has been met.
Definition solver.hh:73
Abstract base class for all solvers.
Definition solver.hh:99
Category
Definition solvercategory.hh:23
@ sequential
Category for sequential solvers.
Definition solvercategory.hh:25
Definition solverregistry.hh:77
Definition solvertype.hh:16
@ value
Whether this is a direct solver.
Definition solvertype.hh:24
Definition solvertype.hh:30
@ value
whether the solver internally uses column compressed storage
Definition solvertype.hh:36
Definition umfpack.hh:49
The UMFPack direct sparse solver.
Definition umfpack.hh:335
Definition umfpack.hh:730
Definition umfpack.hh:731