\doxysection{block\+\_\+operator.\+hpp}
\hypertarget{block__operator_8hpp_source}{}\label{block__operator_8hpp_source}\index{ginkgo/core/base/block\_operator.hpp@{ginkgo/core/base/block\_operator.hpp}}

\begin{DoxyCode}{0}
\DoxyCodeLine{00001\ \textcolor{comment}{//\ SPDX-\/FileCopyrightText:\ 2017\ -\/\ 2024\ The\ Ginkgo\ authors}}
\DoxyCodeLine{00002\ \textcolor{comment}{//}}
\DoxyCodeLine{00003\ \textcolor{comment}{//\ SPDX-\/License-\/Identifier:\ BSD-\/3-\/Clause}}
\DoxyCodeLine{00004\ }
\DoxyCodeLine{00005\ \textcolor{preprocessor}{\#ifndef\ GINKGO\_BLOCK\_MATRIX\_HPP}}
\DoxyCodeLine{00006\ \textcolor{preprocessor}{\#define\ GINKGO\_BLOCK\_MATRIX\_HPP}}
\DoxyCodeLine{00007\ }
\DoxyCodeLine{00008\ \textcolor{preprocessor}{\#include\ <ginkgo/config.hpp>}}
\DoxyCodeLine{00009\ \textcolor{preprocessor}{\#include\ <ginkgo/core/base/dense\_cache.hpp>}}
\DoxyCodeLine{00010\ \textcolor{preprocessor}{\#include\ <ginkgo/core/base/lin\_op.hpp>}}
\DoxyCodeLine{00011\ \textcolor{preprocessor}{\#include\ <ginkgo/core/base/polymorphic\_object.hpp>}}
\DoxyCodeLine{00012\ }
\DoxyCodeLine{00013\ }
\DoxyCodeLine{00014\ \textcolor{keyword}{namespace\ }\doxymbox{\hyperlink{namespacegko}{gko}}\ \{}
\DoxyCodeLine{00015\ \textcolor{keyword}{namespace\ }detail\ \{}
\DoxyCodeLine{00016\ }
\DoxyCodeLine{00017\ }
\DoxyCodeLine{00022\ \textcolor{keyword}{struct\ }value\_span\ \{}
\DoxyCodeLine{00023\ \ \ \ \ \textcolor{keyword}{constexpr}\ value\_span(\doxymbox{\hyperlink{namespacegko_a9579c98b1d85bf4ad02d7cb5b96fc771}{size\_type}}\ point)\ noexcept}
\DoxyCodeLine{00024\ \ \ \ \ \ \ \ \ :\ value\_span\{point,\ point\ +\ 1\}}
\DoxyCodeLine{00025\ \ \ \ \ \{\}}
\DoxyCodeLine{00026\ }
\DoxyCodeLine{00027\ \ \ \ \ \textcolor{keyword}{constexpr}\ value\_span(\doxymbox{\hyperlink{namespacegko_a9579c98b1d85bf4ad02d7cb5b96fc771}{size\_type}}\ begin,\ \doxymbox{\hyperlink{namespacegko_a9579c98b1d85bf4ad02d7cb5b96fc771}{size\_type}}\ end)\ noexcept}
\DoxyCodeLine{00028\ \ \ \ \ \ \ \ \ :\ begin\{begin\},\ end\{end\}}
\DoxyCodeLine{00029\ \ \ \ \ \{\}}
\DoxyCodeLine{00030\ }
\DoxyCodeLine{00031\ \ \ \ \ \textcolor{keyword}{constexpr}\ \textcolor{keyword}{operator}\ span()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ \{begin,\ end\};\ \}}
\DoxyCodeLine{00032\ }
\DoxyCodeLine{00033\ \ \ \ \ \textcolor{keyword}{constexpr}\ value\_span(\textcolor{keyword}{const}\ span\&\ s)\ noexcept\ :\ value\_span(s.begin,\ s.end)\ \{\}}
\DoxyCodeLine{00034\ }
\DoxyCodeLine{00035\ \ \ \ \ \textcolor{keyword}{constexpr}\ \textcolor{keywordtype}{bool}\ is\_valid()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ begin\ <=\ end;\ \}}
\DoxyCodeLine{00036\ }
\DoxyCodeLine{00037\ \ \ \ \ \textcolor{keyword}{constexpr}\ \doxymbox{\hyperlink{namespacegko_a9579c98b1d85bf4ad02d7cb5b96fc771}{size\_type}}\ length()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ end\ -\/\ begin;\ \}}
\DoxyCodeLine{00038\ }
\DoxyCodeLine{00039\ \ \ \ \ \doxymbox{\hyperlink{namespacegko_a9579c98b1d85bf4ad02d7cb5b96fc771}{size\_type}}\ begin;}
\DoxyCodeLine{00040\ \ \ \ \ \doxymbox{\hyperlink{namespacegko_a9579c98b1d85bf4ad02d7cb5b96fc771}{size\_type}}\ end;}
\DoxyCodeLine{00041\ \};}
\DoxyCodeLine{00042\ }
\DoxyCodeLine{00043\ }
\DoxyCodeLine{00044\ \}\ \ \textcolor{comment}{//\ namespace\ detail}}
\DoxyCodeLine{00045\ }
\DoxyCodeLine{00046\ }
\DoxyCodeLine{00076\ \textcolor{keyword}{class\ }\doxymbox{\hyperlink{classgko_1_1BlockOperator_acb8ff1788a332231a3e9f8199dec0d03}{BlockOperator}}\ final\ :\ \textcolor{keyword}{public}\ \doxymbox{\hyperlink{classgko_1_1EnableLinOp}{EnableLinOp}}<BlockOperator>\ \{}
\DoxyCodeLine{00077\ \ \ \ \ \textcolor{keyword}{friend}\ \textcolor{keyword}{class\ }\doxymbox{\hyperlink{classgko_1_1EnablePolymorphicObject}{EnablePolymorphicObject}}<\doxymbox{\hyperlink{classgko_1_1BlockOperator_acb8ff1788a332231a3e9f8199dec0d03}{BlockOperator}},\ \doxymbox{\hyperlink{classgko_1_1LinOp}{LinOp}}>;}
\DoxyCodeLine{00078\ }
\DoxyCodeLine{00079\ \textcolor{keyword}{public}:}
\DoxyCodeLine{00086\ \ \ \ \ \doxymbox{\hyperlink{structgko_1_1dim}{dim<2>}}\ \doxymbox{\hyperlink{classgko_1_1BlockOperator_a7c5a2afced62435443d0a6e5d67cc5f7}{get\_block\_size}}()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ block\_size\_;\ \}}
\DoxyCodeLine{00087\ }
\DoxyCodeLine{00096\ \ \ \ \ \textcolor{keyword}{const}\ \doxymbox{\hyperlink{classgko_1_1LinOp}{LinOp}}*\ \doxymbox{\hyperlink{classgko_1_1BlockOperator_a8ae64878f419a1719010efa49c660279}{block\_at}}(\doxymbox{\hyperlink{namespacegko_a9579c98b1d85bf4ad02d7cb5b96fc771}{size\_type}}\ i,\ \doxymbox{\hyperlink{namespacegko_a9579c98b1d85bf4ad02d7cb5b96fc771}{size\_type}}\ j)\textcolor{keyword}{\ const}}
\DoxyCodeLine{00097\ \textcolor{keyword}{\ \ \ \ }\{}
\DoxyCodeLine{00098\ \ \ \ \ \ \ \ \ GKO\_ENSURE\_IN\_DIMENSION\_BOUNDS(i,\ j,\ block\_size\_);}
\DoxyCodeLine{00099\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ blocks\_[i\ *\ block\_size\_[1]\ +\ j].get();}
\DoxyCodeLine{00100\ \ \ \ \ \}}
\DoxyCodeLine{00101\ }
\DoxyCodeLine{00109\ \ \ \ \ \textcolor{keyword}{static}\ std::unique\_ptr<BlockOperator>\ \doxymbox{\hyperlink{classgko_1_1BlockOperator_af1263fd5f086a3dd4d72f0fb01db73c4}{create}}(}
\DoxyCodeLine{00110\ \ \ \ \ \ \ \ \ std::shared\_ptr<const\ Executor>\ exec);}
\DoxyCodeLine{00111\ }
\DoxyCodeLine{00121\ \ \ \ \ \textcolor{keyword}{static}\ std::unique\_ptr<BlockOperator>\ \doxymbox{\hyperlink{classgko_1_1BlockOperator_a3d78e60e7ed11202db89b00b16e50cca}{create}}(}
\DoxyCodeLine{00122\ \ \ \ \ \ \ \ \ std::shared\_ptr<const\ Executor>\ exec,}
\DoxyCodeLine{00123\ \ \ \ \ \ \ \ \ std::vector<std::vector<std::shared\_ptr<const\ LinOp>>>\ blocks);}
\DoxyCodeLine{00124\ }
\DoxyCodeLine{00129\ \ \ \ \ \doxymbox{\hyperlink{classgko_1_1BlockOperator_acb8ff1788a332231a3e9f8199dec0d03}{BlockOperator}}(\textcolor{keyword}{const}\ \doxymbox{\hyperlink{classgko_1_1BlockOperator_acb8ff1788a332231a3e9f8199dec0d03}{BlockOperator}}\&\ other);}
\DoxyCodeLine{00130\ }
\DoxyCodeLine{00136\ \ \ \ \ \doxymbox{\hyperlink{classgko_1_1BlockOperator_a4066b33a9d42462429c76eea3f9532c1}{BlockOperator}}(\doxymbox{\hyperlink{classgko_1_1BlockOperator_acb8ff1788a332231a3e9f8199dec0d03}{BlockOperator}}\&\&\ other)\ \textcolor{keyword}{noexcept};}
\DoxyCodeLine{00137\ }
\DoxyCodeLine{00142\ \ \ \ \ \doxymbox{\hyperlink{classgko_1_1BlockOperator_acb8ff1788a332231a3e9f8199dec0d03}{BlockOperator}}\&\ \doxymbox{\hyperlink{classgko_1_1BlockOperator_a2b553db151f4260372d94d952bce4dfb}{operator=}}(\textcolor{keyword}{const}\ \doxymbox{\hyperlink{classgko_1_1BlockOperator_acb8ff1788a332231a3e9f8199dec0d03}{BlockOperator}}\&\ other);}
\DoxyCodeLine{00143\ }
\DoxyCodeLine{00150\ \ \ \ \ \doxymbox{\hyperlink{classgko_1_1BlockOperator_acb8ff1788a332231a3e9f8199dec0d03}{BlockOperator}}\&\ \doxymbox{\hyperlink{classgko_1_1BlockOperator_a6d7ad2c57e28354129a21e9e2098a85f}{operator=}}(\doxymbox{\hyperlink{classgko_1_1BlockOperator_acb8ff1788a332231a3e9f8199dec0d03}{BlockOperator}}\&\&\ other);}
\DoxyCodeLine{00151\ }
\DoxyCodeLine{00152\ \textcolor{keyword}{private}:}
\DoxyCodeLine{00153\ \ \ \ \ \textcolor{keyword}{explicit}\ \doxymbox{\hyperlink{classgko_1_1BlockOperator_acb8ff1788a332231a3e9f8199dec0d03}{BlockOperator}}(std::shared\_ptr<const\ Executor>\ exec);}
\DoxyCodeLine{00154\ }
\DoxyCodeLine{00155\ \ \ \ \ \doxymbox{\hyperlink{classgko_1_1BlockOperator_acb8ff1788a332231a3e9f8199dec0d03}{BlockOperator}}(}
\DoxyCodeLine{00156\ \ \ \ \ \ \ \ \ std::shared\_ptr<const\ Executor>\ exec,}
\DoxyCodeLine{00157\ \ \ \ \ \ \ \ \ std::vector<std::vector<std::shared\_ptr<const\ LinOp>>>\ blocks);}
\DoxyCodeLine{00158\ }
\DoxyCodeLine{00159\ \ \ \ \ \textcolor{keywordtype}{void}\ apply\_impl(\textcolor{keyword}{const}\ \doxymbox{\hyperlink{classgko_1_1LinOp}{LinOp}}*\ b,\ \doxymbox{\hyperlink{classgko_1_1LinOp}{LinOp}}*\ x)\ \textcolor{keyword}{const\ override};}
\DoxyCodeLine{00160\ }
\DoxyCodeLine{00161\ \ \ \ \ \textcolor{keywordtype}{void}\ apply\_impl(\textcolor{keyword}{const}\ \doxymbox{\hyperlink{classgko_1_1LinOp}{LinOp}}*\ alpha,\ \textcolor{keyword}{const}\ \doxymbox{\hyperlink{classgko_1_1LinOp}{LinOp}}*\ b,\ \textcolor{keyword}{const}\ \doxymbox{\hyperlink{classgko_1_1LinOp}{LinOp}}*\ beta,}
\DoxyCodeLine{00162\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \doxymbox{\hyperlink{classgko_1_1LinOp}{LinOp}}*\ x)\ \textcolor{keyword}{const\ override};}
\DoxyCodeLine{00163\ }
\DoxyCodeLine{00164\ \ \ \ \ \doxymbox{\hyperlink{structgko_1_1dim}{dim<2>}}\ block\_size\_;}
\DoxyCodeLine{00165\ \ \ \ \ std::vector<detail::value\_span>\ row\_spans\_;}
\DoxyCodeLine{00166\ \ \ \ \ std::vector<detail::value\_span>\ col\_spans\_;}
\DoxyCodeLine{00167\ \ \ \ \ std::vector<std::shared\_ptr<const\ LinOp>>\ blocks\_;}
\DoxyCodeLine{00175\ \ \ \ \ detail::DenseCache<default\_precision>\ one\_;}
\DoxyCodeLine{00176\ \};}
\DoxyCodeLine{00177\ }
\DoxyCodeLine{00178\ }
\DoxyCodeLine{00179\ \}\ \ \textcolor{comment}{//\ namespace\ gko}}
\DoxyCodeLine{00180\ }
\DoxyCodeLine{00181\ \textcolor{preprocessor}{\#endif\ \ }\textcolor{comment}{//\ GINKGO\_BLOCK\_MATRIX\_HPP}}

\end{DoxyCode}
