VTK-m  2.2
Public Types | Public Member Functions | List of all members
vtkm::cont::ArrayHandleRandomStandardNormal< Real > Class Template Reference

An ArrayHandle that provides a source of random numbers with a standard normal distribution. More...

#include <ArrayHandleRandomStandardNormal.h>

Inheritance diagram for vtkm::cont::ArrayHandleRandomStandardNormal< Real >:
vtkm::cont::ArrayHandleTransform< vtkm::cont::ArrayHandleZip< vtkm::cont::ArrayHandleRandomUniformReal< vtkm::Float64 >, vtkm::cont::ArrayHandleRandomUniformReal< vtkm::Float64 > >, detail::BoxMuller >

Public Types

using SeedType = vtkm::Vec< vtkm::UInt32, 1 >
 
using UniformReal = vtkm::cont::ArrayHandleRandomUniformReal< Real >
 
using Thisclass = typename vtkm::cont::detail::GetTypeInParentheses< void(ArrayHandleRandomStandardNormal< Real >) >::type
 
using Superclass = typename vtkm::cont::detail::GetTypeInParentheses< void(vtkm::cont::ArrayHandleTransform< vtkm::cont::ArrayHandleZip< vtkm::cont::ArrayHandleRandomUniformReal< Real >, vtkm::cont::ArrayHandleRandomUniformReal< Real > >, detail::BoxMuller >) >::type
 
using ValueType = typename Superclass::ValueType
 
using StorageTag = typename Superclass::StorageTag
 
using StorageType = typename Superclass::StorageType
 
using ReadPortalType = typename Superclass::ReadPortalType
 
using WritePortalType = typename Superclass::WritePortalType
 

Public Member Functions

 ArrayHandleRandomStandardNormal ()
 
VTKM_CONT ArrayHandleRandomStandardNormal (const Thisclass &src)
 
VTKM_CONT ArrayHandleRandomStandardNormal (Thisclass &&src) noexcept
 
VTKM_CONT ArrayHandleRandomStandardNormal (const vtkm::cont::ArrayHandle< typename Superclass::ValueType, typename Superclass::StorageTag > &src)
 
VTKM_CONT ArrayHandleRandomStandardNormal (vtkm::cont::ArrayHandle< typename Superclass::ValueType, typename Superclass::StorageTag > &&src) noexcept
 
VTKM_CONT ArrayHandleRandomStandardNormal (const std::vector< vtkm::cont::internal::Buffer > &buffers)
 
VTKM_CONT ArrayHandleRandomStandardNormal (std::vector< vtkm::cont::internal::Buffer > &&buffers) noexcept
 
VTKM_CONT Thisclassoperator= (const Thisclass &src)
 
VTKM_CONT Thisclassoperator= (Thisclass &&src) noexcept
 
 ArrayHandleRandomStandardNormal (vtkm::Id length, SeedType seed={ std::random_device{}() })
 Construct an ArrayHandleRandomStandardNormal. More...
 

Detailed Description

template<typename Real = vtkm::Float64>
class vtkm::cont::ArrayHandleRandomStandardNormal< Real >

An ArrayHandle that provides a source of random numbers with a standard normal distribution.

ArrayHandleRandomStandardNormal takes a user supplied seed and hashes it to provide a sequence of numbers drawn from a random standard normal distribution. The probability density function of the numbers is $\frac{e^{-x^2/2}}{\sqrt{2\pi}}$. The range of possible values is technically infinite, but the probability of large positive or negative numbers becomes vanishingly small.

This array uses the Box-Muller transform to pick random numbers in the stanard normal distribution.

Note: In contrast to traditional random number generator, ArrayHandleRandomStandardNormal does not have "state", i.e. multiple calls the Get() method with the same index will always return the same hash value. To get a new set of random bits, create a new ArrayHandleRandomUniformBits with a different seed.

Member Typedef Documentation

◆ ReadPortalType

template<typename Real = vtkm::Float64>
using vtkm::cont::ArrayHandleRandomStandardNormal< Real >::ReadPortalType = typename Superclass::ReadPortalType

◆ SeedType

template<typename Real = vtkm::Float64>
using vtkm::cont::ArrayHandleRandomStandardNormal< Real >::SeedType = vtkm::Vec<vtkm::UInt32, 1>

◆ StorageTag

template<typename Real = vtkm::Float64>
using vtkm::cont::ArrayHandleRandomStandardNormal< Real >::StorageTag = typename Superclass::StorageTag

◆ StorageType

template<typename Real = vtkm::Float64>
using vtkm::cont::ArrayHandleRandomStandardNormal< Real >::StorageType = typename Superclass::StorageType

◆ Superclass

template<typename Real = vtkm::Float64>
using vtkm::cont::ArrayHandleRandomStandardNormal< Real >::Superclass = typename vtkm::cont::detail::GetTypeInParentheses<void (vtkm::cont::ArrayHandleTransform< vtkm::cont::ArrayHandleZip<vtkm::cont::ArrayHandleRandomUniformReal<Real>, vtkm::cont::ArrayHandleRandomUniformReal<Real> >, detail::BoxMuller>) >::type

◆ Thisclass

template<typename Real = vtkm::Float64>
using vtkm::cont::ArrayHandleRandomStandardNormal< Real >::Thisclass = typename vtkm::cont::detail::GetTypeInParentheses<void (ArrayHandleRandomStandardNormal<Real>) >::type

◆ UniformReal

template<typename Real = vtkm::Float64>
using vtkm::cont::ArrayHandleRandomStandardNormal< Real >::UniformReal = vtkm::cont::ArrayHandleRandomUniformReal<Real>

◆ ValueType

template<typename Real = vtkm::Float64>
using vtkm::cont::ArrayHandleRandomStandardNormal< Real >::ValueType = typename Superclass::ValueType

◆ WritePortalType

template<typename Real = vtkm::Float64>
using vtkm::cont::ArrayHandleRandomStandardNormal< Real >::WritePortalType = typename Superclass::WritePortalType

Constructor & Destructor Documentation

◆ ArrayHandleRandomStandardNormal() [1/8]

template<typename Real = vtkm::Float64>
vtkm::cont::ArrayHandleRandomStandardNormal< Real >::ArrayHandleRandomStandardNormal ( )
inline

◆ ArrayHandleRandomStandardNormal() [2/8]

template<typename Real = vtkm::Float64>
VTKM_CONT vtkm::cont::ArrayHandleRandomStandardNormal< Real >::ArrayHandleRandomStandardNormal ( const Thisclass src)
inline

◆ ArrayHandleRandomStandardNormal() [3/8]

template<typename Real = vtkm::Float64>
VTKM_CONT vtkm::cont::ArrayHandleRandomStandardNormal< Real >::ArrayHandleRandomStandardNormal ( Thisclass &&  src)
inlinenoexcept

◆ ArrayHandleRandomStandardNormal() [4/8]

template<typename Real = vtkm::Float64>
VTKM_CONT vtkm::cont::ArrayHandleRandomStandardNormal< Real >::ArrayHandleRandomStandardNormal ( const vtkm::cont::ArrayHandle< typename Superclass::ValueType, typename Superclass::StorageTag > &  src)
inline

◆ ArrayHandleRandomStandardNormal() [5/8]

template<typename Real = vtkm::Float64>
VTKM_CONT vtkm::cont::ArrayHandleRandomStandardNormal< Real >::ArrayHandleRandomStandardNormal ( vtkm::cont::ArrayHandle< typename Superclass::ValueType, typename Superclass::StorageTag > &&  src)
inlinenoexcept

◆ ArrayHandleRandomStandardNormal() [6/8]

template<typename Real = vtkm::Float64>
VTKM_CONT vtkm::cont::ArrayHandleRandomStandardNormal< Real >::ArrayHandleRandomStandardNormal ( const std::vector< vtkm::cont::internal::Buffer > &  buffers)
inlineexplicit

◆ ArrayHandleRandomStandardNormal() [7/8]

template<typename Real = vtkm::Float64>
VTKM_CONT vtkm::cont::ArrayHandleRandomStandardNormal< Real >::ArrayHandleRandomStandardNormal ( std::vector< vtkm::cont::internal::Buffer > &&  buffers)
inlineexplicitnoexcept

◆ ArrayHandleRandomStandardNormal() [8/8]

template<typename Real = vtkm::Float64>
vtkm::cont::ArrayHandleRandomStandardNormal< Real >::ArrayHandleRandomStandardNormal ( vtkm::Id  length,
SeedType  seed = { std::random_device{}() } 
)
inlineexplicit

Construct an ArrayHandleRandomStandardNormal.

Parameters
lengthSpecifies the length of the generated array.
seedProvides a seed to use for the pseudorandom numbers. To prevent confusion between the seed and the length, the type of the seed is a vtkm::Vec of size 1. To specify the seed, declare it in braces. For example, to construct a random array of size 50 with seed 123, use ArrayHandleRandomStandardNormal(50, { 123 }).

Member Function Documentation

◆ operator=() [1/2]

template<typename Real = vtkm::Float64>
VTKM_CONT Thisclass& vtkm::cont::ArrayHandleRandomStandardNormal< Real >::operator= ( const Thisclass src)
inline

◆ operator=() [2/2]

template<typename Real = vtkm::Float64>
VTKM_CONT Thisclass& vtkm::cont::ArrayHandleRandomStandardNormal< Real >::operator= ( Thisclass &&  src)
inlinenoexcept

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