prrng 1.12.1
Loading...
Searching...
No Matches
prrng::pcg32_arrayBase_cumsum< Generator, Data, Index > Class Template Reference

TODO: copydoc. More...

#include <prrng.h>

Inheritance diagram for prrng::pcg32_arrayBase_cumsum< Generator, Data, Index >:
prrng::pcg32_arrayBase_chunkBase< Generator, Data, Index, true >

Public Types

using size_type = typename Data::size_type
 Size type of the data container.
 
- Public Types inherited from prrng::pcg32_arrayBase_chunkBase< Generator, Data, Index, true >
using size_type = typename Data::size_type
 Size type of the data container.
 

Public Member Functions

template<class T >
void align (const T &target)
 Align the chunk to encompass a target value.
 
void align (size_t i, double target)
 Align the chunk to encompass a target value.
 
template<class S , class V , class T >
void restore (const S &state, const V &value, const T &index)
 Restore a specific state in the cumulative sum.
 
template<class T >
bool contains (const T &target) const
 Check if the chunk contains a target.
 
- Public Member Functions inherited from prrng::pcg32_arrayBase_chunkBase< Generator, Data, Index, true >
 pcg32_arrayBase_chunkBase (const pcg32_arrayBase_chunkBase &other)
 Copy constructor.
 
void operator= (const pcg32_arrayBase_chunkBase &other)
 Copy constructor.
 
pcg32_arrayBase_chunkBaseoperator+= (const T &values)
 Add values to each chunk.
 
pcg32_arrayBase_chunkBaseoperator-= (const T &values)
 Subtract values from each chunk.
 
bool is_extendible () const
 true if the chunk is extendible.
 
size_type chunk_size () const
 Size of the chunk per generator.
 
const Generator & generators () const
 Reference to the underlying generators.
 
const Data & data () const
 The current chunk of the cumsum of random numbers.
 
void set_data (const Data &data)
 Overwrite the current chunk of the cumsum of random numbers.
 
const Index & start () const
 Global index of the first element in the chunk.
 
void set_start (const Index &index)
 Set global index of the first element in the chunk.
 
void align_at (const Index &index)
 Get the index random number, which index specified per generator.
 
Index index_at_align () const
 Global index of target (the last time prrng::pcg32_cumsum::align() was called).
 
const Index & chunk_index_at_align () const
 Index of target relative to the beginning of the chunk (the last time prrng::pcg32_cumsum::align() was called).
 
void left_of_align (R &ret) const
 Return the value of the cumsum left of the target (the last time prrng::pcg32_cumsum::align() was called).
 
left_of_align () const
 Return the value of the cumsum left of the target (the last time prrng::pcg32_cumsum::align() was called).
 
void right_of_align (R &ret) const
 Return the value of the cumsum right of the target (the last time prrng::pcg32_cumsum::align() was called).
 
right_of_align () const
 Return the value of the cumsum right of the target (the last time prrng::pcg32_cumsum::align() was called).
 
state_at (const T &index)
 The current "state" of the generator.
 

Additional Inherited Members

- Protected Member Functions inherited from prrng::pcg32_arrayBase_chunkBase< Generator, Data, Index, true >
void init (const S &shape, const T &initstate, const U &initseq, enum distribution distribution, const std::vector< double > &parameters, const alignment &align=alignment())
 Constructor.
 
void auto_functions ()
 Set draw function.
 
void copy_from (const pcg32_arrayBase_chunkBase &other)
 Copy constructor.
 
- Protected Attributes inherited from prrng::pcg32_arrayBase_chunkBase< Generator, Data, Index, true >
Generator m_gen
 Array of generators.
 
Data m_data
 Data container.
 
std::vector< std::function< xt::xtensor< double, 1 >(size_t)> > m_draw
 Function to draw the next chunk of n random numbers starting from the curent state of the generator.
 
std::vector< std::function< double(size_t)> > m_sum
 Function to get the cumsum of n random numbers starting from the curent state of the generator (used to skip allocating an list of size n).
 
bool m_extendible
 Signal if the drawing functions are specified, implying that the chunk can be changed.
 
alignment m_align
 alignment settings, see prrng::alignment().
 
distribution m_distro
 Distribution name, see prrng::distribution().
 
std::array< double, 3 > m_param
 Distribution parameters.
 
Index m_start
 Start index of the chunk.
 
Index m_i
 Last known index of target in align.
 
size_t m_n
 Size of the chunk.
 

Detailed Description

template<class Generator, class Data, class Index>
class prrng::pcg32_arrayBase_cumsum< Generator, Data, Index >

TODO: copydoc.

Array of generators of a random cumulative sum.

 -   A chunk of the cumsum is kept in memory, from which to can move forward or backward.
 -   All chunks are assembled to one big array.
 -   The random number generated by the pcg32 algorithm.
Template Parameters
GeneratorStorage of the generator array, e.g. prrng::pcg32_tensor<N>.
DataStorage of the data, e.g. xt::xtensor<double, N + n>.
IndexStorage of the index, e.g. xt::xtensor<ptrdiff_t, N>.

Definition at line 6343 of file prrng.h.

Member Typedef Documentation

◆ size_type

template<class Generator , class Data , class Index >
using prrng::pcg32_arrayBase_cumsum< Generator, Data, Index >::size_type = typename Data::size_type

Size type of the data container.

Definition at line 6356 of file prrng.h.

Member Function Documentation

◆ align() [1/2]

template<class Generator , class Data , class Index >
template<class T >
void prrng::pcg32_arrayBase_cumsum< Generator, Data, Index >::align ( const T &  target)
inline

Align the chunk to encompass a target value.

After this call:

Parameters
targetTarget value.

Definition at line 6365 of file prrng.h.

◆ align() [2/2]

template<class Generator , class Data , class Index >
void prrng::pcg32_arrayBase_cumsum< Generator, Data, Index >::align ( size_t  i,
double  target 
)
inline

Align the chunk to encompass a target value.

After this call:

Parameters
targetTarget value.
iFlat index of the item to align.

Definition at line 6396 of file prrng.h.

◆ contains()

template<class Generator , class Data , class Index >
template<class T >
bool prrng::pcg32_arrayBase_cumsum< Generator, Data, Index >::contains ( const T &  target) const
inline

Check if the chunk contains a target.

Parameters
targetThe target.
Returns
true if the chunk contains the target.

Definition at line 6448 of file prrng.h.

◆ restore()

template<class Generator , class Data , class Index >
template<class S , class V , class T >
void prrng::pcg32_arrayBase_cumsum< Generator, Data, Index >::restore ( const S &  state,
const V &  value,
const T &  index 
)
inline

Restore a specific state in the cumulative sum.

Parameters
stateThe state at the beginning of the new chunk.
valueThe value of the first entry of the new chunk.
indexThe index of the first entry of the new chunk.

Definition at line 6425 of file prrng.h.


The documentation for this class was generated from the following file: