\doxysection{identity.\+hpp}
\hypertarget{identity_8hpp_source}{}\label{identity_8hpp_source}\index{ginkgo/core/matrix/identity.hpp@{ginkgo/core/matrix/identity.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\_MATRIX\_IDENTITY\_HPP\_}}
\DoxyCodeLine{00006\ \textcolor{preprocessor}{\#define\ GKO\_PUBLIC\_CORE\_MATRIX\_IDENTITY\_HPP\_}}
\DoxyCodeLine{00007\ }
\DoxyCodeLine{00008\ }
\DoxyCodeLine{00009\ \textcolor{preprocessor}{\#include\ <ginkgo/core/base/lin\_op.hpp>}}
\DoxyCodeLine{00010\ }
\DoxyCodeLine{00011\ }
\DoxyCodeLine{00012\ \textcolor{keyword}{namespace\ }\doxymbox{\hyperlink{namespacegko}{gko}}\ \{}
\DoxyCodeLine{00013\ \textcolor{keyword}{namespace\ }\doxymbox{\hyperlink{namespacegko_1_1matrix}{matrix}}\ \{}
\DoxyCodeLine{00014\ }
\DoxyCodeLine{00015\ }
\DoxyCodeLine{00034\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ ValueType\ =\ default\_precision>}
\DoxyCodeLine{00035\ \textcolor{keyword}{class\ }Identity\ :\ \textcolor{keyword}{public}\ \doxymbox{\hyperlink{classgko_1_1EnableLinOp}{EnableLinOp}}<Identity<ValueType>>,\ \textcolor{keyword}{public}\ \doxymbox{\hyperlink{classgko_1_1Transposable}{Transposable}}\ \{}
\DoxyCodeLine{00036\ \ \ \ \ \textcolor{keyword}{friend}\ \textcolor{keyword}{class\ }\doxymbox{\hyperlink{classgko_1_1EnablePolymorphicObject}{EnablePolymorphicObject}}<Identity,\ \doxymbox{\hyperlink{classgko_1_1LinOp}{LinOp}}>;}
\DoxyCodeLine{00037\ \ \ \ \ GKO\_ASSERT\_SUPPORTED\_VALUE\_TYPE;}
\DoxyCodeLine{00038\ }
\DoxyCodeLine{00039\ \textcolor{keyword}{public}:}
\DoxyCodeLine{00040\ \ \ \ \ \textcolor{keyword}{using\ }\doxymbox{\hyperlink{classgko_1_1EnableLinOp}{EnableLinOp}}<Identity>::convert\_to;}
\DoxyCodeLine{00041\ \ \ \ \ \textcolor{keyword}{using\ }\doxymbox{\hyperlink{classgko_1_1EnableLinOp}{EnableLinOp}}<Identity>::move\_to;}
\DoxyCodeLine{00042\ }
\DoxyCodeLine{00043\ \ \ \ \ \textcolor{keyword}{using\ }value\_type\ =\ ValueType;}
\DoxyCodeLine{00044\ \ \ \ \ \textcolor{keyword}{using\ }transposed\_type\ =\ Identity<ValueType>;}
\DoxyCodeLine{00045\ }
\DoxyCodeLine{00046\ \ \ \ \ std::unique\_ptr<LinOp>\ \doxymbox{\hyperlink{classgko_1_1matrix_1_1Identity_ab8e03f1121e194c79b82bb98e15ea03f}{transpose}}()\ \textcolor{keyword}{const\ override};}
\DoxyCodeLine{00047\ }
\DoxyCodeLine{00048\ \ \ \ \ std::unique\_ptr<LinOp>\ \doxymbox{\hyperlink{classgko_1_1matrix_1_1Identity_a75a54f2d74087e57a275db5605cc7478}{conj\_transpose}}()\ \textcolor{keyword}{const\ override};}
\DoxyCodeLine{00049\ }
\DoxyCodeLine{00055\ \ \ \ \ GKO\_DEPRECATED(\textcolor{stringliteral}{"{}use\ the\ version\ taking\ a\ size\_type\ instead\ of\ dim<2>"{}})}
\DoxyCodeLine{00056\ \ \ \ \ static\ \doxymbox{\hyperlink{namespacestd}{std}}::unique\_ptr<Identity>\ \doxymbox{\hyperlink{classgko_1_1matrix_1_1Identity_a55417b971157946c8f5f4f8d30b11aba}{create}}(}
\DoxyCodeLine{00057\ \ \ \ \ \ \ \ \ \doxymbox{\hyperlink{namespacestd}{std}}::shared\_ptr<const\ \doxymbox{\hyperlink{classgko_1_1Executor}{Executor}}>\ exec,\ \doxymbox{\hyperlink{structgko_1_1dim}{dim}}<2>\ size);}
\DoxyCodeLine{00058\ }
\DoxyCodeLine{00064\ \ \ \ \ static\ \doxymbox{\hyperlink{namespacestd}{std}}::unique\_ptr<Identity>\ \doxymbox{\hyperlink{classgko_1_1matrix_1_1Identity_a55417b971157946c8f5f4f8d30b11aba}{create}}(}
\DoxyCodeLine{00065\ \ \ \ \ \ \ \ \ \doxymbox{\hyperlink{namespacestd}{std}}::shared\_ptr<const\ \doxymbox{\hyperlink{classgko_1_1Executor}{Executor}}>\ exec,\ \doxymbox{\hyperlink{namespacegko_a9579c98b1d85bf4ad02d7cb5b96fc771}{size\_type}}\ size\ =\ 0);}
\DoxyCodeLine{00066\ }
\DoxyCodeLine{00067\ protected:}
\DoxyCodeLine{00068\ \ \ \ \ explicit\ Identity(\doxymbox{\hyperlink{namespacestd}{std}}::shared\_ptr<const\ \doxymbox{\hyperlink{classgko_1_1Executor}{Executor}}>\ exec,\ \doxymbox{\hyperlink{namespacegko_a9579c98b1d85bf4ad02d7cb5b96fc771}{size\_type}}\ size\ =\ 0);}
\DoxyCodeLine{00069\ }
\DoxyCodeLine{00070\ \ \ \ \ \textcolor{keywordtype}{void}\ apply\_impl(const\ \doxymbox{\hyperlink{classgko_1_1LinOp}{LinOp}}*\ b,\ \doxymbox{\hyperlink{classgko_1_1LinOp}{LinOp}}*\ x)\ const\ override;}
\DoxyCodeLine{00071\ }
\DoxyCodeLine{00072\ \ \ \ \ \textcolor{keywordtype}{void}\ apply\_impl(const\ \doxymbox{\hyperlink{classgko_1_1LinOp}{LinOp}}*\ alpha,\ const\ \doxymbox{\hyperlink{classgko_1_1LinOp}{LinOp}}*\ b,\ const\ \doxymbox{\hyperlink{classgko_1_1LinOp}{LinOp}}*\ beta,}
\DoxyCodeLine{00073\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \doxymbox{\hyperlink{classgko_1_1LinOp}{LinOp}}*\ x)\ const\ override;}
\DoxyCodeLine{00074\ \};}
\DoxyCodeLine{00075\ }
\DoxyCodeLine{00076\ }
\DoxyCodeLine{00089\ template\ <typename\ ValueType\ =\ \doxymbox{\hyperlink{namespacegko_a89637c833af7ae805802226d97cebebf}{default\_precision}}>}
\DoxyCodeLine{00090\ class\ IdentityFactory}
\DoxyCodeLine{00091\ \ \ \ \ :\ public\ \doxymbox{\hyperlink{classgko_1_1EnablePolymorphicObject}{EnablePolymorphicObject}}<IdentityFactory<ValueType>,\ \doxymbox{\hyperlink{classgko_1_1LinOpFactory}{LinOpFactory}}>\ \{}
\DoxyCodeLine{00092\ \ \ \ \ \textcolor{keyword}{friend}\ \textcolor{keyword}{class\ }\doxymbox{\hyperlink{classgko_1_1EnablePolymorphicObject}{EnablePolymorphicObject}}<IdentityFactory,\ \doxymbox{\hyperlink{classgko_1_1LinOpFactory}{LinOpFactory}}>;}
\DoxyCodeLine{00093\ }
\DoxyCodeLine{00094\ \textcolor{keyword}{public}:}
\DoxyCodeLine{00095\ \ \ \ \ \textcolor{keyword}{using\ }value\_type\ =\ ValueType;}
\DoxyCodeLine{00096\ }
\DoxyCodeLine{00104\ \ \ \ \ \textcolor{keyword}{static}\ std::unique\_ptr<IdentityFactory>\ \doxymbox{\hyperlink{classgko_1_1matrix_1_1IdentityFactory_a3cb03d8ebb85217d5eaa0b2f1ce812ef}{create}}(}
\DoxyCodeLine{00105\ \ \ \ \ \ \ \ \ std::shared\_ptr<const\ Executor>\ exec)}
\DoxyCodeLine{00106\ \ \ \ \ \{}
\DoxyCodeLine{00107\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ std::unique\_ptr<IdentityFactory>(}
\DoxyCodeLine{00108\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{new}\ IdentityFactory(std::move(exec)));}
\DoxyCodeLine{00109\ \ \ \ \ \}}
\DoxyCodeLine{00110\ }
\DoxyCodeLine{00111\ \textcolor{keyword}{protected}:}
\DoxyCodeLine{00112\ \ \ \ \ std::unique\_ptr<LinOp>\ generate\_impl(}
\DoxyCodeLine{00113\ \ \ \ \ \ \ \ \ std::shared\_ptr<const\ LinOp>\ base)\ \textcolor{keyword}{const\ override};}
\DoxyCodeLine{00114\ }
\DoxyCodeLine{00115\ \ \ \ \ \doxymbox{\hyperlink{classgko_1_1matrix_1_1IdentityFactory}{IdentityFactory}}(std::shared\_ptr<const\ Executor>\ exec)}
\DoxyCodeLine{00116\ \ \ \ \ \ \ \ \ :\ \doxymbox{\hyperlink{classgko_1_1EnablePolymorphicObject}{EnablePolymorphicObject}}<\doxymbox{\hyperlink{classgko_1_1matrix_1_1IdentityFactory}{IdentityFactory}},\ \doxymbox{\hyperlink{classgko_1_1LinOpFactory}{LinOpFactory}}>(exec)}
\DoxyCodeLine{00117\ \ \ \ \ \{\}}
\DoxyCodeLine{00118\ \};}
\DoxyCodeLine{00119\ }
\DoxyCodeLine{00120\ }
\DoxyCodeLine{00121\ \}\ \ \textcolor{comment}{//\ namespace\ matrix}}
\DoxyCodeLine{00122\ \}\ \ \textcolor{comment}{//\ namespace\ gko}}
\DoxyCodeLine{00123\ }
\DoxyCodeLine{00124\ }
\DoxyCodeLine{00125\ \textcolor{preprocessor}{\#endif\ \ }\textcolor{comment}{//\ GKO\_PUBLIC\_CORE\_MATRIX\_IDENTITY\_HPP\_}}

\end{DoxyCode}
