lbfgsb 0.3.1 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b3bd36b7d31d1cbc04ef90be26df3fcf67b73a1dbeba544a1c838f6b35786115
4
- data.tar.gz: d09cc5f75361c4ec6c542ed7b663d87c8654e806cfdcd81415754f963074fbd1
3
+ metadata.gz: d0558e429ff4c590e681165e0af885de04e9b78d4d679afc89f9c0bcfc1b2764
4
+ data.tar.gz: 5e1a8a157614da1a8541fbe28aad8cb04bf4096a4d3022f1b519c35abf071544
5
5
  SHA512:
6
- metadata.gz: ce048d758955f403e2d6c176f316e8f7e5db58dc142f91a0ee343fd0115a17b9b61c6a26a145eb1553dab6644f3f6cc5f6fa8ad04898287393247ef34de58fc0
7
- data.tar.gz: 6d6e7dd5fbc941b37542de548385a6202322fbfebe5a6a77a9afbb169dcf9d421f7d79435dda881b5c3174948b47eb603a065c6726011f010c66e45b674c41d5
6
+ metadata.gz: 66997d33a6fd0fb750ae236934fa866a94592161cbba49375bd7d46d94a9c98f0177cd207431d24cd1812bbf10be050106c941de9ac972f7699d0687b97a41c8
7
+ data.tar.gz: d8ba46b919591239180642f9a45fe5f14337f2aa703ac527ba533449c647be4b64de700a49a88616019241010d37e6118904c992c3886ed7e44c620f771cadc9
data/CHANGELOG.md CHANGED
@@ -1,3 +1,29 @@
1
+ ## 0.5.0
2
+ - Add build option to select FORTRAN integer bit size.
3
+
4
+ ```
5
+ $ gem install lbfgsb -- --with-use-int64
6
+ ```
7
+
8
+ - Add build option to use any blas library.
9
+
10
+ ```
11
+ $ gem install lbfgsb -- --with-blas-dir=/opt/local/openblas/lib --with-blas-lib=openblas
12
+ ```
13
+
14
+ - Change to use 32-bit integer for FORTRAN integer in internal functions by default.
15
+ - Introduce conventional commits.
16
+
17
+ ## 0.4.1
18
+ - Remove dependent gem's type declaration file from installation files.
19
+
20
+ ## 0.4.0
21
+ - Add type declaration file: sig/lbfgsb.rbs
22
+
23
+ ## 0.3.2
24
+ - Refactor native extension codes.
25
+ - Update documentations.
26
+
1
27
  ## 0.3.1
2
28
  - Add GC guard to narray given to native extension method.
3
29
 
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2020-2021 Atsushi Tatsuma
1
+ Copyright (c) 2020-2022 Atsushi Tatsuma
2
2
  All rights reserved.
3
3
 
4
4
  Redistribution and use in source and binary forms, with or without
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/master/LICENSE.txt)
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)
@@ -1,6 +1,8 @@
1
1
  require 'mkmf'
2
2
  require 'numo/narray'
3
3
 
4
+ $defs << '-DUSE_INT64' if with_config('use-int64', false)
5
+
4
6
  $LOAD_PATH.each do |lp|
5
7
  if File.exist?(File.join(lp, 'numo/numo/narray.h'))
6
8
  $INCFLAGS = "-I#{lp}/numo #{$INCFLAGS}"
@@ -26,10 +28,17 @@ if RUBY_PLATFORM =~ /mswin|cygwin|mingw/
26
28
  end
27
29
  end
28
30
 
29
- $srcs = Dir.glob("#{$srcdir}/*.c").map { |path| File.basename(path) }
30
- $srcs.concat(%w[blas.c linpack.c lbfgsb.c])
31
+ $srcs = Dir.glob("#{$srcdir}/**/*.c").map { |path| File.basename(path) }
32
+
33
+ blas_dir = with_config('blas-dir')
34
+ $LDFLAGS = "-L#{blas_dir} #{$LDFLAGS}" unless blas_dir.nil?
35
+
36
+ blas_lib = with_config('blas-lib')
37
+ unless blas_lib.nil?
38
+ abort "#{blas_lib} not found." unless have_library(blas_lib)
39
+ $srcs.delete('blas.c')
40
+ end
31
41
 
32
- $INCFLAGS << " -I$(srcdir)/src"
33
42
  $VPATH << "$(srcdir)/src"
34
43
 
35
44
  create_makefile('lbfgsb/lbfgsbext')
@@ -2,40 +2,46 @@
2
2
 
3
3
  VALUE rb_mLbfgsb;
4
4
 
5
- static
6
- VALUE lbfgsb_min_l_bfgs_b(VALUE self,
7
- VALUE fnc, VALUE x_val, VALUE jcb, VALUE args,
8
- VALUE l_val, VALUE u_val, VALUE nbd_val,
9
- VALUE maxcor, VALUE ftol, VALUE gtol, VALUE maxiter, VALUE disp)
10
- {
11
- long i;
12
- long n_iter;
13
- long n_fev;
14
- long n_jev;
15
- long max_iter = NUM2LONG(maxiter);
5
+ static VALUE lbfgsb_min_l_bfgs_b(VALUE self, VALUE fnc, VALUE x_val, VALUE jcb, VALUE args, VALUE l_val, VALUE u_val,
6
+ VALUE nbd_val, VALUE maxcor, VALUE ftol, VALUE gtol, VALUE maxiter, VALUE disp) {
7
+ F77_int n_iter;
8
+ F77_int n_fev;
9
+ F77_int n_jev;
10
+ #ifdef USE_INT64
11
+ F77_int max_iter = NUM2LONG(maxiter);
12
+ #else
13
+ F77_int max_iter = NUM2INT(maxiter);
14
+ #endif
16
15
  narray_t* x_nary;
17
16
  narray_t* l_nary;
18
17
  narray_t* u_nary;
19
18
  narray_t* nbd_nary;
20
- long n;
21
- long m = NUM2LONG(maxcor);
22
- double *x_ptr;
23
- double *l_ptr;
24
- double *u_ptr;
25
- long *nbd_ptr;
19
+ F77_int n;
20
+ #ifdef USE_INT64
21
+ F77_int m = NUM2LONG(maxcor);
22
+ #else
23
+ F77_int m = NUM2INT(maxcor);
24
+ #endif
25
+ double* x_ptr;
26
+ double* l_ptr;
27
+ double* u_ptr;
28
+ F77_int* nbd_ptr;
26
29
  double f;
27
- double *g;
30
+ double* g;
28
31
  double factr = NUM2DBL(ftol);
29
32
  double pgtol = NUM2DBL(gtol);
30
33
  double* wa;
31
- long* iwa;
34
+ F77_int* iwa;
32
35
  char task[60];
33
- long iprint = NIL_P(disp) ? -1 : NUM2LONG(disp);
36
+ #ifdef USE_INT64
37
+ F77_int iprint = NIL_P(disp) ? -1 : NUM2LONG(disp);
38
+ #else
39
+ F77_int iprint = NIL_P(disp) ? -1 : NUM2INT(disp);
40
+ #endif
34
41
  char csave[60];
35
- long lsave[4];
36
- long isave[44];
42
+ F77_int lsave[4];
43
+ F77_int isave[44];
37
44
  double dsave[29];
38
- double* g_ptr;
39
45
  VALUE g_val;
40
46
  VALUE fg_arr;
41
47
  VALUE ret;
@@ -45,7 +51,7 @@ VALUE lbfgsb_min_l_bfgs_b(VALUE self,
45
51
  rb_raise(rb_eArgError, "x must be a 1-D array.");
46
52
  return Qnil;
47
53
  }
48
- n = (long)NA_SIZE(x_nary);
54
+ n = (F77_int)NA_SIZE(x_nary);
49
55
  if (CLASS_OF(x_val) != numo_cDFloat) {
50
56
  x_val = rb_funcall(numo_cDFloat, rb_intern("cast"), 1, x_val);
51
57
  }
@@ -58,7 +64,7 @@ VALUE lbfgsb_min_l_bfgs_b(VALUE self,
58
64
  rb_raise(rb_eArgError, "l must be a 1-D array.");
59
65
  return Qnil;
60
66
  }
61
- if ((long)NA_SIZE(l_nary) != n) {
67
+ if ((F77_int)NA_SIZE(l_nary) != n) {
62
68
  rb_raise(rb_eArgError, "The size of l must be equal to that of x.");
63
69
  return Qnil;
64
70
  }
@@ -74,7 +80,7 @@ VALUE lbfgsb_min_l_bfgs_b(VALUE self,
74
80
  rb_raise(rb_eArgError, "u must be a 1-D array.");
75
81
  return Qnil;
76
82
  }
77
- if ((long)NA_SIZE(u_nary) != n) {
83
+ if ((F77_int)NA_SIZE(u_nary) != n) {
78
84
  rb_raise(rb_eArgError, "The size of u must be equal to that of x.");
79
85
  return Qnil;
80
86
  }
@@ -90,13 +96,19 @@ VALUE lbfgsb_min_l_bfgs_b(VALUE self,
90
96
  rb_raise(rb_eArgError, "nbd must be a 1-D array.");
91
97
  return Qnil;
92
98
  }
93
- if ((long)NA_SIZE(nbd_nary) != n) {
99
+ if ((F77_int)NA_SIZE(nbd_nary) != n) {
94
100
  rb_raise(rb_eArgError, "The size of nbd must be equal to that of x.");
95
101
  return Qnil;
96
102
  }
103
+ #ifdef USE_INT64
97
104
  if (CLASS_OF(nbd_val) != numo_cInt64) {
98
105
  nbd_val = rb_funcall(numo_cInt64, rb_intern("cast"), 1, nbd_val);
99
106
  }
107
+ #else
108
+ if (CLASS_OF(nbd_val) != numo_cInt32) {
109
+ nbd_val = rb_funcall(numo_cInt32, rb_intern("cast"), 1, nbd_val);
110
+ }
111
+ #endif
100
112
  if (!RTEST(nary_check_contiguous(nbd_val))) {
101
113
  nbd_val = nary_dup(nbd_val);
102
114
  }
@@ -104,23 +116,20 @@ VALUE lbfgsb_min_l_bfgs_b(VALUE self,
104
116
  x_ptr = (double*)na_get_pointer_for_read_write(x_val);
105
117
  l_ptr = (double*)na_get_pointer_for_read(l_val);
106
118
  u_ptr = (double*)na_get_pointer_for_read(u_val);
107
- nbd_ptr = (long*)na_get_pointer_for_read(nbd_val);
119
+ nbd_ptr = (F77_int*)na_get_pointer_for_read(nbd_val);
108
120
  g = ALLOC_N(double, n);
109
121
  wa = ALLOC_N(double, (2 * m + 5) * n + 12 * m * m + 12 * m);
110
- iwa = ALLOC_N(long, 3 * n);
122
+ iwa = ALLOC_N(F77_int, 3 * n);
111
123
 
112
124
  g_val = Qnil;
113
125
  f = 0.0;
114
- for (i = 0; i < n; g[i++] = 0.0);
126
+ memset(g, 0, n * sizeof(*g));
115
127
  strcpy(task, "START");
116
128
  n_fev = 0;
117
129
  n_jev = 0;
118
130
 
119
131
  for (n_iter = 0; n_iter < max_iter;) {
120
- setulb_(
121
- &n, &m, x_ptr, l_ptr, u_ptr, nbd_ptr, &f, g, &factr, &pgtol, wa, iwa,
122
- task, &iprint, csave, lsave, isave, dsave
123
- );
132
+ setulb_(&n, &m, x_ptr, l_ptr, u_ptr, nbd_ptr, &f, g, &factr, &pgtol, wa, iwa, task, &iprint, csave, lsave, isave, dsave);
124
133
  if (strncmp(task, "FG", 2) == 0) {
125
134
  if (RB_TYPE_P(jcb, T_TRUE)) {
126
135
  fg_arr = rb_funcall(self, rb_intern("fnc"), 3, fnc, x_val, args);
@@ -130,15 +139,16 @@ VALUE lbfgsb_min_l_bfgs_b(VALUE self,
130
139
  f = NUM2DBL(rb_funcall(self, rb_intern("fnc"), 3, fnc, x_val, args));
131
140
  g_val = rb_funcall(self, rb_intern("jcb"), 3, jcb, x_val, args);
132
141
  }
133
- n_fev += 1;
134
- n_jev += 1;
135
- if (CLASS_OF(g_val) != numo_cDFloat) g_val = rb_funcall(numo_cDFloat, rb_intern("cast"), 1, g_val);
136
- if (!RTEST(nary_check_contiguous(g_val))) g_val = nary_dup(g_val);
137
- g_ptr = (double*)na_get_pointer_for_read(g_val);
138
- for (i = 0; i < n; i++) g[i] = g_ptr[i];
142
+ n_fev++;
143
+ n_jev++;
144
+ if (CLASS_OF(g_val) != numo_cDFloat)
145
+ g_val = rb_funcall(numo_cDFloat, rb_intern("cast"), 1, g_val);
146
+ if (!RTEST(nary_check_contiguous(g_val)))
147
+ g_val = nary_dup(g_val);
148
+ memcpy(g, na_get_pointer_for_read(g_val), n * sizeof(*g));
149
+ RB_GC_GUARD(g_val);
139
150
  } else if (strncmp(task, "NEW_X", 5) == 0) {
140
- n_iter += 1;
141
- continue;
151
+ n_iter++;
142
152
  } else {
143
153
  break;
144
154
  }
@@ -153,9 +163,15 @@ VALUE lbfgsb_min_l_bfgs_b(VALUE self,
153
163
  rb_hash_aset(ret, ID2SYM(rb_intern("x")), x_val);
154
164
  rb_hash_aset(ret, ID2SYM(rb_intern("fnc")), DBL2NUM(f));
155
165
  rb_hash_aset(ret, ID2SYM(rb_intern("jcb")), g_val);
166
+ #ifdef USE_INT64
156
167
  rb_hash_aset(ret, ID2SYM(rb_intern("n_iter")), LONG2NUM(n_iter));
157
168
  rb_hash_aset(ret, ID2SYM(rb_intern("n_fev")), LONG2NUM(n_fev));
158
169
  rb_hash_aset(ret, ID2SYM(rb_intern("n_jev")), LONG2NUM(n_jev));
170
+ #else
171
+ rb_hash_aset(ret, ID2SYM(rb_intern("n_iter")), INT2NUM(n_iter));
172
+ rb_hash_aset(ret, ID2SYM(rb_intern("n_fev")), INT2NUM(n_fev));
173
+ rb_hash_aset(ret, ID2SYM(rb_intern("n_jev")), INT2NUM(n_jev));
174
+ #endif
159
175
  rb_hash_aset(ret, ID2SYM(rb_intern("success")), strncmp(task, "CONV", 4) == 0 ? Qtrue : Qfalse);
160
176
 
161
177
  RB_GC_GUARD(x_val);
@@ -166,12 +182,17 @@ VALUE lbfgsb_min_l_bfgs_b(VALUE self,
166
182
  return ret;
167
183
  }
168
184
 
169
- void
170
- Init_lbfgsbext(void)
171
- {
185
+ void Init_lbfgsbext(void) {
172
186
  rb_mLbfgsb = rb_define_module("Lbfgsb");
173
187
  /* The value of double epsilon used in the native extension. */
174
188
  rb_define_const(rb_mLbfgsb, "DBL_EPSILON", DBL2NUM(DBL_EPSILON));
189
+ #ifdef USE_INT64
190
+ /* The bit size of fortran integer. */
191
+ rb_define_const(rb_mLbfgsb, "SZ_F77_INTEGER", INT2NUM(64));
192
+ #else
193
+ /* The bit size of fortran integer. */
194
+ rb_define_const(rb_mLbfgsb, "SZ_F77_INTEGER", INT2NUM(32));
195
+ #endif
175
196
  /* @!visibility private */
176
197
  rb_define_module_function(rb_mLbfgsb, "min_l_bfgs_b", lbfgsb_min_l_bfgs_b, 12);
177
198
  }
@@ -2,11 +2,13 @@
2
2
  #define LBFGSB_RB_H 1
3
3
 
4
4
  #include <float.h>
5
+ #include <string.h>
5
6
 
6
7
  #include <ruby.h>
8
+
7
9
  #include <numo/narray.h>
8
10
  #include <numo/template.h>
9
11
 
10
- #include <lbfgsb.h>
12
+ #include "src/lbfgsb.h"
11
13
 
12
14
  #endif /* LBFGSB_RB_H */
@@ -5,10 +5,9 @@
5
5
  */
6
6
  #include "blas.h"
7
7
 
8
- int lbfgsb_rb_daxpy_(long *n, double *da, double *dx, long *incx, double *dy, long *incy)
9
- {
10
- long i__1;
11
- static long i__, m, ix, iy, mp1;
8
+ void daxpy_(F77_int* n, double* da, double* dx, F77_int* incx, double* dy, F77_int* incy) {
9
+ F77_int i__1;
10
+ static F77_int i__, m, ix, iy, mp1;
12
11
 
13
12
  --dy;
14
13
  --dx;
@@ -17,10 +16,10 @@ int lbfgsb_rb_daxpy_(long *n, double *da, double *dx, long *incx, double *dy, lo
17
16
  /* uses unrolled loops for increments equal to one. */
18
17
  /* jack dongarra, linpack, 3/11/78. */
19
18
  if (*n <= 0) {
20
- return 0;
19
+ return;
21
20
  }
22
21
  if (*da == 0.) {
23
- return 0;
22
+ return;
24
23
  }
25
24
  if (*incx == 1 && *incy == 1) {
26
25
  goto L20;
@@ -42,7 +41,7 @@ int lbfgsb_rb_daxpy_(long *n, double *da, double *dx, long *incx, double *dy, lo
42
41
  ix += *incx;
43
42
  iy += *incy;
44
43
  }
45
- return 0;
44
+ return;
46
45
 
47
46
  /* code for both increments equal to 1 */
48
47
  /* clean-up loop */
@@ -56,7 +55,7 @@ L20:
56
55
  dy[i__] += *da * dx[i__];
57
56
  }
58
57
  if (*n < 4) {
59
- return 0;
58
+ return;
60
59
  }
61
60
  L40:
62
61
  mp1 = m + 1;
@@ -67,13 +66,12 @@ L40:
67
66
  dy[i__ + 2] += *da * dx[i__ + 2];
68
67
  dy[i__ + 3] += *da * dx[i__ + 3];
69
68
  }
70
- return 0;
69
+ return;
71
70
  }
72
71
 
73
- int lbfgsb_rb_dcopy_(long *n, double *dx, long *incx, double *dy, long *incy)
74
- {
75
- long i__1;
76
- static long i__, m, ix, iy, mp1;
72
+ void dcopy_(F77_int* n, double* dx, F77_int* incx, double* dy, F77_int* incy) {
73
+ F77_int i__1;
74
+ static F77_int i__, m, ix, iy, mp1;
77
75
 
78
76
  --dy;
79
77
  --dx;
@@ -82,7 +80,7 @@ int lbfgsb_rb_dcopy_(long *n, double *dx, long *incx, double *dy, long *incy)
82
80
  /* uses unrolled loops for increments equal to one. */
83
81
  /* jack dongarra, linpack, 3/11/78. */
84
82
  if (*n <= 0) {
85
- return 0;
83
+ return;
86
84
  }
87
85
  if (*incx == 1 && *incy == 1) {
88
86
  goto L20;
@@ -104,7 +102,7 @@ int lbfgsb_rb_dcopy_(long *n, double *dx, long *incx, double *dy, long *incy)
104
102
  ix += *incx;
105
103
  iy += *incy;
106
104
  }
107
- return 0;
105
+ return;
108
106
 
109
107
  /* code for both increments equal to 1 */
110
108
  /* clean-up loop */
@@ -118,7 +116,7 @@ L20:
118
116
  dy[i__] = dx[i__];
119
117
  }
120
118
  if (*n < 7) {
121
- return 0;
119
+ return;
122
120
  }
123
121
  L40:
124
122
  mp1 = m + 1;
@@ -132,14 +130,13 @@ L40:
132
130
  dy[i__ + 5] = dx[i__ + 5];
133
131
  dy[i__ + 6] = dx[i__ + 6];
134
132
  }
135
- return 0;
133
+ return;
136
134
  }
137
135
 
138
- double lbfgsb_rb_ddot_(long *n, double *dx, long *incx, double *dy, long *incy)
139
- {
140
- long i__1;
136
+ double ddot_(F77_int* n, double* dx, F77_int* incx, double* dy, F77_int* incy) {
137
+ F77_int i__1;
141
138
  double ret_val;
142
- static long i__, m, ix, iy, mp1;
139
+ static F77_int i__, m, ix, iy, mp1;
143
140
  static double dtemp;
144
141
 
145
142
  --dy;
@@ -194,18 +191,17 @@ L40:
194
191
  mp1 = m + 1;
195
192
  i__1 = *n;
196
193
  for (i__ = mp1; i__ <= i__1; i__ += 5) {
197
- dtemp = dtemp + dx[i__] * dy[i__] + dx[i__ + 1] * dy[i__ + 1]
198
- + dx[i__ + 2] * dy[i__ + 2] + dx[i__ + 3] * dy[i__ + 3] + dx[i__ + 4] * dy[i__ + 4];
194
+ dtemp = dtemp + dx[i__] * dy[i__] + dx[i__ + 1] * dy[i__ + 1] + dx[i__ + 2] * dy[i__ + 2] + dx[i__ + 3] * dy[i__ + 3] +
195
+ dx[i__ + 4] * dy[i__ + 4];
199
196
  }
200
197
  L60:
201
198
  ret_val = dtemp;
202
199
  return ret_val;
203
200
  }
204
201
 
205
- int lbfgsb_rb_dscal_(long *n, double *da, double *dx, long *incx)
206
- {
207
- long i__1, i__2;
208
- static long i__, m, mp1, nincx;
202
+ void dscal_(F77_int* n, double* da, double* dx, F77_int* incx) {
203
+ F77_int i__1, i__2;
204
+ static F77_int i__, m, mp1, nincx;
209
205
 
210
206
  --dx;
211
207
 
@@ -214,7 +210,7 @@ int lbfgsb_rb_dscal_(long *n, double *da, double *dx, long *incx)
214
210
  /* jack dongarra, linpack, 3/11/78. */
215
211
  /* modified 3/93 to return if incx .le. 0. */
216
212
  if (*n <= 0 || *incx <= 0) {
217
- return 0;
213
+ return;
218
214
  }
219
215
  if (*incx == 1) {
220
216
  goto L20;
@@ -227,7 +223,7 @@ int lbfgsb_rb_dscal_(long *n, double *da, double *dx, long *incx)
227
223
  for (i__ = 1; i__2 < 0 ? i__ >= i__1 : i__ <= i__1; i__ += i__2) {
228
224
  dx[i__] = *da * dx[i__];
229
225
  }
230
- return 0;
226
+ return;
231
227
 
232
228
  /* code for increment equal to 1 */
233
229
  /* clean-up loop */
@@ -241,7 +237,7 @@ L20:
241
237
  dx[i__] = *da * dx[i__];
242
238
  }
243
239
  if (*n < 5) {
244
- return 0;
240
+ return;
245
241
  }
246
242
  L40:
247
243
  mp1 = m + 1;
@@ -253,5 +249,5 @@ L40:
253
249
  dx[i__ + 3] = *da * dx[i__ + 3];
254
250
  dx[i__ + 4] = *da * dx[i__ + 4];
255
251
  }
256
- return 0;
252
+ return;
257
253
  }
@@ -1,11 +1,11 @@
1
1
  #ifndef LBFGSB_RB_BLAS_H_
2
2
  #define LBFGSB_RB_BLAS_H_
3
3
 
4
- #include <math.h>
4
+ #include "common.h"
5
5
 
6
- extern int lbfgsb_rb_daxpy_(long *n, double *da, double *dx, long *incx, double *dy, long *incy);
7
- extern int lbfgsb_rb_dcopy_(long *n, double *dx, long *incx, double *dy, long *incy);
8
- extern double lbfgsb_rb_ddot_(long *n, double *dx, long *incx, double *dy, long *incy);
9
- extern int lbfgsb_rb_dscal_(long *n, double *da, double *dx, long *incx);
6
+ extern void daxpy_(F77_int* n, double* da, double* dx, F77_int* incx, double* dy, F77_int* incy);
7
+ extern void dcopy_(F77_int* n, double* dx, F77_int* incx, double* dy, F77_int* incy);
8
+ extern double ddot_(F77_int* n, double* dx, F77_int* incx, double* dy, F77_int* incy);
9
+ extern void dscal_(F77_int* n, double* da, double* dx, F77_int* incx);
10
10
 
11
11
  #endif /* LBFGSB_RB_BLAS_H_ */
@@ -0,0 +1,16 @@
1
+ #ifndef LBFGSB_RB_COMMON_H_
2
+ #define LBFGSB_RB_COMMON_H_
3
+
4
+ #include <stdint.h>
5
+ #include <inttypes.h>
6
+ #include <math.h>
7
+
8
+ #ifdef USE_INT64
9
+ typedef int64_t F77_int;
10
+ #define PRIdF77INT PRId64
11
+ #else
12
+ typedef int32_t F77_int;
13
+ #define PRIdF77INT PRId32
14
+ #endif
15
+
16
+ #endif /* LBFGSB_RB_COMMON_H_ */