Class: Liblinear::Array::Integer

Inherits:
Liblinear::Array show all
Defined in:
lib/liblinear/array/integer.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Liblinear::Array

#decode, #delete, #swig

Constructor Details

#initialize(array) ⇒ Integer

Returns a new instance of Integer.

Parameters:



18
19
20
21
22
23
24
# File 'lib/liblinear/array/integer.rb', line 18

def initialize(array)
  @array = Liblinearswig.new_int(array.size)
  array.size.times do |index|
    Liblinearswig.int_setitem(@array, index, array[index])
  end
  @size = array.size
end

Class Method Details

.decode(array, size) ⇒ Object

Parameters:



7
8
9
# File 'lib/liblinear/array/integer.rb', line 7

def decode(array, size)
  size.times.map {|index| Liblinearswig.int_getitem(array, index)}
end

.delete(array) ⇒ Object

Parameters:

  • array (SWIG::TYPE_p_int)


12
13
14
# File 'lib/liblinear/array/integer.rb', line 12

def delete(array)
  Liblinearswig.delete_int(array)
end