File: gsl.rb

package info (click to toggle)
ruby-distribution 0.7.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 572 kB
  • ctags: 370
  • sloc: ruby: 4,270; makefile: 5
file content (24 lines) | stat: -rw-r--r-- 535 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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)
          lambda { 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 p_value(qn)
          GSL::Cdf::ugaussian_Pinv(qn)
        end
        def gsl
        end
      end
    end
  end
end