Class: Digiproc::Probability::GaussianDistribution
- Inherits:
-
Object
- Object
- Digiproc::Probability::GaussianDistribution
- Defined in:
- lib/probability/gaussian_distribution.rb
Overview
Class to create a sample of Gaussian Distributed values
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
-
#generator ⇒ Object
Returns the value of attribute generator.
-
#mean ⇒ Object
Returns the value of attribute mean.
-
#size ⇒ Object
readonly
Returns the value of attribute size.
-
#stddev ⇒ Object
Returns the value of attribute stddev.
Attributes included from FourierTransformable
Instance Method Summary collapse
-
#initialize(mean:, stddev:, size:, generator: Digiproc::Strategies::GaussianGeneratorBoxMullerStrategy.new) ⇒ GaussianDistribution
constructor
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.
Methods included from Convolvable::InstanceMethods
#acorr, #auto_correlation, #conv, #convolution_strategy, #convolve, #cross_correlation, included, #xcorr
Methods included from Initializable
Methods included from FourierTransformable
#fft_angle, #fft_data, #fft_db, #fft_imaginary, #fft_magnitude, #fft_real, included
Constructor Details
#initialize(mean:, stddev:, size:, generator: Digiproc::Strategies::GaussianGeneratorBoxMullerStrategy.new) ⇒ GaussianDistribution
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
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/probability/gaussian_distribution.rb', line 16 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 |
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
5 6 7 |
# File 'lib/probability/gaussian_distribution.rb', line 5 def data @data end |
#generator ⇒ Object
Returns the value of attribute generator.
5 6 7 |
# File 'lib/probability/gaussian_distribution.rb', line 5 def generator @generator end |
#mean ⇒ Object
Returns the value of attribute mean.
5 6 7 |
# File 'lib/probability/gaussian_distribution.rb', line 5 def mean @mean end |
#size ⇒ Object (readonly)
Returns the value of attribute size.
6 7 8 |
# File 'lib/probability/gaussian_distribution.rb', line 6 def size @size end |
#stddev ⇒ Object
Returns the value of attribute stddev.
5 6 7 |
# File 'lib/probability/gaussian_distribution.rb', line 5 def stddev @stddev end |