\doxysection{rcm.\+hpp}
\hypertarget{rcm_8hpp_source}{}\label{rcm_8hpp_source}\index{ginkgo/core/reorder/rcm.hpp@{ginkgo/core/reorder/rcm.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\_REORDER\_RCM\_HPP\_}}
\DoxyCodeLine{00006\ \textcolor{preprocessor}{\#define\ GKO\_PUBLIC\_CORE\_REORDER\_RCM\_HPP\_}}
\DoxyCodeLine{00007\ }
\DoxyCodeLine{00008\ }
\DoxyCodeLine{00009\ \textcolor{preprocessor}{\#include\ <memory>}}
\DoxyCodeLine{00010\ }
\DoxyCodeLine{00011\ \textcolor{preprocessor}{\#include\ <ginkgo/core/base/abstract\_factory.hpp>}}
\DoxyCodeLine{00012\ \textcolor{preprocessor}{\#include\ <ginkgo/core/base/array.hpp>}}
\DoxyCodeLine{00013\ \textcolor{preprocessor}{\#include\ <ginkgo/core/base/dim.hpp>}}
\DoxyCodeLine{00014\ \textcolor{preprocessor}{\#include\ <ginkgo/core/base/lin\_op.hpp>}}
\DoxyCodeLine{00015\ \textcolor{preprocessor}{\#include\ <ginkgo/core/base/polymorphic\_object.hpp>}}
\DoxyCodeLine{00016\ \textcolor{preprocessor}{\#include\ <ginkgo/core/base/types.hpp>}}
\DoxyCodeLine{00017\ \textcolor{preprocessor}{\#include\ <ginkgo/core/base/utils.hpp>}}
\DoxyCodeLine{00018\ \textcolor{preprocessor}{\#include\ <ginkgo/core/matrix/csr.hpp>}}
\DoxyCodeLine{00019\ \textcolor{preprocessor}{\#include\ <ginkgo/core/matrix/identity.hpp>}}
\DoxyCodeLine{00020\ \textcolor{preprocessor}{\#include\ <ginkgo/core/matrix/permutation.hpp>}}
\DoxyCodeLine{00021\ \textcolor{preprocessor}{\#include\ <ginkgo/core/matrix/sparsity\_csr.hpp>}}
\DoxyCodeLine{00022\ \textcolor{preprocessor}{\#include\ <ginkgo/core/reorder/reordering\_base.hpp>}}
\DoxyCodeLine{00023\ }
\DoxyCodeLine{00024\ }
\DoxyCodeLine{00025\ \textcolor{keyword}{namespace\ }\doxymbox{\hyperlink{namespacegko}{gko}}\ \{}
\DoxyCodeLine{00031\ \textcolor{keyword}{namespace\ }\doxymbox{\hyperlink{namespacegko_1_1reorder}{reorder}}\ \{}
\DoxyCodeLine{00032\ }
\DoxyCodeLine{00033\ }
\DoxyCodeLine{00034\ \textcolor{keyword}{enum\ class}\ starting\_strategy\ \{\ minimum\_degree,\ pseudo\_peripheral\ \};}
\DoxyCodeLine{00035\ }
\DoxyCodeLine{00036\ }
\DoxyCodeLine{00070\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ ValueType\ =\ default\_precision,\ \textcolor{keyword}{typename}\ IndexType\ =\ \textcolor{keywordtype}{int}32>}
\DoxyCodeLine{00071\ \textcolor{keyword}{class\ }Rcm\ :\ \textcolor{keyword}{public}\ \doxymbox{\hyperlink{classgko_1_1EnablePolymorphicObject}{EnablePolymorphicObject}}<Rcm<ValueType,\ IndexType>,}
\DoxyCodeLine{00072\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ReorderingBase<IndexType>>,}
\DoxyCodeLine{00073\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{public}\ \doxymbox{\hyperlink{classgko_1_1EnablePolymorphicAssignment}{EnablePolymorphicAssignment}}<Rcm<ValueType,\ IndexType>>\ \{}
\DoxyCodeLine{00074\ \ \ \ \ \textcolor{keyword}{friend}\ \textcolor{keyword}{class\ }\doxymbox{\hyperlink{classgko_1_1EnablePolymorphicObject}{EnablePolymorphicObject}}<Rcm,\ \doxymbox{\hyperlink{classgko_1_1reorder_1_1ReorderingBase}{ReorderingBase}}<IndexType>>;}
\DoxyCodeLine{00075\ \ \ \ \ GKO\_ASSERT\_SUPPORTED\_VALUE\_AND\_INDEX\_TYPE;}
\DoxyCodeLine{00076\ }
\DoxyCodeLine{00077\ \textcolor{keyword}{public}:}
\DoxyCodeLine{00078\ \ \ \ \ \textcolor{keyword}{using\ }SparsityMatrix\ =\ \doxymbox{\hyperlink{classgko_1_1matrix_1_1SparsityCsr}{matrix::SparsityCsr<ValueType,\ IndexType>}};}
\DoxyCodeLine{00079\ \ \ \ \ \textcolor{keyword}{using\ }PermutationMatrix\ =\ \doxymbox{\hyperlink{classgko_1_1matrix_1_1Permutation}{matrix::Permutation<IndexType>}};}
\DoxyCodeLine{00080\ \ \ \ \ \textcolor{keyword}{using\ }value\_type\ =\ ValueType;}
\DoxyCodeLine{00081\ \ \ \ \ \textcolor{keyword}{using\ }index\_type\ =\ IndexType;}
\DoxyCodeLine{00082\ }
\DoxyCodeLine{00089\ \ \ \ \ std::shared\_ptr<const\ PermutationMatrix>\ \doxymbox{\hyperlink{classgko_1_1reorder_1_1Rcm_a618eae188e134f667fca188b0438293e}{get\_permutation}}()\textcolor{keyword}{\ const}}
\DoxyCodeLine{00090\ \textcolor{keyword}{\ \ \ \ }\{}
\DoxyCodeLine{00091\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ permutation\_;}
\DoxyCodeLine{00092\ \ \ \ \ \}}
\DoxyCodeLine{00093\ }
\DoxyCodeLine{00100\ \ \ \ \ std::shared\_ptr<const\ PermutationMatrix>\ \doxymbox{\hyperlink{classgko_1_1reorder_1_1Rcm_a328fd3080bb7dd044dd4017403545f34}{get\_inverse\_permutation}}()\textcolor{keyword}{\ const}}
\DoxyCodeLine{00101\ \textcolor{keyword}{\ \ \ \ }\{}
\DoxyCodeLine{00102\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ inv\_permutation\_;}
\DoxyCodeLine{00103\ \ \ \ \ \}}
\DoxyCodeLine{00104\ }
\DoxyCodeLine{00105\ \ \ \ \ \textcolor{comment}{/*const\ array<index\_type>\&\ get\_permutation\_array()\ const\ override}}
\DoxyCodeLine{00106\ \textcolor{comment}{\ \ \ \ \{}}
\DoxyCodeLine{00107\ \textcolor{comment}{\ \ \ \ \ \ \ \ return\ permutation\_array\_;}}
\DoxyCodeLine{00108\ \textcolor{comment}{\ \ \ \ \}*/}}
\DoxyCodeLine{00109\ }
\DoxyCodeLine{00110\ \ \ \ \ \doxymbox{\hyperlink{group__LinOp_ga1fc8e9d8be0c9ad2d72bc1ddfc6d8358}{GKO\_CREATE\_FACTORY\_PARAMETERS}}(parameters,\ \doxymbox{\hyperlink{classgko_1_1reorder_1_1Rcm_1_1Factory}{Factory}})}
\DoxyCodeLine{00111\ \ \ \ \ \{}
\DoxyCodeLine{00116\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{bool}\ \doxymbox{\hyperlink{group__LinOp_ga49d4c09c39f06b22bebbbfd1d8bfe450}{GKO\_FACTORY\_PARAMETER\_SCALAR}}(\doxymbox{\hyperlink{structgko_1_1reorder_1_1Rcm_1_1parameters__type_a4c30f0388851e1dc03a7bf0d243fae24}{construct\_inverse\_permutation}},\ \textcolor{keyword}{false});}
\DoxyCodeLine{00117\ }
\DoxyCodeLine{00122\ \ \ \ \ \ \ \ \ starting\_strategy\ \doxymbox{\hyperlink{group__LinOp_ga49d4c09c39f06b22bebbbfd1d8bfe450}{GKO\_FACTORY\_PARAMETER\_SCALAR}}(}
\DoxyCodeLine{00123\ \ \ \ \ \ \ \ \ \ \ \ \ \doxymbox{\hyperlink{structgko_1_1reorder_1_1Rcm_1_1parameters__type_a539aa37eff93671ffaf42f1c9614a563}{strategy}},\ starting\_strategy::pseudo\_peripheral);}
\DoxyCodeLine{00124\ \ \ \ \ \};}
\DoxyCodeLine{00125\ \ \ \ \ GKO\_ENABLE\_REORDERING\_BASE\_FACTORY(Rcm,\ parameters,\ Factory);}
\DoxyCodeLine{00126\ \ \ \ \ \doxymbox{\hyperlink{group__LinOp_ga521f65604cc4cf427dcb2ecfa49b757c}{GKO\_ENABLE\_BUILD\_METHOD}}(Factory);}
\DoxyCodeLine{00127\ }
\DoxyCodeLine{00128\ \textcolor{keyword}{protected}:}
\DoxyCodeLine{00129\ \ \ \ \ \textcolor{keyword}{explicit}\ Rcm(std::shared\_ptr<const\ Executor>\ exec);}
\DoxyCodeLine{00130\ }
\DoxyCodeLine{00131\ \ \ \ \ \textcolor{keyword}{explicit}\ Rcm(\textcolor{keyword}{const}\ Factory*\ factory,\ \textcolor{keyword}{const}\ \doxymbox{\hyperlink{structgko_1_1reorder_1_1ReorderingBaseArgs}{ReorderingBaseArgs}}\&\ args);}
\DoxyCodeLine{00132\ }
\DoxyCodeLine{00133\ \textcolor{keyword}{private}:}
\DoxyCodeLine{00134\ \ \ \ \ std::shared\_ptr<PermutationMatrix>\ permutation\_;}
\DoxyCodeLine{00135\ \ \ \ \ std::shared\_ptr<PermutationMatrix>\ inv\_permutation\_;}
\DoxyCodeLine{00136\ \};}
\DoxyCodeLine{00137\ }
\DoxyCodeLine{00138\ }
\DoxyCodeLine{00139\ \}\ \ \textcolor{comment}{//\ namespace\ reorder}}
\DoxyCodeLine{00140\ }
\DoxyCodeLine{00141\ }
\DoxyCodeLine{00142\ \textcolor{keyword}{namespace\ }experimental\ \{}
\DoxyCodeLine{00143\ \textcolor{keyword}{namespace\ }\doxymbox{\hyperlink{namespacegko_1_1reorder}{reorder}}\ \{}
\DoxyCodeLine{00144\ }
\DoxyCodeLine{00145\ }
\DoxyCodeLine{00146\ \textcolor{keyword}{using\ }rcm\_starting\_strategy\ =\ gko::reorder::starting\_strategy;}
\DoxyCodeLine{00147\ }
\DoxyCodeLine{00148\ }
\DoxyCodeLine{00174\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ IndexType\ =\ \textcolor{keywordtype}{int}32>}
\DoxyCodeLine{00175\ \textcolor{keyword}{class\ }Rcm\ :\ \textcolor{keyword}{public}\ \doxymbox{\hyperlink{classgko_1_1EnablePolymorphicObject}{EnablePolymorphicObject}}<Rcm<IndexType>,\ LinOpFactory>,}
\DoxyCodeLine{00176\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{public}\ \doxymbox{\hyperlink{classgko_1_1EnablePolymorphicAssignment}{EnablePolymorphicAssignment}}<Rcm<IndexType>>\ \{}
\DoxyCodeLine{00177\ \textcolor{keyword}{public}:}
\DoxyCodeLine{00178\ \ \ \ \ \textcolor{keyword}{struct\ }\doxymbox{\hyperlink{structgko_1_1experimental_1_1reorder_1_1Rcm_1_1parameters__type}{parameters\_type}};}
\DoxyCodeLine{00179\ \ \ \ \ \textcolor{keyword}{friend}\ \textcolor{keyword}{class\ }\doxymbox{\hyperlink{classgko_1_1EnablePolymorphicObject}{EnablePolymorphicObject}}<Rcm<IndexType>,\ \doxymbox{\hyperlink{classgko_1_1LinOpFactory}{LinOpFactory}}>;}
\DoxyCodeLine{00180\ \ \ \ \ \textcolor{keyword}{friend}\ \textcolor{keyword}{class\ }\doxymbox{\hyperlink{classgko_1_1enable__parameters__type}{enable\_parameters\_type}}<\doxymbox{\hyperlink{structgko_1_1experimental_1_1reorder_1_1Rcm_1_1parameters__type}{parameters\_type}},\ Rcm<IndexType>>;}
\DoxyCodeLine{00181\ }
\DoxyCodeLine{00182\ \ \ \ \ \textcolor{keyword}{using\ }index\_type\ =\ IndexType;}
\DoxyCodeLine{00183\ \ \ \ \ \textcolor{keyword}{using\ }permutation\_type\ =\ \doxymbox{\hyperlink{classgko_1_1matrix_1_1Permutation}{matrix::Permutation<index\_type>}};}
\DoxyCodeLine{00184\ }
\DoxyCodeLine{00185\ \ \ \ \ \textcolor{keyword}{struct\ }\doxymbox{\hyperlink{structgko_1_1experimental_1_1reorder_1_1Rcm_1_1parameters__type}{parameters\_type}}}
\DoxyCodeLine{00186\ \ \ \ \ \ \ \ \ :\ \textcolor{keyword}{public}\ \doxymbox{\hyperlink{classgko_1_1enable__parameters__type}{enable\_parameters\_type}}<parameters\_type,\ Rcm<IndexType>>\ \{}
\DoxyCodeLine{00191\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{bool}\ \doxymbox{\hyperlink{group__LinOp_ga49d4c09c39f06b22bebbbfd1d8bfe450}{GKO\_FACTORY\_PARAMETER\_SCALAR}}(\doxymbox{\hyperlink{structgko_1_1experimental_1_1reorder_1_1Rcm_1_1parameters__type_a6133aeca5f37998c94fad80670d2a684}{skip\_symmetrize}},\ \textcolor{keyword}{false});}
\DoxyCodeLine{00192\ }
\DoxyCodeLine{00197\ \ \ \ \ \ \ \ \ rcm\_starting\_strategy\ \doxymbox{\hyperlink{group__LinOp_ga49d4c09c39f06b22bebbbfd1d8bfe450}{GKO\_FACTORY\_PARAMETER\_SCALAR}}(}
\DoxyCodeLine{00198\ \ \ \ \ \ \ \ \ \ \ \ \ \doxymbox{\hyperlink{structgko_1_1experimental_1_1reorder_1_1Rcm_1_1parameters__type_abfd39576e4f4effe345936e4197385df}{strategy}},\ rcm\_starting\_strategy::pseudo\_peripheral);}
\DoxyCodeLine{00199\ \ \ \ \ \};}
\DoxyCodeLine{00200\ }
\DoxyCodeLine{00206\ \ \ \ \ \textcolor{keyword}{const}\ \doxymbox{\hyperlink{structgko_1_1experimental_1_1reorder_1_1Rcm_1_1parameters__type}{parameters\_type}}\&\ \doxymbox{\hyperlink{classgko_1_1experimental_1_1reorder_1_1Rcm_a1dc8890f88e6a7786a10ad93d40fb06d}{get\_parameters}}()\ \{\ \textcolor{keywordflow}{return}\ parameters\_;\ \}}
\DoxyCodeLine{00207\ }
\DoxyCodeLine{00215\ \ \ \ \ std::unique\_ptr<permutation\_type>\ \doxymbox{\hyperlink{classgko_1_1experimental_1_1reorder_1_1Rcm_a61b09ab022128e95d197cb536444a6f1}{generate}}(}
\DoxyCodeLine{00216\ \ \ \ \ \ \ \ \ std::shared\_ptr<const\ LinOp>\ system\_matrix)\ \textcolor{keyword}{const};}
\DoxyCodeLine{00217\ }
\DoxyCodeLine{00219\ \ \ \ \ \textcolor{keyword}{static}\ \doxymbox{\hyperlink{structgko_1_1experimental_1_1reorder_1_1Rcm_1_1parameters__type}{parameters\_type}}\ \doxymbox{\hyperlink{classgko_1_1experimental_1_1reorder_1_1Rcm_a6be4bed40dd659bc915f4320c6f1ab81}{build}}()\ \{\ \textcolor{keywordflow}{return}\ \{\};\ \}}
\DoxyCodeLine{00220\ }
\DoxyCodeLine{00221\ \textcolor{keyword}{protected}:}
\DoxyCodeLine{00222\ \ \ \ \ \textcolor{keyword}{explicit}\ \doxymbox{\hyperlink{classgko_1_1experimental_1_1reorder_1_1Rcm}{Rcm}}(std::shared\_ptr<const\ Executor>\ exec,}
\DoxyCodeLine{00223\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{const}\ parameters\_type\&\ params\ =\ \{\});}
\DoxyCodeLine{00224\ }
\DoxyCodeLine{00225\ \ \ \ \ std::unique\_ptr<LinOp>\ generate\_impl(}
\DoxyCodeLine{00226\ \ \ \ \ \ \ \ \ std::shared\_ptr<const\ LinOp>\ system\_matrix)\ \textcolor{keyword}{const\ override};}
\DoxyCodeLine{00227\ }
\DoxyCodeLine{00228\ \ \ \ \ parameters\_type\ parameters\_;}
\DoxyCodeLine{00229\ \};}
\DoxyCodeLine{00230\ }
\DoxyCodeLine{00231\ }
\DoxyCodeLine{00232\ \}\ \ \textcolor{comment}{//\ namespace\ reorder}}
\DoxyCodeLine{00233\ \}\ \ \textcolor{comment}{//\ namespace\ experimental}}
\DoxyCodeLine{00234\ \}\ \ \textcolor{comment}{//\ namespace\ gko}}
\DoxyCodeLine{00235\ }
\DoxyCodeLine{00236\ }
\DoxyCodeLine{00237\ \textcolor{preprocessor}{\#endif\ \ }\textcolor{comment}{//\ GKO\_PUBLIC\_CORE\_REORDER\_RCM\_HPP\_}}

\end{DoxyCode}
