diff --git a/source/numerics.tex b/source/numerics.tex index 9e4db2e194..c36654b6b1 100644 --- a/source/numerics.tex +++ b/source/numerics.tex @@ -16865,6 +16865,12 @@ const basic_vec& x, const typename basic_vec::mask_type& mask, BinaryOperation binary_op = {}, type_identity_t identity_element = @\seebelow@); + template> + constexpr T reduce(const T&, BinaryOperation = {}); + template> + constexpr T reduce(const T& x, same_as auto mask, BinaryOperation binary_op = {}, + type_identity_t identity_element = @\seebelow@); + template constexpr T reduce_min(const basic_vec&) noexcept; template @@ -16876,6 +16882,11 @@ constexpr T reduce_max(const basic_vec&, const typename basic_vec::mask_type&) noexcept; + template constexpr T reduce_min(const T&) noexcept; + template constexpr T reduce_min(const T&, same_as auto) noexcept; + template constexpr T reduce_max(const T&) noexcept; + template constexpr T reduce_max(const T&, same_as auto) noexcept; + // \ref{simd.loadstore}, load and store functions template requires ranges::@\libconcept{sized_range}@ @@ -18715,6 +18726,50 @@ \end{itemize} \end{itemdescr} +\begin{itemdecl} +template> + constexpr T reduce(const T& x, BinaryOperation binary_op = {}); +template> + constexpr T reduce(const T& x, same_as auto mask, BinaryOperation binary_op = {}, + type_identity_t identity_element = @\seebelow@); +\end{itemdecl} + +\begin{itemdescr} +\pnum +Let \tcode{mask} be \tcode{true} for the overload with no \tcode{mask} parameter. + +\pnum +\constraints +\begin{itemize} +\item \tcode{T} is vectorizable. +\item \tcode{BinaryOperation} models + \tcode{\exposconcept{reduction-binary-operation}}. +\item An argument for \tcode{identity_element} is provided for the invocation, + unless \tcode{BinaryOperation} is one of \code{plus<>}, \code{multiplies<>}, + \code{bit_and<>}, \code{bit_or<>}, or \code{bit_xor<>}. +\end{itemize} + +\pnum +\returns +If \tcode{mask} is \tcode{false}, returns \tcode{identity_element}. +Otherwise, returns \tcode{x}. + +\pnum +\throws +Nothing. + +\pnum +\remarks +The default argument for \code{identity_element} is equal to +\begin{itemize} +\item \tcode{T()} if \code{BinaryOperation} is \code{plus<>}, +\item \tcode{T(1)} if \code{BinaryOperation} is \code{multiplies<>}, +\item \tcode{T(\~{}T())} if \code{BinaryOperation} is \code{bit_and<>}, +\item \tcode{T()} if \code{BinaryOperation} is \code{bit_or<>}, or +\item \tcode{T()} if \code{BinaryOperation} is \code{bit_xor<>}. +\end{itemize} +\end{itemdescr} + \indexlibrarymember{reduce_min}{simd} \begin{itemdecl} template constexpr T reduce_min(const basic_vec& x) noexcept; @@ -18789,6 +18844,32 @@ \tcode{mask}. \end{itemdescr} +\begin{itemdecl} +template constexpr T reduce_min(const T& x) noexcept; +template constexpr T reduce_min(const T& x, same_as auto mask) noexcept; +template constexpr T reduce_max(const T& x) noexcept; +template constexpr T reduce_max(const T& x, same_as auto mask) noexcept; +\end{itemdecl} + +\begin{itemdescr} +\pnum +Let \tcode{mask} be \tcode{true} for the overloads with no \tcode{mask} parameter. + +\pnum +\constraints +\begin{itemize} +\item \tcode{T} is vectorizable. +\item \tcode{T} models \tcode{totally_ordered}. +\end{itemize} + +\pnum +\returns +If \tcode{mask} is \tcode{false}, returns \tcode{numeric_limits::max()} for +\tcode{reduce_min} and \tcode{numeric_limits::lowest()} for +\tcode{reduce_max}. +Otherwise, returns \tcode{x}. +\end{itemdescr} + \rSec3[simd.loadstore]{Load and store functions} \indexlibrarymember{unchecked_load}{simd} diff --git a/source/support.tex b/source/support.tex index f4f632944b..c60c09c788 100644 --- a/source/support.tex +++ b/source/support.tex @@ -832,7 +832,7 @@ #define @\defnlibxname{cpp_lib_shared_ptr_weak_type}@ 201606L // also in \libheader{memory} #define @\defnlibxname{cpp_lib_shared_timed_mutex}@ 201402L // also in \libheader{shared_mutex} #define @\defnlibxname{cpp_lib_shift}@ 202202L // also in \libheader{algorithm} -#define @\defnlibxname{cpp_lib_simd}@ 202511L // also in \libheader{simd} +#define @\defnlibxname{cpp_lib_simd}@ 202603L // also in \libheader{simd} #define @\defnlibxname{cpp_lib_simd_complex}@ 202502L // also in \libheader{simd} #define @\defnlibxname{cpp_lib_simd_permutations}@ 202506L // also in \libheader{simd} #define @\defnlibxname{cpp_lib_smart_ptr_for_overwrite}@ 202002L // also in \libheader{memory}