IPPL (Independent Parallel Particle Layer)
IPPL
Loading...
Searching...
No Matches
ippl::random::randn< T, Dim > Struct Template Reference

Functor to generate random numbers from a normal distribution. More...

#include <Randn.h>

Collaboration diagram for ippl::random::randn< T, Dim >:

Public Types

using view_type
using GeneratorPool = typename Kokkos::Random_XorShift64_Pool<>

Public Member Functions

KOKKOS_INLINE_FUNCTION randn (view_type v_, GeneratorPool rand_pool_, T *mu_p, T *sd_p)
 Constructor for the randn functor.
KOKKOS_INLINE_FUNCTION randn (view_type v_, GeneratorPool rand_pool_)
KOKKOS_INLINE_FUNCTION const TgetMu (unsigned int idx) const
 Getter function for mean in idx dimension.
KOKKOS_INLINE_FUNCTION const TgetSd (unsigned int idx) const
 Getter function for the standard deviation in idx dimension.
KOKKOS_INLINE_FUNCTION void operator() (const size_t i) const
 Operator to generate random numbers.

Public Attributes

view_type v
GeneratorPool rand_pool
T mu [Dim]
T sd [Dim]

Detailed Description

template<typename T, unsigned Dim>
struct ippl::random::randn< T, Dim >

Functor to generate random numbers from a normal distribution.

This functor can be used to generates random numbers from a normal distribution with mean 0 and standard deviation 1.

Template Parameters
TData type of the random numbers.
GeneratorPoolType of the random number generator pool.
DimDimensionality of the random numbers.

Definition at line 26 of file Randn.h.

Member Typedef Documentation

◆ GeneratorPool

template<typename T, unsigned Dim>
using ippl::random::randn< T, Dim >::GeneratorPool = typename Kokkos::Random_XorShift64_Pool<>

Definition at line 29 of file Randn.h.

◆ view_type

template<typename T, unsigned Dim>
using ippl::random::randn< T, Dim >::view_type
Initial value:

Definition at line 27 of file Randn.h.

Constructor & Destructor Documentation

◆ randn() [1/2]

template<typename T, unsigned Dim>
KOKKOS_INLINE_FUNCTION ippl::random::randn< T, Dim >::randn ( view_type v_,
GeneratorPool rand_pool_,
T * mu_p,
T * sd_p )
inline

Constructor for the randn functor.

Parameters
v_Output view for the random numbers.
rand_pool_The random number generator pool.
muThe array of means in each dimension
sdThe array of standard deviation in each dimension

Definition at line 47 of file Randn.h.

References Dim, mu, rand_pool, sd, and v.

◆ randn() [2/2]

template<typename T, unsigned Dim>
KOKKOS_INLINE_FUNCTION ippl::random::randn< T, Dim >::randn ( view_type v_,
GeneratorPool rand_pool_ )
inline

Definition at line 56 of file Randn.h.

References Dim, mu, rand_pool, sd, and v.

Member Function Documentation

◆ getMu()

template<typename T, unsigned Dim>
KOKKOS_INLINE_FUNCTION const T & ippl::random::randn< T, Dim >::getMu ( unsigned int idx) const
inline

Getter function for mean in idx dimension.

Parameters
idxThe index indicating the dimension.

Definition at line 70 of file Randn.h.

References mu.

◆ getSd()

template<typename T, unsigned Dim>
KOKKOS_INLINE_FUNCTION const T & ippl::random::randn< T, Dim >::getSd ( unsigned int idx) const
inline

Getter function for the standard deviation in idx dimension.

Parameters
idxThe index indicating the dimension.

Definition at line 77 of file Randn.h.

References sd.

◆ operator()()

template<typename T, unsigned Dim>
KOKKOS_INLINE_FUNCTION void ippl::random::randn< T, Dim >::operator() ( const size_t i) const
inline

Operator to generate random numbers.

Parameters
iIndex for the random numbers.

Definition at line 84 of file Randn.h.

References Dim, mu, rand_pool, sd, and v.

Member Data Documentation

◆ mu

template<typename T, unsigned Dim>
T ippl::random::randn< T, Dim >::mu[Dim]

Definition at line 37 of file Randn.h.

Referenced by getMu(), operator()(), randn(), and randn().

◆ rand_pool

template<typename T, unsigned Dim>
GeneratorPool ippl::random::randn< T, Dim >::rand_pool

Definition at line 35 of file Randn.h.

Referenced by operator()(), randn(), and randn().

◆ sd

template<typename T, unsigned Dim>
T ippl::random::randn< T, Dim >::sd[Dim]

Definition at line 38 of file Randn.h.

Referenced by getSd(), operator()(), randn(), and randn().

◆ v

template<typename T, unsigned Dim>
view_type ippl::random::randn< T, Dim >::v

Definition at line 32 of file Randn.h.

Referenced by operator()(), randn(), and randn().


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