\doxysection{gko::\+solver::\+Fcg\texorpdfstring{$<$}{<} Value\+Type \texorpdfstring{$>$}{>} Class Template Reference}
\hypertarget{classgko_1_1solver_1_1Fcg}{}\label{classgko_1_1solver_1_1Fcg}\index{gko::solver::Fcg$<$ ValueType $>$@{gko::solver::Fcg$<$ ValueType $>$}}


FCG or the flexible conjugate gradient method is an iterative type Krylov subspace method which is suitable for symmetric positive definite methods.  




{\ttfamily \+\#include $<$ginkgo/\+core/\+solver/\+fcg.\+hpp$>$}



Inheritance diagram for gko::\+solver::\+Fcg\texorpdfstring{$<$}{<} Value\+Type \texorpdfstring{$>$}{>}:\+
\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{classgko_1_1solver_1_1Fcg__inherit__graph}
\end{center}
\end{figure}


Collaboration diagram for gko::\+solver::\+Fcg\texorpdfstring{$<$}{<} Value\+Type \texorpdfstring{$>$}{>}:\+
\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{classgko_1_1solver_1_1Fcg__coll__graph}
\end{center}
\end{figure}
\doxysubsubsection*{Classes}
\begin{DoxyCompactItemize}
\item 
struct \doxymbox{\hyperlink{structgko_1_1solver_1_1Fcg_1_1parameters__type}{parameters\+\_\+type}}
\item 
class \doxymbox{\hyperlink{classgko_1_1solver_1_1Fcg_1_1Factory}{Factory}}
\end{DoxyCompactItemize}
\doxysubsubsection*{Public Types}
\begin{DoxyCompactItemize}
\item 
\Hypertarget{classgko_1_1solver_1_1Fcg_aacc2d9bd24b654a16f9eb6719d5de1bb}\label{classgko_1_1solver_1_1Fcg_aacc2d9bd24b654a16f9eb6719d5de1bb} 
using {\bfseries value\+\_\+type} = Value\+Type
\item 
\Hypertarget{classgko_1_1solver_1_1Fcg_a433ffcfc5a7b5c74a67452f840d1f11e}\label{classgko_1_1solver_1_1Fcg_a433ffcfc5a7b5c74a67452f840d1f11e} 
using {\bfseries transposed\+\_\+type} = Fcg$<$Value\+Type$>$
\end{DoxyCompactItemize}
\doxysubsection*{Public Types inherited from \doxymbox{\hyperlink{classgko_1_1EnablePolymorphicAssignment}{gko::\+\+Enable\+Polymorphic\+Assignment$<$ Fcg$<$ default\+\_\+precision $>$ $>$}}}
\begin{DoxyCompactItemize}
\item 
using {\bfseries result\+\_\+type}
\end{DoxyCompactItemize}
\doxysubsubsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
std::\+unique\+\_\+ptr$<$ \doxymbox{\hyperlink{classgko_1_1LinOp}{Lin\+Op}} $>$ \doxymbox{\hyperlink{classgko_1_1solver_1_1Fcg_a2d8092247167dc5e583b00e306497f8a}{transpose}} () const override
\begin{DoxyCompactList}\small\item\em Returns a \doxylink{classgko_1_1LinOp}{Lin\+Op} representing the transpose of the \doxylink{classgko_1_1Transposable}{Transposable} object. \end{DoxyCompactList}\item 
std::\+unique\+\_\+ptr$<$ \doxymbox{\hyperlink{classgko_1_1LinOp}{Lin\+Op}} $>$ \doxymbox{\hyperlink{classgko_1_1solver_1_1Fcg_a7dbdbeedd5a1fccc68e92a98b838166d}{conj\+\_\+transpose}} () const override
\begin{DoxyCompactList}\small\item\em Returns a \doxylink{classgko_1_1LinOp}{Lin\+Op} representing the conjugate transpose of the \doxylink{classgko_1_1Transposable}{Transposable} object. \end{DoxyCompactList}\item 
bool \doxymbox{\hyperlink{classgko_1_1solver_1_1Fcg_ae1caa80eed7b3e8761e577c7623518fc}{apply\+\_\+uses\+\_\+initial\+\_\+guess}} () const override
\begin{DoxyCompactList}\small\item\em Return true as iterative solvers use the data in x as an initial guess. \end{DoxyCompactList}\item 
\Hypertarget{classgko_1_1solver_1_1Fcg_aafa0b53c4cae4498f0fad770b6b1cfae}\label{classgko_1_1solver_1_1Fcg_aafa0b53c4cae4498f0fad770b6b1cfae} 
const \doxymbox{\hyperlink{structgko_1_1solver_1_1Fcg_1_1parameters__type}{parameters\+\_\+type}} \& {\bfseries get\+\_\+parameters} () const
\end{DoxyCompactItemize}
\doxysubsection*{Public Member Functions inherited from \doxymbox{\hyperlink{classgko_1_1EnableLinOp}{gko::\+\+Enable\+Lin\+Op$<$ Fcg$<$ default\+\_\+precision $>$ $>$}}}
\begin{DoxyCompactItemize}
\item 
const Fcg$<$ \doxymbox{\hyperlink{namespacegko_a89637c833af7ae805802226d97cebebf}{default\+\_\+precision}} $>$ \texorpdfstring{$\ast$}{*} {\bfseries apply} (\doxymbox{\hyperlink{classgko_1_1ptr__param}{ptr\+\_\+param}}$<$ const \doxymbox{\hyperlink{classgko_1_1LinOp}{Lin\+Op}} $>$ b, \doxymbox{\hyperlink{classgko_1_1ptr__param}{ptr\+\_\+param}}$<$ \doxymbox{\hyperlink{classgko_1_1LinOp}{Lin\+Op}} $>$ x) const
\end{DoxyCompactItemize}
\doxysubsection*{Public Member Functions inherited from \doxymbox{\hyperlink{classgko_1_1EnablePolymorphicAssignment}{gko::\+\+Enable\+Polymorphic\+Assignment$<$ Fcg$<$ default\+\_\+precision $>$ $>$}}}
\begin{DoxyCompactItemize}
\item 
void {\bfseries convert\+\_\+to} (result\+\_\+type \texorpdfstring{$\ast$}{*}result) const override
\item 
void {\bfseries move\+\_\+to} (result\+\_\+type \texorpdfstring{$\ast$}{*}result) override
\end{DoxyCompactItemize}
\doxysubsection*{Public Member Functions inherited from \doxymbox{\hyperlink{classgko_1_1solver_1_1EnableSolverBase}{gko::\+solver::\+\+Enable\+Solver\+Base$<$ Fcg$<$ default\+\_\+precision $>$ $>$}}}
\begin{DoxyCompactItemize}
\item 
Enable\+Solver\+Base \& {\bfseries operator=} (const Enable\+Solver\+Base \&other)
\begin{DoxyCompactList}\small\item\em Creates a shallow copy of the provided system matrix, clones it onto this executor if executors don\textquotesingle{}t match. \end{DoxyCompactList}\item 
int {\bfseries get\+\_\+num\+\_\+workspace\+\_\+ops} () const override
\item 
std::\+vector$<$ std::\+string $>$ {\bfseries get\+\_\+workspace\+\_\+op\+\_\+names} () const override
\item 
std::\+vector$<$ int $>$ {\bfseries get\+\_\+workspace\+\_\+scalars} () const override
\begin{DoxyCompactList}\small\item\em Returns the IDs of all scalars (workspace vectors with system dimension-\/independent size, usually 1 x num\+\_\+rhs). \end{DoxyCompactList}\item 
std::\+vector$<$ int $>$ {\bfseries get\+\_\+workspace\+\_\+vectors} () const override
\begin{DoxyCompactList}\small\item\em Returns the IDs of all vectors (workspace vectors with system dimension-\/dependent size, usually system\+\_\+matrix\+\_\+size x num\+\_\+rhs). \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Public Member Functions inherited from \doxymbox{\hyperlink{classgko_1_1solver_1_1SolverBase}{gko::\+solver::\+\+Solver\+Base$<$ Lin\+Op $>$}}}
\begin{DoxyCompactItemize}
\item 
std::\+shared\+\_\+ptr$<$ const \doxymbox{\hyperlink{classgko_1_1LinOp}{Lin\+Op}} $>$ \doxymbox{\hyperlink{classgko_1_1solver_1_1SolverBase_a2270916c6cb8451c275c0bca44c5d09e}{get\+\_\+system\+\_\+matrix}} () const
\begin{DoxyCompactList}\small\item\em Returns the system matrix, with its concrete type, used by the solver. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Public Member Functions inherited from \doxymbox{\hyperlink{classgko_1_1solver_1_1EnableIterativeBase}{gko::\+solver::\+\+Enable\+Iterative\+Base$<$ Fcg$<$ default\+\_\+precision $>$ $>$}}}
\begin{DoxyCompactItemize}
\item 
Enable\+Iterative\+Base \& {\bfseries operator=} (const Enable\+Iterative\+Base \&other)
\begin{DoxyCompactList}\small\item\em Creates a shallow copy of the provided stopping criterion, clones it onto this executor if executors don\textquotesingle{}t match. \end{DoxyCompactList}\item 
void \doxymbox{\hyperlink{classgko_1_1solver_1_1EnableIterativeBase_a5e96a31681a2bc03fffb2d76e7a7da12}{set\+\_\+stop\+\_\+criterion\+\_\+factory}} (std::\+shared\+\_\+ptr$<$ const \doxymbox{\hyperlink{namespacegko_1_1stop_a61839f234ddbaaf68db337e58e012499}{stop::\+\+Criterion\+Factory}} $>$ new\+\_\+stop\+\_\+factory) override
\begin{DoxyCompactList}\small\item\em Sets the stopping criterion of the solver. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Public Member Functions inherited from \doxymbox{\hyperlink{classgko_1_1solver_1_1IterativeBase}{gko::\+solver::\+\+Iterative\+Base}}}
\begin{DoxyCompactItemize}
\item 
std::\+shared\+\_\+ptr$<$ const \doxymbox{\hyperlink{namespacegko_1_1stop_a61839f234ddbaaf68db337e58e012499}{stop::\+\+Criterion\+Factory}} $>$ \doxymbox{\hyperlink{classgko_1_1solver_1_1IterativeBase_a26beb5ec985d883c22b614a8240d981d}{get\+\_\+stop\+\_\+criterion\+\_\+factory}} () const
\begin{DoxyCompactList}\small\item\em Gets the stopping criterion factory of the solver. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Public Member Functions inherited from \doxymbox{\hyperlink{classgko_1_1solver_1_1EnablePreconditionable}{gko::\+solver::\+\+Enable\+Preconditionable$<$ Fcg$<$ default\+\_\+precision $>$ $>$}}}
\begin{DoxyCompactItemize}
\item 
void \doxymbox{\hyperlink{classgko_1_1solver_1_1EnablePreconditionable_ad1f52e213256cd7c50811787dfcf4288}{set\+\_\+preconditioner}} (std::\+shared\+\_\+ptr$<$ const \doxymbox{\hyperlink{classgko_1_1LinOp}{Lin\+Op}} $>$ new\+\_\+precond) override
\begin{DoxyCompactList}\small\item\em Sets the preconditioner operator used by the \doxylink{classgko_1_1Preconditionable}{Preconditionable}. \end{DoxyCompactList}\item 
Enable\+Preconditionable \& {\bfseries operator=} (const Enable\+Preconditionable \&other)
\begin{DoxyCompactList}\small\item\em Creates a shallow copy of the provided preconditioner, clones it onto this executor if executors don\textquotesingle{}t match. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Public Member Functions inherited from \doxymbox{\hyperlink{classgko_1_1Preconditionable}{gko::\+\+Preconditionable}}}
\begin{DoxyCompactItemize}
\item 
virtual std::\+shared\+\_\+ptr$<$ const \doxymbox{\hyperlink{classgko_1_1LinOp}{Lin\+Op}} $>$ \doxymbox{\hyperlink{classgko_1_1Preconditionable_abde941e32b5fc5007a4afe0f6d3fdfbc}{get\+\_\+preconditioner}} () const
\begin{DoxyCompactList}\small\item\em Returns the preconditioner operator used by the \doxylink{classgko_1_1Preconditionable}{Preconditionable}. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsubsection*{Static Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\Hypertarget{classgko_1_1solver_1_1Fcg_a1d60446bc2a5a04a63b3aebaa867b35d}\label{classgko_1_1solver_1_1Fcg_a1d60446bc2a5a04a63b3aebaa867b35d} 
static auto {\bfseries build} () -\/$>$ decltype(\doxymbox{\hyperlink{classgko_1_1EnableDefaultFactory_a1d077101d9e788e6c65f088612d14cc3}{Factory::\+create}}())
\item 
static \doxymbox{\hyperlink{structgko_1_1solver_1_1Fcg_1_1parameters__type}{parameters\+\_\+type}} \doxymbox{\hyperlink{classgko_1_1solver_1_1Fcg_a7dc7979f82c7d84dc6755b7b16111f8e}{parse}} (const \doxymbox{\hyperlink{classgko_1_1config_1_1pnode}{config::\+pnode}} \&config, const \doxymbox{\hyperlink{classgko_1_1config_1_1registry}{config::\+registry}} \&context, const \doxymbox{\hyperlink{classgko_1_1config_1_1type__descriptor}{config::\+type\+\_\+descriptor}} \&td\+\_\+for\+\_\+child=config::\+make\+\_\+type\+\_\+descriptor$<$ Value\+Type $>$())
\begin{DoxyCompactList}\small\item\em Create the parameters from the property\+\_\+tree. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsubsection*{Friends}
\begin{DoxyCompactItemize}
\item 
\Hypertarget{classgko_1_1solver_1_1Fcg_a6bf004d0a3aa4e0763da2c239ffd4d67}\label{classgko_1_1solver_1_1Fcg_a6bf004d0a3aa4e0763da2c239ffd4d67} 
class {\bfseries Enable\+Lin\+Op$<$ Fcg $>$}
\item 
\Hypertarget{classgko_1_1solver_1_1Fcg_a5f1e6df5b9f436dafaf1d60c6005a8be}\label{classgko_1_1solver_1_1Fcg_a5f1e6df5b9f436dafaf1d60c6005a8be} 
class {\bfseries Enable\+Polymorphic\+Object$<$ Fcg, Lin\+Op $>$}
\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}
\subsubsection*{template$<$typename Value\+Type = default\+\_\+precision$>$\newline
class gko::\+solver::\+\+Fcg$<$ Value\+Type $>$}
FCG or the flexible conjugate gradient method is an iterative type Krylov subspace method which is suitable for symmetric positive definite methods. 

Though this method performs very well for symmetric positive definite matrices, it is in general not suitable for general matrices.

In contrast to the standard CG based on the Polack-\/\+Ribiere formula, the flexible CG uses the Fletcher-\/\+Reeves formula for creating the orthonormal vectors spanning the Krylov subspace. This increases the computational cost of every Krylov solver iteration but allows for non-\/constant preconditioners.

The implementation in Ginkgo makes use of the merged kernel to make the best use of data locality. The inner operations in one iteration of FCG are merged into 2 separate steps.


\begin{DoxyTemplParams}{Template Parameters}
{\em Value\+Type} & precision of matrix elements \\
\hline
\end{DoxyTemplParams}


\label{doc-func-members}
\Hypertarget{classgko_1_1solver_1_1Fcg_doc-func-members}
\doxysubsection{Member Function Documentation}
\Hypertarget{classgko_1_1solver_1_1Fcg_ae1caa80eed7b3e8761e577c7623518fc}\index{gko::solver::Fcg$<$ ValueType $>$@{gko::solver::Fcg$<$ ValueType $>$}!apply\_uses\_initial\_guess@{apply\_uses\_initial\_guess}}
\index{apply\_uses\_initial\_guess@{apply\_uses\_initial\_guess}!gko::solver::Fcg$<$ ValueType $>$@{gko::solver::Fcg$<$ ValueType $>$}}
\doxysubsubsection{\texorpdfstring{apply\_uses\_initial\_guess()}{apply\_uses\_initial\_guess()}}
{\footnotesize\ttfamily \label{classgko_1_1solver_1_1Fcg_ae1caa80eed7b3e8761e577c7623518fc} 
template$<$typename Value\+Type = default\+\_\+precision$>$ \\
bool \doxymbox{\hyperlink{classgko_1_1solver_1_1Fcg}{gko::\+solver::\+\+Fcg}}$<$ Value\+Type $>$::\+apply\+\_\+uses\+\_\+initial\+\_\+guess (\begin{DoxyParamCaption}{}{}\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [override]}}



Return true as iterative solvers use the data in x as an initial guess. 

\begin{DoxyReturn}{Returns}
true as iterative solvers use the data in x as an initial guess. 
\end{DoxyReturn}
\Hypertarget{classgko_1_1solver_1_1Fcg_a7dbdbeedd5a1fccc68e92a98b838166d}\index{gko::solver::Fcg$<$ ValueType $>$@{gko::solver::Fcg$<$ ValueType $>$}!conj\_transpose@{conj\_transpose}}
\index{conj\_transpose@{conj\_transpose}!gko::solver::Fcg$<$ ValueType $>$@{gko::solver::Fcg$<$ ValueType $>$}}
\doxysubsubsection{\texorpdfstring{conj\_transpose()}{conj\_transpose()}}
{\footnotesize\ttfamily \label{classgko_1_1solver_1_1Fcg_a7dbdbeedd5a1fccc68e92a98b838166d} 
template$<$typename Value\+Type = default\+\_\+precision$>$ \\
std::\+unique\+\_\+ptr$<$ \doxymbox{\hyperlink{classgko_1_1LinOp}{Lin\+Op}} $>$ \doxymbox{\hyperlink{classgko_1_1solver_1_1Fcg}{gko::\+solver::\+\+Fcg}}$<$ Value\+Type $>$::\+conj\+\_\+transpose (\begin{DoxyParamCaption}{}{}\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [override]}, {\ttfamily [virtual]}}



Returns a \doxylink{classgko_1_1LinOp}{Lin\+Op} representing the conjugate transpose of the \doxylink{classgko_1_1Transposable}{Transposable} object. 

\begin{DoxyReturn}{Returns}
a pointer to the new conjugate transposed object 
\end{DoxyReturn}


Implements \doxymbox{\hyperlink{classgko_1_1Transposable_a7c230aacdb222f09ba49baf0bd9e82eb}{gko::\+\+Transposable}}.

\Hypertarget{classgko_1_1solver_1_1Fcg_a7dc7979f82c7d84dc6755b7b16111f8e}\index{gko::solver::Fcg$<$ ValueType $>$@{gko::solver::Fcg$<$ ValueType $>$}!parse@{parse}}
\index{parse@{parse}!gko::solver::Fcg$<$ ValueType $>$@{gko::solver::Fcg$<$ ValueType $>$}}
\doxysubsubsection{\texorpdfstring{parse()}{parse()}}
{\footnotesize\ttfamily \label{classgko_1_1solver_1_1Fcg_a7dc7979f82c7d84dc6755b7b16111f8e} 
template$<$typename Value\+Type = default\+\_\+precision$>$ \\
\doxymbox{\hyperlink{structgko_1_1solver_1_1Fcg_1_1parameters__type}{parameters\+\_\+type}} \doxymbox{\hyperlink{classgko_1_1solver_1_1Fcg}{gko::\+solver::\+\+Fcg}}$<$ Value\+Type $>$::\+parse (\begin{DoxyParamCaption}\item[{const \doxymbox{\hyperlink{classgko_1_1config_1_1pnode}{config::\+pnode}} \&}]{config}{, }\item[{const \doxymbox{\hyperlink{classgko_1_1config_1_1registry}{config::\+registry}} \&}]{context}{, }\item[{const \doxymbox{\hyperlink{classgko_1_1config_1_1type__descriptor}{config::\+type\+\_\+descriptor}} \&}]{td\+\_\+for\+\_\+child}{ = {\ttfamily config:\+:\+make\+\_\+type\+\_\+descriptor$<$~ValueType~$>$()}}\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}



Create the parameters from the property\+\_\+tree. 

Because this is directly tied to the specific type, the value/\+index type settings within config are ignored and type\+\_\+descriptor is only used for children configs.


\begin{DoxyParams}{Parameters}
{\em config} & the property tree for setting \\
\hline
{\em context} & the registry \\
\hline
{\em td\+\_\+for\+\_\+child} & the type descriptor for children configs. The default uses the value type of this class.\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
parameters 
\end{DoxyReturn}
\Hypertarget{classgko_1_1solver_1_1Fcg_a2d8092247167dc5e583b00e306497f8a}\index{gko::solver::Fcg$<$ ValueType $>$@{gko::solver::Fcg$<$ ValueType $>$}!transpose@{transpose}}
\index{transpose@{transpose}!gko::solver::Fcg$<$ ValueType $>$@{gko::solver::Fcg$<$ ValueType $>$}}
\doxysubsubsection{\texorpdfstring{transpose()}{transpose()}}
{\footnotesize\ttfamily \label{classgko_1_1solver_1_1Fcg_a2d8092247167dc5e583b00e306497f8a} 
template$<$typename Value\+Type = default\+\_\+precision$>$ \\
std::\+unique\+\_\+ptr$<$ \doxymbox{\hyperlink{classgko_1_1LinOp}{Lin\+Op}} $>$ \doxymbox{\hyperlink{classgko_1_1solver_1_1Fcg}{gko::\+solver::\+\+Fcg}}$<$ Value\+Type $>$::\+transpose (\begin{DoxyParamCaption}{}{}\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [override]}, {\ttfamily [virtual]}}



Returns a \doxylink{classgko_1_1LinOp}{Lin\+Op} representing the transpose of the \doxylink{classgko_1_1Transposable}{Transposable} object. 

\begin{DoxyReturn}{Returns}
a pointer to the new transposed object 
\end{DoxyReturn}


Implements \doxymbox{\hyperlink{classgko_1_1Transposable_adf04fdf2ed79b117edbef42520bfe8fa}{gko::\+\+Transposable}}.



The documentation for this class was generated from the following file:\+\begin{DoxyCompactItemize}
\item 
ginkgo/\+core/\+solver/\+fcg.\+hpp\end{DoxyCompactItemize}
