stdgpu/numeric.h Source File — stdgpu Latest documentation (original) (raw)

stdgpu/numeric.h Source File#

stdgpu: stdgpu/numeric.h Source File

stdgpu Latest

Efficient STL-like Data Structures on the GPU

Go to the documentation of this file.

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16#ifndef STDGPU_NUMERIC_H

17#define STDGPU_NUMERIC_H

18

29

30namespace stdgpu

31{

32

33#ifdef STDGPU_RUN_DOXYGEN

34

46template <typename ExecutionPolicy,

47 typename Iterator,

48 typename T,

49 STDGPU_DETAIL_OVERLOAD_IF(is_execution_policy_v<remove_cvref_t>)>

50void

51iota(ExecutionPolicy&& policy, Iterator begin, Iterator end, T value);

52

53#endif

54

56namespace adl_barrier

57{

58

59template <typename ExecutionPolicy,

60 typename Iterator,

61 typename T,

62 STDGPU_DETAIL_OVERLOAD_IF(is_execution_policy_v<remove_cvref_t>)>

63void

64iota(ExecutionPolicy&& policy, Iterator begin, Iterator end, T value);

65

66}

67

68using namespace adl_barrier;

70

85template <typename IndexType,

86 typename ExecutionPolicy,

87 typename T,

88 typename BinaryFunction,

89 typename UnaryFunction,

90 STDGPU_DETAIL_OVERLOAD_IF(is_execution_policy_v<remove_cvref_t>)>

91T

92transform_reduce_index(ExecutionPolicy&& policy, IndexType size, T init, BinaryFunction reduce, UnaryFunction f);

93

94}

95

96#include <stdgpu/impl/numeric_detail.h>

97

98#endif

index64_t size(T *array)

Finds the size (number of elements) of the given dynamically allocated array.

T transform_reduce_index(ExecutionPolicy &&policy, IndexType size, T init, BinaryFunction reduce, UnaryFunction f)

Calls the given unary function with an index from the range [0, size) and performs a reduction afterw...

void iota(ExecutionPolicy &&policy, Iterator begin, Iterator end, T value)

Writes ascending values {values + i} to the i-th position of the given range.