lib/lbfgsb.rb in lbfgsb-0.5.0 vs lib/lbfgsb.rb in lbfgsb-0.5.1
- old
+ new
@@ -3,10 +3,11 @@
require 'numo/narray'
require 'lbfgsb/version'
require 'lbfgsb/lbfgsbext'
+# Lbfgsb.rb is a Ruby binding for L-BFGS-B with Numo::NArray.
module Lbfgsb
module_function
# Minimize a function using the L-BFGS-B algorithm.
#
@@ -37,10 +38,10 @@
# - n_iter [Integer] Number of iterations.
# - fnc [Float] Value of the objective function.
# - jcb [Numo::Narray] Values of the jacobian
# - task [String] Description of the cause of the termination.
# - success [Boolean] Whether or not the optimization exited successfully.
- def minimize(fnc:, x_init:, jcb:, args: nil, bounds: nil, factr: 1e7, pgtol: 1e-5, maxcor: 10, maxiter: 15_000, verbose: nil)
+ def minimize(fnc:, x_init:, jcb:, args: nil, bounds: nil, factr: 1e7, pgtol: 1e-5, maxcor: 10, maxiter: 15_000, verbose: nil) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
n_elements = x_init.size
l = Numo::DFloat.zeros(n_elements)
u = Numo::DFloat.zeros(n_elements)
nbd = SZ_F77_INTEGER == 64 ? Numo::Int64.zeros(n_elements) : Numo::Int32.zeros(n_elements)