Standard library header <valarray> - cppreference.com

##### cppreference.com

##### Search

Create account

##### Namespaces

- Page
- Discussion

##### Variants

##### Views

- View
- Edit
- History

##### Actions

# Standard library header <valarray>

From cppreference.com
< cpp‎ | header

This header is part of the numeric library.

### [edit] Classes

valarray | numeric arrays and array slices (class template)
slice | BLAS-like slice of a valarray: starting index, length, stride (class) [edit]
slice_array | proxy to a subset of a valarray after applying a slice (class template) [edit]
gslice | generalized slice of a valarray: starting index, set of lengths, set of strides (class) [edit]
gslice_array | proxy to a subset of a valarray after applying a gslice (class template) [edit]
mask_array | proxy to a subset of a valarray after applying a boolean mask `operator[]` (class template) [edit]
indirect_array | proxy to a subset of a valarray after applying indirect `operator[]` (class template) [edit]

### [edit] Functions

##### Operations
std::swap(std::valarray) (C++11) | specializes the std::swap() algorithm (function template) [edit]
std::begin(std::valarray) (C++11) | specializes std::begin (function template) [edit]
std::end(std::valarray) (C++11) | specializes std::end (function template) [edit]
operator+operator-operator*operator/operator%operator&operator|operator^operator<<operator>>operator&&operator|| | applies binary operators to each element of two valarrays, or a valarray and a value (function template) [edit]
operator==operator!=operator<operator<=operator>operator>= | compares two valarrays or a valarray with a value (function template) [edit]
abs(std::valarray) | applies the function std::abs to each element of valarray (function template) [edit]
##### Exponential functions
exp(std::valarray) | applies the function std::exp to each element of valarray (function template) [edit]
log(std::valarray) | applies the function std::log to each element of valarray (function template) [edit]
log10(std::valarray) | applies the function std::log10 to each element of valarray (function template) [edit]
##### Power functions
pow(std::valarray) | applies the function std::pow to two valarrays or a valarray and a value (function template) [edit]
sqrt(std::valarray) | applies the function std::sqrt to each element of valarray (function template) [edit]
##### Trigonometric functions
sin(std::valarray) | applies the function std::sin to each element of valarray (function template) [edit]
cos(std::valarray) | applies the function std::cos to each element of valarray (function template) [edit]
tan(std::valarray) | applies the function std::tan to each element of valarray (function template) [edit]
asin(std::valarray) | applies the function std::asin to each element of valarray (function template) [edit]
acos(std::valarray) | applies the function std::acos to each element of valarray (function template) [edit]
atan(std::valarray) | applies the function std::atan to each element of valarray (function template) [edit]
atan2(std::valarray) | applies the function std::atan2 to a valarray and a value (function template) [edit]
##### Hyperbolic functions
sinh(std::valarray) | applies the function std::sinh to each element of valarray (function template) [edit]
cosh(std::valarray) | applies the function std::cosh to each element of valarray (function template) [edit]
tanh(std::valarray) | applies the function std::tanh to each element of valarray (function template) [edit]

### [edit] Synopsis

    #include <initializer_list>

    namespace std {
        template<class T> class valarray;       // An array of type T
        class slice;                            // a BLAS-like slice out of an array
        template<class T> class slice_array;
        class gslice;                           // a generalized slice out of an array
        template<class T> class gslice_array;
        template<class T> class mask_array;     // a masked array
        template<class T> class indirect_array; // an indirected array

        template<class T> void swap(valarray<T>&, valarray<T>&) noexcept;

        template<class T> valarray<T> operator* (const valarray<T>&, const valarray<T>&);
        template<class T> valarray<T> operator* (const valarray<T>&, const T&);
        template<class T> valarray<T> operator* (const T&, const valarray<T>&);

        template<class T> valarray<T> operator/ (const valarray<T>&, const valarray<T>&);
        template<class T> valarray<T> operator/ (const valarray<T>&, const T&);
        template<class T> valarray<T> operator/ (const T&, const valarray<T>&);

        template<class T> valarray<T> operator% (const valarray<T>&, const valarray<T>&);
        template<class T> valarray<T> operator% (const valarray<T>&, const T&);
        template<class T> valarray<T> operator% (const T&, const valarray<T>&);

        template<class T> valarray<T> operator+ (const valarray<T>&, const valarray<T>&);
        template<class T> valarray<T> operator+ (const valarray<T>&, const T&);
        template<class T> valarray<T> operator+ (const T&, const valarray<T>&);

        template<class T> valarray<T> operator- (const valarray<T>&, const valarray<T>&);
        template<class T> valarray<T> operator- (const valarray<T>&, const T&);
        template<class T> valarray<T> operator- (const T&, const valarray<T>&);

        template<class T> valarray<T> operator^ (const valarray<T>&, const valarray<T>&);
        template<class T> valarray<T> operator^ (const valarray<T>&, const T&);
        template<class T> valarray<T> operator^ (const T&, const valarray<T>&);

        template<class T> valarray<T> operator& (const valarray<T>&, const valarray<T>&);
        template<class T> valarray<T> operator& (const valarray<T>&, const T&);
        template<class T> valarray<T> operator& (const T&, const valarray<T>&);

        template<class T> valarray<T> operator| (const valarray<T>&, const valarray<T>&);
        template<class T> valarray<T> operator| (const valarray<T>&, const T&);
        template<class T> valarray<T> operator| (const T&, const valarray<T>&);

        template<class T> valarray<T> operator<<(const valarray<T>&, const valarray<T>&);
        template<class T> valarray<T> operator<<(const valarray<T>&, const T&);
        template<class T> valarray<T> operator<<(const T&, const valarray<T>&);

        template<class T> valarray<T> operator>>(const valarray<T>&, const valarray<T>&);
        template<class T> valarray<T> operator>>(const valarray<T>&, const T&);
        template<class T> valarray<T> operator>>(const T&, const valarray<T>&);

        template<class T> valarray<bool> operator&&(const valarray<T>&, const valarray<T>&);
        template<class T> valarray<bool> operator&&(const valarray<T>&, const T&);
        template<class T> valarray<bool> operator&&(const T&, const valarray<T>&);

        template<class T> valarray<bool> operator||(const valarray<T>&, const valarray<T>&);
        template<class T> valarray<bool> operator||(const valarray<T>&, const T&);
        template<class T> valarray<bool> operator||(const T&, const valarray<T>&);

        template<class T>
        valarray<bool> operator==(const valarray<T>&, const valarray<T>&);
        template<class T> valarray<bool> operator==(const valarray<T>&, const T&);
        template<class T> valarray<bool> operator==(const T&, const valarray<T>&);

        template<class T>
        valarray<bool> operator!=(const valarray<T>&, const valarray<T>&);
        template<class T> valarray<bool> operator!=(const valarray<T>&, const T&);
        template<class T> valarray<bool> operator!=(const T&, const valarray<T>&);

        template<class T>
        valarray<bool> operator< (const valarray<T>&, const valarray<T>&);
        template<class T> valarray<bool> operator< (const valarray<T>&, const T&);
        template<class T> valarray<bool> operator< (const T&, const valarray<T>&);

        template<class T>
        valarray<bool> operator> (const valarray<T>&, const valarray<T>&);
        template<class T> valarray<bool> operator> (const valarray<T>&, const T&);
        template<class T> valarray<bool> operator> (const T&, const valarray<T>&);

        template<class T>
        valarray<bool> operator<=(const valarray<T>&, const valarray<T>&);
        template<class T> valarray<bool> operator<=(const valarray<T>&, const T&);
        template<class T> valarray<bool> operator<=(const T&, const valarray<T>&);

        template<class T>
        valarray<bool> operator>=(const valarray<T>&, const valarray<T>&);
        template<class T> valarray<bool> operator>=(const valarray<T>&, const T&);
        template<class T> valarray<bool> operator>=(const T&, const valarray<T>&);

        template<class  T>  valarray<T> abs (const  valarray<T>&);
        template<class  T>  valarray<T> acos(const  valarray<T>&);
        template<class  T>  valarray<T> asin(const  valarray<T>&);
        template<class  T>  valarray<T> atan(const  valarray<T>&);

        template<class T> valarray<T> atan2(const valarray<T>&, const valarray<T>&);
        template<class T> valarray<T> atan2(const valarray<T>&, const T&);
        template<class T> valarray<T> atan2(const T&, const valarray<T>&);

        template<class  T>  valarray<T> cos  (const  valarray<T>&);
        template<class  T>  valarray<T> cosh (const valarray<T>&);
        template<class  T>  valarray<T> exp  (const  valarray<T>&);
        template<class  T>  valarray<T> log  (const  valarray<T>&);
        template<class  T>  valarray<T> log10(const valarray<T>&);

        template<class T> valarray<T> pow(const valarray<T>&, const valarray<T>&);
        template<class T> valarray<T> pow(const valarray<T>&, const T&);
        template<class T> valarray<T> pow(const T&, const valarray<T>&);

        template<class T>  valarray<T> sin (const valarray<T>&);
        template<class T>  valarray<T> sinh(const valarray<T>&);
        template<class T>  valarray<T> sqrt(const valarray<T>&);
        template<class T>  valarray<T> tan (const valarray<T>&);
        template<class T>  valarray<T> tanh(const valarray<T>&);

        template<class T>  /*unspecified1*/ begin(valarray<T>& v);
        template<class T>  /*unspecified2*/ begin(const valarray<T>& v);
        template<class T>  /*unspecified1*/ end(valarray<T>& v);
        template<class T>  /*unspecified2*/ end(const valarray<T>& v);

    }

| This section is incomplete Reason: Class synopses

Retrieved from "http://en.cppreference.com/mwiki/index.php?title=cpp/header/valarray&oldid=57552"
Category:

- Todo with reason