Edit

Share via


<valarray>

Defines the class template valarray<Type> and several supporting class templates and functions.

Requirements

Header: <valarray>

Namespace: std

Note

The <valarray> library uses the #include <initializer_list> statement.

Remarks

These class templates and functions are permitted unusual latitude in the interest of improved performance. Specifically, any function that returns 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.

Members

Functions

Name Description
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 valarray inputs.
begin
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.
end
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 any input valarray 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
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

Name Description
operator!= Tests whether the corresponding elements of two equally sized valarray objects are unequal or whether all the elements of a valarray are unequal to a specified value of the valarray object's element type.
operator% Obtains the remainder of dividing the corresponding elements of two equally sized valarray objects or of dividing a valarray by a specified value of the valarray object's element type or of dividing a specified value by a valarray.
operator& Obtains the bitwise AND between corresponding elements of two equally sized valarray objects or between a valarray and a specified value of the element type.
operator&& Obtains the logical AND between corresponding elements of two equally sized valarray objects or between a valarray and a specified value of the valarray object'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 object'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 valarray objects or of between a valarray a specified value of the valarray object's element type.
operator+ Obtains the element-wise sum between corresponding elements of two equally sized valarray objects or of between a valarray a specified value of the valarray object's element type.
operator- Obtains the element-wise difference between corresponding elements of two equally sized valarray objects or of between a valarray a specified value of the valarray object's element type.
operator/ Obtains the element-wise quotient between corresponding elements of two equally sized valarray objects or of between a valarray a specified value of the valarray object's element type.
operator== Tests whether the corresponding elements of two equally sized valarray objects are equal or whether all the elements of a valarray are equal a specified value of the valarray object's element type.
operator^ Obtains the bitwise exclusive OR between corresponding elements of two equally sized valarray objects or between a valarray and a specified value of the element type.
operator| Obtains the bitwise OR between corresponding elements of two equally sized valarray objects or between a valarray and a specified value of the element type.
operator|| Obtains the logical OR between corresponding elements of two equally sized valarray objects or between a valarray and a specified value of the valarray object's element type.

Classes

Name Description
gslice class A utility class to valarray that is used to define multi-dimensional slices of a valarray.
gslice_array class An internal, auxiliary class template 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 class template that supports objects that are subsets of valarray objects by providing operations between subset arrays defined by specifying a subset of indices of a parent valarray.
mask_array class An internal, auxiliary class template that supports objects that are subsets of parent valarray objects, 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 class template that supports slice objects by providing operations between subset arrays defined by the slice of a valarray.
valarray<Type> class The class template describes an object that controls a sequence of elements of type Type that are stored as an array and designed for high-speed mathematical operations, optimized for computational performance.

Specializations

Name Description
valarray<bool> class A specialized version of the class template valarray<Type> for elements of type bool.

See also

Header files reference
Thread safety in the C++ Standard Library