Sha256: e6a62f59544421c6bcd1e90d95a74d7112d40498c93522e7f5ec8e26ad7542cd

Contents?: true

Size: 1.63 KB

Versions: 4

Compression:

Stored size: 1.63 KB

Contents

module XLearn
  module FFI
    extend ::FFI::Library

    begin
      ffi_lib XLearn.ffi_lib
    rescue LoadError => e
      raise e if ENV["XLEARN_DEBUG"]
      raise LoadError, "Could not find xLearn"
    end

    # https://github.com/aksnzhy/xlearn/blob/master/src/c_api/c_api.h
    # keep same order

    attach_function :XLearnHello, %i[], :int
    attach_function :XLearnCreate, %i[string pointer], :int
    attach_function :XlearnCreateDataFromMat, %i[pointer uint32 uint32 pointer pointer pointer], :int
    attach_function :XlearnDataFree, %i[pointer], :int
    attach_function :XLearnHandleFree, %i[pointer], :int
    attach_function :XLearnShow, %i[pointer], :int
    attach_function :XLearnSetTrain, %i[pointer string], :int
    attach_function :XLearnSetTest, %i[pointer string], :int
    attach_function :XLearnSetPreModel, %i[pointer string], :int
    attach_function :XLearnSetValidate, %i[pointer string], :int
    attach_function :XLearnSetTXTModel, %i[pointer string], :int
    attach_function :XLearnFit, %i[pointer string], :int
    attach_function :XLearnCV, %i[pointer], :int
    attach_function :XLearnPredictForMat, %i[pointer string pointer pointer], :int
    attach_function :XLearnPredictForFile, %i[pointer string string], :int
    attach_function :XLearnSetDMatrix, %i[pointer string pointer], :int
    attach_function :XLearnSetStr, %i[pointer string string], :int
    attach_function :XLearnSetInt, %i[pointer string int], :int
    attach_function :XLearnSetFloat, %i[pointer string float], :int
    attach_function :XLearnSetBool, %i[pointer string bool], :int

    # errors
    attach_function :XLearnGetLastError, %i[], :string
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
xlearn-0.1.3 lib/xlearn/ffi.rb
xlearn-0.1.2 lib/xlearn/ffi.rb
xlearn-0.1.1 lib/xlearn/ffi.rb
xlearn-0.1.0 lib/xlearn/ffi.rb