Class: DTW::Alignment

Inherits:
Data
  • Object
show all
Defined in:
lib/dtwrb/alignment.rb,
sig/dtwrb.rbs

Constant Summary collapse

UNDEFINED =

Returns:

Alignment.new(path: [].freeze, cost: Float::INFINITY)

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#costObject (readonly)

Returns the value of attribute cost

Returns:

  • (Object)

    the current value of cost



4
5
6
# File 'lib/dtwrb/alignment.rb', line 4

def cost
  @cost
end

#pathObject (readonly)

Returns the value of attribute path

Returns:

  • (Object)

    the current value of path



4
5
6
# File 'lib/dtwrb/alignment.rb', line 4

def path
  @path
end

Class Method Details

.newAlignment

Parameters:

  • path: (::Array[cell])
  • cost: (::Float)

Returns:



134
# File 'sig/dtwrb.rbs', line 134

def self.new: (path: ::Array[cell], cost: ::Float) -> Alignment

Instance Method Details

#distance::Float

Returns:

  • (::Float)


7
# File 'lib/dtwrb/alignment.rb', line 7

def distance = steps.zero? ? cost : cost / steps

#steps::Integer

Returns:

  • (::Integer)


5
# File 'lib/dtwrb/alignment.rb', line 5

def steps = path.length

#to_a::Array[cell]

Returns:

  • (::Array[cell])


11
# File 'lib/dtwrb/alignment.rb', line 11

def to_a = path

#to_h::Hash[::Symbol, untyped]

Returns:

  • (::Hash[::Symbol, untyped])


140
# File 'sig/dtwrb.rbs', line 140

def to_h: () -> ::Hash[::Symbol, untyped]

#undefined?Boolean

Returns:

  • (Boolean)


9
# File 'lib/dtwrb/alignment.rb', line 9

def undefined? = path.empty?

#withAlignment

Parameters:

  • (Object)

Returns:



139
# File 'sig/dtwrb.rbs', line 139

def with: (**untyped) -> Alignment