\doxysection{batch\+\_\+jacobi.\+hpp}
\hypertarget{batch__jacobi_8hpp_source}{}\label{batch__jacobi_8hpp_source}\index{ginkgo/core/preconditioner/batch\_jacobi.hpp@{ginkgo/core/preconditioner/batch\_jacobi.hpp}}

\begin{DoxyCode}{0}
\DoxyCodeLine{00001\ \textcolor{comment}{//\ SPDX-\/FileCopyrightText:\ 2017\ -\/\ 2025\ The\ Ginkgo\ authors}}
\DoxyCodeLine{00002\ \textcolor{comment}{//}}
\DoxyCodeLine{00003\ \textcolor{comment}{//\ SPDX-\/License-\/Identifier:\ BSD-\/3-\/Clause}}
\DoxyCodeLine{00004\ }
\DoxyCodeLine{00005\ \textcolor{preprocessor}{\#ifndef\ GKO\_PUBLIC\_CORE\_PRECONDITIONER\_BATCH\_JACOBI\_HPP\_}}
\DoxyCodeLine{00006\ \textcolor{preprocessor}{\#define\ GKO\_PUBLIC\_CORE\_PRECONDITIONER\_BATCH\_JACOBI\_HPP\_}}
\DoxyCodeLine{00007\ }
\DoxyCodeLine{00008\ }
\DoxyCodeLine{00009\ \textcolor{preprocessor}{\#include\ <ginkgo/core/base/array.hpp>}}
\DoxyCodeLine{00010\ \textcolor{preprocessor}{\#include\ <ginkgo/core/base/batch\_lin\_op.hpp>}}
\DoxyCodeLine{00011\ \textcolor{preprocessor}{\#include\ <ginkgo/core/base/batch\_multi\_vector.hpp>}}
\DoxyCodeLine{00012\ \textcolor{preprocessor}{\#include\ <ginkgo/core/base/exception\_helpers.hpp>}}
\DoxyCodeLine{00013\ \textcolor{preprocessor}{\#include\ <ginkgo/core/base/lin\_op.hpp>}}
\DoxyCodeLine{00014\ \textcolor{preprocessor}{\#include\ <ginkgo/core/base/types.hpp>}}
\DoxyCodeLine{00015\ \textcolor{preprocessor}{\#include\ <ginkgo/core/matrix/batch\_csr.hpp>}}
\DoxyCodeLine{00016\ \textcolor{preprocessor}{\#include\ <ginkgo/core/matrix/batch\_dense.hpp>}}
\DoxyCodeLine{00017\ \textcolor{preprocessor}{\#include\ <ginkgo/core/matrix/csr.hpp>}}
\DoxyCodeLine{00018\ }
\DoxyCodeLine{00019\ }
\DoxyCodeLine{00020\ \textcolor{keyword}{namespace\ }\doxymbox{\hyperlink{namespacegko}{gko}}\ \{}
\DoxyCodeLine{00021\ \textcolor{keyword}{namespace\ }batch\ \{}
\DoxyCodeLine{00022\ \textcolor{keyword}{namespace\ }preconditioner\ \{}
\DoxyCodeLine{00023\ }
\DoxyCodeLine{00024\ }
\DoxyCodeLine{00049\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ ValueType\ =\ default\_precision,\ \textcolor{keyword}{typename}\ IndexType\ =\ \textcolor{keywordtype}{int}32>}
\DoxyCodeLine{00050\ \textcolor{keyword}{class\ }Jacobi\ final\ :\ \textcolor{keyword}{public}\ \doxymbox{\hyperlink{classgko_1_1batch_1_1EnableBatchLinOp}{EnableBatchLinOp}}<Jacobi<ValueType,\ IndexType>>\ \{}
\DoxyCodeLine{00051\ \ \ \ \ \textcolor{keyword}{friend}\ \textcolor{keyword}{class\ }\doxymbox{\hyperlink{classgko_1_1batch_1_1EnableBatchLinOp}{EnableBatchLinOp}}<Jacobi>;}
\DoxyCodeLine{00052\ \ \ \ \ \textcolor{keyword}{friend}\ \textcolor{keyword}{class\ }\doxymbox{\hyperlink{classgko_1_1EnablePolymorphicObject}{EnablePolymorphicObject}}<Jacobi,\ \doxymbox{\hyperlink{classgko_1_1batch_1_1BatchLinOp}{BatchLinOp}}>;}
\DoxyCodeLine{00053\ \ \ \ \ GKO\_ASSERT\_SUPPORTED\_VALUE\_AND\_INDEX\_TYPE;}
\DoxyCodeLine{00054\ }
\DoxyCodeLine{00055\ \textcolor{keyword}{public}:}
\DoxyCodeLine{00056\ \ \ \ \ \textcolor{keyword}{using\ }\doxymbox{\hyperlink{classgko_1_1batch_1_1EnableBatchLinOp}{EnableBatchLinOp}}<Jacobi>::convert\_to;}
\DoxyCodeLine{00057\ \ \ \ \ \textcolor{keyword}{using\ }\doxymbox{\hyperlink{classgko_1_1batch_1_1EnableBatchLinOp}{EnableBatchLinOp}}<Jacobi>::move\_to;}
\DoxyCodeLine{00058\ \ \ \ \ \textcolor{keyword}{using\ }value\_type\ =\ ValueType;}
\DoxyCodeLine{00059\ \ \ \ \ \textcolor{keyword}{using\ }index\_type\ =\ IndexType;}
\DoxyCodeLine{00060\ \ \ \ \ \textcolor{keyword}{using\ }matrix\_type\ =\ \doxymbox{\hyperlink{classgko_1_1batch_1_1matrix_1_1Csr}{batch::matrix::Csr<ValueType,\ IndexType>}};}
\DoxyCodeLine{00061\ }
\DoxyCodeLine{00068\ \ \ \ \ \textcolor{keyword}{const}\ index\_type*\ \doxymbox{\hyperlink{classgko_1_1batch_1_1preconditioner_1_1Jacobi_a03b50e8ba9be39ff8e984872d1f37f6b}{get\_const\_block\_pointers}}()\ const\ noexcept}
\DoxyCodeLine{00069\ \ \ \ \ \{}
\DoxyCodeLine{00070\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ block\_pointers\_.get\_const\_data();}
\DoxyCodeLine{00071\ \ \ \ \ \}}
\DoxyCodeLine{00072\ }
\DoxyCodeLine{00079\ \ \ \ \ \textcolor{keyword}{const}\ index\_type*\ \doxymbox{\hyperlink{classgko_1_1batch_1_1preconditioner_1_1Jacobi_a3f1387813dd7fb1c38019d38e59b9a1a}{get\_const\_map\_block\_to\_row}}()\ const\ noexcept}
\DoxyCodeLine{00080\ \ \ \ \ \{}
\DoxyCodeLine{00081\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ map\_block\_to\_row\_.get\_const\_data();}
\DoxyCodeLine{00082\ \ \ \ \ \}}
\DoxyCodeLine{00083\ }
\DoxyCodeLine{00090\ \ \ \ \ \textcolor{keyword}{const}\ index\_type*\ \doxymbox{\hyperlink{classgko_1_1batch_1_1preconditioner_1_1Jacobi_a42b58d3f29f00352c24c789f1aeefadb}{get\_const\_blocks\_cumulative\_offsets}}()\ const\ noexcept}
\DoxyCodeLine{00091\ \ \ \ \ \{}
\DoxyCodeLine{00092\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ blocks\_cumulative\_offsets\_.get\_const\_data();}
\DoxyCodeLine{00093\ \ \ \ \ \}}
\DoxyCodeLine{00094\ }
\DoxyCodeLine{00100\ \ \ \ \ \doxymbox{\hyperlink{namespacegko_a7cf056fa904140b50658e0637fba428c}{uint32}}\ \doxymbox{\hyperlink{classgko_1_1batch_1_1preconditioner_1_1Jacobi_a33328b011a3a2125774e4471da563181}{get\_max\_block\_size}}()\ const\ noexcept}
\DoxyCodeLine{00101\ \ \ \ \ \{}
\DoxyCodeLine{00102\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ parameters\_.max\_block\_size;}
\DoxyCodeLine{00103\ \ \ \ \ \}}
\DoxyCodeLine{00104\ }
\DoxyCodeLine{00110\ \ \ \ \ \doxymbox{\hyperlink{namespacegko_a9579c98b1d85bf4ad02d7cb5b96fc771}{size\_type}}\ \doxymbox{\hyperlink{classgko_1_1batch_1_1preconditioner_1_1Jacobi_a4d5fe04bfd88e13bbfcac393595707c7}{get\_num\_blocks}}()\ const\ noexcept\ \{\ \textcolor{keywordflow}{return}\ num\_blocks\_;\ \}}
\DoxyCodeLine{00111\ }
\DoxyCodeLine{00130\ \ \ \ \ \textcolor{keyword}{const}\ value\_type*\ \doxymbox{\hyperlink{classgko_1_1batch_1_1preconditioner_1_1Jacobi_aaaf8c476b2182bca3fbe3abd26ebc285}{get\_const\_blocks}}()\ const\ noexcept}
\DoxyCodeLine{00131\ \ \ \ \ \{}
\DoxyCodeLine{00132\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ blocks\_.get\_const\_data();}
\DoxyCodeLine{00133\ \ \ \ \ \}}
\DoxyCodeLine{00134\ }
\DoxyCodeLine{00144\ \ \ \ \ \doxymbox{\hyperlink{namespacegko_a9579c98b1d85bf4ad02d7cb5b96fc771}{size\_type}}\ \doxymbox{\hyperlink{classgko_1_1batch_1_1preconditioner_1_1Jacobi_af97a949dceeedd5d38a1e6cc7fe2b327}{get\_num\_stored\_elements}}()\ const\ noexcept}
\DoxyCodeLine{00145\ \ \ \ \ \{}
\DoxyCodeLine{00146\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ blocks\_.get\_size();}
\DoxyCodeLine{00147\ \ \ \ \ \}}
\DoxyCodeLine{00148\ }
\DoxyCodeLine{00149\ \ \ \ \ \doxymbox{\hyperlink{group__LinOp_ga1fc8e9d8be0c9ad2d72bc1ddfc6d8358}{GKO\_CREATE\_FACTORY\_PARAMETERS}}(parameters,\ \doxymbox{\hyperlink{classgko_1_1batch_1_1preconditioner_1_1Jacobi_1_1Factory}{Factory}})}
\DoxyCodeLine{00150\ \ \ \ \ \{}
\DoxyCodeLine{00163\ \ \ \ \ \ \ \ \ \doxymbox{\hyperlink{namespacegko_a7cf056fa904140b50658e0637fba428c}{uint32}}\ \doxymbox{\hyperlink{group__LinOp_ga49d4c09c39f06b22bebbbfd1d8bfe450}{GKO\_FACTORY\_PARAMETER\_SCALAR}}(\doxymbox{\hyperlink{structgko_1_1batch_1_1preconditioner_1_1Jacobi_1_1parameters__type_a06ada09498ccd4f438aa5107d66d83e9}{max\_block\_size}},\ 8u);}
\DoxyCodeLine{00164\ }
\DoxyCodeLine{00191\ \ \ \ \ \ \ \ \ \doxymbox{\hyperlink{classgko_1_1array}{gko::array<index\_type>}}\ \doxymbox{\hyperlink{group__LinOp_gaa292314d27ec1fb7ad54debaa3606ea8}{GKO\_FACTORY\_PARAMETER\_VECTOR}}(\doxymbox{\hyperlink{structgko_1_1batch_1_1preconditioner_1_1Jacobi_1_1parameters__type_afd91913f62dc55b7173d41f6d6144961}{block\_pointers}},}
\DoxyCodeLine{00192\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{nullptr});}
\DoxyCodeLine{00193\ \ \ \ \ \};}
\DoxyCodeLine{00194\ \ \ \ \ \doxymbox{\hyperlink{group__BatchLinOp_gab7f0cd5a4520a215974412e6fff4f25f}{GKO\_ENABLE\_BATCH\_LIN\_OP\_FACTORY}}(Jacobi,\ parameters,\ Factory);}
\DoxyCodeLine{00195\ \ \ \ \ \doxymbox{\hyperlink{group__LinOp_ga521f65604cc4cf427dcb2ecfa49b757c}{GKO\_ENABLE\_BUILD\_METHOD}}(Factory);}
\DoxyCodeLine{00196\ }
\DoxyCodeLine{00197\ \textcolor{keyword}{private}:}
\DoxyCodeLine{00198\ \ \ \ \ \textcolor{keyword}{explicit}\ Jacobi(std::shared\_ptr<const\ Executor>\ exec);}
\DoxyCodeLine{00199\ }
\DoxyCodeLine{00200\ \ \ \ \ \textcolor{keyword}{explicit}\ Jacobi(\textcolor{keyword}{const}\ Factory*\ factory,}
\DoxyCodeLine{00201\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ std::shared\_ptr<const\ BatchLinOp>\ system\_matrix);}
\DoxyCodeLine{00202\ }
\DoxyCodeLine{00203\ \ \ \ \ \textcolor{keywordtype}{void}\ generate\_precond(\textcolor{keyword}{const}\ \doxymbox{\hyperlink{classgko_1_1batch_1_1BatchLinOp}{BatchLinOp}}*\ \textcolor{keyword}{const}\ system\_matrix);}
\DoxyCodeLine{00204\ }
\DoxyCodeLine{00205\ \ \ \ \ \doxymbox{\hyperlink{namespacegko_a9579c98b1d85bf4ad02d7cb5b96fc771}{size\_type}}\ compute\_storage\_space(\textcolor{keyword}{const}\ \doxymbox{\hyperlink{namespacegko_a9579c98b1d85bf4ad02d7cb5b96fc771}{size\_type}}\ num\_batch)\ \textcolor{keyword}{const}\ \textcolor{keyword}{noexcept};}
\DoxyCodeLine{00206\ }
\DoxyCodeLine{00207\ \ \ \ \ \textcolor{keywordtype}{void}\ detect\_blocks(}
\DoxyCodeLine{00208\ \ \ \ \ \ \ \ \ \textcolor{keyword}{const}\ \doxymbox{\hyperlink{classgko_1_1matrix_1_1Csr}{gko::matrix::Csr<ValueType,\ IndexType>}}*\ system\_matrix);}
\DoxyCodeLine{00209\ }
\DoxyCodeLine{00210\ \ \ \ \ \doxymbox{\hyperlink{classgko_1_1array}{array<index\_type>}}\ block\_pointers\_;}
\DoxyCodeLine{00211\ \ \ \ \ \doxymbox{\hyperlink{namespacegko_a9579c98b1d85bf4ad02d7cb5b96fc771}{size\_type}}\ num\_blocks\_;}
\DoxyCodeLine{00212\ \ \ \ \ \doxymbox{\hyperlink{classgko_1_1array}{array<value\_type>}}\ blocks\_;}
\DoxyCodeLine{00213\ \ \ \ \ \doxymbox{\hyperlink{classgko_1_1array}{array<index\_type>}}\ map\_block\_to\_row\_;}
\DoxyCodeLine{00214\ \ \ \ \ \doxymbox{\hyperlink{classgko_1_1array}{array<index\_type>}}\ blocks\_cumulative\_offsets\_;}
\DoxyCodeLine{00215\ \};}
\DoxyCodeLine{00216\ }
\DoxyCodeLine{00217\ }
\DoxyCodeLine{00218\ \}\ \ \textcolor{comment}{//\ namespace\ preconditioner}}
\DoxyCodeLine{00219\ \}\ \ \textcolor{comment}{//\ namespace\ batch}}
\DoxyCodeLine{00220\ \}\ \ \textcolor{comment}{//\ namespace\ gko}}
\DoxyCodeLine{00221\ }
\DoxyCodeLine{00222\ }
\DoxyCodeLine{00223\ \textcolor{preprocessor}{\#endif\ \ }\textcolor{comment}{//\ GKO\_PUBLIC\_CORE\_PRECONDITIONER\_BATCH\_JACOBI\_HPP\_}}

\end{DoxyCode}
