\doxysection{array.\+hpp}
\hypertarget{array_8hpp_source}{}\label{array_8hpp_source}\index{ginkgo/core/base/array.hpp@{ginkgo/core/base/array.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\_BASE\_ARRAY\_HPP\_}}
\DoxyCodeLine{00006\ \textcolor{preprocessor}{\#define\ GKO\_PUBLIC\_CORE\_BASE\_ARRAY\_HPP\_}}
\DoxyCodeLine{00007\ }
\DoxyCodeLine{00008\ }
\DoxyCodeLine{00009\ \textcolor{preprocessor}{\#include\ <algorithm>}}
\DoxyCodeLine{00010\ \textcolor{preprocessor}{\#include\ <iterator>}}
\DoxyCodeLine{00011\ \textcolor{preprocessor}{\#include\ <memory>}}
\DoxyCodeLine{00012\ \textcolor{preprocessor}{\#include\ <type\_traits>}}
\DoxyCodeLine{00013\ \textcolor{preprocessor}{\#include\ <utility>}}
\DoxyCodeLine{00014\ }
\DoxyCodeLine{00015\ \textcolor{preprocessor}{\#include\ <ginkgo/core/base/exception.hpp>}}
\DoxyCodeLine{00016\ \textcolor{preprocessor}{\#include\ <ginkgo/core/base/exception\_helpers.hpp>}}
\DoxyCodeLine{00017\ \textcolor{preprocessor}{\#include\ <ginkgo/core/base/executor.hpp>}}
\DoxyCodeLine{00018\ \textcolor{preprocessor}{\#include\ <ginkgo/core/base/types.hpp>}}
\DoxyCodeLine{00019\ \textcolor{preprocessor}{\#include\ <ginkgo/core/base/utils.hpp>}}
\DoxyCodeLine{00020\ }
\DoxyCodeLine{00021\ }
\DoxyCodeLine{00022\ \textcolor{keyword}{namespace\ }\doxymbox{\hyperlink{namespacegko}{gko}}\ \{}
\DoxyCodeLine{00023\ }
\DoxyCodeLine{00024\ }
\DoxyCodeLine{00025\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ ValueType>}
\DoxyCodeLine{00026\ \textcolor{keyword}{class\ }\doxymbox{\hyperlink{classgko_1_1array}{array}};}
\DoxyCodeLine{00027\ }
\DoxyCodeLine{00028\ }
\DoxyCodeLine{00029\ \textcolor{keyword}{namespace\ }detail\ \{}
\DoxyCodeLine{00030\ }
\DoxyCodeLine{00031\ }
\DoxyCodeLine{00038\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ SourceType,\ \textcolor{keyword}{typename}\ TargetType>}
\DoxyCodeLine{00039\ \textcolor{keywordtype}{void}\ convert\_data(std::shared\_ptr<const\ Executor>\ exec,\ \doxymbox{\hyperlink{namespacegko_a9579c98b1d85bf4ad02d7cb5b96fc771}{size\_type}}\ size,}
\DoxyCodeLine{00040\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{const}\ SourceType*\ src,\ TargetType*\ dst);}
\DoxyCodeLine{00041\ }
\DoxyCodeLine{00042\ }
\DoxyCodeLine{00052\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ ValueType>}
\DoxyCodeLine{00053\ \textcolor{keyword}{class\ }const\_array\_view\ \{}
\DoxyCodeLine{00054\ \textcolor{keyword}{public}:}
\DoxyCodeLine{00058\ \ \ \ \ \textcolor{keyword}{using\ }value\_type\ =\ ValueType;}
\DoxyCodeLine{00059\ }
\DoxyCodeLine{00067\ \ \ \ \ const\_array\_view(std::shared\_ptr<const\ Executor>\ exec,\ \doxymbox{\hyperlink{namespacegko_a9579c98b1d85bf4ad02d7cb5b96fc771}{size\_type}}\ size,}
\DoxyCodeLine{00068\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{const}\ ValueType*\ data)}
\DoxyCodeLine{00069\ \ \ \ \ \ \ \ \ :\ exec\_\{std::move(exec)\},\ size\_\{size\},\ data\_\{data\}}
\DoxyCodeLine{00070\ \ \ \ \ \{\}}
\DoxyCodeLine{00071\ }
\DoxyCodeLine{00072\ \ \ \ \ \textcolor{comment}{/*}}
\DoxyCodeLine{00073\ \textcolor{comment}{\ \ \ \ \ *\ To\ avoid\ any\ collisions\ with\ the\ value\ semantics\ of\ normal\ arrays,}}
\DoxyCodeLine{00074\ \textcolor{comment}{\ \ \ \ \ *\ disable\ assignment\ and\ copy-\/construction\ altogether.}}
\DoxyCodeLine{00075\ \textcolor{comment}{\ \ \ \ \ */}}
\DoxyCodeLine{00076\ \ \ \ \ const\_array\_view\&\ operator=(\textcolor{keyword}{const}\ const\_array\_view\&)\ =\ \textcolor{keyword}{delete};}
\DoxyCodeLine{00077\ \ \ \ \ const\_array\_view\&\ operator=(const\_array\_view\&\&)\ =\ \textcolor{keyword}{delete};}
\DoxyCodeLine{00078\ \ \ \ \ const\_array\_view(\textcolor{keyword}{const}\ const\_array\_view\&)\ =\ \textcolor{keyword}{delete};}
\DoxyCodeLine{00079\ \ \ \ \ \textcolor{comment}{/*}}
\DoxyCodeLine{00080\ \textcolor{comment}{\ \ \ \ \ *\ TODO\ C++17:\ delete\ this\ overload\ as\ well,\ it\ is\ no\ longer\ necessary\ due}}
\DoxyCodeLine{00081\ \textcolor{comment}{\ \ \ \ \ *\ to\ guaranteed\ RVO.}}
\DoxyCodeLine{00082\ \textcolor{comment}{\ \ \ \ \ */}}
\DoxyCodeLine{00083\ \ \ \ \ const\_array\_view(const\_array\_view\&\&\ other)}
\DoxyCodeLine{00084\ \ \ \ \ \ \ \ \ :\ const\_array\_view\{other.exec\_,\ other.size\_,\ other.data\_\}}
\DoxyCodeLine{00085\ \ \ \ \ \{}
\DoxyCodeLine{00086\ \ \ \ \ \ \ \ \ other.size\_\ =\ 0;}
\DoxyCodeLine{00087\ \ \ \ \ \ \ \ \ other.data\_\ =\ \textcolor{keyword}{nullptr};}
\DoxyCodeLine{00088\ \ \ \ \ \}}
\DoxyCodeLine{00089\ }
\DoxyCodeLine{00095\ \ \ \ \ \doxymbox{\hyperlink{namespacegko_a9579c98b1d85bf4ad02d7cb5b96fc771}{size\_type}}\ get\_size()\ const\ noexcept\ \{\ \textcolor{keywordflow}{return}\ size\_;\ \}}
\DoxyCodeLine{00096\ }
\DoxyCodeLine{00102\ \ \ \ \ GKO\_DEPRECATED(\textcolor{stringliteral}{"{}use\ get\_size()\ instead"{}})}
\DoxyCodeLine{00103\ \ \ \ \ \doxymbox{\hyperlink{namespacegko_a9579c98b1d85bf4ad02d7cb5b96fc771}{size\_type}}\ get\_num\_elems()\ const\ noexcept\ \{\ \textcolor{keywordflow}{return}\ get\_size();\ \}}
\DoxyCodeLine{00104\ }
\DoxyCodeLine{00110\ \ \ \ \ \textcolor{keyword}{const}\ value\_type*\ get\_const\_data()\ const\ noexcept\ \{\ \textcolor{keywordflow}{return}\ data\_;\ \}}
\DoxyCodeLine{00111\ }
\DoxyCodeLine{00117\ \ \ \ \ std::shared\_ptr<const\ Executor>\ get\_executor()\ const\ noexcept}
\DoxyCodeLine{00118\ \ \ \ \ \{}
\DoxyCodeLine{00119\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ exec\_;}
\DoxyCodeLine{00120\ \ \ \ \ \}}
\DoxyCodeLine{00121\ }
\DoxyCodeLine{00125\ \ \ \ \ \textcolor{keywordtype}{bool}\ is\_owning()\ const\ noexcept\ \{\ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};\ \}}
\DoxyCodeLine{00126\ }
\DoxyCodeLine{00132\ \ \ \ \ \doxymbox{\hyperlink{namespacegko_ae749a5ea11a93c1bcc9158d9a6e9fb68af1f713c9e000f5d3f280adbd124df4f5}{array<ValueType>}}\ copy\_to\_array()\ \textcolor{keyword}{const};}
\DoxyCodeLine{00133\ }
\DoxyCodeLine{00134\ \textcolor{keyword}{private}:}
\DoxyCodeLine{00135\ \ \ \ \ std::shared\_ptr<const\ Executor>\ exec\_;}
\DoxyCodeLine{00136\ \ \ \ \ \doxymbox{\hyperlink{namespacegko_a9579c98b1d85bf4ad02d7cb5b96fc771}{size\_type}}\ size\_;}
\DoxyCodeLine{00137\ \ \ \ \ \textcolor{keyword}{const}\ ValueType*\ data\_;}
\DoxyCodeLine{00138\ \};}
\DoxyCodeLine{00139\ }
\DoxyCodeLine{00140\ }
\DoxyCodeLine{00141\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ ValueType>}
\DoxyCodeLine{00142\ \textcolor{keyword}{using\ }ConstArrayView\ GKO\_DEPRECATED(\textcolor{stringliteral}{"{}please\ use\ const\_array\_view"{}})\ =}
\DoxyCodeLine{00143\ \ \ \ \ const\_array\_view<ValueType>;}
\DoxyCodeLine{00144\ }
\DoxyCodeLine{00145\ }
\DoxyCodeLine{00146\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ ValueType>}
\DoxyCodeLine{00147\ \doxymbox{\hyperlink{namespacegko_ae749a5ea11a93c1bcc9158d9a6e9fb68af1f713c9e000f5d3f280adbd124df4f5}{array<ValueType>}}\ array\_const\_cast(const\_array\_view<ValueType>\ view);}
\DoxyCodeLine{00148\ }
\DoxyCodeLine{00149\ }
\DoxyCodeLine{00150\ \}\ \ \textcolor{comment}{//\ namespace\ detail}}
\DoxyCodeLine{00151\ }
\DoxyCodeLine{00152\ }
\DoxyCodeLine{00165\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ ValueType>}
\DoxyCodeLine{00166\ \textcolor{keyword}{class\ }array\ \{}
\DoxyCodeLine{00167\ \textcolor{keyword}{public}:}
\DoxyCodeLine{00171\ \ \ \ \ \textcolor{keyword}{using\ }\doxymbox{\hyperlink{classgko_1_1array_a9a8aebb3d68396889cf98ca877808549}{value\_type}}\ =\ ValueType;}
\DoxyCodeLine{00172\ }
\DoxyCodeLine{00176\ \ \ \ \ \textcolor{keyword}{using\ }\doxymbox{\hyperlink{classgko_1_1array_a7987c3c644cf27ae9d5dd926e5891f17}{default\_deleter}}\ =\ \doxymbox{\hyperlink{classgko_1_1executor__deleter}{executor\_deleter<value\_type[]>}};}
\DoxyCodeLine{00177\ }
\DoxyCodeLine{00181\ \ \ \ \ \textcolor{keyword}{using\ }\doxymbox{\hyperlink{classgko_1_1array_a377a6aaf5ee6c2747781b889eea6c226}{view\_deleter}}\ =\ \doxymbox{\hyperlink{classgko_1_1null__deleter}{null\_deleter<value\_type[]>}};}
\DoxyCodeLine{00182\ }
\DoxyCodeLine{00196\ \ \ \ \ \doxymbox{\hyperlink{classgko_1_1array_ab96931be7058db223821fa73bcf24a7d}{array}}()\ noexcept}
\DoxyCodeLine{00197\ \ \ \ \ \ \ \ \ :\ size\_(0),\ data\_(\textcolor{keywordtype}{nullptr},\ \doxymbox{\hyperlink{classgko_1_1array_a7987c3c644cf27ae9d5dd926e5891f17}{default\_deleter}}\{\textcolor{keyword}{nullptr}\}),\ exec\_(\textcolor{keyword}{nullptr})}
\DoxyCodeLine{00198\ \ \ \ \ \{\}}
\DoxyCodeLine{00199\ }
\DoxyCodeLine{00205\ \ \ \ \ \textcolor{keyword}{explicit}\ \doxymbox{\hyperlink{classgko_1_1array_a7b0b51262019434e9e4cec51ccec919c}{array}}(std::shared\_ptr<const\ Executor>\ exec)\ noexcept}
\DoxyCodeLine{00206\ \ \ \ \ \ \ \ \ :\ size\_(0),}
\DoxyCodeLine{00207\ \ \ \ \ \ \ \ \ \ \ data\_(\textcolor{keyword}{nullptr},\ \doxymbox{\hyperlink{classgko_1_1array_a7987c3c644cf27ae9d5dd926e5891f17}{default\_deleter}}\{exec\}),}
\DoxyCodeLine{00208\ \ \ \ \ \ \ \ \ \ \ exec\_(std::move(exec))}
\DoxyCodeLine{00209\ \ \ \ \ \{\}}
\DoxyCodeLine{00210\ }
\DoxyCodeLine{00218\ \ \ \ \ \doxymbox{\hyperlink{classgko_1_1array_a9da78040715432ea1f88ec7b2078c215}{array}}(std::shared\_ptr<const\ Executor>\ exec,\ \doxymbox{\hyperlink{namespacegko_a9579c98b1d85bf4ad02d7cb5b96fc771}{size\_type}}\ size)}
\DoxyCodeLine{00219\ \ \ \ \ \ \ \ \ :\ size\_(size),}
\DoxyCodeLine{00220\ \ \ \ \ \ \ \ \ \ \ data\_(nullptr,\ \doxymbox{\hyperlink{classgko_1_1array_a7987c3c644cf27ae9d5dd926e5891f17}{default\_deleter}}\{exec\}),}
\DoxyCodeLine{00221\ \ \ \ \ \ \ \ \ \ \ exec\_(\doxymbox{\hyperlink{namespacestd}{std}}::move(exec))}
\DoxyCodeLine{00222\ \ \ \ \ \{}
\DoxyCodeLine{00223\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (size\ >\ 0)\ \{}
\DoxyCodeLine{00224\ \ \ \ \ \ \ \ \ \ \ \ \ data\_.reset(exec\_-\/>alloc<\doxymbox{\hyperlink{classgko_1_1array_a9a8aebb3d68396889cf98ca877808549}{value\_type}}>(size));}
\DoxyCodeLine{00225\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00226\ \ \ \ \ \}}
\DoxyCodeLine{00227\ }
\DoxyCodeLine{00246\ \ \ \ \ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ DeleterType>}
\DoxyCodeLine{00247\ \ \ \ \ \doxymbox{\hyperlink{classgko_1_1array_a83e140ae0fa8e62cac38a13b0e5ed16a}{array}}(std::shared\_ptr<const\ Executor>\ exec,\ \doxymbox{\hyperlink{namespacegko_a9579c98b1d85bf4ad02d7cb5b96fc771}{size\_type}}\ size,}
\DoxyCodeLine{00248\ \ \ \ \ \ \ \ \ \ \ \doxymbox{\hyperlink{classgko_1_1array_a9a8aebb3d68396889cf98ca877808549}{value\_type}}*\ data,\ DeleterType\ deleter)}
\DoxyCodeLine{00249\ \ \ \ \ \ \ \ \ :\ size\_\{size\},\ data\_(data,\ deleter),\ exec\_\{exec\}}
\DoxyCodeLine{00250\ \ \ \ \ \{\}}
\DoxyCodeLine{00251\ }
\DoxyCodeLine{00262\ \ \ \ \ \doxymbox{\hyperlink{classgko_1_1array_aaf29a7dee071347b3c9f8b73c67473e5}{array}}(std::shared\_ptr<const\ Executor>\ exec,\ \doxymbox{\hyperlink{namespacegko_a9579c98b1d85bf4ad02d7cb5b96fc771}{size\_type}}\ size,}
\DoxyCodeLine{00263\ \ \ \ \ \ \ \ \ \ \ \doxymbox{\hyperlink{classgko_1_1array_a9a8aebb3d68396889cf98ca877808549}{value\_type}}*\ data)}
\DoxyCodeLine{00264\ \ \ \ \ \ \ \ \ :\ array(exec,\ size,\ data,\ \doxymbox{\hyperlink{classgko_1_1array_a7987c3c644cf27ae9d5dd926e5891f17}{default\_deleter}}\{exec\})}
\DoxyCodeLine{00265\ \ \ \ \ \{\}}
\DoxyCodeLine{00266\ }
\DoxyCodeLine{00277\ \ \ \ \ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ RandomAccessIterator>}
\DoxyCodeLine{00278\ \ \ \ \ \doxymbox{\hyperlink{classgko_1_1array_af989e24d7c9a3e5b97b124a7de9f5ceb}{array}}(std::shared\_ptr<const\ Executor>\ exec,\ RandomAccessIterator\ begin,}
\DoxyCodeLine{00279\ \ \ \ \ \ \ \ \ \ \ RandomAccessIterator\ end)}
\DoxyCodeLine{00280\ \ \ \ \ \ \ \ \ :\ array(exec)}
\DoxyCodeLine{00281\ \ \ \ \ \{}
\DoxyCodeLine{00282\ \ \ \ \ \ \ \ \ array\ tmp(exec-\/>get\_master(),\ std::distance(begin,\ end));}
\DoxyCodeLine{00283\ \ \ \ \ \ \ \ \ std::copy(begin,\ end,\ tmp.data\_.get());}
\DoxyCodeLine{00284\ \ \ \ \ \ \ \ \ *\textcolor{keyword}{this}\ =\ std::move(tmp);}
\DoxyCodeLine{00285\ \ \ \ \ \}}
\DoxyCodeLine{00286\ }
\DoxyCodeLine{00297\ \ \ \ \ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00298\ \ \ \ \ \doxymbox{\hyperlink{classgko_1_1array_aed42096c88f3c6ba799968064232314c}{array}}(std::shared\_ptr<const\ Executor>\ exec,}
\DoxyCodeLine{00299\ \ \ \ \ \ \ \ \ \ \ std::initializer\_list<T>\ init\_list)}
\DoxyCodeLine{00300\ \ \ \ \ \ \ \ \ :\ array(exec,\ begin(init\_list),\ end(init\_list))}
\DoxyCodeLine{00301\ \ \ \ \ \{\}}
\DoxyCodeLine{00302\ }
\DoxyCodeLine{00312\ \ \ \ \ \doxymbox{\hyperlink{classgko_1_1array_a5739509a139efee8361781329cde68a0}{array}}(std::shared\_ptr<const\ Executor>\ exec,\ \textcolor{keyword}{const}\ array\&\ other)}
\DoxyCodeLine{00313\ \ \ \ \ \ \ \ \ :\ array(exec)}
\DoxyCodeLine{00314\ \ \ \ \ \{}
\DoxyCodeLine{00315\ \ \ \ \ \ \ \ \ *\textcolor{keyword}{this}\ =\ other;}
\DoxyCodeLine{00316\ \ \ \ \ \}}
\DoxyCodeLine{00317\ }
\DoxyCodeLine{00326\ \ \ \ \ \doxymbox{\hyperlink{classgko_1_1array_af1c0803356eb19bc29414ca9e33269d7}{array}}(\textcolor{keyword}{const}\ array\&\ other)\ :\ array(other.\doxymbox{\hyperlink{classgko_1_1array_a169a0f4e9fc1aa81b8e7fef15de57af7}{get\_executor}}(),\ other)\ \{\}}
\DoxyCodeLine{00327\ }
\DoxyCodeLine{00337\ \ \ \ \ \doxymbox{\hyperlink{classgko_1_1array_aff509e1fb1484b6f52da44baea6ae690}{array}}(std::shared\_ptr<const\ Executor>\ exec,\ array\&\&\ other)\ :\ array(exec)}
\DoxyCodeLine{00338\ \ \ \ \ \{}
\DoxyCodeLine{00339\ \ \ \ \ \ \ \ \ *\textcolor{keyword}{this}\ =\ std::move(other);}
\DoxyCodeLine{00340\ \ \ \ \ \}}
\DoxyCodeLine{00341\ }
\DoxyCodeLine{00350\ \ \ \ \ \doxymbox{\hyperlink{classgko_1_1array_a15c81560d947cec07e9e35f1878ed24e}{array}}(array\&\&\ other)\ :\ array(other.\doxymbox{\hyperlink{classgko_1_1array_a169a0f4e9fc1aa81b8e7fef15de57af7}{get\_executor}}(),\ \doxymbox{\hyperlink{namespacestd}{std}}::move(other))\ \{\}}
\DoxyCodeLine{00351\ }
\DoxyCodeLine{00365\ \ \ \ \ \textcolor{keyword}{static}\ array\ \doxymbox{\hyperlink{classgko_1_1array_aac2a7c2d59045e56fb751b18712a4635}{view}}(std::shared\_ptr<const\ Executor>\ exec,\ \doxymbox{\hyperlink{namespacegko_a9579c98b1d85bf4ad02d7cb5b96fc771}{size\_type}}\ size,}
\DoxyCodeLine{00366\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \doxymbox{\hyperlink{classgko_1_1array_a9a8aebb3d68396889cf98ca877808549}{value\_type}}*\ data)}
\DoxyCodeLine{00367\ \ \ \ \ \{}
\DoxyCodeLine{00368\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ array\{exec,\ size,\ data,\ \doxymbox{\hyperlink{classgko_1_1array_a377a6aaf5ee6c2747781b889eea6c226}{view\_deleter}}\{\}\};}
\DoxyCodeLine{00369\ \ \ \ \ \}}
\DoxyCodeLine{00370\ }
\DoxyCodeLine{00384\ \ \ \ \ \textcolor{keyword}{static}\ detail::const\_array\_view<ValueType>\ \doxymbox{\hyperlink{classgko_1_1array_a5c223b741d704bdef319279caaf54159}{const\_view}}(}
\DoxyCodeLine{00385\ \ \ \ \ \ \ \ \ std::shared\_ptr<const\ Executor>\ exec,\ \doxymbox{\hyperlink{namespacegko_a9579c98b1d85bf4ad02d7cb5b96fc771}{size\_type}}\ size,}
\DoxyCodeLine{00386\ \ \ \ \ \ \ \ \ \textcolor{keyword}{const}\ \doxymbox{\hyperlink{classgko_1_1array_a9a8aebb3d68396889cf98ca877808549}{value\_type}}*\ data)}
\DoxyCodeLine{00387\ \ \ \ \ \{}
\DoxyCodeLine{00388\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \{exec,\ size,\ data\};}
\DoxyCodeLine{00389\ \ \ \ \ \}}
\DoxyCodeLine{00390\ }
\DoxyCodeLine{00395\ \ \ \ \ array<ValueType>\ \doxymbox{\hyperlink{classgko_1_1array_a95c5260cdbaeac6f1abad5f3e0f9f6f2}{as\_view}}()}
\DoxyCodeLine{00396\ \ \ \ \ \{}
\DoxyCodeLine{00397\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \doxymbox{\hyperlink{classgko_1_1array_aac2a7c2d59045e56fb751b18712a4635}{view}}(this-\/>\doxymbox{\hyperlink{classgko_1_1array_a169a0f4e9fc1aa81b8e7fef15de57af7}{get\_executor}}(),\ this-\/>\doxymbox{\hyperlink{classgko_1_1array_ad38e4c252d698a4581ffa0833ab98c3f}{get\_size}}(),\ this-\/>\doxymbox{\hyperlink{classgko_1_1array_a10eab2ea8b6b4efaae84e6a143d61eed}{get\_data}}());}
\DoxyCodeLine{00398\ \ \ \ \ \}}
\DoxyCodeLine{00399\ }
\DoxyCodeLine{00404\ \ \ \ \ detail::const\_array\_view<ValueType>\ \doxymbox{\hyperlink{classgko_1_1array_ab0ba2a19c43e58e52d33fae70b17ed9b}{as\_const\_view}}()\textcolor{keyword}{\ const}}
\DoxyCodeLine{00405\ \textcolor{keyword}{\ \ \ \ }\{}
\DoxyCodeLine{00406\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \doxymbox{\hyperlink{classgko_1_1array_a5c223b741d704bdef319279caaf54159}{const\_view}}(this-\/>\doxymbox{\hyperlink{classgko_1_1array_a169a0f4e9fc1aa81b8e7fef15de57af7}{get\_executor}}(),\ this-\/>\doxymbox{\hyperlink{classgko_1_1array_ad38e4c252d698a4581ffa0833ab98c3f}{get\_size}}(),}
\DoxyCodeLine{00407\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ this-\/>\doxymbox{\hyperlink{classgko_1_1array_a699ce7bef6d2838c8acd10d04f775e2a}{get\_const\_data}}());}
\DoxyCodeLine{00408\ \ \ \ \ \}}
\DoxyCodeLine{00409\ }
\DoxyCodeLine{00426\ \ \ \ \ array\&\ \doxymbox{\hyperlink{classgko_1_1array_ab9656cf55cdab80a0dbeaa74edc50188}{operator=}}(\textcolor{keyword}{const}\ array\&\ other)}
\DoxyCodeLine{00427\ \ \ \ \ \{}
\DoxyCodeLine{00428\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (\&other\ ==\ \textcolor{keyword}{this})\ \{}
\DoxyCodeLine{00429\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ *\textcolor{keyword}{this};}
\DoxyCodeLine{00430\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00431\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (exec\_\ ==\ \textcolor{keyword}{nullptr})\ \{}
\DoxyCodeLine{00432\ \ \ \ \ \ \ \ \ \ \ \ \ exec\_\ =\ other.\doxymbox{\hyperlink{classgko_1_1array_a169a0f4e9fc1aa81b8e7fef15de57af7}{get\_executor}}();}
\DoxyCodeLine{00433\ \ \ \ \ \ \ \ \ \ \ \ \ data\_\ =\ data\_manager\{\textcolor{keyword}{nullptr},\ other.data\_.get\_deleter()\};}
\DoxyCodeLine{00434\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00435\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (other.\doxymbox{\hyperlink{classgko_1_1array_a169a0f4e9fc1aa81b8e7fef15de57af7}{get\_executor}}()\ ==\ \textcolor{keyword}{nullptr})\ \{}
\DoxyCodeLine{00436\ \ \ \ \ \ \ \ \ \ \ \ \ this-\/>\doxymbox{\hyperlink{classgko_1_1array_a38fcf9307191a64064580fba0e32ef68}{clear}}();}
\DoxyCodeLine{00437\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ *\textcolor{keyword}{this};}
\DoxyCodeLine{00438\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00439\ }
\DoxyCodeLine{00440\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (this-\/>\doxymbox{\hyperlink{classgko_1_1array_a6fe24edd5e764e99ba724d8c0398b187}{is\_owning}}())\ \{}
\DoxyCodeLine{00441\ \ \ \ \ \ \ \ \ \ \ \ \ this-\/>\doxymbox{\hyperlink{classgko_1_1array_a085b8df0daa446f48d14c47d1fa49f9e}{resize\_and\_reset}}(other.\doxymbox{\hyperlink{classgko_1_1array_ad38e4c252d698a4581ffa0833ab98c3f}{get\_size}}());}
\DoxyCodeLine{00442\ \ \ \ \ \ \ \ \ \}\ \textcolor{keywordflow}{else}\ \{}
\DoxyCodeLine{00443\ \ \ \ \ \ \ \ \ \ \ \ \ GKO\_ENSURE\_COMPATIBLE\_BOUNDS(other.\doxymbox{\hyperlink{classgko_1_1array_ad38e4c252d698a4581ffa0833ab98c3f}{get\_size}}(),\ this-\/>get\_size());}
\DoxyCodeLine{00444\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00445\ \ \ \ \ \ \ \ \ exec\_-\/>copy\_from(other.\doxymbox{\hyperlink{classgko_1_1array_a169a0f4e9fc1aa81b8e7fef15de57af7}{get\_executor}}(),\ other.\doxymbox{\hyperlink{classgko_1_1array_ad38e4c252d698a4581ffa0833ab98c3f}{get\_size}}(),}
\DoxyCodeLine{00446\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ other.\doxymbox{\hyperlink{classgko_1_1array_a699ce7bef6d2838c8acd10d04f775e2a}{get\_const\_data}}(),\ this-\/>get\_data());}
\DoxyCodeLine{00447\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ *\textcolor{keyword}{this};}
\DoxyCodeLine{00448\ \ \ \ \ \}}
\DoxyCodeLine{00449\ }
\DoxyCodeLine{00479\ \ \ \ \ array\&\ \doxymbox{\hyperlink{classgko_1_1array_a269dec8a0a24895b4dd521036139335d}{operator=}}(array\&\&\ other)}
\DoxyCodeLine{00480\ \ \ \ \ \{}
\DoxyCodeLine{00481\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (\&other\ ==\ \textcolor{keyword}{this})\ \{}
\DoxyCodeLine{00482\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ *\textcolor{keyword}{this};}
\DoxyCodeLine{00483\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00484\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (exec\_\ ==\ \textcolor{keyword}{nullptr})\ \{}
\DoxyCodeLine{00485\ \ \ \ \ \ \ \ \ \ \ \ \ exec\_\ =\ other.get\_executor();}
\DoxyCodeLine{00486\ \ \ \ \ \ \ \ \ \ \ \ \ data\_\ =\ data\_manager\{\textcolor{keyword}{nullptr},\ \doxymbox{\hyperlink{classgko_1_1array_a7987c3c644cf27ae9d5dd926e5891f17}{default\_deleter}}\{exec\_\}\};}
\DoxyCodeLine{00487\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00488\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (other.get\_executor()\ ==\ \textcolor{keyword}{nullptr})\ \{}
\DoxyCodeLine{00489\ \ \ \ \ \ \ \ \ \ \ \ \ this-\/>\doxymbox{\hyperlink{classgko_1_1array_a38fcf9307191a64064580fba0e32ef68}{clear}}();}
\DoxyCodeLine{00490\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ *\textcolor{keyword}{this};}
\DoxyCodeLine{00491\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00492\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (exec\_\ ==\ other.get\_executor())\ \{}
\DoxyCodeLine{00493\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ same\ device,\ only\ move\ the\ pointer}}
\DoxyCodeLine{00494\ \ \ \ \ \ \ \ \ \ \ \ \ data\_\ =\ std::exchange(}
\DoxyCodeLine{00495\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ other.data\_,\ data\_manager\{nullptr,\ default\_deleter\{exec\_\}\});}
\DoxyCodeLine{00496\ \ \ \ \ \ \ \ \ \ \ \ \ size\_\ =\ std::exchange(other.size\_,\ 0);}
\DoxyCodeLine{00497\ \ \ \ \ \ \ \ \ \}\ \textcolor{keywordflow}{else}\ \{}
\DoxyCodeLine{00498\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ different\ device,\ copy\ the\ data}}
\DoxyCodeLine{00499\ \ \ \ \ \ \ \ \ \ \ \ \ *\textcolor{keyword}{this}\ =\ other;}
\DoxyCodeLine{00500\ \ \ \ \ \ \ \ \ \ \ \ \ other.clear();}
\DoxyCodeLine{00501\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00502\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ *\textcolor{keyword}{this};}
\DoxyCodeLine{00503\ \ \ \ \ \}}
\DoxyCodeLine{00504\ }
\DoxyCodeLine{00522\ \ \ \ \ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ OtherValueType>}
\DoxyCodeLine{00523\ \ \ \ \ std::enable\_if\_t<!std::is\_same<ValueType,\ OtherValueType>::value,\ \doxymbox{\hyperlink{classgko_1_1array}{array}}>\&}
\DoxyCodeLine{00524\ \ \ \ \ \doxymbox{\hyperlink{classgko_1_1array_a09e8debb2e05c90e2703a623c19ce978}{operator=}}(\textcolor{keyword}{const}\ array<OtherValueType>\&\ other)}
\DoxyCodeLine{00525\ \ \ \ \ \{}
\DoxyCodeLine{00526\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (this-\/>exec\_\ ==\ \textcolor{keyword}{nullptr})\ \{}
\DoxyCodeLine{00527\ \ \ \ \ \ \ \ \ \ \ \ \ this-\/>exec\_\ =\ other.\doxymbox{\hyperlink{classgko_1_1array_a169a0f4e9fc1aa81b8e7fef15de57af7}{get\_executor}}();}
\DoxyCodeLine{00528\ \ \ \ \ \ \ \ \ \ \ \ \ this-\/>data\_\ =\ data\_manager\{\textcolor{keyword}{nullptr},\ \doxymbox{\hyperlink{classgko_1_1array_a7987c3c644cf27ae9d5dd926e5891f17}{default\_deleter}}\{this-\/>exec\_\}\};}
\DoxyCodeLine{00529\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00530\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (other.\doxymbox{\hyperlink{classgko_1_1array_a169a0f4e9fc1aa81b8e7fef15de57af7}{get\_executor}}()\ ==\ \textcolor{keyword}{nullptr})\ \{}
\DoxyCodeLine{00531\ \ \ \ \ \ \ \ \ \ \ \ \ this-\/>\doxymbox{\hyperlink{classgko_1_1array_a38fcf9307191a64064580fba0e32ef68}{clear}}();}
\DoxyCodeLine{00532\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ *\textcolor{keyword}{this};}
\DoxyCodeLine{00533\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00534\ }
\DoxyCodeLine{00535\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (this-\/>\doxymbox{\hyperlink{classgko_1_1array_a6fe24edd5e764e99ba724d8c0398b187}{is\_owning}}())\ \{}
\DoxyCodeLine{00536\ \ \ \ \ \ \ \ \ \ \ \ \ this-\/>\doxymbox{\hyperlink{classgko_1_1array_a085b8df0daa446f48d14c47d1fa49f9e}{resize\_and\_reset}}(other.\doxymbox{\hyperlink{classgko_1_1array_ad38e4c252d698a4581ffa0833ab98c3f}{get\_size}}());}
\DoxyCodeLine{00537\ \ \ \ \ \ \ \ \ \}\ \textcolor{keywordflow}{else}\ \{}
\DoxyCodeLine{00538\ \ \ \ \ \ \ \ \ \ \ \ \ GKO\_ENSURE\_COMPATIBLE\_BOUNDS(other.\doxymbox{\hyperlink{classgko_1_1array_ad38e4c252d698a4581ffa0833ab98c3f}{get\_size}}(),\ this-\/>get\_size());}
\DoxyCodeLine{00539\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00540\ \ \ \ \ \ \ \ \ array<OtherValueType>\ tmp\{this-\/>exec\_\};}
\DoxyCodeLine{00541\ \ \ \ \ \ \ \ \ \textcolor{keyword}{const}\ OtherValueType*\ source\ =\ other.\doxymbox{\hyperlink{classgko_1_1array_a699ce7bef6d2838c8acd10d04f775e2a}{get\_const\_data}}();}
\DoxyCodeLine{00542\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ if\ we\ are\ on\ different\ executors:\ copy,\ then\ convert}}
\DoxyCodeLine{00543\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (this-\/>exec\_\ !=\ other.\doxymbox{\hyperlink{classgko_1_1array_a169a0f4e9fc1aa81b8e7fef15de57af7}{get\_executor}}())\ \{}
\DoxyCodeLine{00544\ \ \ \ \ \ \ \ \ \ \ \ \ tmp\ =\ other;}
\DoxyCodeLine{00545\ \ \ \ \ \ \ \ \ \ \ \ \ source\ =\ tmp.\doxymbox{\hyperlink{classgko_1_1array_a699ce7bef6d2838c8acd10d04f775e2a}{get\_const\_data}}();}
\DoxyCodeLine{00546\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00547\ \ \ \ \ \ \ \ \ detail::convert\_data(this-\/>exec\_,\ other.\doxymbox{\hyperlink{classgko_1_1array_ad38e4c252d698a4581ffa0833ab98c3f}{get\_size}}(),\ source,}
\DoxyCodeLine{00548\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ this-\/>get\_data());}
\DoxyCodeLine{00549\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ *\textcolor{keyword}{this};}
\DoxyCodeLine{00550\ \ \ \ \ \}}
\DoxyCodeLine{00551\ }
\DoxyCodeLine{00569\ \ \ \ \ array\&\ \doxymbox{\hyperlink{classgko_1_1array_afa269c52f25fb48fa886fdedfd869bea}{operator=}}(\textcolor{keyword}{const}\ detail::const\_array\_view<ValueType>\&\ other)}
\DoxyCodeLine{00570\ \ \ \ \ \{}
\DoxyCodeLine{00571\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (this-\/>exec\_\ ==\ \textcolor{keyword}{nullptr})\ \{}
\DoxyCodeLine{00572\ \ \ \ \ \ \ \ \ \ \ \ \ this-\/>exec\_\ =\ other.get\_executor();}
\DoxyCodeLine{00573\ \ \ \ \ \ \ \ \ \ \ \ \ this-\/>data\_\ =\ data\_manager\{\textcolor{keyword}{nullptr},\ \doxymbox{\hyperlink{classgko_1_1array_a7987c3c644cf27ae9d5dd926e5891f17}{default\_deleter}}\{this-\/>exec\_\}\};}
\DoxyCodeLine{00574\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00575\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (other.get\_executor()\ ==\ \textcolor{keyword}{nullptr})\ \{}
\DoxyCodeLine{00576\ \ \ \ \ \ \ \ \ \ \ \ \ this-\/>\doxymbox{\hyperlink{classgko_1_1array_a38fcf9307191a64064580fba0e32ef68}{clear}}();}
\DoxyCodeLine{00577\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ *\textcolor{keyword}{this};}
\DoxyCodeLine{00578\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00579\ }
\DoxyCodeLine{00580\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (this-\/>\doxymbox{\hyperlink{classgko_1_1array_a6fe24edd5e764e99ba724d8c0398b187}{is\_owning}}())\ \{}
\DoxyCodeLine{00581\ \ \ \ \ \ \ \ \ \ \ \ \ this-\/>\doxymbox{\hyperlink{classgko_1_1array_a085b8df0daa446f48d14c47d1fa49f9e}{resize\_and\_reset}}(other.get\_size());}
\DoxyCodeLine{00582\ \ \ \ \ \ \ \ \ \}\ \textcolor{keywordflow}{else}\ \{}
\DoxyCodeLine{00583\ \ \ \ \ \ \ \ \ \ \ \ \ GKO\_ENSURE\_COMPATIBLE\_BOUNDS(other.get\_size(),\ this-\/>get\_size());}
\DoxyCodeLine{00584\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00585\ \ \ \ \ \ \ \ \ array\ tmp\{this-\/>exec\_\};}
\DoxyCodeLine{00586\ \ \ \ \ \ \ \ \ \textcolor{keyword}{const}\ ValueType*\ source\ =\ other.get\_const\_data();}
\DoxyCodeLine{00587\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ if\ we\ are\ on\ different\ executors:\ copy}}
\DoxyCodeLine{00588\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (this-\/>exec\_\ !=\ other.get\_executor())\ \{}
\DoxyCodeLine{00589\ \ \ \ \ \ \ \ \ \ \ \ \ tmp\ =\ other.copy\_to\_array();}
\DoxyCodeLine{00590\ \ \ \ \ \ \ \ \ \ \ \ \ source\ =\ tmp.\doxymbox{\hyperlink{classgko_1_1array_a699ce7bef6d2838c8acd10d04f775e2a}{get\_const\_data}}();}
\DoxyCodeLine{00591\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00592\ \ \ \ \ \ \ \ \ exec\_-\/>copy\_from(other.get\_executor(),\ other.get\_size(),\ source,}
\DoxyCodeLine{00593\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ this-\/>get\_data());}
\DoxyCodeLine{00594\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ *\textcolor{keyword}{this};}
\DoxyCodeLine{00595\ \ \ \ \ \}}
\DoxyCodeLine{00596\ }
\DoxyCodeLine{00604\ \ \ \ \ \textcolor{keywordtype}{void}\ \doxymbox{\hyperlink{classgko_1_1array_a38fcf9307191a64064580fba0e32ef68}{clear}}()\ noexcept}
\DoxyCodeLine{00605\ \ \ \ \ \{}
\DoxyCodeLine{00606\ \ \ \ \ \ \ \ \ size\_\ =\ 0;}
\DoxyCodeLine{00607\ \ \ \ \ \ \ \ \ data\_.reset(\textcolor{keyword}{nullptr});}
\DoxyCodeLine{00608\ \ \ \ \ \}}
\DoxyCodeLine{00609\ }
\DoxyCodeLine{00622\ \ \ \ \ \textcolor{keywordtype}{void}\ \doxymbox{\hyperlink{classgko_1_1array_a085b8df0daa446f48d14c47d1fa49f9e}{resize\_and\_reset}}(\doxymbox{\hyperlink{namespacegko_a9579c98b1d85bf4ad02d7cb5b96fc771}{size\_type}}\ size)}
\DoxyCodeLine{00623\ \ \ \ \ \{}
\DoxyCodeLine{00624\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (size\ ==\ size\_)\ \{}
\DoxyCodeLine{00625\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return};}
\DoxyCodeLine{00626\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00627\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (exec\_\ ==\ \textcolor{keyword}{nullptr})\ \{}
\DoxyCodeLine{00628\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{throw}\ \doxymbox{\hyperlink{classgko_1_1NotSupported}{gko::NotSupported}}(\_\_FILE\_\_,\ \_\_LINE\_\_,\ \_\_func\_\_,}
\DoxyCodeLine{00629\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{stringliteral}{"{}gko::Executor\ (nullptr)"{}});}
\DoxyCodeLine{00630\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00631\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (!this-\/>\doxymbox{\hyperlink{classgko_1_1array_a6fe24edd5e764e99ba724d8c0398b187}{is\_owning}}())\ \{}
\DoxyCodeLine{00632\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{throw}\ \doxymbox{\hyperlink{classgko_1_1NotSupported}{gko::NotSupported}}(\_\_FILE\_\_,\ \_\_LINE\_\_,\ \_\_func\_\_,}
\DoxyCodeLine{00633\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{stringliteral}{"{}Non\ owning\ gko::array\ cannot\ be\ resized."{}});}
\DoxyCodeLine{00634\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00635\ }
\DoxyCodeLine{00636\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (size\ >\ 0\ \&\&\ this-\/>\doxymbox{\hyperlink{classgko_1_1array_a6fe24edd5e764e99ba724d8c0398b187}{is\_owning}}())\ \{}
\DoxyCodeLine{00637\ \ \ \ \ \ \ \ \ \ \ \ \ size\_\ =\ size;}
\DoxyCodeLine{00638\ \ \ \ \ \ \ \ \ \ \ \ \ data\_.reset(exec\_-\/>alloc<\doxymbox{\hyperlink{classgko_1_1array_a9a8aebb3d68396889cf98ca877808549}{value\_type}}>(size));}
\DoxyCodeLine{00639\ \ \ \ \ \ \ \ \ \}\ \textcolor{keywordflow}{else}\ \{}
\DoxyCodeLine{00640\ \ \ \ \ \ \ \ \ \ \ \ \ this-\/>\doxymbox{\hyperlink{classgko_1_1array_a38fcf9307191a64064580fba0e32ef68}{clear}}();}
\DoxyCodeLine{00641\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00642\ \ \ \ \ \}}
\DoxyCodeLine{00643\ }
\DoxyCodeLine{00649\ \ \ \ \ std::vector<value\_type>\ \doxymbox{\hyperlink{classgko_1_1array_ae5a34914d9d54a6be5008162fb0aa613}{copy\_to\_host}}()\textcolor{keyword}{\ const}}
\DoxyCodeLine{00650\ \textcolor{keyword}{\ \ \ \ }\{}
\DoxyCodeLine{00651\ \ \ \ \ \ \ \ \ std::vector<value\_type>\ result(this-\/>\doxymbox{\hyperlink{classgko_1_1array_ad38e4c252d698a4581ffa0833ab98c3f}{get\_size}}());}
\DoxyCodeLine{00652\ \ \ \ \ \ \ \ \ \textcolor{keyword}{auto}\ \doxymbox{\hyperlink{classgko_1_1array_aac2a7c2d59045e56fb751b18712a4635}{view}}\ =\ \doxymbox{\hyperlink{namespacegko_a752922d291cf7c72e3042cc5b367aa60}{make\_array\_view}}(this-\/>\doxymbox{\hyperlink{classgko_1_1array_a169a0f4e9fc1aa81b8e7fef15de57af7}{get\_executor}}()-\/>get\_master(),}
\DoxyCodeLine{00653\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ this-\/>\doxymbox{\hyperlink{classgko_1_1array_ad38e4c252d698a4581ffa0833ab98c3f}{get\_size}}(),\ result.data());}
\DoxyCodeLine{00654\ \ \ \ \ \ \ \ \ \doxymbox{\hyperlink{classgko_1_1array_aac2a7c2d59045e56fb751b18712a4635}{view}}\ =\ *\textcolor{keyword}{this};}
\DoxyCodeLine{00655\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ result;}
\DoxyCodeLine{00656\ \ \ \ \ \}}
\DoxyCodeLine{00657\ }
\DoxyCodeLine{00663\ \ \ \ \ \textcolor{keywordtype}{void}\ \doxymbox{\hyperlink{classgko_1_1array_a81458893928d0be780235bea675ced6a}{fill}}(\textcolor{keyword}{const}\ \doxymbox{\hyperlink{classgko_1_1array_a9a8aebb3d68396889cf98ca877808549}{value\_type}}\ value);}
\DoxyCodeLine{00664\ }
\DoxyCodeLine{00670\ \ \ \ \ \doxymbox{\hyperlink{namespacegko_a9579c98b1d85bf4ad02d7cb5b96fc771}{size\_type}}\ \doxymbox{\hyperlink{classgko_1_1array_ad38e4c252d698a4581ffa0833ab98c3f}{get\_size}}()\ const\ noexcept\ \{\ \textcolor{keywordflow}{return}\ size\_;\ \}}
\DoxyCodeLine{00671\ }
\DoxyCodeLine{00677\ \ \ \ \ GKO\_DEPRECATED(\textcolor{stringliteral}{"{}use\ get\_size()\ instead"{}})}
\DoxyCodeLine{00678\ \ \ \ \ \doxymbox{\hyperlink{namespacegko_a9579c98b1d85bf4ad02d7cb5b96fc771}{size\_type}}\ \doxymbox{\hyperlink{classgko_1_1array_a9c6a40a8a007af8c6e541fbc030d6291}{get\_num\_elems}}()\ const\ noexcept\ \{\ \textcolor{keywordflow}{return}\ \doxymbox{\hyperlink{classgko_1_1array_ad38e4c252d698a4581ffa0833ab98c3f}{get\_size}}();\ \}}
\DoxyCodeLine{00679\ }
\DoxyCodeLine{00687\ \ \ \ \ \doxymbox{\hyperlink{classgko_1_1array_a9a8aebb3d68396889cf98ca877808549}{value\_type}}*\ \doxymbox{\hyperlink{classgko_1_1array_a10eab2ea8b6b4efaae84e6a143d61eed}{get\_data}}()\ noexcept\ \{\ \textcolor{keywordflow}{return}\ data\_.get();\ \}}
\DoxyCodeLine{00688\ }
\DoxyCodeLine{00696\ \ \ \ \ \textcolor{keyword}{const}\ \doxymbox{\hyperlink{classgko_1_1array_a9a8aebb3d68396889cf98ca877808549}{value\_type}}*\ \doxymbox{\hyperlink{classgko_1_1array_a699ce7bef6d2838c8acd10d04f775e2a}{get\_const\_data}}()\ const\ noexcept\ \{\ \textcolor{keywordflow}{return}\ data\_.get();\ \}}
\DoxyCodeLine{00697\ }
\DoxyCodeLine{00703\ \ \ \ \ std::shared\_ptr<const\ Executor>\ \doxymbox{\hyperlink{classgko_1_1array_a169a0f4e9fc1aa81b8e7fef15de57af7}{get\_executor}}()\ const\ noexcept}
\DoxyCodeLine{00704\ \ \ \ \ \{}
\DoxyCodeLine{00705\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ exec\_;}
\DoxyCodeLine{00706\ \ \ \ \ \}}
\DoxyCodeLine{00707\ }
\DoxyCodeLine{00714\ \ \ \ \ \textcolor{keywordtype}{void}\ \doxymbox{\hyperlink{classgko_1_1array_aba67dcaa3c627446ca187c7a35536cd3}{set\_executor}}(std::shared\_ptr<const\ Executor>\ exec)}
\DoxyCodeLine{00715\ \ \ \ \ \{}
\DoxyCodeLine{00716\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (exec\ ==\ exec\_)\ \{}
\DoxyCodeLine{00717\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ moving\ to\ the\ same\ executor,\ no-\/op}}
\DoxyCodeLine{00718\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return};}
\DoxyCodeLine{00719\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00720\ \ \ \ \ \ \ \ \ array\ tmp(std::move(exec));}
\DoxyCodeLine{00721\ \ \ \ \ \ \ \ \ tmp\ =\ *\textcolor{keyword}{this};}
\DoxyCodeLine{00722\ \ \ \ \ \ \ \ \ exec\_\ =\ std::move(tmp.exec\_);}
\DoxyCodeLine{00723\ \ \ \ \ \ \ \ \ data\_\ =\ std::move(tmp.data\_);}
\DoxyCodeLine{00724\ \ \ \ \ \}}
\DoxyCodeLine{00725\ }
\DoxyCodeLine{00737\ \ \ \ \ \textcolor{keywordtype}{bool}\ \doxymbox{\hyperlink{classgko_1_1array_a6fe24edd5e764e99ba724d8c0398b187}{is\_owning}}()}
\DoxyCodeLine{00738\ \ \ \ \ \{}
\DoxyCodeLine{00739\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ data\_.get\_deleter().target\_type()\ ==\ \textcolor{keyword}{typeid}(\doxymbox{\hyperlink{classgko_1_1array_a7987c3c644cf27ae9d5dd926e5891f17}{default\_deleter}});}
\DoxyCodeLine{00740\ \ \ \ \ \}}
\DoxyCodeLine{00741\ }
\DoxyCodeLine{00742\ }
\DoxyCodeLine{00743\ \textcolor{keyword}{private}:}
\DoxyCodeLine{00744\ \ \ \ \ \textcolor{comment}{//\ Allow\ other\ array\ types\ to\ access\ private\ members}}
\DoxyCodeLine{00745\ \ \ \ \ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ OtherValueType>}
\DoxyCodeLine{00746\ \ \ \ \ \textcolor{keyword}{friend}\ \textcolor{keyword}{class\ }\doxymbox{\hyperlink{classgko_1_1array}{array}};}
\DoxyCodeLine{00747\ }
\DoxyCodeLine{00748\ \ \ \ \ \textcolor{keyword}{using\ }data\_manager\ =}
\DoxyCodeLine{00749\ \ \ \ \ \ \ \ \ std::unique\_ptr<value\_type[],\ std::function<void(value\_type[])>>;}
\DoxyCodeLine{00750\ }
\DoxyCodeLine{00751\ \ \ \ \ \doxymbox{\hyperlink{namespacegko_a9579c98b1d85bf4ad02d7cb5b96fc771}{size\_type}}\ size\_;}
\DoxyCodeLine{00752\ \ \ \ \ data\_manager\ data\_;}
\DoxyCodeLine{00753\ \ \ \ \ std::shared\_ptr<const\ Executor>\ exec\_;}
\DoxyCodeLine{00754\ \};}
\DoxyCodeLine{00755\ }
\DoxyCodeLine{00756\ }
\DoxyCodeLine{00757\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ ValueType>}
\DoxyCodeLine{00758\ \textcolor{keyword}{using\ }Array\ GKO\_DEPRECATED(\textcolor{stringliteral}{"{}please\ use\ array"{}})\ =\ array<ValueType>;}
\DoxyCodeLine{00759\ }
\DoxyCodeLine{00760\ }
\DoxyCodeLine{00771\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ ValueType>}
\DoxyCodeLine{00772\ ValueType\ \doxymbox{\hyperlink{namespacegko_a12e62081e2511f958dc2c9f1cc73c11d}{reduce\_add}}(\textcolor{keyword}{const}\ \doxymbox{\hyperlink{classgko_1_1array}{array<ValueType>}}\&\ input\_arr,}
\DoxyCodeLine{00773\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{const}\ ValueType\ init\_val\ =\ 0);}
\DoxyCodeLine{00774\ }
\DoxyCodeLine{00785\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ ValueType>}
\DoxyCodeLine{00786\ \textcolor{keywordtype}{void}\ \doxymbox{\hyperlink{namespacegko_a12e62081e2511f958dc2c9f1cc73c11d}{reduce\_add}}(\textcolor{keyword}{const}\ \doxymbox{\hyperlink{classgko_1_1array}{array<ValueType>}}\&\ input\_arr,\ \doxymbox{\hyperlink{classgko_1_1array}{array<ValueType>}}\&\ result);}
\DoxyCodeLine{00787\ }
\DoxyCodeLine{00788\ }
\DoxyCodeLine{00800\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ ValueType>}
\DoxyCodeLine{00801\ \doxymbox{\hyperlink{classgko_1_1array}{array<ValueType>}}\ \doxymbox{\hyperlink{namespacegko_a752922d291cf7c72e3042cc5b367aa60}{make\_array\_view}}(std::shared\_ptr<const\ Executor>\ exec,}
\DoxyCodeLine{00802\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \doxymbox{\hyperlink{namespacegko_a9579c98b1d85bf4ad02d7cb5b96fc771}{size\_type}}\ size,\ ValueType*\ data)}
\DoxyCodeLine{00803\ \{}
\DoxyCodeLine{00804\ \ \ \ \ \textcolor{keywordflow}{return}\ \doxymbox{\hyperlink{classgko_1_1array_aac2a7c2d59045e56fb751b18712a4635}{array<ValueType>::view}}(exec,\ size,\ data);}
\DoxyCodeLine{00805\ \}}
\DoxyCodeLine{00806\ }
\DoxyCodeLine{00807\ }
\DoxyCodeLine{00819\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ ValueType>}
\DoxyCodeLine{00820\ detail::const\_array\_view<ValueType>\ \doxymbox{\hyperlink{namespacegko_a5309c321872a54fc9818ed9f5556eef4}{make\_const\_array\_view}}(}
\DoxyCodeLine{00821\ \ \ \ \ std::shared\_ptr<const\ Executor>\ exec,\ \doxymbox{\hyperlink{namespacegko_a9579c98b1d85bf4ad02d7cb5b96fc771}{size\_type}}\ size,\ \textcolor{keyword}{const}\ ValueType*\ data)}
\DoxyCodeLine{00822\ \{}
\DoxyCodeLine{00823\ \ \ \ \ \textcolor{keywordflow}{return}\ \doxymbox{\hyperlink{classgko_1_1array_a5c223b741d704bdef319279caaf54159}{array<ValueType>::const\_view}}(exec,\ size,\ data);}
\DoxyCodeLine{00824\ \}}
\DoxyCodeLine{00825\ }
\DoxyCodeLine{00826\ }
\DoxyCodeLine{00827\ \textcolor{keyword}{namespace\ }detail\ \{}
\DoxyCodeLine{00828\ }
\DoxyCodeLine{00829\ }
\DoxyCodeLine{00830\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00831\ \textcolor{keyword}{struct\ }temporary\_clone\_helper<array<T>>\ \{}
\DoxyCodeLine{00832\ \ \ \ \ \textcolor{keyword}{static}\ std::unique\_ptr<array<T>>\ create(}
\DoxyCodeLine{00833\ \ \ \ \ \ \ \ \ std::shared\_ptr<const\ Executor>\ exec,\ array<T>*\ ptr,\ \textcolor{keywordtype}{bool}\ copy\_data)}
\DoxyCodeLine{00834\ \ \ \ \ \{}
\DoxyCodeLine{00835\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (copy\_data)\ \{}
\DoxyCodeLine{00836\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ std::make\_unique<array<T>>(std::move(exec),\ *ptr);}
\DoxyCodeLine{00837\ \ \ \ \ \ \ \ \ \}\ \textcolor{keywordflow}{else}\ \{}
\DoxyCodeLine{00838\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ std::make\_unique<array<T>>(std::move(exec),\ ptr-\/>get\_size());}
\DoxyCodeLine{00839\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00840\ \ \ \ \ \}}
\DoxyCodeLine{00841\ \};}
\DoxyCodeLine{00842\ }
\DoxyCodeLine{00843\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00844\ \textcolor{keyword}{struct\ }temporary\_clone\_helper<const\ \doxymbox{\hyperlink{namespacegko_ae749a5ea11a93c1bcc9158d9a6e9fb68af1f713c9e000f5d3f280adbd124df4f5}{array}}<T>>\ \{}
\DoxyCodeLine{00845\ \ \ \ \ \textcolor{keyword}{static}\ std::unique\_ptr<const\ array<T>>\ create(}
\DoxyCodeLine{00846\ \ \ \ \ \ \ \ \ std::shared\_ptr<const\ Executor>\ exec,\ \textcolor{keyword}{const}\ array<T>*\ ptr,\ \textcolor{keywordtype}{bool})}
\DoxyCodeLine{00847\ \ \ \ \ \{}
\DoxyCodeLine{00848\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ std::make\_unique<const\ array<T>>(std::move(exec),\ *ptr);}
\DoxyCodeLine{00849\ \ \ \ \ \}}
\DoxyCodeLine{00850\ \};}
\DoxyCodeLine{00851\ }
\DoxyCodeLine{00852\ }
\DoxyCodeLine{00853\ \textcolor{comment}{//\ specialization\ for\ non-\/constant\ arrays,\ copying\ back\ via\ assignment}}
\DoxyCodeLine{00854\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00855\ \textcolor{keyword}{class\ }copy\_back\_deleter<\doxymbox{\hyperlink{namespacegko_ae749a5ea11a93c1bcc9158d9a6e9fb68af1f713c9e000f5d3f280adbd124df4f5}{array}}<T>>}
\DoxyCodeLine{00856\ \ \ \ \ :\ \textcolor{keyword}{public}\ copy\_back\_deleter\_from\_assignment<array<T>>\ \{}
\DoxyCodeLine{00857\ \textcolor{keyword}{public}:}
\DoxyCodeLine{00858\ \ \ \ \ \textcolor{keyword}{using\ }copy\_back\_deleter\_from\_assignment<}
\DoxyCodeLine{00859\ \ \ \ \ \ \ \ \ array<T>>::copy\_back\_deleter\_from\_assignment;}
\DoxyCodeLine{00860\ \};}
\DoxyCodeLine{00861\ }
\DoxyCodeLine{00862\ }
\DoxyCodeLine{00875\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ ValueType>}
\DoxyCodeLine{00876\ array<ValueType>\ array\_const\_cast(const\_array\_view<ValueType>\ view)}
\DoxyCodeLine{00877\ \{}
\DoxyCodeLine{00878\ \ \ \ \ \textcolor{keywordflow}{return}\ array<ValueType>::view(}
\DoxyCodeLine{00879\ \ \ \ \ \ \ \ \ view.get\_executor(),\ view.get\_size(),}
\DoxyCodeLine{00880\ \ \ \ \ \ \ \ \ \textcolor{keyword}{const\_cast<}ValueType*\textcolor{keyword}{>}(view.get\_const\_data()));}
\DoxyCodeLine{00881\ \}}
\DoxyCodeLine{00882\ }
\DoxyCodeLine{00883\ }
\DoxyCodeLine{00884\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ ValueType>}
\DoxyCodeLine{00885\ array<ValueType>\ const\_array\_view<ValueType>::copy\_to\_array()\textcolor{keyword}{\ const}}
\DoxyCodeLine{00886\ \textcolor{keyword}{}\{}
\DoxyCodeLine{00887\ \ \ \ \ array<ValueType>\ result(this-\/>get\_executor(),\ this-\/>get\_size());}
\DoxyCodeLine{00888\ \ \ \ \ result.get\_executor()-\/>copy\_from(this-\/>get\_executor(),\ this-\/>get\_size(),}
\DoxyCodeLine{00889\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ this-\/>get\_const\_data(),\ result.get\_data());}
\DoxyCodeLine{00890\ \ \ \ \ \textcolor{keywordflow}{return}\ result;}
\DoxyCodeLine{00891\ \}}
\DoxyCodeLine{00892\ }
\DoxyCodeLine{00893\ }
\DoxyCodeLine{00894\ \}\ \ \textcolor{comment}{//\ namespace\ detail}}
\DoxyCodeLine{00895\ \}\ \ \textcolor{comment}{//\ namespace\ gko}}
\DoxyCodeLine{00896\ }
\DoxyCodeLine{00897\ }
\DoxyCodeLine{00898\ \textcolor{preprocessor}{\#endif\ \ }\textcolor{comment}{//\ GKO\_PUBLIC\_CORE\_BASE\_ARRAY\_HPP\_}}

\end{DoxyCode}
