lib/libmf/ffi.rb in libmf-0.1.3 vs lib/libmf/ffi.rb in libmf-0.2.0
- old
+ new
@@ -1,15 +1,10 @@
module Libmf
module FFI
extend ::FFI::Library
- begin
- ffi_lib Libmf.ffi_lib
- rescue LoadError => e
- raise e if ENV["LIBMF_DEBUG"]
- raise LoadError, "Could not find LIBMF"
- end
+ ffi_lib Libmf.ffi_lib
class Node < ::FFI::Struct
layout :u, :int,
:v, :int,
:r, :float
@@ -49,9 +44,10 @@
:p, :pointer,
:q, :pointer
end
attach_function :mf_get_default_param, [], Parameter.by_value
+ attach_function :mf_read_problem, [:string], Problem.by_value
attach_function :mf_save_model, [Model.by_ref, :string], :int
attach_function :mf_load_model, [:string], Model.by_ref
attach_function :mf_destroy_model, [Model.by_ref], :void
attach_function :mf_train, [Problem.by_ref, Parameter.by_value], Model.by_ref
attach_function :mf_train_with_validation, [Problem.by_ref, Problem.by_ref, Parameter.by_value], Model.by_ref