Inheritance diagram for std::valarray< Type >:
Public Types | |
typedef Type | value_type |
Public Member Functions | |
valarray () | |
Construct an empty array. | |
valarray (size_t) | |
Construct an array with n elements. | |
valarray (const Type &, size_t) | |
Construct an array with n elements initialized to t. | |
valarray (const Type *__restrict__, size_t) | |
Construct an array initialized to the first n elements of t. | |
valarray (const valarray &) | |
Copy constructor. | |
valarray (const slice_array< Type > &) | |
Construct an array with the same size and values in sa. | |
valarray (const gslice_array< Type > &) | |
Construct an array with the same size and values in ga. | |
valarray (const mask_array< Type > &) | |
Construct an array with the same size and values in ma. | |
valarray (const indirect_array< Type > &) | |
Construct an array with the same size and values in ia. | |
template<class Dom> | |
valarray (const Expr< Dom, Type > &__e) | |
~valarray () | |
valarray< Type > & | operator= (const valarray< Type > &) |
Assign elements to an array. | |
valarray< Type > & | operator= (const Type &) |
Assign elements to a value. | |
valarray< Type > & | operator= (const slice_array< Type > &) |
Assign elements to an array subset. | |
valarray< Type > & | operator= (const gslice_array< Type > &) |
Assign elements to an array subset. | |
valarray< Type > & | operator= (const mask_array< Type > &) |
Assign elements to an array subset. | |
valarray< Type > & | operator= (const indirect_array< Type > &) |
Assign elements to an array subset. | |
template<class Dom> | |
valarray< Type > & | operator= (const Expr< Dom, Type > &) |
Type & | operator[] (size_t) |
const Type & | operator[] (size_t) const |
Expr< SClos< ValArray, Type >, Type > | operator[] (slice) const |
Return an array subset. | |
slice_array< Type > | operator[] (slice) |
Return a reference to an array subset. | |
Expr< GClos< ValArray, Type >, Type > | operator[] (const gslice &) const |
Return an array subset. | |
gslice_array< Type > | operator[] (const gslice &) |
Return a reference to an array subset. | |
valarray< Type > | operator[] (const valarray< bool > &) const |
Return an array subset. | |
mask_array< Type > | operator[] (const valarray< bool > &) |
Return a reference to an array subset. | |
Expr< IClos< ValArray, Type >, Type > | operator[] (const valarray< size_t > &) const |
Return an array subset. | |
indirect_array< Type > | operator[] (const valarray< size_t > &) |
Return a reference to an array subset. | |
UnaryOp< __unary_plus >::Rt | operator+ () const |
Return a new valarray by applying unary + to each element. | |
UnaryOp< negate >::Rt | operator- () const |
Return a new valarray by applying unary - to each element. | |
UnaryOp< __bitwise_not >::Rt | operator~ () const |
Return a new valarray by applying unary ~ to each element. | |
UnaryOp< __logical_not >::Rt | operator! () const |
Return a new valarray by applying unary ! to each element. | |
valarray< Type > & | operator *= (const Type &) |
Multiply each element of array by t. | |
valarray< Type > & | operator/= (const Type &) |
Divide each element of array by t. | |
valarray< Type > & | operator%= (const Type &) |
Set each element e of array to e % t. | |
valarray< Type > & | operator+= (const Type &) |
Add t to each element of array. | |
valarray< Type > & | operator-= (const Type &) |
Subtract t to each element of array. | |
valarray< Type > & | operator^= (const Type &) |
Set each element e of array to e ^ t. | |
valarray< Type > & | operator &= (const Type &) |
Set each element e of array to e & t. | |
valarray< Type > & | operator|= (const Type &) |
Set each element e of array to e | t. | |
valarray< Type > & | operator<<= (const Type &) |
Left shift each element e of array by t bits. | |
valarray< Type > & | operator>>= (const Type &) |
Right shift each element e of array by t bits. | |
valarray< Type > & | operator *= (const valarray< Type > &) |
Multiply elements of array by corresponding elements of v. | |
valarray< Type > & | operator/= (const valarray< Type > &) |
Divide elements of array by corresponding elements of v. | |
valarray< Type > & | operator%= (const valarray< Type > &) |
Modulo elements of array by corresponding elements of v. | |
valarray< Type > & | operator+= (const valarray< Type > &) |
Add corresponding elements of v to elements of array. | |
valarray< Type > & | operator-= (const valarray< Type > &) |
Subtract corresponding elements of v from elements of array. | |
valarray< Type > & | operator^= (const valarray< Type > &) |
Logical xor corresponding elements of v with elements of array. | |
valarray< Type > & | operator|= (const valarray< Type > &) |
Logical or corresponding elements of v with elements of array. | |
valarray< Type > & | operator &= (const valarray< Type > &) |
Logical and corresponding elements of v with elements of array. | |
valarray< Type > & | operator<<= (const valarray< Type > &) |
Left shift elements of array by corresponding elements of v. | |
valarray< Type > & | operator>>= (const valarray< Type > &) |
Right shift elements of array by corresponding elements of v. | |
size_t | size () const |
Return the number of elements in array. | |
Type | sum () const |
Return the sum of all elements in the array. | |
Type | min () const |
Return the minimum element using operator<(). | |
Type | max () const |
Return the maximum element using operator<(). | |
valarray< Type > | shift (int) const |
Return a shifted array. | |
valarray< Type > | cshift (int) const |
Return a rotated array. | |
Expr< ValFunClos< ValArray, Type >, Type > | apply (Type func(Type)) const |
Apply a function to the array. | |
Expr< RefFunClos< ValArray, Type >, Type > | apply (Type func(const Type &)) const |
Apply a function to the array. | |
void | resize (size_t size, Type c=Type()) |
Resize array. | |
template<typename Type> | |
valarray (const Type *__restrict__ __p, size_t n) | |
template<typename Type> | |
valarray (const valarray< Type > &__v) | |
Private Attributes | |
size_t | M_size |
Type *__restrict__ | M_data |
Friends | |
class | Array< Type > |
Classes | |
struct | UnaryOp |
A valarray is an array that provides constraints intended to allow for effective optimization of numeric array processing by reducing the aliasing that can result from pointer representations. It represents a one-dimensional array from which different multidimensional subsets can be accessed and modified.
Tp | Type of object in the array. |
Definition at line 110 of file valarray.
std::valarray< Type >::valarray | ( | ) | [inline] |
std::valarray< Type >::valarray | ( | size_t | ) | [inline, explicit] |
Construct an array with n elements.
Definition at line 560 of file valarray.
References std::__valarray_default_construct().
std::valarray< Type >::valarray | ( | const Type & | , | |
size_t | ||||
) | [inline] |
Construct an array with n elements initialized to t.
Definition at line 566 of file valarray.
References std::__valarray_fill_construct().
std::valarray< Type >::valarray | ( | const Type * | __restrict__, | |
size_t | ||||
) |
Construct an array initialized to the first n elements of t.
std::valarray< Type >::valarray | ( | const valarray< Type > & | ) |
Copy constructor.
std::valarray< Type >::valarray | ( | const slice_array< Type > & | ) | [inline] |
std::valarray< Type >::valarray | ( | const gslice_array< Type > & | ) | [inline] |
std::valarray< Type >::valarray | ( | const mask_array< Type > & | ) | [inline] |
std::valarray< Type >::valarray | ( | const indirect_array< Type > & | ) | [inline] |
Expr< RefFunClos< ValArray, Type >, Type > std::valarray< Type >::apply | ( | Type | func(const Type &) | ) | const [inline] |
Apply a function to the array.
Returns a new valarray with elements assigned to the result of applying func to the corresponding element of this array. The new array is the same size as this one.
func | Function of const Tp& returning Tp to apply. |
Expr< ValFunClos< ValArray, Type >, Type > std::valarray< Type >::apply | ( | Type | func(Type) | ) | const [inline] |
Apply a function to the array.
Returns a new valarray with elements assigned to the result of applying func to the corresponding element of this array. The new array is the same size as this one.
func | Function of Tp returning Tp to apply. |
valarray< Type > std::valarray< Type >::cshift | ( | int | ) | const [inline] |
Return a rotated array.
A new valarray is constructed as a copy of this array with elements in shifted positions. For an element with index i, the new position is (i - n) % size(). The new valarray is the same size as the current one. Elements that are shifted beyond the array bounds are shifted into the other end of the array. No elements are lost.
Positive arguments shift toward index 0, wrapping around the top. Negative arguments shift towards the top, wrapping around to 0.
n | Number of element positions to rotate. |
Definition at line 822 of file valarray.
References std::__valarray_copy_construct().
Type std::valarray< Type >::max | ( | ) | const [inline] |
Return the maximum element using operator<().
Definition at line 870 of file valarray.
References std::max_element().
Type std::valarray< Type >::min | ( | ) | const [inline] |
Return the minimum element using operator<().
Definition at line 862 of file valarray.
References std::min_element().
valarray<Type>& std::valarray< Type >::operator &= | ( | const valarray< Type > & | ) |
Logical and corresponding elements of v with elements of array.
valarray<Type>& std::valarray< Type >::operator &= | ( | const Type & | ) |
Set each element e of array to e & t.
valarray<Type>& std::valarray< Type >::operator *= | ( | const valarray< Type > & | ) |
Multiply elements of array by corresponding elements of v.
valarray<Type>& std::valarray< Type >::operator *= | ( | const Type & | ) |
Multiply each element of array by t.
UnaryOp<__logical_not>::Rt std::valarray< Type >::operator! | ( | ) | const |
Return a new valarray by applying unary ! to each element.
valarray<Type>& std::valarray< Type >::operator%= | ( | const valarray< Type > & | ) |
Modulo elements of array by corresponding elements of v.
valarray<Type>& std::valarray< Type >::operator%= | ( | const Type & | ) |
Set each element e of array to e % t.
UnaryOp<__unary_plus>::Rt std::valarray< Type >::operator+ | ( | ) | const |
Return a new valarray by applying unary + to each element.
valarray<Type>& std::valarray< Type >::operator+= | ( | const valarray< Type > & | ) |
Add corresponding elements of v to elements of array.
valarray<Type>& std::valarray< Type >::operator+= | ( | const Type & | ) |
Add t to each element of array.
UnaryOp<negate>::Rt std::valarray< Type >::operator- | ( | ) | const |
Return a new valarray by applying unary - to each element.
valarray<Type>& std::valarray< Type >::operator-= | ( | const valarray< Type > & | ) |
Subtract corresponding elements of v from elements of array.
valarray<Type>& std::valarray< Type >::operator-= | ( | const Type & | ) |
Subtract t to each element of array.
valarray<Type>& std::valarray< Type >::operator/= | ( | const valarray< Type > & | ) |
Divide elements of array by corresponding elements of v.
valarray<Type>& std::valarray< Type >::operator/= | ( | const Type & | ) |
Divide each element of array by t.
valarray<Type>& std::valarray< Type >::operator<<= | ( | const valarray< Type > & | ) |
Left shift elements of array by corresponding elements of v.
valarray<Type>& std::valarray< Type >::operator<<= | ( | const Type & | ) |
Left shift each element e of array by t bits.
valarray< Type > & std::valarray< Type >::operator= | ( | const indirect_array< Type > & | ) | [inline] |
valarray< Type > & std::valarray< Type >::operator= | ( | const mask_array< Type > & | ) | [inline] |
valarray< Type > & std::valarray< Type >::operator= | ( | const gslice_array< Type > & | ) | [inline] |
valarray< Type > & std::valarray< Type >::operator= | ( | const slice_array< Type > & | ) | [inline] |
valarray< Type > & std::valarray< Type >::operator= | ( | const Type & | ) | [inline] |
valarray< Type > & std::valarray< Type >::operator= | ( | const valarray< Type > & | ) | [inline] |
valarray<Type>& std::valarray< Type >::operator>>= | ( | const valarray< Type > & | ) |
Right shift elements of array by corresponding elements of v.
valarray<Type>& std::valarray< Type >::operator>>= | ( | const Type & | ) |
Right shift each element e of array by t bits.
indirect_array< Type > std::valarray< Type >::operator[] | ( | const valarray< size_t > & | ) | [inline] |
Return a reference to an array subset.
Returns an indirect_array referencing the elements of the array indicated by the argument. The elements in the argument are interpreted as the indices of elements of this valarray to include in the subset. The returned indirect_array refers to these elements.
i | The valarray element index list. |
Definition at line 768 of file valarray.
References std::valarray< Type >::size().
Expr< IClos< ValArray, Type >, Type > std::valarray< Type >::operator[] | ( | const valarray< size_t > & | ) | const [inline] |
Return an array subset.
Returns a new valarray containing the elements of the array indicated by the argument. The elements in the argument are interpreted as the indices of elements of this valarray to copy to the return valarray.
i | The valarray element index list. |
mask_array< Type > std::valarray< Type >::operator[] | ( | const valarray< bool > & | ) | [inline] |
Return a reference to an array subset.
Returns a new mask_array referencing the elements of the array indicated by the argument. The input is a valarray of bool which represents a bitmask indicating which elements are part of the subset. Elements of the array are part of the subset if the corresponding element of the argument is true.
m | The valarray bitmask. |
Definition at line 749 of file valarray.
References std::valarray< Type >::size().
valarray< Type > std::valarray< Type >::operator[] | ( | const valarray< bool > & | ) | const [inline] |
Return an array subset.
Returns a new valarray containing the elements of the array indicated by the argument. The input is a valarray of bool which represents a bitmask indicating which elements should be copied into the new valarray. Each element of the array is added to the return valarray if the corresponding element of the argument is true.
m | The valarray bitmask. |
Definition at line 737 of file valarray.
References std::valarray< Type >::size().
gslice_array< Type > std::valarray< Type >::operator[] | ( | const gslice & | ) | [inline] |
Return a reference to an array subset.
Returns a new valarray containing the elements of the array indicated by the gslice argument. The new valarray is the size of the input gslice.
s | The source gslice. |
Expr< GClos< ValArray, Type >, Type > std::valarray< Type >::operator[] | ( | const gslice & | ) | const [inline] |
Return an array subset.
Returns a slice_array referencing the elements of the array indicated by the slice argument.
s | The source slice. |
slice_array< Type > std::valarray< Type >::operator[] | ( | slice | ) | [inline] |
Return a reference to an array subset.
Returns a new valarray containing the elements of the array indicated by the slice argument. The new valarray is the size of the input slice.
s | The source slice. |
Expr< SClos< ValArray, Type >, Type > std::valarray< Type >::operator[] | ( | slice | ) | const [inline] |
Return an array subset.
Returns a new valarray containing the elements of the array indicated by the slice argument. The new valarray is the size of the input slice.
s | The source slice. |
Type & std::valarray< Type >::operator[] | ( | size_t | ) | [inline] |
valarray<Type>& std::valarray< Type >::operator^= | ( | const valarray< Type > & | ) |
Logical xor corresponding elements of v with elements of array.
valarray<Type>& std::valarray< Type >::operator^= | ( | const Type & | ) |
Set each element e of array to e ^ t.
valarray<Type>& std::valarray< Type >::operator|= | ( | const valarray< Type > & | ) |
Logical or corresponding elements of v with elements of array.
valarray<Type>& std::valarray< Type >::operator|= | ( | const Type & | ) |
Set each element e of array to e | t.
UnaryOp<__bitwise_not>::Rt std::valarray< Type >::operator~ | ( | ) | const |
Return a new valarray by applying unary ~ to each element.
void std::valarray< Type >::resize | ( | size_t | size, | |
Type | c = Type() | |||
) | [inline] |
Resize array.
Resize this array to be size and set all elements to c. All references and iterators are invalidated.
size | New array size. | |
c | New value for all elements. |
Definition at line 845 of file valarray.
References std::__valarray_destroy_elements(), std::__valarray_fill_construct(), and std::__valarray_release_memory().
valarray< Type > std::valarray< Type >::shift | ( | int | ) | const [inline] |
Return a shifted array.
A new valarray is constructed as a copy of this array with elements in shifted positions. For an element with index i, the new position is i - n. The new valarray is the same size as the current one. New elements without a value are set to 0. Elements whos new position is outside the bounds of the array are discarded.
Positive arguments shift toward index 0, discarding elements [0, n). Negative arguments discard elements from the top of the array.
n | Number of element positions to shift. |
Definition at line 796 of file valarray.
References std::__valarray_copy_construct(), and std::__valarray_default_construct().
size_t std::valarray< Type >::size | ( | ) | const [inline] |
Return the number of elements in array.
Definition at line 776 of file valarray.
Referenced by std::__gslice_to_index(), std::__valarray_product(), and std::valarray< Type >::operator[]().
Type std::valarray< Type >::sum | ( | ) | const [inline] |
Return the sum of all elements in the array.
Accumulates the sum of all elements into a Tp using +=. The order of adding the elements is unspecified.
Definition at line 781 of file valarray.
References std::__valarray_sum().