IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
NormalRandom.h
Go to the documentation of this file.
1 // NormalRandom.h:
3 // ------------
4 //
15 
16 #ifndef __IPSDKUTIL_INSTRUCTIONSET_NORMALRANDOM_H__
17 #define __IPSDKUTIL_INSTRUCTIONSET_NORMALRANDOM_H__
18 
19 #pragma warning (push)
20 #pragma warning (disable:4251)
21 
25 
29 
30 namespace ipsdk {
31 namespace simd {
32 
35 
36 
37 template <eInstructionSet::domain instructionSet, eInstructionSet::domain instructionSetFma, typename T>
38 class NormalRandom {
39 public:
45 
50 
54  {
55  _bGenerate = !_bGenerate;
56  if(_bGenerate) {
59  _rMean,
60  _rSigma,
61  _uniformRandomLCG(),
62  _uniformRandomLCG(),
63  randomPack, _savedRandomPack);
64  return randomPack;
65  }
66  else
67  return _savedRandomPack;
68  }
69 
70 protected:
71  typedef typename RegType<instructionSet, ipReal32>::Type RegFloat;
72 
74  RegFloat _rMean;
75  RegFloat _rSigma;
76  bool _bGenerate;
78 };
79 
82 
83 } // end of namespace simd
84 } // end of namespace ipsdk
85 
86 #pragma warning (pop)
87 
88 #endif // __IPSDKUTIL_INSTRUCTIONSET_NORMALRANDOM_H__
Defines the IPSDK_FORCEINLINE.
Main namespace for IPSDK library.
Definition: AlgorithmFunctionEfficiency.h:22
IPSDKMATH_API ipReal64 mean(const std::vector< T > &coll)
function allowing to compute mean for a vector
NormalRandom(ipsdk::ipReal32 mean, ipsdk::ipReal32 sigma)
constructor; create a NormalRandom object, that will generate random values whose distribution follow...
Definition: NormalRandom.h:38
NormalRandomPack<eInstructionSet::domain instructionSet, typename T, typename Enable=void> structure...
generator of random values, based on LCG; this generator is fast, but must not be used for applicatio...
IPSDK_FORCEINLINE BasePack< IS2PackType< instructionSet >::_packType, T > operator()()
generate a random value of type T to each element of a Pack<instructionSet, T>
Definition: NormalRandom.h:53
Definition of import/export macro for library.
Definition: NormalRandomPack.h:34
Definition: RegType.h:29
float ipReal32
Base types definition.
Definition: BaseTypes.h:56
uint32_t ipUInt32
Base types definition.
Definition: BaseTypes.h:53
structure containing intrinsic registers used to store vectorized data
Definition: BasePackDecl.h:29