Class: Noyes::DeltaDecoder

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_impl/compression.rb

Instance Method Summary collapse

Constructor Details

#initialize(dimensions = 13) ⇒ DeltaDecoder

Returns a new instance of DeltaDecoder.


45
46
47
48
# File 'lib/ruby_impl/compression.rb', line 45

def initialize dimensions=13
  @dimensions = dimensions
  @delta = Array.new dimensions, 0.0
end

Instance Method Details

#<<(data) ⇒ Object


50
51
52
53
54
55
56
# File 'lib/ruby_impl/compression.rb', line 50

def << data
  data.each_slice(@dimensions).map do |array|
    array.each_with_index.map do |element, index|
      @delta[index] += element
    end
  end
end