34 #include <cugar/basic/numbers.h> 55 template <
typename Generator,
typename Iterator = const
float*>
75 CUGAR_HOST_DEVICE
CP_rotator(Generator& gen, Iterator rot, uint32 size, uint32 dim = 0) :
76 m_gen( gen ), m_rot( rot ), m_size( size ), m_dim( dim ) {}
80 inline CUGAR_HOST_DEVICE
float next()
82 return cugar::mod( m_gen.next() + m_rot[m_dim++ & (m_size-1)], 1.0f );
87 inline CUGAR_HOST_DEVICE
float density(
const float x)
const 102 template <
typename Sample_sequence,
typename Iterator = const
float*>
113 CUGAR_HOST_DEVICE
CP_rotated_sequence(Sample_sequence& sequence,
const uint32 dims, Iterator rot, uint32 size) :
114 m_sequence( sequence ), m_rot( rot ), m_size( size ), m_dims( dims ) {}
120 Sampler_type CUGAR_HOST_DEVICE
instance(
const uint32 index,
const uint32 copy)
const 122 return Sampler_type( m_sequence.instance( index, copy ), m_rot, m_dims * m_size, copy * m_dims );
125 Sample_sequence& m_sequence;
CUGAR_HOST_DEVICE CP_rotator(Generator &gen, Iterator rot, uint32 size, uint32 dim=0)
Definition: cp_rotations.h:75
float CUGAR_HOST_DEVICE mod(const float x, const float m)
Definition: numbers.h:606
CUGAR_HOST_DEVICE CP_rotated_sequence(Sample_sequence &sequence, const uint32 dims, Iterator rot, uint32 size)
Definition: cp_rotations.h:113
Definition: cp_rotations.h:103
Sampler_type CUGAR_HOST_DEVICE instance(const uint32 index, const uint32 copy) const
Definition: cp_rotations.h:120
Define a vector_view POD type and plain_view() for std::vector.
Definition: diff.h:38
CUGAR_HOST_DEVICE float next()
Definition: cp_rotations.h:80
Definition: cp_rotations.h:67
CUGAR_HOST_DEVICE float density(const float x) const
Definition: cp_rotations.h:87