Sha256: ba9f4294f0dddf0fe2caa03b506be45645c75afaa5b697f52e04e5be384572a3

Contents?: true

Size: 1.07 KB

Versions: 7

Compression:

Stored size: 1.07 KB

Contents

##
# Class to create a sample of Gaussian Distributed values
class Digiproc::Probability::GaussianDistribution

    attr_accessor :mean, :stddev, :generator, :data
    attr_reader :size

    include Digiproc::Convolvable::InstanceMethods, Digiproc::Initializable, Digiproc::FourierTransformable

    ##
    # == Initialize arguments
    # mean:: [Float] mean of the population
    # stddev:: [Float] standard deviation of the population
    # size:: [Integer] number of datapoints
    # generator:: Strategy for making Gaussian values. Defaults to Digiproc::Strategies::GaussianGeneratorBoxMullerStrategy.new
    def initialize(mean: , stddev: , size: ,generator: Digiproc::Strategies::GaussianGeneratorBoxMullerStrategy.new)
        @mean, @stddev, @generator, @size = mean, stddev, generator, size
        generator.mean = mean
        generator.stddev = stddev
        data = []
        size.times do 
            data << generator.rand
        end
        @data = data
        initialize_modules(Digiproc::FourierTransformable => {time_data: data})
    end


end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
digiproc-0.2.5 lib/probability/gaussian_distribution.rb
digiproc-0.2.4 lib/probability/gaussian_distribution.rb
digiproc-0.2.3 lib/probability/gaussian_distribution.rb
digiproc-0.2.2 lib/probability/gaussian_distribution.rb
digiproc-0.2.1 lib/probability/gaussian_distribution.rb
digiproc-0.2.0 lib/probability/gaussian_distribution.rb
digiproc-0.1.0 lib/probability/gaussian_distribution.rb