[valarray.nonmembers] # 29 Numerics library [[numerics]](./#numerics) ## 29.6 Numeric arrays [[numarray]](numarray#valarray.nonmembers) ### 29.6.3 valarray non-member operations [valarray.nonmembers] #### [29.6.3.1](#valarray.binary) Binary operators [[valarray.binary]](valarray.binary) [🔗](#lib:operator*,valarray) `template valarray operator* (const valarray&, const valarray&); template valarray operator/ (const valarray&, const valarray&); template valarray operator% (const valarray&, const valarray&); template valarray operator+ (const valarray&, const valarray&); template valarray operator- (const valarray&, const valarray&); template valarray operator^ (const valarray&, const valarray&); template valarray operator& (const valarray&, const valarray&); template valarray operator| (const valarray&, const valarray&); template valarray operator<<(const valarray&, const valarray&); template valarray operator>>(const valarray&, const valarray&); ` [1](#valarray.binary-1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L8119) *Mandates*: The indicated operator can be applied to operands of type T and returns a value of type T or which can be unambiguously implicitly converted to T[.](#valarray.binary-1.sentence-1) [2](#valarray.binary-2) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L8125) *Preconditions*: The argument arrays have the same length[.](#valarray.binary-2.sentence-1) [3](#valarray.binary-3) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L8129) *Returns*: A valarray whose length is equal to the lengths of the argument arrays[.](#valarray.binary-3.sentence-1) Each element of the returned array is initialized with the result of applying the indicated operator to the corresponding elements of the argument arrays[.](#valarray.binary-3.sentence-2) [🔗](#lib:operator*,valarray_) `template valarray operator* (const valarray&, const typename valarray::value_type&); template valarray operator* (const typename valarray::value_type&, const valarray&); template valarray operator/ (const valarray&, const typename valarray::value_type&); template valarray operator/ (const typename valarray::value_type&, const valarray&); template valarray operator% (const valarray&, const typename valarray::value_type&); template valarray operator% (const typename valarray::value_type&, const valarray&); template valarray operator+ (const valarray&, const typename valarray::value_type&); template valarray operator+ (const typename valarray::value_type&, const valarray&); template valarray operator- (const valarray&, const typename valarray::value_type&); template valarray operator- (const typename valarray::value_type&, const valarray&); template valarray operator^ (const valarray&, const typename valarray::value_type&); template valarray operator^ (const typename valarray::value_type&, const valarray&); template valarray operator& (const valarray&, const typename valarray::value_type&); template valarray operator& (const typename valarray::value_type&, const valarray&); template valarray operator| (const valarray&, const typename valarray::value_type&); template valarray operator| (const typename valarray::value_type&, const valarray&); template valarray operator<<(const valarray&, const typename valarray::value_type&); template valarray operator<<(const typename valarray::value_type&, const valarray&); template valarray operator>>(const valarray&, const typename valarray::value_type&); template valarray operator>>(const typename valarray::value_type&, const valarray&); ` [4](#valarray.binary-4) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L8192) *Mandates*: The indicated operator can be applied to operands of type T and returns a value of type T or which can be unambiguously implicitly converted to T[.](#valarray.binary-4.sentence-1) [5](#valarray.binary-5) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L8198) *Returns*: A valarray whose length is equal to the length of the array argument[.](#valarray.binary-5.sentence-1) Each element of the returned array is initialized with the result of applying the indicated operator to the corresponding element of the array argument and the non-array argument[.](#valarray.binary-5.sentence-2) #### [29.6.3.2](#valarray.comparison) Logical operators [[valarray.comparison]](valarray.comparison) [🔗](#lib:operator==,valarray) `template valarray operator==(const valarray&, const valarray&); template valarray operator!=(const valarray&, const valarray&); template valarray operator< (const valarray&, const valarray&); template valarray operator> (const valarray&, const valarray&); template valarray operator<=(const valarray&, const valarray&); template valarray operator>=(const valarray&, const valarray&); template valarray operator&&(const valarray&, const valarray&); template valarray operator||(const valarray&, const valarray&); ` [1](#valarray.comparison-1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L8229) *Mandates*: The indicated operator can be applied to operands of type T and returns a value of type bool or which can be unambiguously implicitly converted to bool[.](#valarray.comparison-1.sentence-1) [2](#valarray.comparison-2) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L8235) *Preconditions*: The two array arguments have the same length[.](#valarray.comparison-2.sentence-1) [3](#valarray.comparison-3) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L8240) *Returns*: A valarray whose length is equal to the length of the array arguments[.](#valarray.comparison-3.sentence-1) Each element of the returned array is initialized with the result of applying the indicated operator to the corresponding elements of the argument arrays[.](#valarray.comparison-3.sentence-2) [🔗](#lib:operator==,valarray_) `template valarray operator==(const valarray&, const typename valarray::value_type&); template valarray operator==(const typename valarray::value_type&, const valarray&); template valarray operator!=(const valarray&, const typename valarray::value_type&); template valarray operator!=(const typename valarray::value_type&, const valarray&); template valarray operator< (const valarray&, const typename valarray::value_type&); template valarray operator< (const typename valarray::value_type&, const valarray&); template valarray operator> (const valarray&, const typename valarray::value_type&); template valarray operator> (const typename valarray::value_type&, const valarray&); template valarray operator<=(const valarray&, const typename valarray::value_type&); template valarray operator<=(const typename valarray::value_type&, const valarray&); template valarray operator>=(const valarray&, const typename valarray::value_type&); template valarray operator>=(const typename valarray::value_type&, const valarray&); template valarray operator&&(const valarray&, const typename valarray::value_type&); template valarray operator&&(const typename valarray::value_type&, const valarray&); template valarray operator||(const valarray&, const typename valarray::value_type&); template valarray operator||(const typename valarray::value_type&, const valarray&); ` [4](#valarray.comparison-4) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L8293) *Mandates*: The indicated operator can be applied to operands of type T and returns a value of type bool or which can be unambiguously implicitly converted to bool[.](#valarray.comparison-4.sentence-1) [5](#valarray.comparison-5) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L8299) *Returns*: A valarray whose length is equal to the length of the array argument[.](#valarray.comparison-5.sentence-1) Each element of the returned array is initialized with the result of applying the indicated operator to the corresponding element of the array and the non-array argument[.](#valarray.comparison-5.sentence-2) #### [29.6.3.3](#valarray.transcend) Transcendentals [[valarray.transcend]](valarray.transcend) [🔗](#lib:abs,valarray) `template valarray abs (const valarray&); template valarray acos (const valarray&); template valarray asin (const valarray&); template valarray atan (const valarray&); template valarray atan2(const valarray&, const valarray&); template valarray atan2(const valarray&, const typename valarray::value_type&); template valarray atan2(const typename valarray::value_type&, const valarray&); template valarray cos (const valarray&); template valarray cosh (const valarray&); template valarray exp (const valarray&); template valarray log (const valarray&); template valarray log10(const valarray&); template valarray pow (const valarray&, const valarray&); template valarray pow (const valarray&, const typename valarray::value_type&); template valarray pow (const typename valarray::value_type&, const valarray&); template valarray sin (const valarray&); template valarray sinh (const valarray&); template valarray sqrt (const valarray&); template valarray tan (const valarray&); template valarray tanh (const valarray&); ` [1](#valarray.transcend-1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L8350) *Mandates*: A unique function with the indicated name can be applied (unqualified) to an operand of type T[.](#valarray.transcend-1.sentence-1) This function returns a value of type T or which can be unambiguously implicitly converted to type T[.](#valarray.transcend-1.sentence-2) #### [29.6.3.4](#valarray.special) Specialized algorithms [[valarray.special]](valarray.special) [🔗](#lib:swap,valarray) `template void swap(valarray& x, valarray& y) noexcept; ` [1](#valarray.special-1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L8366) *Effects*: Equivalent to x.swap(y)[.](#valarray.special-1.sentence-1)