Public Types | |
typedef _Tp | value_type |
Public Member Functions | |
valarray () | |
Construct an empty array. | |
valarray (size_t) | |
Construct an array with n elements. | |
valarray (const _Tp &, size_t) | |
Construct an array with n elements initialized to t. | |
valarray (const _Tp *__restrict__, size_t) | |
Construct an array initialized to the first n elements of t. | |
valarray (const valarray &) | |
Copy constructor. | |
valarray (const slice_array< _Tp > &) | |
Construct an array with the same size and values in sa. | |
valarray (const gslice_array< _Tp > &) | |
Construct an array with the same size and values in ga. | |
valarray (const mask_array< _Tp > &) | |
Construct an array with the same size and values in ma. | |
valarray (const indirect_array< _Tp > &) | |
Construct an array with the same size and values in ia. | |
template<class _Dom> | valarray (const _Expr< _Dom, _Tp > &__e) |
~valarray () | |
valarray< _Tp > & | operator= (const valarray< _Tp > &) |
Assign elements to an array. | |
valarray< _Tp > & | operator= (const _Tp &) |
Assign elements to a value. | |
valarray< _Tp > & | operator= (const slice_array< _Tp > &) |
Assign elements to an array subset. | |
valarray< _Tp > & | operator= (const gslice_array< _Tp > &) |
Assign elements to an array subset. | |
valarray< _Tp > & | operator= (const mask_array< _Tp > &) |
Assign elements to an array subset. | |
valarray< _Tp > & | operator= (const indirect_array< _Tp > &) |
Assign elements to an array subset. | |
template<class _Dom> valarray< _Tp > & | operator= (const _Expr< _Dom, _Tp > &) |
_Tp & | operator[] (size_t) |
const _Tp & | operator[] (size_t) const |
_Expr< _SClos< _ValArray, _Tp >, _Tp > | operator[] (slice) const |
Return an array subset. | |
slice_array< _Tp > | operator[] (slice) |
Return a reference to an array subset. | |
_Expr< _GClos< _ValArray, _Tp >, _Tp > | operator[] (const gslice &) const |
Return an array subset. | |
gslice_array< _Tp > | operator[] (const gslice &) |
Return a reference to an array subset. | |
valarray< _Tp > | operator[] (const valarray< bool > &) const |
Return an array subset. | |
mask_array< _Tp > | operator[] (const valarray< bool > &) |
Return a reference to an array subset. | |
_Expr< _IClos< _ValArray, _Tp >, _Tp > | operator[] (const valarray< size_t > &) const |
Return an array subset. | |
indirect_array< _Tp > | 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< _Tp > & | operator *= (const _Tp &) |
Multiply each element of array by t. | |
valarray< _Tp > & | operator/= (const _Tp &) |
Divide each element of array by t. | |
valarray< _Tp > & | operator%= (const _Tp &) |
Set each element e of array to e t. | |
valarray< _Tp > & | operator+= (const _Tp &) |
Add t to each element of array. | |
valarray< _Tp > & | operator-= (const _Tp &) |
Subtract t to each element of array. | |
valarray< _Tp > & | operator^= (const _Tp &) |
Set each element e of array to e ^ t. | |
valarray< _Tp > & | operator &= (const _Tp &) |
Set each element e of array to e & t. | |
valarray< _Tp > & | operator|= (const _Tp &) |
Set each element e of array to e | t. | |
valarray< _Tp > & | operator<<= (const _Tp &) |
Left shift each element e of array by t bits. | |
valarray< _Tp > & | operator>>= (const _Tp &) |
Right shift each element e of array by t bits. | |
valarray< _Tp > & | operator *= (const valarray< _Tp > &) |
Multiply elements of array by corresponding elements of v. | |
valarray< _Tp > & | operator/= (const valarray< _Tp > &) |
Divide elements of array by corresponding elements of v. | |
valarray< _Tp > & | operator%= (const valarray< _Tp > &) |
Modulo elements of array by corresponding elements of v. | |
valarray< _Tp > & | operator+= (const valarray< _Tp > &) |
Add corresponding elements of v to elements of array. | |
valarray< _Tp > & | operator-= (const valarray< _Tp > &) |
Subtract corresponding elements of v from elements of array. | |
valarray< _Tp > & | operator^= (const valarray< _Tp > &) |
Logical xor corresponding elements of v with elements of array. | |
valarray< _Tp > & | operator|= (const valarray< _Tp > &) |
Logical or corresponding elements of v with elements of array. | |
valarray< _Tp > & | operator &= (const valarray< _Tp > &) |
Logical and corresponding elements of v with elements of array. | |
valarray< _Tp > & | operator<<= (const valarray< _Tp > &) |
Left shift elements of array by corresponding elements of v. | |
valarray< _Tp > & | operator>>= (const valarray< _Tp > &) |
Right shift elements of array by corresponding elements of v. | |
template<class _Dom> valarray< _Tp > & | operator *= (const _Expr< _Dom, _Tp > &) |
template<class _Dom> valarray< _Tp > & | operator/= (const _Expr< _Dom, _Tp > &) |
template<class _Dom> valarray< _Tp > & | operator%= (const _Expr< _Dom, _Tp > &) |
template<class _Dom> valarray< _Tp > & | operator+= (const _Expr< _Dom, _Tp > &) |
template<class _Dom> valarray< _Tp > & | operator-= (const _Expr< _Dom, _Tp > &) |
template<class _Dom> valarray< _Tp > & | operator^= (const _Expr< _Dom, _Tp > &) |
template<class _Dom> valarray< _Tp > & | operator|= (const _Expr< _Dom, _Tp > &) |
template<class _Dom> valarray< _Tp > & | operator &= (const _Expr< _Dom, _Tp > &) |
template<class _Dom> valarray< _Tp > & | operator<<= (const _Expr< _Dom, _Tp > &) |
template<class _Dom> valarray< _Tp > & | operator>>= (const _Expr< _Dom, _Tp > &) |
size_t | size () const |
Return the number of elements in array. | |
_Tp | sum () const |
Return the sum of all elements in the array. | |
_Tp | min () const |
Return the minimum element using operator<(). | |
_Tp | max () const |
Return the maximum element using operator<(). | |
valarray< _Tp > | shift (int) const |
Return a shifted array. | |
valarray< _Tp > | cshift (int) const |
Return a rotated array. | |
_Expr< _ValFunClos< _ValArray, _Tp >, _Tp > | apply (_Tp func(_Tp)) const |
Apply a function to the array. | |
_Expr< _RefFunClos< _ValArray, _Tp >, _Tp > | apply (_Tp func(const _Tp &)) const |
Apply a function to the array. | |
void | resize (size_t __size, _Tp __c=_Tp()) |
Resize array. | |
Private Attributes | |
size_t | _M_size |
_Tp *__restrict__ | _M_data |
Friends | |
class | _Array< _Tp > |
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.
|
|
|
Construct an empty array.
|
|
Construct an array with n elements.
Definition at line 560 of file valarray. References std::__valarray_default_construct(), and std::__valarray_get_storage(). |
|
Construct an array with n elements initialized to t.
Definition at line 566 of file valarray. References std::__valarray_fill_construct(), and std::__valarray_get_storage(). |
|
Construct an array initialized to the first n elements of t.
|
|
Copy constructor.
Definition at line 581 of file valarray. References std::__valarray_copy_construct(), std::__valarray_get_storage(), and std::valarray< _Tp >::_M_data. |
|
Construct an array with the same size and values in sa.
Definition at line 587 of file valarray. References std::__valarray_get_storage(), std::slice_array< _Tp >::_M_array, std::slice_array< _Tp >::_M_stride, and std::slice_array< _Tp >::_M_sz. |
|
Construct an array with the same size and values in ga.
Definition at line 596 of file valarray. References std::__valarray_get_storage(), std::gslice_array< _Tp >::_M_array, and std::gslice_array< _Tp >::_M_index. |
|
Construct an array with the same size and values in ma.
Definition at line 607 of file valarray. References std::__valarray_get_storage(), std::mask_array< _Tp >::_M_array, and std::mask_array< _Tp >::_M_mask. |
|
Construct an array with the same size and values in ia.
Definition at line 616 of file valarray. References std::__valarray_get_storage(), std::indirect_array< _Tp >::_M_array, and std::indirect_array< _Tp >::_M_index. |
|
Definition at line 625 of file valarray. References std::__valarray_copy(), and std::__valarray_get_storage(). |
|
Definition at line 631 of file valarray. References std::__valarray_destroy_elements(), and std::__valarray_release_memory(). |
|
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.
|
|
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.
|
|
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.
Definition at line 822 of file valarray. References std::__valarray_copy_construct(). |
|
Return the maximum element using operator<().
Definition at line 870 of file valarray. References _GLIBCXX_DEBUG_ASSERT, and std::max_element(). |
|
Return the minimum element using operator<().
Definition at line 862 of file valarray. References _GLIBCXX_DEBUG_ASSERT, and std::min_element(). |
|
|
|
Logical and corresponding elements of v with elements of array.
|
|
Set each element e of array to e & t.
|
|
|
|
Multiply elements of array by corresponding elements of v.
|
|
Multiply each element of array by t.
|
|
Return a new valarray by applying unary ! to each element.
|
|
|
|
Modulo elements of array by corresponding elements of v.
|
|
Set each element e of array to e t.
|
|
Return a new valarray by applying unary + to each element.
|
|
|
|
Add corresponding elements of v to elements of array.
|
|
Add t to each element of array.
|
|
Return a new valarray by applying unary - to each element.
|
|
|
|
Subtract corresponding elements of v from elements of array.
|
|
Subtract t to each element of array.
|
|
|
|
Divide elements of array by corresponding elements of v.
|
|
Divide each element of array by t.
|
|
|
|
Left shift elements of array by corresponding elements of v.
|
|
Left shift each element e of array by t bits.
|
|
Definition at line 696 of file valarray. References std::__valarray_copy(), _GLIBCXX_DEBUG_ASSERT, and std::_Expr< _Clos, _Tp >::size(). |
|
Assign elements to an array subset. Assign elements of array to values in ia. Results are undefined if ia is not the same size as this array.
Definition at line 686 of file valarray. References std::__valarray_copy(), _GLIBCXX_DEBUG_ASSERT, std::indirect_array< _Tp >::_M_array, std::indirect_array< _Tp >::_M_index, and std::indirect_array< _Tp >::_M_sz. |
|
Assign elements to an array subset. Assign elements of array to values in ma. Results are undefined if ma is not the same size as this array.
Definition at line 676 of file valarray. References std::__valarray_copy(), _GLIBCXX_DEBUG_ASSERT, std::mask_array< _Tp >::_M_array, std::mask_array< _Tp >::_M_mask, and std::mask_array< _Tp >::_M_sz. |
|
Assign elements to an array subset. Assign elements of array to values in ga. Results are undefined if ga is not the same size as this array.
Definition at line 666 of file valarray. References std::__valarray_copy(), _GLIBCXX_DEBUG_ASSERT, std::gslice_array< _Tp >::_M_array, std::gslice_array< _Tp >::_M_index, and std::valarray< size_t >::size(). |
|
Assign elements to an array subset. Assign elements of array to values in sa. Results are undefined if sa is not the same size as this array.
Definition at line 656 of file valarray. References std::__valarray_copy(), _GLIBCXX_DEBUG_ASSERT, std::slice_array< _Tp >::_M_array, std::slice_array< _Tp >::_M_stride, and std::slice_array< _Tp >::_M_sz. |
|
Assign elements to a value. Assign all elements of array to t.
Definition at line 648 of file valarray. References std::__valarray_fill(). |
|
Assign elements to an array. Assign elements of array to values in v. Results are undefined if v is not the same size as this array.
Definition at line 639 of file valarray. References std::__valarray_copy(), _GLIBCXX_DEBUG_ASSERT, std::valarray< _Tp >::_M_data, and std::valarray< _Tp >::_M_size. |
|
|
|
Right shift elements of array by corresponding elements of v.
|
|
Right shift each element e of array by t bits.
|
|
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.
Definition at line 768 of file valarray. References std::valarray< _Tp >::size(). |
|
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.
|
|
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.
Definition at line 749 of file valarray. References std::valarray< _Tp >::size(). |
|
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.
Definition at line 737 of file valarray. References std::valarray< _Tp >::size(). |
|
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.
Definition at line 729 of file valarray. References std::gslice::_M_index. |
|
Return an array subset. Returns a slice_array referencing the elements of the array indicated by the slice argument.
Definition at line 720 of file valarray. References std::gslice::_M_index. |
|
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.
|
|
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.
|
|
Definition at line 528 of file valarray. References __glibcxx_requires_subscript. |
|
Return a reference to the i'th array element.
Definition at line 536 of file valarray. References __glibcxx_requires_subscript. |
|
|
|
Logical xor corresponding elements of v with elements of array.
|
|
Set each element e of array to e ^ t.
|
|
|
|
Logical or corresponding elements of v with elements of array.
|
|
Set each element e of array to e | t.
|
|
Return a new valarray by applying unary ~ to each element.
|
|
Resize array. Resize this array to be size and set all elements to c. All references and iterators are invalidated.
Definition at line 845 of file valarray. References std::__valarray_destroy_elements(), std::__valarray_fill_construct(), and std::__valarray_release_memory(). |
|
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.
Definition at line 796 of file valarray. References std::__valarray_copy_construct(), and std::__valarray_default_construct(). |
|
Return the number of elements in array.
Definition at line 776 of file valarray. Referenced by std::valarray< _Tp >::operator[](). |
|
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(), and _GLIBCXX_DEBUG_ASSERT. |
|
|
|
Definition at line 521 of file valarray. Referenced by std::valarray< _Tp >::operator=(), and std::valarray< _Tp >::valarray(). |
|
Definition at line 520 of file valarray. Referenced by std::valarray< _Tp >::operator=(). |