Class: Nonsensor::MidpointDisplacement
- Inherits:
-
Object
- Object
- Nonsensor::MidpointDisplacement
- Includes:
- Series
- Defined in:
- lib/nonsensor/midpoint_displacement.rb
Instance Attribute Summary collapse
-
#batch ⇒ Object
readonly
Returns the value of attribute batch.
-
#batch_size ⇒ Object
readonly
Returns the value of attribute batch_size.
-
#start ⇒ Object
readonly
Returns the value of attribute start.
Instance Method Summary collapse
-
#initialize(start: 0.0, displacement: 50.0, decay_power: 1, batch_size: 100) ⇒ MidpointDisplacement
constructor
A new instance of MidpointDisplacement.
- #next! ⇒ Object
Methods included from Series
Constructor Details
#initialize(start: 0.0, displacement: 50.0, decay_power: 1, batch_size: 100) ⇒ MidpointDisplacement
Returns a new instance of MidpointDisplacement.
6 7 8 9 10 11 12 13 |
# File 'lib/nonsensor/midpoint_displacement.rb', line 6 def initialize(start: 0.0, displacement: 50.0, decay_power: 1, batch_size: 100) @start = start @initial_displacement = displacement @decay = (1.0 / 2 ** decay_power) @batch_size = batch_size.to_i @batch = [] end |
Instance Attribute Details
#batch ⇒ Object (readonly)
Returns the value of attribute batch.
4 5 6 |
# File 'lib/nonsensor/midpoint_displacement.rb', line 4 def batch @batch end |
#batch_size ⇒ Object (readonly)
Returns the value of attribute batch_size.
4 5 6 |
# File 'lib/nonsensor/midpoint_displacement.rb', line 4 def batch_size @batch_size end |
#start ⇒ Object (readonly)
Returns the value of attribute start.
4 5 6 |
# File 'lib/nonsensor/midpoint_displacement.rb', line 4 def start @start end |
Instance Method Details
#next! ⇒ Object
15 16 17 18 |
# File 'lib/nonsensor/midpoint_displacement.rb', line 15 def next! make_batch if @batch.empty? @batch.shift end |