lbfgsb 0.3.1 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +26 -0
- data/LICENSE.txt +1 -1
- data/README.md +1 -1
- data/ext/lbfgsb/extconf.rb +12 -3
- data/ext/lbfgsb/lbfgsbext.c +66 -45
- data/ext/lbfgsb/lbfgsbext.h +3 -1
- data/ext/lbfgsb/src/blas.c +27 -31
- data/ext/lbfgsb/src/blas.h +5 -5
- data/ext/lbfgsb/src/common.h +16 -0
- data/ext/lbfgsb/src/lbfgsb.c +305 -406
- data/ext/lbfgsb/src/lbfgsb.h +70 -109
- data/ext/lbfgsb/src/linpack.c +69 -68
- data/ext/lbfgsb/src/linpack.h +3 -3
- data/lib/lbfgsb/version.rb +1 -1
- data/lib/lbfgsb.rb +1 -1
- data/sig/lbfgsb.rbs +31 -0
- metadata +9 -12
- data/.github/workflows/build.yml +0 -21
- data/.gitignore +0 -17
- data/.rspec +0 -3
- data/.yardopts +0 -1
- data/Gemfile +0 -8
- data/Rakefile +0 -15
- data/lbfgsb.gemspec +0 -30
data/ext/lbfgsb/src/lbfgsb.h
CHANGED
@@ -1,122 +1,83 @@
|
|
1
1
|
#ifndef LBFGSB_RB_LBFGSB_H_
|
2
2
|
#define LBFGSB_RB_LBFGSB_H_
|
3
3
|
|
4
|
-
#include <stdio.h>
|
5
|
-
#include <stdlib.h>
|
6
4
|
#include <float.h>
|
7
5
|
#include <math.h>
|
6
|
+
#include <stdio.h>
|
7
|
+
#include <stdlib.h>
|
8
8
|
#include <string.h>
|
9
9
|
#include <time.h>
|
10
10
|
|
11
|
+
#include "common.h"
|
12
|
+
|
11
13
|
#define TRUE_ (1)
|
12
14
|
#define FALSE_ (0)
|
13
15
|
|
14
|
-
extern
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
extern
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
extern
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
extern
|
68
|
-
|
69
|
-
extern
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
double *r__, long *itail, long *iupdat, long *col,
|
81
|
-
long *head, double *theta, double *rr, double *dr,
|
82
|
-
double *stp, double *dtd);
|
83
|
-
|
84
|
-
extern int prn1lb_(long *n, long *m, double *l,
|
85
|
-
double *u, double *x, long *iprint, long *itfile,
|
86
|
-
double *epsmch);
|
87
|
-
|
88
|
-
extern int prn2lb_(long *n, double *x, double *f,
|
89
|
-
double *g, long *iprint, long *itfile, long *iter,
|
90
|
-
long *nfgv, long *nact, double *sbgnrm, long *nseg, char*word,
|
91
|
-
long *iword, long *iback, double *stp, double *xstep);
|
92
|
-
|
93
|
-
extern int prn3lb_(long *n, double *x, double *f, char *task,
|
94
|
-
long *iprint, long *info, long *itfile, long *iter,
|
95
|
-
long *nfgv, long *nintol, long *nskip, long *nact,
|
96
|
-
double *sbgnrm, double *time, long *nseg, char *word,
|
97
|
-
long *iback, double *stp, double *xstep, long *k,
|
98
|
-
double *cachyt, double *sbtime, double *lnscht);
|
99
|
-
|
100
|
-
extern int projgr_(long *n, double *l, double *u,
|
101
|
-
long *nbd, double *x, double *g, double *sbgnrm);
|
102
|
-
|
103
|
-
extern int subsm_(long *n, long *m, long *nsub, long *ind,
|
104
|
-
double *l, double *u, long *nbd, double *x,
|
105
|
-
double *d__, double *xp, double *ws, double *wy,
|
106
|
-
double *theta, double *xx, double *gg, long *col,
|
107
|
-
long *head, long *iword, double *wv, double *wn,
|
108
|
-
long *iprint, long *info);
|
109
|
-
|
110
|
-
extern int dcsrch_(double *f, double *g, double *stp,
|
111
|
-
double *ftol, double *gtol, double *xtol,
|
112
|
-
double *stpmin, double *stpmax,
|
113
|
-
char *task, long *isave, double *dsave);
|
114
|
-
|
115
|
-
extern int dcstep_(double *stx, double *fx, double *dx,
|
116
|
-
double *sty, double *fy, double *dy, double *stp,
|
117
|
-
double *fp, double *dp, long *brackt, double *stpmin,
|
118
|
-
double *stpmax);
|
119
|
-
|
120
|
-
extern int timer_(double *ttime);
|
16
|
+
extern void setulb_(F77_int* n, F77_int* m, double* x, double* l, double* u, F77_int* nbd, double* f, double* g, double* factr,
|
17
|
+
double* pgtol, double* wa, F77_int* iwa, char* task, F77_int* iprint, char* csave, F77_int* lsave, F77_int* isave,
|
18
|
+
double* dsave);
|
19
|
+
|
20
|
+
extern void mainlb_(F77_int* n, F77_int* m, double* x, double* l, double* u, F77_int* nbd, double* f, double* g, double* factr,
|
21
|
+
double* pgtol, double* ws, double* wy, double* sy, double* ss, double* wt, double* wn, double* snd,
|
22
|
+
double* z__, double* r__, double* d__, double* t, double* xp, double* wa, F77_int* index, F77_int* iwhere,
|
23
|
+
F77_int* indx2, char* task, F77_int* iprint, char* csave, F77_int* lsave, F77_int* isave, double* dsave);
|
24
|
+
|
25
|
+
extern void active_(F77_int* n, double* l, double* u, F77_int* nbd, double* x, F77_int* iwhere, F77_int* iprint, F77_int* prjctd, F77_int* cnstnd,
|
26
|
+
F77_int* boxed);
|
27
|
+
|
28
|
+
extern void bmv_(F77_int* m, double* sy, double* wt, F77_int* col, double* v, double* p, F77_int* info);
|
29
|
+
|
30
|
+
extern void cauchy_(F77_int* n, double* x, double* l, double* u, F77_int* nbd, double* g, F77_int* iorder, F77_int* iwhere, double* t,
|
31
|
+
double* d__, double* xcp, F77_int* m, double* wy, double* ws, double* sy, double* wt, double* theta, F77_int* col,
|
32
|
+
F77_int* head, double* p, double* c__, double* wbp, double* v, F77_int* nseg, F77_int* iprint, double* sbgnrm,
|
33
|
+
F77_int* info, double* epsmch);
|
34
|
+
|
35
|
+
extern void cmprlb_(F77_int* n, F77_int* m, double* x, double* g, double* ws, double* wy, double* sy, double* wt, double* z__,
|
36
|
+
double* r__, double* wa, F77_int* index, double* theta, F77_int* col, F77_int* head, F77_int* nfree, F77_int* cnstnd,
|
37
|
+
F77_int* info);
|
38
|
+
|
39
|
+
extern void errclb_(F77_int* n, F77_int* m, double* factr, double* l, double* u, F77_int* nbd, char* task, F77_int* info, F77_int* k);
|
40
|
+
|
41
|
+
extern void formk_(F77_int* n, F77_int* nsub, F77_int* ind, F77_int* nenter, F77_int* ileave, F77_int* indx2, F77_int* iupdat, F77_int* updatd,
|
42
|
+
double* wn, double* wn1, F77_int* m, double* ws, double* wy, double* sy, double* theta, F77_int* col, F77_int* head,
|
43
|
+
F77_int* info);
|
44
|
+
|
45
|
+
extern void formt_(F77_int* m, double* wt, double* sy, double* ss, F77_int* col, double* theta, F77_int* info);
|
46
|
+
|
47
|
+
extern void freev_(F77_int* n, F77_int* nfree, F77_int* index, F77_int* nenter, F77_int* ileave, F77_int* indx2, F77_int* iwhere, F77_int* wrk,
|
48
|
+
F77_int* updatd, F77_int* cnstnd, F77_int* iprint, F77_int* iter);
|
49
|
+
|
50
|
+
extern void hpsolb_(F77_int* n, double* t, F77_int* iorder, F77_int* iheap);
|
51
|
+
|
52
|
+
extern void lnsrlb_(F77_int* n, double* l, double* u, F77_int* nbd, double* x, double* f, double* fold, double* gd, double* gdold,
|
53
|
+
double* g, double* d__, double* r__, double* t, double* z__, double* stp, double* dnorm, double* dtd,
|
54
|
+
double* xstep, double* stpmx, F77_int* iter, F77_int* ifun, F77_int* iback, F77_int* nfgv, F77_int* info, char* task,
|
55
|
+
F77_int* boxed, F77_int* cnstnd, char* csave, F77_int* isave, double* dsave);
|
56
|
+
|
57
|
+
extern void matupd_(F77_int* n, F77_int* m, double* ws, double* wy, double* sy, double* ss, double* d__, double* r__, F77_int* itail,
|
58
|
+
F77_int* iupdat, F77_int* col, F77_int* head, double* theta, double* rr, double* dr, double* stp, double* dtd);
|
59
|
+
|
60
|
+
extern void prn1lb_(F77_int* n, F77_int* m, double* l, double* u, double* x, F77_int* iprint, F77_int* itfile, double* epsmch);
|
61
|
+
|
62
|
+
extern void prn2lb_(F77_int* n, double* x, double* f, double* g, F77_int* iprint, F77_int* itfile, F77_int* iter, F77_int* nfgv, F77_int* nact,
|
63
|
+
double* sbgnrm, F77_int* nseg, char* word, F77_int* iword, F77_int* iback, double* stp, double* xstep);
|
64
|
+
|
65
|
+
extern void prn3lb_(F77_int* n, double* x, double* f, char* task, F77_int* iprint, F77_int* info, F77_int* itfile, F77_int* iter, F77_int* nfgv,
|
66
|
+
F77_int* nintol, F77_int* nskip, F77_int* nact, double* sbgnrm, double* time, F77_int* nseg, char* word, F77_int* iback,
|
67
|
+
double* stp, double* xstep, F77_int* k, double* cachyt, double* sbtime, double* lnscht);
|
68
|
+
|
69
|
+
extern void projgr_(F77_int* n, double* l, double* u, F77_int* nbd, double* x, double* g, double* sbgnrm);
|
70
|
+
|
71
|
+
extern void subsm_(F77_int* n, F77_int* m, F77_int* nsub, F77_int* ind, double* l, double* u, F77_int* nbd, double* x, double* d__, double* xp,
|
72
|
+
double* ws, double* wy, double* theta, double* xx, double* gg, F77_int* col, F77_int* head, F77_int* iword, double* wv,
|
73
|
+
double* wn, F77_int* iprint, F77_int* info);
|
74
|
+
|
75
|
+
extern void dcsrch_(double* f, double* g, double* stp, double* ftol, double* gtol, double* xtol, double* stpmin, double* stpmax,
|
76
|
+
char* task, F77_int* isave, double* dsave);
|
77
|
+
|
78
|
+
extern void dcstep_(double* stx, double* fx, double* dx, double* sty, double* fy, double* dy, double* stp, double* fp,
|
79
|
+
double* dp, F77_int* brackt, double* stpmin, double* stpmax);
|
80
|
+
|
81
|
+
extern void timer_(double* ttime);
|
121
82
|
|
122
83
|
#endif /* LBFGSB_RB_LBFGSB_H_ */
|
data/ext/lbfgsb/src/linpack.c
CHANGED
@@ -3,11 +3,10 @@
|
|
3
3
|
* or “3-clause license”)
|
4
4
|
* Please read attached file License.txt
|
5
5
|
*/
|
6
|
-
|
7
6
|
#include "blas.h"
|
8
7
|
#include "linpack.h"
|
9
8
|
|
10
|
-
static
|
9
|
+
static F77_int c__1 = 1;
|
11
10
|
|
12
11
|
/**
|
13
12
|
* dpofa factors a double precision symmetric positive definite
|
@@ -23,10 +22,10 @@ static long c__1 = 1;
|
|
23
22
|
* the symmetric matrix to be factored. only the
|
24
23
|
* diagonal and upper triangle are used.
|
25
24
|
*
|
26
|
-
* lda
|
25
|
+
* lda integer
|
27
26
|
* the leading dimension of the array a .
|
28
27
|
*
|
29
|
-
* n
|
28
|
+
* n integer
|
30
29
|
* the order of the matrix a .
|
31
30
|
*
|
32
31
|
* on return
|
@@ -36,7 +35,7 @@ static long c__1 = 1;
|
|
36
35
|
* the strict lower triangle is unaltered.
|
37
36
|
* if info .ne. 0 , the factorization is not complete.
|
38
37
|
*
|
39
|
-
* info
|
38
|
+
* info integer
|
40
39
|
* = 0 for normal return.
|
41
40
|
* = k signals an error condition. the leading minor
|
42
41
|
* of order k is not positive definite.
|
@@ -44,12 +43,11 @@ static long c__1 = 1;
|
|
44
43
|
* linpack. this version dated 08/14/78 .
|
45
44
|
* cleve moler, university of new mexico, argonne national lab.
|
46
45
|
*/
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
static long j, k;
|
46
|
+
void dpofa_(double* a, F77_int* lda, F77_int* n, F77_int* info) {
|
47
|
+
F77_int a_dim1, a_offset, i__1, i__2, i__3;
|
48
|
+
static F77_int j, k;
|
51
49
|
static double s, t;
|
52
|
-
static
|
50
|
+
static F77_int jm1;
|
53
51
|
|
54
52
|
a_dim1 = *lda;
|
55
53
|
a_offset = 1 + a_dim1;
|
@@ -57,31 +55,31 @@ int lbfgsb_rb_dpofa_(double *a, long *lda, long *n, long *info)
|
|
57
55
|
|
58
56
|
i__1 = *n;
|
59
57
|
for (j = 1; j <= i__1; ++j) {
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
L20:
|
75
|
-
|
58
|
+
*info = j;
|
59
|
+
s = 0.;
|
60
|
+
jm1 = j - 1;
|
61
|
+
if (jm1 < 1) {
|
62
|
+
goto L20;
|
63
|
+
}
|
64
|
+
i__2 = jm1;
|
65
|
+
for (k = 1; k <= i__2; ++k) {
|
66
|
+
i__3 = k - 1;
|
67
|
+
t = a[k + j * a_dim1] - ddot_(&i__3, &a[k * a_dim1 + 1], &c__1, &a[j * a_dim1 + 1], &c__1);
|
68
|
+
t /= a[k + k * a_dim1];
|
69
|
+
a[k + j * a_dim1] = t;
|
70
|
+
s += t * t;
|
71
|
+
}
|
72
|
+
L20:
|
73
|
+
s = a[j + j * a_dim1] - s;
|
76
74
|
/* ......exit */
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
75
|
+
if (s <= 0.) {
|
76
|
+
goto L40;
|
77
|
+
}
|
78
|
+
a[j + j * a_dim1] = sqrt(s);
|
81
79
|
}
|
82
80
|
*info = 0;
|
83
81
|
L40:
|
84
|
-
return
|
82
|
+
return;
|
85
83
|
}
|
86
84
|
|
87
85
|
/**
|
@@ -102,16 +100,16 @@ L40:
|
|
102
100
|
* the corresponding elements of the array can be
|
103
101
|
* used to store other information.
|
104
102
|
*
|
105
|
-
* ldt
|
103
|
+
* ldt integer
|
106
104
|
* ldt is the leading dimension of the array t.
|
107
105
|
*
|
108
|
-
* n
|
106
|
+
* n integer
|
109
107
|
* n is the order of the system.
|
110
108
|
*
|
111
109
|
* b double precision(n).
|
112
110
|
* b contains the right hand side of the system.
|
113
111
|
*
|
114
|
-
* job
|
112
|
+
* job integer
|
115
113
|
* job specifies what kind of system is to be solved.
|
116
114
|
* if job is
|
117
115
|
*
|
@@ -125,7 +123,7 @@ L40:
|
|
125
123
|
* b b contains the solution, if info .eq. 0.
|
126
124
|
* otherwise b is unaltered.
|
127
125
|
*
|
128
|
-
* info
|
126
|
+
* info integer
|
129
127
|
* info contains zero if the system is nonsingular.
|
130
128
|
* otherwise info contains the index of
|
131
129
|
* the first zero diagonal element of t.
|
@@ -133,10 +131,9 @@ L40:
|
|
133
131
|
* linpack. this version dated 08/14/78 .
|
134
132
|
* g. w. stewart, university of maryland, argonne national lab.
|
135
133
|
*/
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
static long j, jj, case__;
|
134
|
+
void dtrsl_(double* t, F77_int* ldt, F77_int* n, double* b, F77_int* job, F77_int* info) {
|
135
|
+
F77_int t_dim1, t_offset, i__1, i__2;
|
136
|
+
static F77_int j, jj, case__;
|
140
137
|
static double temp;
|
141
138
|
|
142
139
|
/* check for zero diagonal elements. */
|
@@ -148,39 +145,43 @@ int lbfgsb_rb_dtrsl_(double *t, long *ldt, long *n, double *b, long *job, long *
|
|
148
145
|
i__1 = *n;
|
149
146
|
for (*info = 1; *info <= i__1; ++(*info)) {
|
150
147
|
/* ......exit */
|
151
|
-
|
152
|
-
|
153
|
-
|
148
|
+
if (t[*info + *info * t_dim1] == 0.) {
|
149
|
+
goto L150;
|
150
|
+
}
|
154
151
|
}
|
155
152
|
*info = 0;
|
156
153
|
|
157
154
|
/* determine the task and go to it. */
|
158
155
|
case__ = 1;
|
159
156
|
if (*job % 10 != 0) {
|
160
|
-
|
157
|
+
case__ = 2;
|
161
158
|
}
|
162
159
|
if (*job % 100 / 10 != 0) {
|
163
|
-
|
160
|
+
case__ += 2;
|
164
161
|
}
|
165
162
|
switch (case__) {
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
163
|
+
case 1:
|
164
|
+
goto L20;
|
165
|
+
case 2:
|
166
|
+
goto L50;
|
167
|
+
case 3:
|
168
|
+
goto L80;
|
169
|
+
case 4:
|
170
|
+
goto L110;
|
170
171
|
}
|
171
172
|
|
172
173
|
/* solve t*x=b for t lower triangular */
|
173
174
|
L20:
|
174
175
|
b[1] /= t[t_dim1 + 1];
|
175
176
|
if (*n < 2) {
|
176
|
-
|
177
|
+
goto L40;
|
177
178
|
}
|
178
179
|
i__1 = *n;
|
179
180
|
for (j = 2; j <= i__1; ++j) {
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
181
|
+
temp = -b[j - 1];
|
182
|
+
i__2 = *n - j + 1;
|
183
|
+
daxpy_(&i__2, &temp, &t[j + (j - 1) * t_dim1], &c__1, &b[j], &c__1);
|
184
|
+
b[j] /= t[j + j * t_dim1];
|
184
185
|
}
|
185
186
|
L40:
|
186
187
|
goto L140;
|
@@ -189,14 +190,14 @@ L40:
|
|
189
190
|
L50:
|
190
191
|
b[*n] /= t[*n + *n * t_dim1];
|
191
192
|
if (*n < 2) {
|
192
|
-
|
193
|
+
goto L70;
|
193
194
|
}
|
194
195
|
i__1 = *n;
|
195
196
|
for (jj = 2; jj <= i__1; ++jj) {
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
197
|
+
j = *n - jj + 1;
|
198
|
+
temp = -b[j + 1];
|
199
|
+
daxpy_(&j, &temp, &t[(j + 1) * t_dim1 + 1], &c__1, &b[1], &c__1);
|
200
|
+
b[j] /= t[j + j * t_dim1];
|
200
201
|
}
|
201
202
|
L70:
|
202
203
|
goto L140;
|
@@ -205,14 +206,14 @@ L70:
|
|
205
206
|
L80:
|
206
207
|
b[*n] /= t[*n + *n * t_dim1];
|
207
208
|
if (*n < 2) {
|
208
|
-
|
209
|
+
goto L100;
|
209
210
|
}
|
210
211
|
i__1 = *n;
|
211
212
|
for (jj = 2; jj <= i__1; ++jj) {
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
213
|
+
j = *n - jj + 1;
|
214
|
+
i__2 = jj - 1;
|
215
|
+
b[j] -= ddot_(&i__2, &t[j + 1 + j * t_dim1], &c__1, &b[j + 1], &c__1);
|
216
|
+
b[j] /= t[j + j * t_dim1];
|
216
217
|
}
|
217
218
|
L100:
|
218
219
|
goto L140;
|
@@ -221,16 +222,16 @@ L100:
|
|
221
222
|
L110:
|
222
223
|
b[1] /= t[t_dim1 + 1];
|
223
224
|
if (*n < 2) {
|
224
|
-
|
225
|
+
goto L130;
|
225
226
|
}
|
226
227
|
i__1 = *n;
|
227
228
|
for (j = 2; j <= i__1; ++j) {
|
228
|
-
|
229
|
-
|
230
|
-
|
229
|
+
i__2 = j - 1;
|
230
|
+
b[j] -= ddot_(&i__2, &t[j * t_dim1 + 1], &c__1, &b[1], &c__1);
|
231
|
+
b[j] /= t[j + j * t_dim1];
|
231
232
|
}
|
232
233
|
L130:
|
233
234
|
L140:
|
234
235
|
L150:
|
235
|
-
return
|
236
|
+
return;
|
236
237
|
}
|
data/ext/lbfgsb/src/linpack.h
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
#ifndef LBFGSB_RB_LINPACK_H_
|
2
2
|
#define LBFGSB_RB_LINPACK_H_
|
3
3
|
|
4
|
-
#include
|
4
|
+
#include "common.h"
|
5
5
|
|
6
|
-
extern
|
7
|
-
extern
|
6
|
+
extern void dpofa_(double* a, F77_int* lda, F77_int* n, F77_int* info);
|
7
|
+
extern void dtrsl_(double* t, F77_int* ldt, F77_int* n, double* b, F77_int* job, F77_int* info);
|
8
8
|
|
9
9
|
#endif /* LBFGSB_RB_LINPACK_H_ */
|
data/lib/lbfgsb/version.rb
CHANGED
data/lib/lbfgsb.rb
CHANGED
@@ -43,7 +43,7 @@ module Lbfgsb
|
|
43
43
|
n_elements = x_init.size
|
44
44
|
l = Numo::DFloat.zeros(n_elements)
|
45
45
|
u = Numo::DFloat.zeros(n_elements)
|
46
|
-
nbd = Numo::Int64.zeros(n_elements)
|
46
|
+
nbd = SZ_F77_INTEGER == 64 ? Numo::Int64.zeros(n_elements) : Numo::Int32.zeros(n_elements)
|
47
47
|
|
48
48
|
unless bounds.nil?
|
49
49
|
n_elements.times do |n|
|
data/sig/lbfgsb.rbs
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
module Lbfgsb
|
2
|
+
type result = {
|
3
|
+
task: String,
|
4
|
+
x: Numo::DFloat,
|
5
|
+
fnc: Float,
|
6
|
+
jcb: Numo::DFloat,
|
7
|
+
n_iter: Integer,
|
8
|
+
n_fev: Integer,
|
9
|
+
n_jev: Integer,
|
10
|
+
success: bool
|
11
|
+
}
|
12
|
+
|
13
|
+
VERSION: String
|
14
|
+
|
15
|
+
DBL_EPSILON: Float
|
16
|
+
|
17
|
+
def self?.minimize: (fnc: Method | Proc fnc, x_init: Numo::DFloat x_init, jcb: Method | Proc | bool jcb,
|
18
|
+
?args: untyped args, ?bounds: Numo::DFloat? bounds, ?factr: Float factr, ?pgtol: Float pgtol,
|
19
|
+
?maxcor: Integer maxcor, ?maxiter: Integer maxiter,
|
20
|
+
?verbose: Integer? verbose) -> result
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def self?.fnc: (Method | Proc fnc, Numo::DFloat x, untyped args) -> Float
|
25
|
+
|
26
|
+
def self?.jcb: (Method | Proc jcb, Numo::DFloat x, untyped args) -> Numo::DFloat
|
27
|
+
|
28
|
+
def self?.min_l_bfgs_b: (Method | Proc fnc, Numo::DFloat x, Method | Proc | bool jcb, untyped args,
|
29
|
+
Numo::DFloat l, Numo::DFloat u, Numo::DFloat nbd, Integer maxcor, Float ftol, Float gtol, Integer maxiter,
|
30
|
+
Integer? disp) -> result
|
31
|
+
end
|
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.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- yoshoku
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-02-13 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: []
|
@@ -32,28 +34,23 @@ extensions:
|
|
32
34
|
- ext/lbfgsb/extconf.rb
|
33
35
|
extra_rdoc_files: []
|
34
36
|
files:
|
35
|
-
- ".github/workflows/build.yml"
|
36
|
-
- ".gitignore"
|
37
|
-
- ".rspec"
|
38
|
-
- ".yardopts"
|
39
37
|
- CHANGELOG.md
|
40
|
-
- Gemfile
|
41
38
|
- LICENSE.txt
|
42
39
|
- README.md
|
43
|
-
- Rakefile
|
44
40
|
- ext/lbfgsb/extconf.rb
|
45
41
|
- ext/lbfgsb/lbfgsbext.c
|
46
42
|
- ext/lbfgsb/lbfgsbext.h
|
47
43
|
- ext/lbfgsb/src/License.txt
|
48
44
|
- ext/lbfgsb/src/blas.c
|
49
45
|
- ext/lbfgsb/src/blas.h
|
46
|
+
- ext/lbfgsb/src/common.h
|
50
47
|
- ext/lbfgsb/src/lbfgsb.c
|
51
48
|
- ext/lbfgsb/src/lbfgsb.h
|
52
49
|
- ext/lbfgsb/src/linpack.c
|
53
50
|
- ext/lbfgsb/src/linpack.h
|
54
|
-
- lbfgsb.gemspec
|
55
51
|
- lib/lbfgsb.rb
|
56
52
|
- lib/lbfgsb/version.rb
|
53
|
+
- sig/lbfgsb.rbs
|
57
54
|
homepage: https://github.com/yoshoku/lbfgsb.rb
|
58
55
|
licenses:
|
59
56
|
- BSD-3-Clause
|
@@ -77,8 +74,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
77
74
|
- !ruby/object:Gem::Version
|
78
75
|
version: '0'
|
79
76
|
requirements: []
|
80
|
-
rubygems_version: 3.
|
77
|
+
rubygems_version: 3.3.7
|
81
78
|
signing_key:
|
82
79
|
specification_version: 4
|
83
|
-
summary: Lbfgsb.rb is a Ruby binding for L-BFGS-B
|
80
|
+
summary: Lbfgsb.rb is a Ruby binding for L-BFGS-B.
|
84
81
|
test_files: []
|
data/.github/workflows/build.yml
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
name: build
|
2
|
-
|
3
|
-
on: [push, pull_request]
|
4
|
-
|
5
|
-
jobs:
|
6
|
-
build:
|
7
|
-
runs-on: ubuntu-latest
|
8
|
-
strategy:
|
9
|
-
matrix:
|
10
|
-
ruby: [ '2.5', '2.6', '2.7' ]
|
11
|
-
steps:
|
12
|
-
- uses: actions/checkout@v2
|
13
|
-
- name: Set up Ruby ${{ matrix.ruby }}
|
14
|
-
uses: actions/setup-ruby@v1
|
15
|
-
with:
|
16
|
-
ruby-version: ${{ matrix.ruby }}
|
17
|
-
- name: Build and test with Rake
|
18
|
-
run: |
|
19
|
-
gem install bundler
|
20
|
-
bundle install --jobs 4 --retry 3
|
21
|
-
bundle exec rake
|
data/.gitignore
DELETED
data/.rspec
DELETED
data/.yardopts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
--exclude ext/lbfgsb/src/
|