File view_functions.hpp

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 T>
static inline void setViewToValue(Iterator iterator, uint32 numElements, T 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 b to the elements in another view a, such that a = a + b.

Template Parameters:
  • IteratorA – The type of the iterator that provides access to the values in the view a

  • IteratorB – 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 a

  • b – An iterator to the beginning of the view b

  • numElements – The number of elements in the views a and b

template<typename IteratorA, typename IteratorB, typename Weight>
static inline void addToView(IteratorA a, IteratorB b, uint32 numElements, Weight weight)

Adds the elements in a view b to the elements in another view a. The elements in the view b are multiplied by a given weight, such that a = a + (b * weight).

Template Parameters:
  • IteratorA – The type of the iterator that provides access to the values in the view a

  • IteratorB – The type of the iterator that provides access to the values in the view b

  • Weight – The type of the weight

Parameters:
  • a – An iterator to the beginning of the view a

  • b – An iterator to the beginning of the view b

  • numElements – The number of elements in the views a and b

  • weight – The weight, the elements in the view b should 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 b to the elements in another view a, such that a = a + b. The indices of the elements in the view b that correspond to the elements in the view a are given as an additional view.

Template Parameters:
  • IteratorA – The type of the iterator that provides access to the values in the view a

  • IteratorB – The type of the iterator that provides access to the values in the view b

  • IndexIterator – The type of the iterator that provides access to the indices

Parameters:
  • a – An iterator to the beginning of the view a

  • b – An iterator to the beginning of the view b

  • numElements – The number of elements in the views a and b

  • indices – An iterator to the beginning of a view that stores the indices of the elements in the view b that correspond to the elements in the view a

template<typename IteratorA, typename IteratorB, typename IndexIterator, typename Weight>
static inline void addToView(IteratorA a, IteratorB b, IndexIterator indices, uint32 numElements, Weight weight)

Adds the elements in a view b to the elements in another view a. The elements in the view b are multiplied by a given weight, such that a = a + (b * weight). The indices of the elements in the view b that correspond to the elements in the view a are given as an additional view.

Template Parameters:
  • IteratorA – The type of the iterator that provides access to the values in the view a

  • IteratorB – The type of the iterator that provides access to the values in the view b

  • IndexIterator – 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 a

  • b – An iterator to the beginning of the view b

  • numElements – The number of elements in the views a and b

  • weight – The weight, the elements in the view b should be multiplied by

  • indices – An iterator to the beginning of a view that stores the indices of the elements in the view b that correspond to the elements in the view a

template<typename IteratorA, typename IteratorB>
static inline void removeFromView(IteratorA a, IteratorB b, uint32 numElements)

Removes the elements in a view b from the elements in another view a, such that a = a - b.

Template Parameters:
  • IteratorA – The type of the iterator that provides access to the values in the view a

  • IteratorB – 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 a

  • b – An iterator to the beginning of the view b

  • numElements – The number of elements in the views a and b

template<typename IteratorA, typename IteratorB, typename Weight>
static inline void removeFromView(IteratorA a, IteratorB b, uint32 numElements, Weight weight)

Removes the elements in a view b from the elements in another view a. The elements in the view b are multiplied by a given weight, such that a = a - (b * weight).

Template Parameters:
  • IteratorA – The type of the iterator that provides access to the values in the view a

  • IteratorB – The type of the iterator that provides access to the values in the view b

  • Weight – The type of the weight

Parameters:
  • a – An iterator to the beginning of the view a

  • b – An iterator to the beginning of the view b

  • numElements – The number of elements in the views a and b

  • weight – The weight, the elements in the view b should 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 a to the difference between the elements in two other views b and c, such that a = b - c.

Template Parameters:
  • IteratorA – The type of the iterator that provides access to the value in the view a

  • IteratorB – The type of the iterator that provides access to the value in the view b

  • IteratorC – 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 a

  • b – An iterator to the beginning of the view b

  • c – An iterator to the beginning of the view c

  • numElements – The number of elements in the views a, b and c

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 a to the difference between the elements in two other views b and c, such that a = b - c. The indices of elements in the view b that correspond to the elements in the views a and c are obtained from an additional view.

Template Parameters:
  • IteratorA – The type of the iterator that provides access to the value in the view a

  • IteratorB – The type of the iterator that provides access to the value in the view b

  • IteratorC – The type of the iterator that provides access to the value in the view c

  • IndexIterator – The type of the iterator that provides access to the indices

Parameters:
  • a – An iterator to the beginning of the view a

  • b – An iterator to the beginning of the view b

  • c – An iterator to the beginning of the view c

  • indices – An iterator to the beginning of the view that provides access to the indices of the elements in the view b that correspond to the elements in the views a and c

  • numElements – The number of elements in the view a

template<typename Iterator>
static inline constexpr 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 constexpr 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