16 #ifndef POPS_LOGNORMAL_KERNEL_HPP 
   17 #define POPS_LOGNORMAL_KERNEL_HPP 
   45             throw std::invalid_argument(
"sigma must be greater than 0.0");
 
   55     template<
class Generator>
 
   70             throw std::invalid_argument(
"x must be greater than or equal to 0.0");
 
   76                * exp(-(pow(log(x), 2)) / (2 * pow(
sigma, 2)));
 
   89         if (x <= 0 || x >= 1) {
 
   90             throw std::invalid_argument(
"icdf: x must be between 0.0 and 1.0");
 
   93         double y = (2 * x) - 1;
 
   94         float sign = (y < 0) ? -1.0f : 1.0f;
 
  100         double t = 2.0 / (
M_PI * a);
 
  101         double l = log(1 - pow(y, 2));
 
  103             sign * sqrt(sqrt(pow(t + (l / 2.0), 2) - (l / a)) - (t + (l / 2.0)));
 
  104         return exp(sqrt(2 * pow(
sigma, 2)) * inverf);
 
  110 #endif  // POPS_LOGNORMAL_KERNEL_HPP