Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Go wrapper for libLBFGS #11

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Go wrapper for libLBFGS #11

wants to merge 1 commit into from

Conversation

kho
Copy link

@kho kho commented Feb 19, 2014

Inter-operation is achieved with cgo. The wrapper offers an idiomatic
Go package for objective function minimization via L-BFGS.

Slight behavioral differences from the C library:

  • The optimization routine is renamed to Minimize() (to not repeat the
    package name).

  • The optimization routine returns the final value of the objective
    function. The C library allows ptr_fx to be NULL when the user does
    not care about the value. In Go this is usually done by assigning _
    to the return value, e.g.

    _, err := lbfgs.Minimize(...)
    

    My question is whether setting ptr_fx to NULL saves any call to
    evaluate(). If that is true, then the design in Go has a
    slightly higher cost when the user does not need the final
    objective and we should revert to the C design.

  • All errors returned from C lbfgs() is translated to Go errors
    (except LBFGS_SUCCESS, in which case nil error is returned as is
    idiomatic in Go).

Inter-operation is achieved with cgo. The wrapper offers an idiomatic
Go package for objective function minimization via L-BFGS.

Slight behavioral differences from the C library:

- The optimization routine is renamed to Minimize() (to not repeat the
  package name).

- The optimization routine returns the final value of the objective
  function. The C library allows ptr_fx to be NULL when the user does
  not care about the value. In Go this is usually done by assigning _
  to the return value, e.g.

      _, err := lbfgs.Minimize(...)

  My question is whether setting ptr_fx to NULL saves any call to
  evaluate(). If that is true, then the design in Go has a
  slightly higher cost when the user does not need the final
  objective and we should revert to the C design.

- All errors returned from C lbfgs() is translated to Go errors
  (except LBFGS_SUCCESS, in which case nil error is returned as is
  idiomatic in Go).
@cynthia
Copy link
Collaborator

cynthia commented Jun 4, 2019

This patch may need extra work if we land #23.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants