lbfgsb 0.5.0 → 0.5.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d0558e429ff4c590e681165e0af885de04e9b78d4d679afc89f9c0bcfc1b2764
4
- data.tar.gz: 5e1a8a157614da1a8541fbe28aad8cb04bf4096a4d3022f1b519c35abf071544
3
+ metadata.gz: d1f3f5f5da7974bebb0bbcefe90295530afe121de4981f0bf44af92d9acaefb3
4
+ data.tar.gz: 75c70e0eece746c5cad39e8bf52ce7cf98f4c3bcd0ac17057b8c8c4ecd26d92e
5
5
  SHA512:
6
- metadata.gz: 66997d33a6fd0fb750ae236934fa866a94592161cbba49375bd7d46d94a9c98f0177cd207431d24cd1812bbf10be050106c941de9ac972f7699d0687b97a41c8
7
- data.tar.gz: d8ba46b919591239180642f9a45fe5f14337f2aa703ac527ba533449c647be4b64de700a49a88616019241010d37e6118904c992c3886ed7e44c620f771cadc9
6
+ metadata.gz: f3f4284185cc16174bbe3570f48127ae091c0c9a476dd3771f3b28e171f60965d95410a79a00cd7bc3ccc64c3ea2c8c393dcc58161e9fb56b060ddad8b62ed8a
7
+ data.tar.gz: 669c4675de248d73becb0a2867a640dcd8f4c51d01a5671502295c81b1837f738598a1c01899a332859915bae790f4b099754dfc4b254545059daaa3471ef419
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 0.5.2
2
+ - Fix build failure with Xcode 14 and Ruby 3.1.x.
3
+
4
+ ## 0.5.1
5
+ - Refactor codes and configs with RuboCop.
6
+
1
7
  ## 0.5.0
2
8
  - Add build option to select FORTRAN integer bit size.
3
9
 
data/README.md CHANGED
@@ -3,9 +3,9 @@
3
3
  [![Build Status](https://github.com/yoshoku/lbfgsb.rb/workflows/build/badge.svg)](https://github.com/yoshoku/lbfgsb.rb/actions?query=workflow%3Abuild)
4
4
  [![Gem Version](https://badge.fury.io/rb/lbfgsb.svg)](https://badge.fury.io/rb/lbfgsb)
5
5
  [![BSD 3-Clause License](https://img.shields.io/badge/License-BSD%203--Clause-orange.svg)](https://github.com/yoshoku/suika/blob/main/LICENSE.txt)
6
- [![Documentation](http://img.shields.io/badge/api-reference-blue.svg)](https://yoshoku.github.io/lbfgsb.rb/doc/)
6
+ [![Documentation](https://img.shields.io/badge/api-reference-blue.svg)](https://yoshoku.github.io/lbfgsb.rb/doc/)
7
7
 
8
- Lbfgsb.rb is a Ruby binding for [L-BFGS-B](http://users.iems.northwestern.edu/~nocedal/lbfgsb.html)
8
+ Lbfgsb.rb is a Ruby binding for [L-BFGS-B](https://users.iems.northwestern.edu/~nocedal/lbfgsb.html)
9
9
  that is a limited-memory algorithm for solving large nonlinear optimization problems
10
10
  subject to simple bounds on the variables.
11
11
  L-BFGS-B is written in FORTRAN. Author converted the codes into C-lang
@@ -27,6 +27,20 @@ Or install it yourself as:
27
27
 
28
28
  $ gem install lbfgsb
29
29
 
30
+ Notes: lbfgsb.rb uses 32-bit integer for the integer type in its native code.
31
+ If you want to use 64-bit integer, give the installation option as below:
32
+
33
+ ```
34
+ $ gem install lbfgsb -- --with-use-int64
35
+ ```
36
+
37
+ In adition, if you want to use an external BLAS library for linear algebra on LBFGSB optimization,
38
+ give the directory and library in the installation options as follows:
39
+
40
+ ```
41
+ $ gem install lbfgsb -- --with-blas-dir=/opt/local/openblas/lib --with-blas-lib=openblas
42
+ ```
43
+
30
44
  ## Usage
31
45
  Example 1. Logistic Regression
32
46
 
@@ -33,6 +33,12 @@ $srcs = Dir.glob("#{$srcdir}/**/*.c").map { |path| File.basename(path) }
33
33
  blas_dir = with_config('blas-dir')
34
34
  $LDFLAGS = "-L#{blas_dir} #{$LDFLAGS}" unless blas_dir.nil?
35
35
 
36
+ if RUBY_PLATFORM.match?(/darwin/) && Gem::Version.new('3.1.0') <= Gem::Version.new(RUBY_VERSION)
37
+ if try_link('int main(void){return 0;}', '-Wl,-undefined,dynamic_lookup')
38
+ $LDFLAGS << ' -Wl,-undefined,dynamic_lookup'
39
+ end
40
+ end
41
+
36
42
  blas_lib = with_config('blas-lib')
37
43
  unless blas_lib.nil?
38
44
  abort "#{blas_lib} not found." unless have_library(blas_lib)
@@ -3,5 +3,5 @@
3
3
  # Lbfgsb.rb is a Ruby binding for L-BFGS-B with Numo::NArray.
4
4
  module Lbfgsb
5
5
  # The version of Lbfgsb.rb you are using.
6
- VERSION = '0.5.0'
6
+ VERSION = '0.5.2'
7
7
  end
data/lib/lbfgsb.rb CHANGED
@@ -5,6 +5,7 @@ require 'numo/narray'
5
5
  require 'lbfgsb/version'
6
6
  require 'lbfgsb/lbfgsbext'
7
7
 
8
+ # Lbfgsb.rb is a Ruby binding for L-BFGS-B with Numo::NArray.
8
9
  module Lbfgsb
9
10
  module_function
10
11
 
@@ -39,7 +40,7 @@ module Lbfgsb
39
40
  # - jcb [Numo::Narray] Values of the jacobian
40
41
  # - task [String] Description of the cause of the termination.
41
42
  # - success [Boolean] Whether or not the optimization exited successfully.
42
- def minimize(fnc:, x_init:, jcb:, args: nil, bounds: nil, factr: 1e7, pgtol: 1e-5, maxcor: 10, maxiter: 15_000, verbose: nil)
43
+ 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
43
44
  n_elements = x_init.size
44
45
  l = Numo::DFloat.zeros(n_elements)
45
46
  u = Numo::DFloat.zeros(n_elements)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lbfgsb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - yoshoku
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-02-13 00:00:00.000000000 Z
11
+ date: 2022-11-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: numo-narray
@@ -59,6 +59,7 @@ metadata:
59
59
  source_code_uri: https://github.com/yoshoku/lbfgsb.rb
60
60
  changelog_uri: https://github.com/yoshoku/lbfgsb.rb/blob/main/CHANGELOG.md
61
61
  documentation_uri: https://yoshoku.github.io/lbfgsb.rb/doc/
62
+ rubygems_mfa_required: 'true'
62
63
  post_install_message:
63
64
  rdoc_options: []
64
65
  require_paths:
@@ -74,7 +75,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
74
75
  - !ruby/object:Gem::Version
75
76
  version: '0'
76
77
  requirements: []
77
- rubygems_version: 3.3.7
78
+ rubygems_version: 3.3.26
78
79
  signing_key:
79
80
  specification_version: 4
80
81
  summary: Lbfgsb.rb is a Ruby binding for L-BFGS-B.