Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 81 additions & 0 deletions source/numerics.tex
Original file line number Diff line number Diff line change
Expand Up @@ -16865,6 +16865,12 @@
const basic_vec<T, Abi>& x, const typename basic_vec<T, Abi>::mask_type& mask,
BinaryOperation binary_op = {}, type_identity_t<T> identity_element = @\seebelow@);

template<class T, class BinaryOperation = plus<>>
constexpr T reduce(const T&, BinaryOperation = {});
template<class T, class BinaryOperation = plus<>>
constexpr T reduce(const T& x, same_as<bool> auto mask, BinaryOperation binary_op = {},
type_identity_t<T> identity_element = @\seebelow@);

template<class T, class Abi>
constexpr T reduce_min(const basic_vec<T, Abi>&) noexcept;
template<class T, class Abi>
Expand All @@ -16876,6 +16882,11 @@
constexpr T reduce_max(const basic_vec<T, Abi>&,
const typename basic_vec<T, Abi>::mask_type&) noexcept;

template<class T> constexpr T reduce_min(const T&) noexcept;
template<class T> constexpr T reduce_min(const T&, same_as<bool> auto) noexcept;
template<class T> constexpr T reduce_max(const T&) noexcept;
template<class T> constexpr T reduce_max(const T&, same_as<bool> auto) noexcept;

// \ref{simd.loadstore}, load and store functions
template<class V = @\seebelow@, ranges::@\libconcept{contiguous_range}@ R, class... Flags>
requires ranges::@\libconcept{sized_range}@<R>
Expand Down Expand Up @@ -18715,6 +18726,50 @@
\end{itemize}
\end{itemdescr}

\begin{itemdecl}
template<class T, class BinaryOperation = plus<>>
constexpr T reduce(const T& x, BinaryOperation binary_op = {});
template<class T, class BinaryOperation = plus<>>
constexpr T reduce(const T& x, same_as<bool> auto mask, BinaryOperation binary_op = {},
type_identity_t<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}<T>}.
\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<class T, class Abi> constexpr T reduce_min(const basic_vec<T, Abi>& x) noexcept;
Expand Down Expand Up @@ -18789,6 +18844,32 @@
\tcode{mask}.
\end{itemdescr}

\begin{itemdecl}
template<class T> constexpr T reduce_min(const T& x) noexcept;
template<class T> constexpr T reduce_min(const T& x, same_as<bool> auto mask) noexcept;
template<class T> constexpr T reduce_max(const T& x) noexcept;
template<class T> constexpr T reduce_max(const T& x, same_as<bool> 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<T>::max()} for
\tcode{reduce_min} and \tcode{numeric_limits<T>::lowest()} for
\tcode{reduce_max}.
Otherwise, returns \tcode{x}.
\end{itemdescr}

\rSec3[simd.loadstore]{Load and store functions}

\indexlibrarymember{unchecked_load}{simd}
Expand Down
2 changes: 1 addition & 1 deletion source/support.tex
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
Loading