\doxysection{cb\+\_\+gmres.\+hpp}
\hypertarget{cb__gmres_8hpp_source}{}\label{cb__gmres_8hpp_source}\index{ginkgo/core/solver/cb\_gmres.hpp@{ginkgo/core/solver/cb\_gmres.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\_SOLVER\_CB\_GMRES\_HPP\_}}
\DoxyCodeLine{00006\ \textcolor{preprocessor}{\#define\ GKO\_PUBLIC\_CORE\_SOLVER\_CB\_GMRES\_HPP\_}}
\DoxyCodeLine{00007\ }
\DoxyCodeLine{00008\ }
\DoxyCodeLine{00009\ \textcolor{preprocessor}{\#include\ <memory>}}
\DoxyCodeLine{00010\ \textcolor{preprocessor}{\#include\ <vector>}}
\DoxyCodeLine{00011\ }
\DoxyCodeLine{00012\ \textcolor{preprocessor}{\#include\ <ginkgo/core/base/array.hpp>}}
\DoxyCodeLine{00013\ \textcolor{preprocessor}{\#include\ <ginkgo/core/base/exception\_helpers.hpp>}}
\DoxyCodeLine{00014\ \textcolor{preprocessor}{\#include\ <ginkgo/core/base/lin\_op.hpp>}}
\DoxyCodeLine{00015\ \textcolor{preprocessor}{\#include\ <ginkgo/core/base/math.hpp>}}
\DoxyCodeLine{00016\ \textcolor{preprocessor}{\#include\ <ginkgo/core/base/types.hpp>}}
\DoxyCodeLine{00017\ \textcolor{preprocessor}{\#include\ <ginkgo/core/config/config.hpp>}}
\DoxyCodeLine{00018\ \textcolor{preprocessor}{\#include\ <ginkgo/core/config/registry.hpp>}}
\DoxyCodeLine{00019\ \textcolor{preprocessor}{\#include\ <ginkgo/core/log/logger.hpp>}}
\DoxyCodeLine{00020\ \textcolor{preprocessor}{\#include\ <ginkgo/core/matrix/dense.hpp>}}
\DoxyCodeLine{00021\ \textcolor{preprocessor}{\#include\ <ginkgo/core/matrix/identity.hpp>}}
\DoxyCodeLine{00022\ \textcolor{preprocessor}{\#include\ <ginkgo/core/solver/solver\_base.hpp>}}
\DoxyCodeLine{00023\ \textcolor{preprocessor}{\#include\ <ginkgo/core/stop/combined.hpp>}}
\DoxyCodeLine{00024\ \textcolor{preprocessor}{\#include\ <ginkgo/core/stop/criterion.hpp>}}
\DoxyCodeLine{00025\ }
\DoxyCodeLine{00026\ }
\DoxyCodeLine{00027\ \textcolor{keyword}{namespace\ }\doxymbox{\hyperlink{namespacegko}{gko}}\ \{}
\DoxyCodeLine{00028\ \textcolor{keyword}{namespace\ }\doxymbox{\hyperlink{namespacegko_1_1solver}{solver}}\ \{}
\DoxyCodeLine{00029\ }
\DoxyCodeLine{00030\ }
\DoxyCodeLine{00031\ \textcolor{keyword}{namespace\ }cb\_gmres\ \{}
\DoxyCodeLine{00032\ }
\DoxyCodeLine{00033\ }
\DoxyCodeLine{00061\ \textcolor{keyword}{enum\ class}\ storage\_precision\ \{}
\DoxyCodeLine{00062\ \ \ \ \ keep,}
\DoxyCodeLine{00063\ \ \ \ \ reduce1,}
\DoxyCodeLine{00064\ \ \ \ \ reduce2,}
\DoxyCodeLine{00065\ \ \ \ \ integer,}
\DoxyCodeLine{00066\ \ \ \ \ ireduce1,}
\DoxyCodeLine{00067\ \ \ \ \ ireduce2}
\DoxyCodeLine{00068\ \};}
\DoxyCodeLine{00069\ }
\DoxyCodeLine{00070\ }
\DoxyCodeLine{00071\ \}\ \ \textcolor{comment}{//\ namespace\ cb\_gmres}}
\DoxyCodeLine{00072\ }
\DoxyCodeLine{00073\ }
\DoxyCodeLine{00095\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ ValueType\ =\ default\_precision>}
\DoxyCodeLine{00096\ \textcolor{keyword}{class\ }CbGmres\ :\ \textcolor{keyword}{public}\ \doxymbox{\hyperlink{classgko_1_1EnableLinOp}{EnableLinOp}}<CbGmres<ValueType>>,}
\DoxyCodeLine{00097\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{public}\ EnablePreconditionedIterativeSolver<ValueType,}
\DoxyCodeLine{00098\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ CbGmres<ValueType>>\ \{}
\DoxyCodeLine{00099\ \ \ \ \ \textcolor{keyword}{friend}\ \textcolor{keyword}{class\ }\doxymbox{\hyperlink{classgko_1_1EnableLinOp}{EnableLinOp}}<CbGmres>;}
\DoxyCodeLine{00100\ \ \ \ \ \textcolor{keyword}{friend}\ \textcolor{keyword}{class\ }\doxymbox{\hyperlink{classgko_1_1EnablePolymorphicObject}{EnablePolymorphicObject}}<CbGmres,\ \doxymbox{\hyperlink{classgko_1_1LinOp}{LinOp}}>;}
\DoxyCodeLine{00101\ \ \ \ \ GKO\_ASSERT\_SUPPORTED\_VALUE\_TYPE;}
\DoxyCodeLine{00102\ }
\DoxyCodeLine{00103\ \textcolor{keyword}{public}:}
\DoxyCodeLine{00104\ \ \ \ \ \textcolor{keyword}{using\ }value\_type\ =\ ValueType;}
\DoxyCodeLine{00105\ }
\DoxyCodeLine{00111\ \ \ \ \ \doxymbox{\hyperlink{namespacegko_a9579c98b1d85bf4ad02d7cb5b96fc771}{size\_type}}\ \doxymbox{\hyperlink{classgko_1_1solver_1_1CbGmres_a2252efc61d8eebee57d835a9bb7fa602}{get\_krylov\_dim}}()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ parameters\_.krylov\_dim;\ \}}
\DoxyCodeLine{00112\ }
\DoxyCodeLine{00118\ \ \ \ \ \textcolor{keywordtype}{void}\ \doxymbox{\hyperlink{classgko_1_1solver_1_1CbGmres_a3540b93ed61652d2ead150e117a80bc3}{set\_krylov\_dim}}(\doxymbox{\hyperlink{namespacegko_a9579c98b1d85bf4ad02d7cb5b96fc771}{size\_type}}\ other)\ \{\ parameters\_.krylov\_dim\ =\ other;\ \}}
\DoxyCodeLine{00119\ }
\DoxyCodeLine{00125\ \ \ \ \ cb\_gmres::storage\_precision\ \doxymbox{\hyperlink{classgko_1_1solver_1_1CbGmres_a41e1ad42633172166c72ca6a0ba8cd67}{get\_storage\_precision}}()\textcolor{keyword}{\ const}}
\DoxyCodeLine{00126\ \textcolor{keyword}{\ \ \ \ }\{}
\DoxyCodeLine{00127\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ parameters\_.storage\_precision;}
\DoxyCodeLine{00128\ \ \ \ \ \}}
\DoxyCodeLine{00129\ }
\DoxyCodeLine{00130\ \ \ \ \ \textcolor{keyword}{class\ }\doxymbox{\hyperlink{classgko_1_1solver_1_1Factory}{Factory}};}
\DoxyCodeLine{00131\ }
\DoxyCodeLine{00132\ \ \ \ \ \textcolor{keyword}{struct\ }\doxymbox{\hyperlink{structgko_1_1solver_1_1CbGmres_1_1parameters__type}{parameters\_type}}}
\DoxyCodeLine{00133\ \ \ \ \ \ \ \ \ :\ \doxymbox{\hyperlink{structgko_1_1solver_1_1enable__preconditioned__iterative__solver__factory__parameters}{enable\_preconditioned\_iterative\_solver\_factory\_parameters}}<}
\DoxyCodeLine{00134\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ parameters\_type,\ Factory>\ \{}
\DoxyCodeLine{00138\ \ \ \ \ \ \ \ \ cb\_gmres::storage\_precision\ \doxymbox{\hyperlink{group__LinOp_ga49d4c09c39f06b22bebbbfd1d8bfe450}{GKO\_FACTORY\_PARAMETER\_SCALAR}}(}
\DoxyCodeLine{00139\ \ \ \ \ \ \ \ \ \ \ \ \ \doxymbox{\hyperlink{structgko_1_1solver_1_1CbGmres_1_1parameters__type_ae28cef8c0fe5f51e914fb2486eb4f125}{storage\_precision}},\ cb\_gmres::storage\_precision::reduce1);}
\DoxyCodeLine{00140\ }
\DoxyCodeLine{00144\ \ \ \ \ \ \ \ \ \doxymbox{\hyperlink{namespacegko_a9579c98b1d85bf4ad02d7cb5b96fc771}{size\_type}}\ \doxymbox{\hyperlink{group__LinOp_ga49d4c09c39f06b22bebbbfd1d8bfe450}{GKO\_FACTORY\_PARAMETER\_SCALAR}}(\doxymbox{\hyperlink{structgko_1_1solver_1_1CbGmres_1_1parameters__type_ac93e0c491af465cc7af9816d94734815}{krylov\_dim}},\ 100u);}
\DoxyCodeLine{00145\ \ \ \ \ \};}
\DoxyCodeLine{00146\ }
\DoxyCodeLine{00147\ \ \ \ \ \doxymbox{\hyperlink{group__LinOp_ga8e0af90ec2414b768266f77cedffc309}{GKO\_ENABLE\_LIN\_OP\_FACTORY}}(CbGmres,\ parameters,\ Factory);}
\DoxyCodeLine{00148\ \ \ \ \ \doxymbox{\hyperlink{group__LinOp_ga521f65604cc4cf427dcb2ecfa49b757c}{GKO\_ENABLE\_BUILD\_METHOD}}(Factory);}
\DoxyCodeLine{00149\ }
\DoxyCodeLine{00163\ \ \ \ \ \textcolor{keyword}{static}\ \doxymbox{\hyperlink{structgko_1_1solver_1_1CbGmres_1_1parameters__type}{parameters\_type}}\ \doxymbox{\hyperlink{classgko_1_1solver_1_1CbGmres_a10b46d92cbb31fb72a573cc897ac08b3}{parse}}(\textcolor{keyword}{const}\ \doxymbox{\hyperlink{classgko_1_1config_1_1pnode}{config::pnode}}\&\ config,}
\DoxyCodeLine{00164\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{const}\ \doxymbox{\hyperlink{classgko_1_1config_1_1registry}{config::registry}}\&\ context,}
\DoxyCodeLine{00165\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{const}\ \doxymbox{\hyperlink{classgko_1_1config_1_1type__descriptor}{config::type\_descriptor}}\&\ td\_for\_child\ =}
\DoxyCodeLine{00166\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ config::make\_type\_descriptor<ValueType>());}
\DoxyCodeLine{00167\ }
\DoxyCodeLine{00168\ \textcolor{keyword}{protected}:}
\DoxyCodeLine{00169\ \ \ \ \ \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{00170\ }
\DoxyCodeLine{00171\ \ \ \ \ \textcolor{keywordtype}{void}\ apply\_dense\_impl(\textcolor{keyword}{const}\ \doxymbox{\hyperlink{classgko_1_1matrix_1_1Dense}{matrix::Dense<ValueType>}}*\ b,}
\DoxyCodeLine{00172\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \doxymbox{\hyperlink{classgko_1_1matrix_1_1Dense}{matrix::Dense<ValueType>}}*\ x)\ \textcolor{keyword}{const};}
\DoxyCodeLine{00173\ }
\DoxyCodeLine{00174\ \ \ \ \ \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{00175\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \doxymbox{\hyperlink{classgko_1_1LinOp}{LinOp}}*\ x)\ \textcolor{keyword}{const\ override};}
\DoxyCodeLine{00176\ }
\DoxyCodeLine{00177\ \ \ \ \ \textcolor{keyword}{explicit}\ CbGmres(std::shared\_ptr<const\ Executor>\ exec)}
\DoxyCodeLine{00178\ \ \ \ \ \ \ \ \ :\ \doxymbox{\hyperlink{classgko_1_1EnableLinOp}{EnableLinOp}}<CbGmres>(\doxymbox{\hyperlink{namespacestd}{std}}::move(exec))}
\DoxyCodeLine{00179\ \ \ \ \ \{\}}
\DoxyCodeLine{00180\ }
\DoxyCodeLine{00181\ \ \ \ \ \textcolor{keyword}{explicit}\ \doxymbox{\hyperlink{classgko_1_1solver_1_1CbGmres}{CbGmres}}(\textcolor{keyword}{const}\ \doxymbox{\hyperlink{classgko_1_1solver_1_1Factory}{Factory}}*\ factory,}
\DoxyCodeLine{00182\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ std::shared\_ptr<const\ LinOp>\ system\_matrix)}
\DoxyCodeLine{00183\ \ \ \ \ \ \ \ \ :\ \doxymbox{\hyperlink{classgko_1_1EnableLinOp}{EnableLinOp}}<\doxymbox{\hyperlink{classgko_1_1solver_1_1CbGmres}{CbGmres}}>(factory-\/>get\_executor(),}
\DoxyCodeLine{00184\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \doxymbox{\hyperlink{namespacegko_aacad7f87b38d3f26674ed034d442a1a0}{transpose}}(system\_matrix-\/>get\_size())),}
\DoxyCodeLine{00185\ \ \ \ \ \ \ \ \ \ \ \doxymbox{\hyperlink{classgko_1_1solver_1_1EnablePreconditionedIterativeSolver}{EnablePreconditionedIterativeSolver}}<ValueType,\ \doxymbox{\hyperlink{classgko_1_1solver_1_1CbGmres}{CbGmres}}<ValueType>>\{}
\DoxyCodeLine{00186\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ std::move(system\_matrix),\ factory-\/>get\_parameters()\},}
\DoxyCodeLine{00187\ \ \ \ \ \ \ \ \ \ \ parameters\_\{factory-\/>get\_parameters()\}}
\DoxyCodeLine{00188\ \ \ \ \ \{\}}
\DoxyCodeLine{00189\ \};}
\DoxyCodeLine{00190\ }
\DoxyCodeLine{00191\ }
\DoxyCodeLine{00192\ \}\ \ \textcolor{comment}{//\ namespace\ solver}}
\DoxyCodeLine{00193\ \}\ \ \textcolor{comment}{//\ namespace\ gko}}
\DoxyCodeLine{00194\ }
\DoxyCodeLine{00195\ }
\DoxyCodeLine{00196\ \textcolor{preprocessor}{\#endif\ \ }\textcolor{comment}{//\ GKO\_PUBLIC\_CORE\_SOLVER\_CB\_GMRES\_HPP\_}}

\end{DoxyCode}
