Vowpal Wabbit
Static Public Member Functions | List of all members
polar_normal_weights_wrapper< T > Class Template Reference

Static Public Member Functions

static void func (weight &w, uint64_t index)
 

Detailed Description

template<class T>
class polar_normal_weights_wrapper< T >

Definition at line 52 of file parse_regressor.cc.

Member Function Documentation

◆ func()

template<class T >
static void polar_normal_weights_wrapper< T >::func ( weight w,
uint64_t  index 
)
inlinestatic

Definition at line 55 of file parse_regressor.cc.

References f, and merand48().

56  {
57  static float x1 = 0.0;
58  static float x2 = 0.0;
59  static float temp = 0.0;
60  do
61  {
62  x1 = 2.0f * merand48(index) - 1.0f;
63  x2 = 2.0f * merand48(index) - 1.0f;
64  temp = x1 * x1 + x2 * x2;
65  } while ((temp >= 1.0) || (temp == 0.0));
66  temp = sqrtf((-2.0f * logf(temp)) / temp);
67  w = x1 * temp;
68  }
float merand48(uint64_t &initial)
Definition: rand48.cc:16
float f
Definition: cache.cc:40

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