FEAT 3
Finite Element Analysis Toolbox
Loading...
Searching...
No Matches
sor_precond.hpp
1// FEAT3: Finite Element Analysis Toolbox, Version 3
2// Copyright (C) 2010 by Stefan Turek & the FEAT group
3// FEAT3 is released under the GNU General Public License version 3,
4// see the file 'copyright.txt' in the top level directory for details.
5
6#pragma once
7
8// includes, FEAT
10#include <kernel/solver/base.hpp>
11
12namespace FEAT
13{
14 namespace Solver
15 {
16 namespace Intern
17 {
18 int cuda_sor_apply(int m, double* y, const double* x, const double* csrVal, const int* csrColInd, int ncolors, double omega,
19 int* colored_row_ptr, int* rows_per_color, int* inverse_row_ptr);
20 template<int BlockSize_>
21 int cuda_sor_bcsr_apply(int m, double* y, const double* x, const double* csrVal, const int* csrColInd, int ncolors, double omega,
22 int* colored_row_ptr, int* rows_per_color, int* inverse_row_ptr);
23 void cuda_sor_done_symbolic(int* colored_row_ptr, int* rows_per_color, int* inverse_row_ptr);
24 void cuda_sor_init_symbolic(int m, int nnz, const double* csrVal, const int* csrRowPtr, const int* csrColInd, int& ncolors,
25 int*& colored_row_ptr, int*& rows_per_color, int*& inverse_row_ptr);
26 }
27
42 template<typename Matrix_>
44 {
45 public:
46 typedef typename Matrix_::DataType DataType;
47 typedef typename Matrix_::VectorTypeL VectorType;
48
49 virtual void set_omega(DataType omega) = 0;
50
51 virtual void init_symbolic() = 0;
52
53 virtual void done_symbolic() = 0;
54
55 virtual String name() const = 0;
56
57 virtual Status apply(VectorType& vec_cor, const VectorType& vec_def) = 0;
58
59 virtual ~SORPrecondBase() {}
60 }; // class SORPrecondBase
61
62 template<PreferredBackend backend_, typename Matrix_, typename Filter_>
64
77 template<typename Filter_, typename DT_, typename IT_>
79 public SORPrecondBase<typename LAFEM::SparseMatrixCSR<DT_, IT_>>
80 {
81 public:
83 typedef DT_ DataType;
84 typedef IT_ IndexType;
85 typedef Filter_ FilterType;
86 typedef typename MatrixType::VectorTypeL VectorType;
87
88 protected:
89 const MatrixType& _matrix;
90 const FilterType& _filter;
91 DataType _omega;
92
93 public:
107 explicit SORPrecondWithBackend(const MatrixType& matrix, const FilterType& filter, const DataType omega = DataType(1)) :
108 _matrix(matrix),
109 _filter(filter),
110 _omega(omega)
111 {
112 if (_matrix.columns() != _matrix.rows())
113 {
114 XABORTM("Matrix is not square!");
115 }
116 }
117
134 explicit SORPrecondWithBackend(const String& section_name, const PropertyMap* section,
135 const MatrixType& matrix, const FilterType& filter) :
136 _matrix(matrix),
137 _filter(filter),
138 _omega(1)
139 {
140 if (_matrix.columns() != _matrix.rows())
141 {
142 XABORTM("Matrix is not square!");
143 }
144
145 auto omega_p = section->query("omega");
146 if (omega_p.second && !omega_p.first.parse(this->_omega))
147 throw ParseError(section_name + ".omega", omega_p.first, "a positive float");
148 }
149
151 virtual String name() const override
152 {
153 return "SOR";
154 }
155
163 virtual void set_omega(DataType omega) override
164 {
165 XASSERT(omega > DataType(0));
166 _omega = omega;
167 }
168
169 virtual void init_symbolic() override
170 {
171 }
172
173 virtual void done_symbolic() override
174 {
175 }
176
177 virtual Status apply(VectorType& vec_cor, const VectorType& vec_def) override
178 {
179 XASSERTM(_matrix.rows() == vec_cor.size(), "matrix / vector size mismatch!");
180 XASSERTM(_matrix.rows() == vec_def.size(), "matrix / vector size mismatch!");
181
182 TimeStamp ts_start;
183
184 // copy in-vector to out-vector
185 vec_cor.copy(vec_def);
186
187 _apply_intern(_matrix, vec_cor, vec_def);
188
189 this->_filter.filter_cor(vec_cor);
190
191 TimeStamp ts_stop;
192 Statistics::add_time_precon(ts_stop.elapsed(ts_start));
193 Statistics::add_flops(_matrix.used_elements() + 3 * vec_cor.size()); // 2 ops per matrix entry, but only on half of the matrix
194
195 return Status::success;
196 }
197
198 protected:
199 void _apply_intern(const LAFEM::SparseMatrixCSR<DataType, IndexType>& matrix, VectorType& vec_cor, const VectorType& vec_def)
200 {
201 // create pointers
202 DataType* pout(vec_cor.elements());
203 const DataType* pin(vec_def.elements());
204 const DataType* pval(matrix.val());
205 const IndexType* pcol_ind(matrix.col_ind());
206 const IndexType* prow_ptr(matrix.row_ptr());
207 const IndexType n((IndexType(matrix.rows())));
208
209 // __forward-insertion__
210 // iteration over all rows
211 for (IndexType i(0); i < n; ++i)
212 {
213 IndexType col;
214 DataType d(0);
215 // iteration over all elements on the left side of the main-diagonal
216 for (col = prow_ptr[i]; pcol_ind[col] < i; ++col)
217 {
218 d += pval[col] * pout[pcol_ind[col]];
219 }
220 pout[i] = _omega * (pin[i] - d) / pval[col];
221 }
222 }
223 }; // class SORPrecondWithBackend<generic, SparseMatrixCSR>
224
225 template<typename Filter_, typename DT_, typename IT_, int BlockHeight_, int BlockWidth_>
226 class SORPrecondWithBackend<PreferredBackend::generic, LAFEM::SparseMatrixBCSR<DT_, IT_, BlockHeight_, BlockWidth_>, Filter_> :
227 public SORPrecondBase<typename LAFEM::SparseMatrixBCSR<DT_, IT_, BlockHeight_, BlockWidth_>>
228 {
229 static_assert(BlockHeight_ == BlockWidth_, "only square blocks are supported!");
230 public:
232 typedef Filter_ FilterType;
233 typedef typename MatrixType::VectorTypeL VectorType;
234 typedef typename MatrixType::DataType DataType;
235 typedef typename MatrixType::IndexType IndexType;
236
237 protected:
238 const MatrixType& _matrix;
239 const FilterType& _filter;
240 DataType _omega;
241
242 void _apply_intern(const MatrixType& matrix, VectorType& vec_cor, const VectorType& vec_def)
243 {
244 // create pointers
245 auto* pout(vec_cor.elements());
246 const auto* pin(vec_def.elements());
247 const auto* pval(matrix.val());
248 const IndexType* pcol_ind(matrix.col_ind());
249 const IndexType* prow_ptr(matrix.row_ptr());
250 const IndexType n((IndexType(matrix.rows())));
251 typename MatrixType::ValueType inverse;
252
253 // __forward-insertion__
254 // iteration over all rows
255
256 for (IndexType i(0); i < n; ++i)
257 {
258 IndexType col;
259 typename VectorType::ValueType d(0);
260
261 // iteration over all elements on the left side of the main-diagonal
262 for (col = prow_ptr[i]; pcol_ind[col] < i; ++col)
263 {
264 d += pval[col] * pout[pcol_ind[col]];
265 }
266 inverse.set_inverse(pval[col]);
267 pout[i] = _omega * inverse * (pin[i] - d);
268 }
269 }
270
271 public:
285 explicit SORPrecondWithBackend(const MatrixType& matrix, const FilterType& filter, const DataType omega = DataType(1)) :
286 _matrix(matrix),
287 _filter(filter),
288 _omega(omega)
289 {
290 if (_matrix.columns() != _matrix.rows())
291 {
292 XABORTM("Matrix is not square!");
293 }
294 }
295
312 explicit SORPrecondWithBackend(const String& /*section_name*/, const PropertyMap* section,
313 const MatrixType& matrix, const FilterType& filter) :
314 _matrix(matrix),
315 _filter(filter),
316 _omega(1)
317 {
318 if (_matrix.columns() != _matrix.rows())
319 {
320 XABORTM("Matrix is not square!");
321 }
322
323 // Check if we have set _krylov_vim
324 auto omega_p = section->query("omega");
325 if (omega_p.second)
326 {
327 set_omega(DataType(std::stod(omega_p.first)));
328 }
329 }
330
332 virtual String name() const override
333 {
334 return "SOR";
335 }
336
344 virtual void set_omega(DataType omega) override
345 {
346 XASSERT(omega > DataType(0));
347 _omega = omega;
348 }
349
350 virtual void init_symbolic() override
351 {
352 }
353
354 virtual void done_symbolic() override
355 {
356 }
357
358 virtual Status apply(VectorType& vec_cor, const VectorType& vec_def)
359 {
360 XASSERTM(_matrix.rows() == vec_cor.size(), "matrix / vector size mismatch!");
361 XASSERTM(_matrix.rows() == vec_def.size(), "matrix / vector size mismatch!");
362
363 TimeStamp ts_start;
364
365 // copy in-vector to out-vector
366 vec_cor.copy(vec_def);
367
368 _apply_intern(_matrix, vec_cor, vec_def);
369
370 this->_filter.filter_cor(vec_cor);
371
372 TimeStamp ts_stop;
373 Statistics::add_time_precon(ts_stop.elapsed(ts_start));
374 Statistics::add_flops(_matrix.template used_elements<LAFEM::Perspective::pod>() + 3 * vec_cor.template size<LAFEM::Perspective::pod>()); // 2 ops per matrix entry, but only on half of the matrix
375
376 return Status::success;
377 }
378 }; // class SORPrecondWithBackend<generic, SparseMatrixBCSR>
379
380#ifdef FEAT_HAVE_CUDA
397 template<typename Filter_>
398 class SORPrecondWithBackend<PreferredBackend::cuda, LAFEM::SparseMatrixCSR<double, unsigned int>, Filter_> :
399 public SORPrecondBase<LAFEM::SparseMatrixCSR<double, unsigned int>>
400 {
401 public:
402 typedef LAFEM::SparseMatrixCSR<double, unsigned int> MatrixType;
403 typedef Filter_ FilterType;
404 typedef typename MatrixType::VectorTypeL VectorType;
405 typedef typename MatrixType::DataType DataType;
406
407 protected:
408 const MatrixType& _matrix;
409 const FilterType& _filter;
410 DataType _omega;
411 // row ptr permutation, sorted by color(each color sorted by amount of rows), start/end index per row
412 int* _colored_row_ptr;
413 // amount of rows per color (sorted by amount of rows)
414 int* _rows_per_color;
415 // mapping of idx to native row number
416 int* _inverse_row_ptr;
417 // number of colors
418 int _ncolors;
419
420 public:
434 explicit SORPrecondWithBackend(const MatrixType& matrix, const FilterType& filter, const DataType omega = DataType(1)) :
435 _matrix(matrix),
436 _filter(filter),
437 _omega(omega),
438 _colored_row_ptr(nullptr),
439 _rows_per_color(nullptr),
440 _inverse_row_ptr(nullptr),
441 _ncolors(0)
442 {
443 if (_matrix.columns() != _matrix.rows())
444 {
445 XABORTM("Matrix is not square!");
446 }
447 }
448
465 explicit SORPrecondWithBackend(const String& /*section_name*/, const PropertyMap* section,
466 const MatrixType& matrix, const FilterType& filter) :
467 _matrix(matrix),
468 _filter(filter),
469 _omega(1),
470 _colored_row_ptr(nullptr),
471 _rows_per_color(nullptr),
472 _inverse_row_ptr(nullptr),
473 _ncolors(0)
474 {
475 if (_matrix.columns() != _matrix.rows())
476 {
477 XABORTM("Matrix is not square!");
478 }
479
480 // Check if we have set _krylov_vim
481 auto omega_p = section->query("omega");
482 if (omega_p.second)
483 {
484 set_omega(DataType(std::stod(omega_p.first)));
485 }
486 }
487
489 virtual String name() const override
490 {
491 return "SOR";
492 }
493
501 virtual void set_omega(DataType omega) override
502 {
503 XASSERT(omega > DataType(0));
504 _omega = omega;
505 }
506
507 virtual void init_symbolic() override
508 {
509 Intern::cuda_sor_init_symbolic((int)_matrix.rows(), (int)_matrix.used_elements(), _matrix.val(), (const int*)_matrix.row_ptr(), (const int*)_matrix.col_ind(), _ncolors,
510 _colored_row_ptr, _rows_per_color, _inverse_row_ptr);
511 }
512
513 virtual void done_symbolic() override
514 {
515 Intern::cuda_sor_done_symbolic(_colored_row_ptr, _rows_per_color, _inverse_row_ptr);
516 }
517
518 virtual Status apply(VectorType& vec_cor, const VectorType& vec_def) override
519 {
520 XASSERTM(_matrix.rows() == vec_cor.size(), "matrix / vector size mismatch!");
521 XASSERTM(_matrix.rows() == vec_def.size(), "matrix / vector size mismatch!");
522
523 TimeStamp ts_start;
524
525 int status = Intern::cuda_sor_apply((int)vec_cor.size(), vec_cor.elements(), vec_def.elements(), (const double*)_matrix.val(), (const int*)_matrix.col_ind(), _ncolors, _omega, _colored_row_ptr, _rows_per_color, _inverse_row_ptr);
526
527 this->_filter.filter_cor(vec_cor);
528
529 TimeStamp ts_stop;
530 Statistics::add_time_precon(ts_stop.elapsed(ts_start));
531 Statistics::add_flops(_matrix.used_elements() + 3 * vec_cor.size()); // 2 ops per matrix entry, but only on half of the matrix
532
533 return (status == 0) ? Status::success : Status::aborted;
534 }
535 }; // class SORPrecondWithBackend<cuda, SparseMatrixCSR>
536
537 template<typename Filter_, int BlockHeight_, int BlockWidth_>
538 class SORPrecondWithBackend<PreferredBackend::cuda, LAFEM::SparseMatrixBCSR<double, unsigned int, BlockHeight_, BlockWidth_>, Filter_> :
539 public SORPrecondBase<typename LAFEM::SparseMatrixBCSR<double, unsigned int, BlockHeight_, BlockWidth_>>
540 {
541 static_assert(BlockHeight_ == BlockWidth_, "only square blocks are supported!");
542 public:
543 typedef LAFEM::SparseMatrixBCSR<double, unsigned int, BlockHeight_, BlockWidth_> MatrixType;
544 typedef Filter_ FilterType;
545 typedef typename MatrixType::VectorTypeL VectorType;
546 typedef typename MatrixType::DataType DataType;
547 typedef typename MatrixType::IndexType IndexType;
548
549 protected:
550 const MatrixType& _matrix;
551 const FilterType& _filter;
552 DataType _omega;
553 // row ptr permutation, sorted by color(each color sorted by amount of rows), start/end index per row
554 int* _colored_row_ptr;
555 // amount of rows per color (sorted by amount of rows)
556 int* _rows_per_color;
557 // mapping of idx to native row number
558 int* _inverse_row_ptr;
559 // number of colors
560 int _ncolors;
561
562 public:
576 explicit SORPrecondWithBackend(const MatrixType& matrix, const FilterType& filter, const DataType omega = DataType(1)) :
577 _matrix(matrix),
578 _filter(filter),
579 _omega(omega),
580 _colored_row_ptr(nullptr),
581 _rows_per_color(nullptr),
582 _inverse_row_ptr(nullptr),
583 _ncolors(0)
584 {
585 if (_matrix.columns() != _matrix.rows())
586 {
587 XABORTM("Matrix is not square!");
588 }
589 }
590
607 explicit SORPrecondWithBackend(const String& /*section_name*/, const PropertyMap* section,
608 const MatrixType& matrix, const FilterType& filter) :
609 _matrix(matrix),
610 _filter(filter),
611 _omega(1),
612 _colored_row_ptr(nullptr),
613 _rows_per_color(nullptr),
614 _inverse_row_ptr(nullptr),
615 _ncolors(0)
616 {
617 if (_matrix.columns() != _matrix.rows())
618 {
619 XABORTM("Matrix is not square!");
620 }
621
622 // Check if we have set _krylov_vim
623 auto omega_p = section->query("omega");
624 if (omega_p.second)
625 {
626 set_omega(DataType(std::stod(omega_p.first)));
627 }
628 }
629
631 virtual String name() const override
632 {
633 return "SOR";
634 }
635
643 virtual void set_omega(DataType omega) override
644 {
645 XASSERT(omega > DataType(0));
646 _omega = omega;
647 }
648
649 virtual void init_symbolic() override
650 {
651 Intern::cuda_sor_init_symbolic((int)_matrix.rows(), (int)_matrix.used_elements(), _matrix.template val<LAFEM::Perspective::pod>(), (const int*)_matrix.row_ptr(), (const int*)_matrix.col_ind(), _ncolors,
652 _colored_row_ptr, _rows_per_color, _inverse_row_ptr);
653 }
654
655 virtual void done_symbolic() override
656 {
657 Intern::cuda_sor_done_symbolic(_colored_row_ptr, _rows_per_color, _inverse_row_ptr);
658 }
659
660 virtual Status apply(VectorType& vec_cor, const VectorType& vec_def) override
661 {
662 XASSERTM(_matrix.rows() == vec_cor.size(), "matrix / vector size mismatch!");
663 XASSERTM(_matrix.rows() == vec_def.size(), "matrix / vector size mismatch!");
664
665 TimeStamp ts_start;
666
667 int status = Intern::cuda_sor_bcsr_apply<BlockHeight_>((int)vec_cor.size(), vec_cor.template elements<LAFEM::Perspective::pod>(), vec_def.template elements<LAFEM::Perspective::pod>(),
668 _matrix.template val<LAFEM::Perspective::pod>(), (const int*)_matrix.col_ind(), _ncolors, _omega, _colored_row_ptr, _rows_per_color, _inverse_row_ptr);
669
670 this->_filter.filter_cor(vec_cor);
671
672 TimeStamp ts_stop;
673 Statistics::add_time_precon(ts_stop.elapsed(ts_start));
674 Statistics::add_flops(_matrix.template used_elements<LAFEM::Perspective::pod>() + 3 * vec_cor.template size<LAFEM::Perspective::pod>()); // 2 ops per matrix entry, but only on half of the matrix
675
676 return (status == 0) ? Status::success : Status::aborted;
677 }
678 }; // class SORPrecondWithBackend<cuda, SparseMatrixBCSR>
679#endif //FEAT_HAVE_CUDA
680
682 template<PreferredBackend backend_, typename Matrix_, typename Filter_>
684 public SORPrecondBase<Matrix_>
685 {
686 public:
687 template<typename DT_>
688 explicit SORPrecondWithBackend(const Matrix_&, const Filter_&, const DT_)
689 {
690 }
691
692 explicit SORPrecondWithBackend(const Matrix_&, const Filter_&)
693 {
694 }
695
696 explicit SORPrecondWithBackend(const String&, const PropertyMap*, const Matrix_&, const Filter_&)
697 {
698 }
699
700 virtual Status apply(typename Matrix_::VectorTypeL&, const typename Matrix_::VectorTypeL&) override
701 {
702 XABORTM("not implemented yet!");
703 }
704
705 virtual String name() const override
706 {
707 XABORTM("not implemented yet!");
708 }
709
710 virtual void init_symbolic() override
711 {
712 XABORTM("not implemented yet!");
713 }
714
715 virtual void done_symbolic() override
716 {
717 XABORTM("not implemented yet!");
718 }
719
720 virtual void set_omega(typename Matrix_::DataType /*omega*/) override
721 {
722 XABORTM("not implemented yet!");
723 }
724 };
725
738 template<typename Matrix_, typename Filter_>
739 class SORPrecond : public SolverBase<typename Matrix_::VectorTypeL>
740 {
741 private:
742 std::shared_ptr<SORPrecondBase<Matrix_>> _impl;
743
744 public:
745 typedef Matrix_ MatrixType;
746 typedef Filter_ FilterType;
747 typedef typename MatrixType::VectorTypeL VectorType;
748 typedef typename MatrixType::DataType DataType;
749
752
753 public:
770 SORPrecond(PreferredBackend backend, const MatrixType& matrix, const FilterType& filter, DataType omega = DataType(1))
771 {
772 if (backend == PreferredBackend::generic)
773 {
774 }
775 else //if(backend == PreferredBackend::cuda)
776 {
777 }
778
779 switch (backend)
780 {
782 _impl = std::make_shared<SORPrecondWithBackend<PreferredBackend::cuda, Matrix_, Filter_>>(matrix, filter, omega);
783 break;
786 default:
787 _impl = std::make_shared<SORPrecondWithBackend<PreferredBackend::generic, Matrix_, Filter_>>(matrix, filter, omega);
788 }
789 }
790
810 SORPrecond(const String& section_name, const PropertyMap* section, PreferredBackend backend, const MatrixType& matrix, const FilterType& filter, DataType omega = DataType(1)) :
811 BaseClass(section_name, section)
812 {
813 switch (backend)
814 {
816 _impl = std::make_shared<SORPrecondWithBackend<PreferredBackend::cuda, Matrix_, Filter_>>(section_name, section, matrix, filter, omega);
817 break;
820 default:
821 _impl = std::make_shared<SORPrecondWithBackend<PreferredBackend::generic, Matrix_, Filter_>>(section_name, section, matrix, filter, omega);
822 }
823 }
824
828 virtual ~SORPrecond()
829 {
830 }
831
833 virtual String name() const override
834 {
835 return _impl->name();
836 }
837
845 virtual void set_omega(DataType omega)
846 {
847 _impl->set_omega(omega);
848 }
849
850 virtual Status apply(VectorType& vec_cor, const VectorType& vec_def) override
851 {
852 return _impl->apply(vec_cor, vec_def);
853 }
854
855 virtual void init_symbolic() override
856 {
857 _impl->init_symbolic();
858 }
859
860 virtual void done_symbolic() override
861 {
862 _impl->done_symbolic();
863 }
864 }; // class SORPrecond
865
884 template<typename Matrix_, typename Filter_>
885 inline std::shared_ptr<SORPrecond<Matrix_, Filter_>> new_sor_precond(PreferredBackend backend,
886 const Matrix_& matrix, const Filter_& filter,
887 const typename Matrix_::DataType omega = typename Matrix_::DataType(1))
888 {
889 return std::make_shared<SORPrecond<Matrix_, Filter_>>(backend, matrix, filter, omega);
890 }
891
913 template<typename Matrix_, typename Filter_>
914 inline std::shared_ptr<SORPrecond<Matrix_, Filter_>> new_sor_precond(
915 const String& section_name, const PropertyMap* section, PreferredBackend backend,
916 const Matrix_& matrix, const Filter_& filter)
917 {
918 return std::make_shared<SORPrecond<Matrix_, Filter_>>(section_name, section, backend, matrix, filter);
919 }
920 } // namespace Solver
921} // namespace FEAT
#define XABORTM(msg)
Abortion macro definition with custom message.
Definition: assertion.hpp:192
#define XASSERT(expr)
Assertion macro definition.
Definition: assertion.hpp:262
#define XASSERTM(expr, msg)
Assertion macro definition with custom message.
Definition: assertion.hpp:263
FEAT Kernel base header.
CSR based blocked sparse matrix.
Intern::BCSRVectorHelper< DT_, IT_, BlockHeight_ >::VectorType VectorTypeL
Compatible L-vector type.
Index rows() const
Retrieve matrix row count.
IT_ * col_ind()
Retrieve column indices array.
IT_ * row_ptr()
Retrieve row start index array.
Index columns() const
Retrieve matrix column count.
auto val() const -> const typename Intern::BCSRPerspectiveHelper< DT_, BlockHeight_, BlockWidth_, perspective_ >::Type *
Retrieve non zero element array.
CSR based sparse matrix.
Index rows() const
Retrieve matrix row count.
Index columns() const
Retrieve matrix column count.
Index used_elements() const
Retrieve non zero element count.
Class for parser related errors.
Definition: exception.hpp:132
A class organizing a tree of key-value pairs.
std::pair< String, bool > query(String key_path) const
Queries a value by its key path.
Inheritances inside sor_precond.hpp.
Definition: sor_precond.hpp:44
SOR preconditioner implementation.
virtual void set_omega(DataType omega)
Sets the damping parameter.
virtual void init_symbolic() override
Symbolic initialization method.
SolverBase< VectorType > BaseClass
Our base class.
SORPrecond(PreferredBackend backend, const MatrixType &matrix, const FilterType &filter, DataType omega=DataType(1))
Constructor.
virtual String name() const override
Returns the name of the solver.
SORPrecond(const String &section_name, const PropertyMap *section, PreferredBackend backend, const MatrixType &matrix, const FilterType &filter, DataType omega=DataType(1))
Constructor using a PropertyMap.
virtual ~SORPrecond()
Empty virtual destructor.
virtual void done_symbolic() override
Symbolic finalization method.
SORPrecondWithBackend(const String &section_name, const PropertyMap *section, const MatrixType &matrix, const FilterType &filter)
Constructor using a PropertyMap.
SORPrecondWithBackend(const MatrixType &matrix, const FilterType &filter, const DataType omega=DataType(1))
Constructor.
SORPrecondWithBackend(const String &, const PropertyMap *section, const MatrixType &matrix, const FilterType &filter)
Constructor using a PropertyMap.
SORPrecondWithBackend(const MatrixType &matrix, const FilterType &filter, const DataType omega=DataType(1))
Constructor.
Dummy class for not implemented specializations.
Polymorphic solver interface.
Definition: base.hpp:183
static void add_flops(Index flops)
Add an amount of flops to the global flop counter.
Definition: statistics.hpp:206
String class implementation.
Definition: string.hpp:47
Tiny Matrix class template.
CUDA_HOST_DEVICE Matrix & set_inverse(const Matrix< T_, m_, n_, sma_, sna_ > &a)
Sets this matrix to the inverse of another matrix.
Status
Solver status return codes enumeration.
Definition: base.hpp:47
@ success
solving successful (convergence criterion fulfilled)
@ aborted
premature abort (solver aborted due to internal errors or preconditioner failure)
std::shared_ptr< SORPrecond< Matrix_, Filter_ > > new_sor_precond(PreferredBackend backend, const Matrix_ &matrix, const Filter_ &filter, const typename Matrix_::DataType omega=typename Matrix_::DataType(1))
Creates a new SORPrecond solver object.
FEAT namespace.
Definition: adjactor.hpp:12
PreferredBackend
The backend that shall be used in all compute heavy calculations.
Definition: backend.hpp:124