Sha256: 2be7b2342fea694abb58fe51deceb0a2fc149e8421b99786010e8833fdd5c8c1

Contents?: true

Size: 562 Bytes

Versions: 1

Compression:

Stored size: 562 Bytes

Contents

module Distribution
  module Normal
    module GSL_
      class << self
        def rng(mean = 0, sigma = 1, seed = nil)
          seed ||= rand(10e8)
          rng = GSL::Rng.alloc(GSL::Rng::MT19937, seed)
          -> { mean + rng.gaussian(sigma) }
        end

        def cdf(x) # :nodoc:
          GSL::Cdf.ugaussian_P(x)
        end

        def pdf(x) # :nodoc:
          GSL::Ran.gaussian_pdf(x)
        end

        def quantile(qn)
          GSL::Cdf.ugaussian_Pinv(qn)
        end

        alias_method :p_value, :quantile
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
distribution-0.8.0 lib/distribution/normal/gsl.rb