File view_functions.hpp¶
-
namespace util
Functions
-
template<typename Iterator>
static inline void setViewToZeros(Iterator iterator, uint32 numElements)¶ Sets all elements in a view to zero.
- Template Parameters:
Iterator – The type of the iterator that provides access to the values in the view
- Parameters:
iterator – An iterator to the beginning of the view
numElements – The number of elements in the view
-
template<typename Iterator, typename Value>
static inline void setViewToValue(Iterator iterator, uint32 numElements, Value value)¶ Sets all elements in a view to a specific value.
- Template Parameters:
Iterator – The type of the iterator that provides access to the values in the view
Value – The type of the value to be set
- Parameters:
iterator – An iterator to to the beginning of the view
numElements – The number of elements in the view
value – The value to be set
-
template<typename Iterator, typename Value>
static inline void setViewToIncreasingValues(Iterator iterator, uint32 numElements, Value start, Value increment)¶ Sets the elements in a view to increasing values.
- Template Parameters:
Iterator – The type of the iterator that provides access to the values in the view
Value – The type of the values to be set
- Parameters:
iterator – An iterator to the beginning of the view
numElements – The number of elements in the view
start – The value to start at
increment – The difference between the values
-
template<typename FromIterator, typename ToIterator>
static inline void copyView(FromIterator from, ToIterator to, uint32 numElements)¶ Copy all elements from one view to another.
- Template Parameters:
FromIterator – The type of the iterator that provides access to the values in the view to copy from
ToIterator – The type of the iterator that provides access to the values in the view to copy to
- Parameters:
from – An iterator to the beginning of the view to copy from
to – An iterator to the beginning of the view to copy to
numElements – The number of elements to be copied
-
template<typename IteratorA, typename IteratorB>
static inline void addToView(IteratorA a, IteratorB b, uint32 numElements)¶ Adds the elements in a view
bto the elements in another viewa, such thata = a + b.- Template Parameters:
IteratorA – The type of the iterator that provides access to the values in the view
aIteratorB – The type of the iterator that provides access to the values in the view
b
- Parameters:
a – An iterator to the beginning of the view
ab – An iterator to the beginning of the view
bnumElements – The number of elements in the views
aandb
-
template<typename IteratorA, typename IteratorB, typename Weight>
static inline void addToViewWeighted(IteratorA a, IteratorB b, uint32 numElements, Weight weight)¶ Adds the elements in a view
bto the elements in another viewa. The elements in the viewbare multiplied by a given weight, such thata = a + (b * weight).- Template Parameters:
IteratorA – The type of the iterator that provides access to the values in the view
aIteratorB – The type of the iterator that provides access to the values in the view
bWeight – The type of the weight
- Parameters:
a – An iterator to the beginning of the view
ab – An iterator to the beginning of the view
bnumElements – The number of elements in the views
aandbweight – The weight, the elements in the view
bshould be multiplied by
-
template<typename IteratorA, typename IteratorB, typename IndexIterator>
static inline void addToView(IteratorA a, IteratorB b, IndexIterator indices, uint32 numElements)¶ Adds the elements in a view
bto the elements in another viewa, such thata = a + b. The indices of the elements in the viewbthat correspond to the elements in the viewaare given as an additional view.- Template Parameters:
IteratorA – The type of the iterator that provides access to the values in the view
aIteratorB – The type of the iterator that provides access to the values in the view
bIndexIterator – The type of the iterator that provides access to the indices
- Parameters:
a – An iterator to the beginning of the view
ab – An iterator to the beginning of the view
bnumElements – The number of elements in the views
aandbindices – An iterator to the beginning of a view that stores the indices of the elements in the view
bthat correspond to the elements in the viewa
-
template<typename IteratorA, typename IteratorB, typename IndexIterator, typename Weight>
static inline void addToViewWeighted(IteratorA a, IteratorB b, IndexIterator indices, uint32 numElements, Weight weight)¶ Adds the elements in a view
bto the elements in another viewa. The elements in the viewbare multiplied by a given weight, such thata = a + (b * weight). The indices of the elements in the viewbthat correspond to the elements in the viewaare given as an additional view.- Template Parameters:
IteratorA – The type of the iterator that provides access to the values in the view
aIteratorB – The type of the iterator that provides access to the values in the view
bIndexIterator – The type of the iterator that provides access to the indices
Weight – The type of the weight
- Parameters:
a – An iterator to the beginning of the view
ab – An iterator to the beginning of the view
bnumElements – The number of elements in the views
aandbweight – The weight, the elements in the view
bshould be multiplied byindices – An iterator to the beginning of a view that stores the indices of the elements in the view
bthat correspond to the elements in the viewa
-
template<typename IteratorA, typename IteratorB>
static inline void removeFromView(IteratorA a, IteratorB b, uint32 numElements)¶ Removes the elements in a view
bfrom the elements in another viewa, such thata = a - b.- Template Parameters:
IteratorA – The type of the iterator that provides access to the values in the view
aIteratorB – The type of the iterator that provides access to the values in the view
b
- Parameters:
a – An iterator to the beginning of the view
ab – An iterator to the beginning of the view
bnumElements – The number of elements in the views
aandb
-
template<typename IteratorA, typename IteratorB, typename Weight>
static inline void removeFromViewWeighted(IteratorA a, IteratorB b, uint32 numElements, Weight weight)¶ Removes the elements in a view
bfrom the elements in another viewa. The elements in the viewbare multiplied by a given weight, such thata = a - (b * weight).- Template Parameters:
IteratorA – The type of the iterator that provides access to the values in the view
aIteratorB – The type of the iterator that provides access to the values in the view
bWeight – The type of the weight
- Parameters:
a – An iterator to the beginning of the view
ab – An iterator to the beginning of the view
bnumElements – The number of elements in the views
aandbweight – The weight, the elements in the view
bshould be multiplied by
-
template<typename IteratorA, typename IteratorB, typename IteratorC>
static inline void setViewToDifference(IteratorA a, IteratorB b, IteratorC c, uint32 numElements)¶ Sets all elements in a view
ato the difference between the elements in two other viewsbandc, such thata = b - c.- Template Parameters:
IteratorA – The type of the iterator that provides access to the value in the view
aIteratorB – The type of the iterator that provides access to the value in the view
bIteratorC – The type of the iterator that provides access to the value in the view
c
- Parameters:
a – An iterator to the beginning of the view
ab – An iterator to the beginning of the view
bc – An iterator to the beginning of the view
cnumElements – The number of elements in the views
a,bandc
-
template<typename IteratorA, typename IteratorB, typename IteratorC, typename IndexIterator>
static inline void setViewToDifference(IteratorA a, const IteratorB b, const IteratorC c, IndexIterator indices, uint32 numElements)¶ Sets all elements in a view
ato the difference between the elements in two other viewsbandc, such thata = b - c. The indices of elements in the viewbthat correspond to the elements in the viewsaandcare obtained from an additional view.- Template Parameters:
IteratorA – The type of the iterator that provides access to the value in the view
aIteratorB – The type of the iterator that provides access to the value in the view
bIteratorC – The type of the iterator that provides access to the value in the view
cIndexIterator – The type of the iterator that provides access to the indices
- Parameters:
a – An iterator to the beginning of the view
ab – An iterator to the beginning of the view
bc – An iterator to the beginning of the view
cindices – An iterator to the beginning of the view that provides access to the indices of the elements in the view
bthat correspond to the elements in the viewsaandcnumElements – The number of elements in the view
a
-
template<typename Iterator>
static inline std::size_t hashView(Iterator iterator, uint32 numElements)¶ Calculates and returns a hash value from a view.
- Template Parameters:
Iterator – The type of the iterator that provides access to the values in the view
- Parameters:
iterator – An iterator to the beginning of the view
numElements – The number of elements in the view
- Returns:
The hash value that has been calculated
-
template<typename FirstIterator, typename SecondIterator>
static inline bool compareViews(FirstIterator first, uint32 numFirst, SecondIterator second, uint32 numSecond)¶ Returns whether all elements of two views are equal or not.
- Template Parameters:
FirstIterator – The type of the iterator that provides access to the values in the first view
SecondIterator – The type of the iterator that provides access to the values in the second view
- Parameters:
first – An iterator to the beginning of the first view
numFirst – The number of elements in the first view
second – An iterator to the beginning of the second view
numSecond – The number of elements in the second view
- Returns:
True, if all elements of both views are equal, false otherwise
-
template<typename Iterator>