Class: DTW::Bands::SakoeChiba
- Inherits:
-
Data
- Object
- Data
- DTW::Bands::SakoeChiba
- Defined in:
- lib/dtwrb/bands.rb,
sig/dtwrb.rbs
Instance Attribute Summary collapse
-
#ratio ⇒ Object
readonly
Returns the value of attribute ratio.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(ratio:) ⇒ SakoeChiba
constructor
A new instance of SakoeChiba.
-
#radius(length_a, length_b) ⇒ ::Integer
The |n - m| + 1 term keeps at least one path feasible when the lengths differ widely.
- #to_h ⇒ ::Hash[::Symbol, untyped]
- #with ⇒ SakoeChiba
Constructor Details
#initialize(ratio:) ⇒ SakoeChiba
Returns a new instance of SakoeChiba.
6 7 8 9 10 11 |
# File 'lib/dtwrb/bands.rb', line 6 def initialize(ratio:) width = Float(ratio) raise ArgumentError, "band ratio must be non-negative, got #{width}" if width.negative? super(ratio: width) end |
Instance Attribute Details
#ratio ⇒ Object (readonly)
Returns the value of attribute ratio
5 6 7 |
# File 'lib/dtwrb/bands.rb', line 5 def ratio @ratio end |
Class Method Details
.new ⇒ SakoeChiba
117 |
# File 'sig/dtwrb.rbs', line 117
def self.new: (ratio: ::Numeric) -> SakoeChiba
|
Instance Method Details
#radius(length_a, length_b) ⇒ ::Integer
The |n - m| + 1 term keeps at least one path feasible when the lengths differ widely.
14 15 16 |
# File 'lib/dtwrb/bands.rb', line 14 def radius(length_a, length_b) [(ratio * [length_a, length_b].max).ceil, (length_a - length_b).abs + 1].max end |
#to_h ⇒ ::Hash[::Symbol, untyped]
120 |
# File 'sig/dtwrb.rbs', line 120
def to_h: () -> ::Hash[::Symbol, untyped]
|