lbfgsb 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +1 -1
- data/ext/lbfgsb/lbfgsbext.c +11 -14
- data/ext/lbfgsb/lbfgsbext.h +1 -0
- data/lbfgsb.gemspec +8 -5
- data/lib/lbfgsb/version.rb +1 -1
- metadata +7 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d3c9f07b919bd5a429225c6aa74e05b4c64ad9df9464388ffea2648560432573
|
4
|
+
data.tar.gz: 2f264cc51d1d7b3438ecdd0204b41cd7d1ad4c38e9b23c2f6fc0a2116e923cd0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9ee089354c99d1eaa412f42f4e74e8b51124be569c4b56820a88e3e0dcaff79b8f23e24d4c12b49b89824ed5f6a4975024973a2d3be6fa0fe33a8f25b1fc5aaa
|
7
|
+
data.tar.gz: f6727155040cd9b36effa98056eabc826dbf7c4701973202238dea8145c0cd2cfa9b6cb55ffa9a01f01d4d1365438ed62cb2dca1b987b41e77a26661a1a5df28
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
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
|
-
[![BSD 3-Clause License](https://img.shields.io/badge/License-BSD%203--Clause-orange.svg)](https://github.com/yoshoku/suika/blob/
|
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
6
|
[![Documentation](http://img.shields.io/badge/api-reference-blue.svg)](https://yoshoku.github.io/lbfgsb.rb/doc/)
|
7
7
|
|
8
8
|
Lbfgsb.rb is a Ruby binding for [L-BFGS-B](http://users.iems.northwestern.edu/~nocedal/lbfgsb.html)
|
data/ext/lbfgsb/lbfgsbext.c
CHANGED
@@ -8,7 +8,6 @@ VALUE lbfgsb_min_l_bfgs_b(VALUE self,
|
|
8
8
|
VALUE l_val, VALUE u_val, VALUE nbd_val,
|
9
9
|
VALUE maxcor, VALUE ftol, VALUE gtol, VALUE maxiter, VALUE disp)
|
10
10
|
{
|
11
|
-
long i;
|
12
11
|
long n_iter;
|
13
12
|
long n_fev;
|
14
13
|
long n_jev;
|
@@ -19,12 +18,12 @@ VALUE lbfgsb_min_l_bfgs_b(VALUE self,
|
|
19
18
|
narray_t* nbd_nary;
|
20
19
|
long n;
|
21
20
|
long m = NUM2LONG(maxcor);
|
22
|
-
double
|
23
|
-
double
|
24
|
-
double
|
25
|
-
long
|
21
|
+
double* x_ptr;
|
22
|
+
double* l_ptr;
|
23
|
+
double* u_ptr;
|
24
|
+
long* nbd_ptr;
|
26
25
|
double f;
|
27
|
-
double
|
26
|
+
double* g;
|
28
27
|
double factr = NUM2DBL(ftol);
|
29
28
|
double pgtol = NUM2DBL(gtol);
|
30
29
|
double* wa;
|
@@ -35,7 +34,6 @@ VALUE lbfgsb_min_l_bfgs_b(VALUE self,
|
|
35
34
|
long lsave[4];
|
36
35
|
long isave[44];
|
37
36
|
double dsave[29];
|
38
|
-
double* g_ptr;
|
39
37
|
VALUE g_val;
|
40
38
|
VALUE fg_arr;
|
41
39
|
VALUE ret;
|
@@ -111,7 +109,7 @@ VALUE lbfgsb_min_l_bfgs_b(VALUE self,
|
|
111
109
|
|
112
110
|
g_val = Qnil;
|
113
111
|
f = 0.0;
|
114
|
-
|
112
|
+
memset(g, 0, n * sizeof(*g));
|
115
113
|
strcpy(task, "START");
|
116
114
|
n_fev = 0;
|
117
115
|
n_jev = 0;
|
@@ -130,15 +128,14 @@ VALUE lbfgsb_min_l_bfgs_b(VALUE self,
|
|
130
128
|
f = NUM2DBL(rb_funcall(self, rb_intern("fnc"), 3, fnc, x_val, args));
|
131
129
|
g_val = rb_funcall(self, rb_intern("jcb"), 3, jcb, x_val, args);
|
132
130
|
}
|
133
|
-
n_fev
|
134
|
-
n_jev
|
131
|
+
n_fev++;
|
132
|
+
n_jev++;
|
135
133
|
if (CLASS_OF(g_val) != numo_cDFloat) g_val = rb_funcall(numo_cDFloat, rb_intern("cast"), 1, g_val);
|
136
134
|
if (!RTEST(nary_check_contiguous(g_val))) g_val = nary_dup(g_val);
|
137
|
-
|
138
|
-
|
135
|
+
memcpy(g, na_get_pointer_for_read(g_val), n * sizeof(*g));
|
136
|
+
RB_GC_GUARD(g_val);
|
139
137
|
} else if (strncmp(task, "NEW_X", 5) == 0) {
|
140
|
-
n_iter
|
141
|
-
continue;
|
138
|
+
n_iter++;
|
142
139
|
} else {
|
143
140
|
break;
|
144
141
|
}
|
data/ext/lbfgsb/lbfgsbext.h
CHANGED
data/lbfgsb.gemspec
CHANGED
@@ -6,14 +6,17 @@ Gem::Specification.new do |spec|
|
|
6
6
|
spec.authors = ['yoshoku']
|
7
7
|
spec.email = ['yoshoku@outlook.com']
|
8
8
|
|
9
|
-
spec.summary = 'Lbfgsb.rb is a Ruby binding for L-BFGS-B'
|
10
|
-
spec.description =
|
9
|
+
spec.summary = 'Lbfgsb.rb is a Ruby binding for L-BFGS-B.'
|
10
|
+
spec.description = <<~MSG
|
11
|
+
Lbfgsb.rb is a Ruby binding for L-BFGS-B that is a limited-memory algorithm for
|
12
|
+
solving large nonlinear optimization problems subject to simple bounds on the variables.
|
13
|
+
MSG
|
11
14
|
spec.homepage = 'https://github.com/yoshoku/lbfgsb.rb'
|
12
15
|
spec.license = 'BSD-3-Clause'
|
13
16
|
|
14
|
-
spec.metadata['homepage_uri']
|
15
|
-
spec.metadata['source_code_uri']
|
16
|
-
spec.metadata['changelog_uri']
|
17
|
+
spec.metadata['homepage_uri'] = spec.homepage
|
18
|
+
spec.metadata['source_code_uri'] = 'https://github.com/yoshoku/lbfgsb.rb'
|
19
|
+
spec.metadata['changelog_uri'] = 'https://github.com/yoshoku/lbfgsb.rb/blob/main/CHANGELOG.md'
|
17
20
|
spec.metadata['documentation_uri'] = 'https://yoshoku.github.io/lbfgsb.rb/doc/'
|
18
21
|
|
19
22
|
# Specify which files should be added to the gem when it is released.
|
data/lib/lbfgsb/version.rb
CHANGED
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.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- yoshoku
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-01-
|
11
|
+
date: 2021-01-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: numo-narray
|
@@ -24,7 +24,9 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 0.9.1
|
27
|
-
description:
|
27
|
+
description: |
|
28
|
+
Lbfgsb.rb is a Ruby binding for L-BFGS-B that is a limited-memory algorithm for
|
29
|
+
solving large nonlinear optimization problems subject to simple bounds on the variables.
|
28
30
|
email:
|
29
31
|
- yoshoku@outlook.com
|
30
32
|
executables: []
|
@@ -77,8 +79,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
77
79
|
- !ruby/object:Gem::Version
|
78
80
|
version: '0'
|
79
81
|
requirements: []
|
80
|
-
rubygems_version: 3.
|
82
|
+
rubygems_version: 3.2.3
|
81
83
|
signing_key:
|
82
84
|
specification_version: 4
|
83
|
-
summary: Lbfgsb.rb is a Ruby binding for L-BFGS-B
|
85
|
+
summary: Lbfgsb.rb is a Ruby binding for L-BFGS-B.
|
84
86
|
test_files: []
|