IPPL (Independent Parallel Particle Layer)
IPPL
Loading...
Searching...
No Matches
ippl::random::InverseTransformSampling< T, Dim, DeviceType, Distribution > Class Template Reference

A class for inverse transform sampling. More...

#include <InverseTransformSampling.h>

Collaboration diagram for ippl::random::InverseTransformSampling< T, Dim, DeviceType, Distribution >:

Classes

struct  fill_random
 Functor that is used for generating samples. More...

Public Types

using view_type = typename ippl::detail::ViewType<Vector<T, Dim>, 1>::view_type
using size_type = ippl::detail::size_type

Public Member Functions

template<class RegionLayout>
 InverseTransformSampling (Distribution &dist_r, Vector< T, Dim > &rmax_r, Vector< T, Dim > &rmin_r, RegionLayout &rlayout_r, size_type &ntotal_r)
 Constructor for InverseTransformSampling class with domain decomposition.
 InverseTransformSampling (Distribution &dist_r, Vector< T, Dim > &rmax_r, Vector< T, Dim > &rmin_r, Vector< T, Dim > &locrmax_r, Vector< T, Dim > &locrmin_r, size_type &ntotal_r)
 Constructor for InverseTransformSampling class without applying domain decomposition..
 InverseTransformSampling (Distribution &dist_r, Vector< T, Dim > &rmax_r, Vector< T, Dim > &rmin_r, size_type &ntotal_r)
 Constructor for InverseTransformSampling class. In this method, we do not consider any domain decomposition.
void updateBounds (Vector< T, Dim > &rmax, Vector< T, Dim > &rmin, Vector< T, Dim > &locrmax, Vector< T, Dim > &locrmin)
 Updates the sampling bounds and reinitializes internal variables.
void updateBounds (Vector< T, Dim > &rmax, Vector< T, Dim > &rmin)
 Updates the sampling bounds using the CDF without any domain decomposition.
 ~InverseTransformSampling ()
 Deconstructor for InverseTransformSampling class.
KOKKOS_INLINE_FUNCTION size_type getLocalSamplesNum () const
 Get the local number of samples.
KOKKOS_INLINE_FUNCTION void setLocalSamplesNum (size_type nlocal)
 Set the local number of particles.
void generate (view_type view, Kokkos::Random_XorShift64_Pool<> rand_pool64)
 Generate random samples using inverse transform sampling.
void generate (view_type view, size_type startIndex, size_type endIndex, Kokkos::Random_XorShift64_Pool<> rand_pool64)
 Generate random samples using inverse transform sampling for a specific range of particles.

Public Attributes

Distribution dist_m
size_type ntotal_m
Vector< T, Dimumin_m
Vector< T, Dimumax_m

Private Attributes

size_type nlocal_m

Detailed Description

template<typename T, unsigned Dim, class DeviceType, class Distribution>
class ippl::random::InverseTransformSampling< T, Dim, DeviceType, Distribution >

A class for inverse transform sampling.

This class performs inverse transform sampling for a given distribution.

Template Parameters
TData type.
DimDimensionality of the sample space.
DeviceTypeThe device type for Kokkos.
DistributionType of the distribution to sample from.

Definition at line 26 of file InverseTransformSampling.h.

Member Typedef Documentation

◆ size_type

template<typename T, unsigned Dim, class DeviceType, class Distribution>
using ippl::random::InverseTransformSampling< T, Dim, DeviceType, Distribution >::size_type = ippl::detail::size_type

Definition at line 29 of file InverseTransformSampling.h.

◆ view_type

template<typename T, unsigned Dim, class DeviceType, class Distribution>
using ippl::random::InverseTransformSampling< T, Dim, DeviceType, Distribution >::view_type = typename ippl::detail::ViewType<Vector<T, Dim>, 1>::view_type

Definition at line 28 of file InverseTransformSampling.h.

Constructor & Destructor Documentation

◆ InverseTransformSampling() [1/3]

template<typename T, unsigned Dim, class DeviceType, class Distribution>
template<class RegionLayout>
ippl::random::InverseTransformSampling< T, Dim, DeviceType, Distribution >::InverseTransformSampling ( Distribution & dist_r,
Vector< T, Dim > & rmax_r,
Vector< T, Dim > & rmin_r,
RegionLayout & rlayout_r,
size_type & ntotal_r )
inline

Constructor for InverseTransformSampling class with domain decomposition.

Parameters
dist_rThe distribution to sample from.
rmax_rMaximum global range.
rmin_rMinimum global range.
rlayout_rThe region layout.
ntotal_rTotal number of samples to generate.

Definition at line 45 of file InverseTransformSampling.h.

References ippl::Comm, Dim, dist_m, ntotal_m, and updateBounds().

Here is the call graph for this function:

◆ InverseTransformSampling() [2/3]

template<typename T, unsigned Dim, class DeviceType, class Distribution>
ippl::random::InverseTransformSampling< T, Dim, DeviceType, Distribution >::InverseTransformSampling ( Distribution & dist_r,
Vector< T, Dim > & rmax_r,
Vector< T, Dim > & rmin_r,
Vector< T, Dim > & locrmax_r,
Vector< T, Dim > & locrmin_r,
size_type & ntotal_r )
inline

Constructor for InverseTransformSampling class without applying domain decomposition..

Parameters
dist_rThe distribution to sample from.
rmax_rMaximum global range.
rmin_rMinimum global range.
locrmax_rMaximum local (per rank) range.
locrmin_rMinimum local (per rank) range.
ntotal_Total number of samples to generate.

Definition at line 74 of file InverseTransformSampling.h.

References dist_m, ntotal_m, and updateBounds().

Here is the call graph for this function:

◆ InverseTransformSampling() [3/3]

template<typename T, unsigned Dim, class DeviceType, class Distribution>
ippl::random::InverseTransformSampling< T, Dim, DeviceType, Distribution >::InverseTransformSampling ( Distribution & dist_r,
Vector< T, Dim > & rmax_r,
Vector< T, Dim > & rmin_r,
size_type & ntotal_r )
inline

Constructor for InverseTransformSampling class. In this method, we do not consider any domain decomposition.

Parameters
dist_rThe distribution to sample from.
rmax_rMaximum global range for sampling.
rmin_rMinimum global range for sampling.
ntotal_rTotal number of samples to generate.

Definition at line 91 of file InverseTransformSampling.h.

References dist_m, nlocal_m, ntotal_m, and updateBounds().

Here is the call graph for this function:

◆ ~InverseTransformSampling()

template<typename T, unsigned Dim, class DeviceType, class Distribution>
ippl::random::InverseTransformSampling< T, Dim, DeviceType, Distribution >::~InverseTransformSampling ( )
inline

Deconstructor for InverseTransformSampling class.

Definition at line 166 of file InverseTransformSampling.h.

Member Function Documentation

◆ generate() [1/2]

template<typename T, unsigned Dim, class DeviceType, class Distribution>
void ippl::random::InverseTransformSampling< T, Dim, DeviceType, Distribution >::generate ( view_type view,
Kokkos::Random_XorShift64_Pool<> rand_pool64 )
inline

Generate random samples using inverse transform sampling.

Parameters
viewThe view to fill with random samples.
rand_pool64The random number generator pool.

Definition at line 245 of file InverseTransformSampling.h.

References Dim, dist_m, nlocal_m, umax_m, and umin_m.

◆ generate() [2/2]

template<typename T, unsigned Dim, class DeviceType, class Distribution>
void ippl::random::InverseTransformSampling< T, Dim, DeviceType, Distribution >::generate ( view_type view,
size_type startIndex,
size_type endIndex,
Kokkos::Random_XorShift64_Pool<> rand_pool64 )
inline

Generate random samples using inverse transform sampling for a specific range of particles.

Parameters
viewThe view to fill with random samples.
startIndexThe starting index of view.
endIndexThe ending index of view.
rand_pool64The random number generator pool.

Definition at line 267 of file InverseTransformSampling.h.

References Dim, dist_m, umax_m, and umin_m.

◆ getLocalSamplesNum()

template<typename T, unsigned Dim, class DeviceType, class Distribution>
KOKKOS_INLINE_FUNCTION size_type ippl::random::InverseTransformSampling< T, Dim, DeviceType, Distribution >::getLocalSamplesNum ( ) const
inline

Get the local number of samples.

Returns
The local number of samples.

Definition at line 230 of file InverseTransformSampling.h.

References nlocal_m.

◆ setLocalSamplesNum()

template<typename T, unsigned Dim, class DeviceType, class Distribution>
KOKKOS_INLINE_FUNCTION void ippl::random::InverseTransformSampling< T, Dim, DeviceType, Distribution >::setLocalSamplesNum ( size_type nlocal)
inline

Set the local number of particles.

Parameters
nlocalThe new number of local particles.

Definition at line 237 of file InverseTransformSampling.h.

References nlocal_m.

◆ updateBounds() [1/2]

template<typename T, unsigned Dim, class DeviceType, class Distribution>
void ippl::random::InverseTransformSampling< T, Dim, DeviceType, Distribution >::updateBounds ( Vector< T, Dim > & rmax,
Vector< T, Dim > & rmin )
inline

Updates the sampling bounds using the CDF without any domain decomposition.

This method allows the user to update the minimum and maximum bounds for the inverse transform sampling method. It recalculates the cumulative distribution function (CDF) values for the new bounds and updates the internal variables to reflect these changes.

Parameters
new_rmaxThe new maximum range for sampling. This vector defines the upper bounds for each dimension.
new_rminThe new minimum range for sampling. This vector defines the lower bounds for each dimension.

Definition at line 155 of file InverseTransformSampling.h.

References Dim, dist_m, umax_m, and umin_m.

◆ updateBounds() [2/2]

template<typename T, unsigned Dim, class DeviceType, class Distribution>
void ippl::random::InverseTransformSampling< T, Dim, DeviceType, Distribution >::updateBounds ( Vector< T, Dim > & rmax,
Vector< T, Dim > & rmin,
Vector< T, Dim > & locrmax,
Vector< T, Dim > & locrmin )
inline

Updates the sampling bounds and reinitializes internal variables.

This method allows the user to update the minimum and maximum bounds for the sampling process It recalculates the cumulative distribution function (CDF) values for the new bounds and updates the internal variables to reflect these changes.

Parameters
rmaxThe new maximum range for sampling. This vector defines the upper bounds for each dimension.
rminThe new minimum range for sampling. This vector defines the lower bounds for each dimension.
locrmaxThe new local maximum range for sampling. This vector defines the upper bounds for each dimension for a given rank.
locrminThe new minimum range for sampling. This vector defines the lower bounds for each dimension for a given rank.

Definition at line 117 of file InverseTransformSampling.h.

References ippl::Vector< T, Dim >::begin(), ippl::Comm, Dim, dist_m, ippl::Vector< T, Dim >::end(), nlocal_m, ntotal_m, umax_m, and umin_m.

Referenced by InverseTransformSampling(), InverseTransformSampling(), and InverseTransformSampling().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ dist_m

◆ nlocal_m

template<typename T, unsigned Dim, class DeviceType, class Distribution>
size_type ippl::random::InverseTransformSampling< T, Dim, DeviceType, Distribution >::nlocal_m
private

◆ ntotal_m

template<typename T, unsigned Dim, class DeviceType, class Distribution>
size_type ippl::random::InverseTransformSampling< T, Dim, DeviceType, Distribution >::ntotal_m

◆ umax_m

template<typename T, unsigned Dim, class DeviceType, class Distribution>
Vector<T, Dim> ippl::random::InverseTransformSampling< T, Dim, DeviceType, Distribution >::umax_m

Definition at line 33 of file InverseTransformSampling.h.

Referenced by generate(), generate(), updateBounds(), and updateBounds().

◆ umin_m

template<typename T, unsigned Dim, class DeviceType, class Distribution>
Vector<T, Dim> ippl::random::InverseTransformSampling< T, Dim, DeviceType, Distribution >::umin_m

Definition at line 33 of file InverseTransformSampling.h.

Referenced by generate(), generate(), updateBounds(), and updateBounds().


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