<valarray>

Defines the template class valarray and numerous supporting template classes and functions.

#include <valarray>

Remarks

These template classes and functions are permitted unusual latitude in the interest of improved performance. Specifically, any function returning type valarray<T1> may return an object of some other type T2. In that case, any function that accepts one or more arguments of type valarray<T2> must have overloads that accept arbitrary combinations of those arguments, each replaced with an argument of type T2.

Functions

abs

Operates on the elements of an input valarray, returning a valarray whose elements are equal to the absolute value of the elements of the input valarray.

acos

Operates on the elements of an input valarray, returning a valarray whose elements are equal to the arccosine of the elements of the input valarray.

asin

Operates on the elements of an input valarray, returning a valarray whose elements are equal to the arcsine of the elements of the input valarray.

atan

Operates on the elements of an input valarray, returning a valarray whose elements are equal to the principal value of the arctangent of the elements of the input valarray.

atan2

Returns a valarray whose elements are equal to the arctangent of the Cartesian components specified by a combination of constants and elements of valarrays.

cos

Operates on the elements of an input valarray, returning a valarray whose elements are equal to the cosine of the elements of the input valarray.

cosh

Operates on the elements of an input valarray, returning a valarray whose elements are equal to the hyperbolic cosine of the elements of the input valarray.

exp

Operates on the elements of an input valarray, returning a valarray whose elements are equal to the natural exponential of the elements of the input valarray.

log

Operates on the elements of an input valarray, returning a valarray whose elements are equal to the natural logarithm of the elements of the input valarray.

log10

Operates on the elements of an input valarray, returning a valarray whose elements are equal to the base 10 or common logarithm of the elements of the input valarray.

pow

Operates on the elements of input valarrays and constants, returning a valarray whose elements are equal to a base specified either by the elements of an input valarray or a constant raised to an exponent specified either by the elements of an input valarray or a constant.

sin

Operates on the elements of an input valarray, returning a valarray whose elements are equal to the sine of the elements of the input valarray.

sinh

Operates on the elements of an input valarray, returning a valarray whose elements are equal to the hyperbolic sine of the elements of the input valarray.

sqrt

Operates on the elements of an input valarray, returning a valarray whose elements are equal to the square root of the elements of the input valarray.

swap (<valarray>)

tan

Operates on the elements of an input valarray, returning a valarray whose elements are equal to the tangent of the elements of the input valarray.

tanh

Operates on the elements of an input valarray, returning a valarray whose elements are equal to the hyperbolic tangent of the elements of the input valarray.

Operators

operator!=

Tests whether the corresponding elements of two equally sized valarrays are unequal or whether all the elements of a valarray are unequal a specified value of the valarray's element type.

operator%

Obtains the remainder of dividing the corresponding elements of two equally sized valarrays or of dividing a valarray by a specified value of the valarray's element type or of dividing a specified value by a valarray.

operator&

Obtains the bitwise AND between corresponding elements of two equally sized valarrays or between a valarray and a specified value of the element type.

operator&&

Obtains the logical AND between corresponding elements of two equally sized valarrays or between a valarray and a specified value of the valarray's element type.

operator>

Tests whether the elements of one valarray are greater than the elements of an equally sized valarray or whether all the elements of a valarray are greater or less than a specified value of the valarray's element type.

operator>=

Tests whether the elements of one valarray are greater than or equal to the elements of an equally sized valarray or whether all the elements of a valarray are greater than or equal to or less than or equal to a specified value.

operator>>

Right-shifts the bits for each element of a valarray a specified number of positions or by an element-wise amount specified by a second valarray.

operator<

Tests whether the elements of one valarray are less than the elements of an equally sized valarray or whether all the elements of a valarray are greater or less than a specified value.

operator<=

Tests whether the elements of one valarray are less than or equal to the elements of an equally sized valarray or whether all the elements of a valarray are greater than or equal to or less than or equal to a specified value.

operator<<

Left shifts the bits for each element of a valarray a specified number of positions or by an element-wise amount specified by a second valarray.

operator*

Obtains the element-wise product between corresponding elements of two equally sized valarrays or of between a valarray a specified value of the valarray's element type.

operator+

Obtains the element-wise sum between corresponding elements of two equally sized valarrays or of between a valarray a specified value of the valarray's element type.

operator-

Obtains the element-wise difference between corresponding elements of two equally sized valarrays or of between a valarray a specified value of the valarray's element type.

operator/

Obtains the element-wise quotient between corresponding elements of two equally sized valarrays or of between a valarray a specified value of the valarray's element type.

operator==

Tests whether the corresponding elements of two equally sized valarrays are equal or whether all the elements of a valarray are equal a specified value of the valarray's element type.

operator^

Obtains the bitwise exclusive OR between corresponding elements of two equally sized valarrays or between a valarray and a specified value of the element type.

operator|

Obtains the bitwise OR between corresponding elements of two equally sized valarrays or between a valarray and a specified value of the element type.

operator||

Obtains the logical OR between corresponding elements of two equally sized valarrays or between a valarray and a specified value of the valarray's element type.

Classes

gslice Class

A utility class to valarray that is used to define multi-dimensional slices of a valarray.

gslice_array Class

An internal, auxiliary template class that supports general slice objects by providing operations between subset arrays defined by the general slice of a valarray.

indirect_array Class

An internal, auxiliary template class that supports objects that are subsets of valarrays by providing operations between subset arrays defined by specifying a subset of indices of a parent valarray.

mask_array Class

An internal, auxiliary template class that supports objects that are subsets of parent valarrays, specified with a Boolean expression, by providing operations between the subset arrays.

slice Class

A utility class to valarray that is used to define one-dimensional, vector-like subsets of a valarray.

slice_array Class

An internal, auxiliary template class that supports slice objects by providing operations between subset arrays defined by the slice of a valarray.

valarray Class

The template class describes an object that controls a sequence of elements of type Type that are stored as an array and designed for performing high-speed mathematical operations, optimized for computational performance.

Specializations

valarray<bool> Class

A specialized version of the template class valarray<Type> to elements of type bool.

See Also

Reference

Thread Safety in the Standard C++ Library

Other Resources

<valarray> Members

Header Files