[simd.alg] # 29 Numerics library [[numerics]](./#numerics) ## 29.10 Data-parallel types [[simd]](simd#alg) ### 29.10.8 basic_vec non-member operations [[simd.nonmembers]](simd.nonmembers#simd.alg) #### 29.10.8.12 Algorithms [simd.alg] [🔗](#lib:min,simd) `template constexpr basic_vec min(const basic_vec& a, const basic_vec& b) noexcept; ` [1](#1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L19237) *Constraints*: T models [totally_ordered](concept.totallyordered#concept:totally_ordered "18.5.5 Concept totally_­ordered [concept.totallyordered]")[.](#1.sentence-1) [2](#2) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L19241) *Returns*: The result of the element-wise application of min(a[i], b[i]) for all i in the range of [0, basic_vec​::​size())[.](#2.sentence-1) [🔗](#lib:max,simd) `template constexpr basic_vec max(const basic_vec& a, const basic_vec& b) noexcept; ` [3](#3) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L19255) *Constraints*: T models [totally_ordered](concept.totallyordered#concept:totally_ordered "18.5.5 Concept totally_­ordered [concept.totallyordered]")[.](#3.sentence-1) [4](#4) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L19259) *Returns*: The result of the element-wise application of max(a[i], b[i]) for all i in the range of [0, basic_vec​::​size())[.](#4.sentence-1) [🔗](#lib:minmax,simd) `template constexpr pair, basic_vec> minmax(const basic_vec& a, const basic_vec& b) noexcept; ` [5](#5) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L19273) *Effects*: Equivalent to: return pair{min(a, b), max(a, b)}; [🔗](#lib:clamp,simd) `template constexpr basic_vec clamp( const basic_vec& v, const basic_vec& lo, const basic_vec& hi); ` [6](#6) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L19286) *Constraints*: T models [totally_ordered](concept.totallyordered#concept:totally_ordered "18.5.5 Concept totally_­ordered [concept.totallyordered]")[.](#6.sentence-1) [7](#7) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L19290) *Preconditions*: No element in lo shall be greater than the corresponding element inhi[.](#7.sentence-1) [8](#8) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L19295) *Returns*: The result of element-wise application of clamp(v[i], lo[i], hi[i]) for all i in the range of [0, basic_vec​::​size())[.](#8.sentence-1) [🔗](#lib:select,simd) `template constexpr auto select(bool c, const T& a, const U& b) -> remove_cvref_t; ` [9](#9) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L19309) *Effects*: Equivalent to: return c ? a : b; [🔗](#lib:select,simd_) `template constexpr auto select(const basic_mask& c, const T& a, const U& b) noexcept -> decltype(simd-select-impl(c, a, b)); ` [10](#10) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L19322) *Effects*: Equivalent to:return *simd-select-impl*(c, a, b); where *simd-select-impl* is found by argument-dependent lookup ([[basic.lookup.argdep]](basic.lookup.argdep "6.5.4 Argument-dependent name lookup")) contrary to [[contents]](contents "16.4.2.2 Library contents")[.](#10.sentence-1)