numo-gsl-integration 0.4.0 → 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.
@@ -2,6 +2,8 @@
2
2
 
3
3
  typedef struct {
4
4
  gsl_function *function;
5
+ VALUE workspace_value;
6
+ VALUE table_value;
5
7
  double a;
6
8
  double b;
7
9
  double alpha;
@@ -11,8 +13,11 @@ typedef struct {
11
13
  double epsabs;
12
14
  double epsrel;
13
15
  size_t limit;
16
+ int limit_given;
14
17
  gsl_integration_workspace *workspace;
18
+ integration_workspace_use workspace_use;
15
19
  gsl_integration_qaws_table *table;
20
+ integration_qaws_table_use table_use;
16
21
  double *result;
17
22
  double *error;
18
23
  } integration_qaws_params;
@@ -20,13 +25,8 @@ typedef struct {
20
25
  static VALUE integration_free_qaws_resources(VALUE data) {
21
26
  integration_qaws_params *params = (integration_qaws_params *)data;
22
27
 
23
- if (params->table != NULL) {
24
- gsl_integration_qaws_table_free(params->table);
25
- }
26
-
27
- if (params->workspace != NULL) {
28
- gsl_integration_workspace_free(params->workspace);
29
- }
28
+ integration_qaws_table_use_end((VALUE)&params->table_use);
29
+ integration_workspace_use_end((VALUE)&params->workspace_use);
30
30
 
31
31
  return Qnil;
32
32
  }
@@ -34,9 +34,13 @@ static VALUE integration_free_qaws_resources(VALUE data) {
34
34
  static VALUE integration_run_qaws(VALUE data) {
35
35
  integration_qaws_params *params = (integration_qaws_params *)data;
36
36
 
37
- params->table = gsl_integration_qaws_table_alloc(params->alpha, params->beta,
38
- params->mu, params->nu);
39
- params->workspace = gsl_integration_workspace_alloc(params->limit);
37
+ integration_workspace_use_begin(params->workspace_value, &params->limit,
38
+ params->limit_given, &params->workspace_use);
39
+ params->workspace = params->workspace_use.workspace;
40
+ integration_qaws_table_use_begin(params->table_value, params->alpha,
41
+ params->beta, params->mu, params->nu,
42
+ &params->table_use);
43
+ params->table = params->table_use.table;
40
44
 
41
45
  (void)gsl_integration_qaws(params->function, params->a, params->b,
42
46
  params->table, params->epsabs, params->epsrel,
@@ -59,13 +63,27 @@ VALUE integration_qaws(int argc, VALUE *argv, VALUE self) {
59
63
  VALUE mu;
60
64
  VALUE nu;
61
65
  VALUE options;
62
- integration_options parsed_options;
66
+ VALUE epsabs_value = Qundef;
67
+ VALUE epsrel_value = Qundef;
68
+ VALUE limit_value = Qundef;
69
+ VALUE workspace_value = Qundef;
70
+ VALUE table_value = Qundef;
71
+ ID keywords[] = {rb_intern("epsabs"), rb_intern("epsrel"), rb_intern("limit"),
72
+ rb_intern("workspace"), rb_intern("table")};
73
+ VALUE keyword_values[5];
74
+ double a_double;
75
+ double b_double;
76
+ double alpha_double;
77
+ double beta_double;
78
+ int mu_integer;
79
+ int nu_integer;
63
80
  double epsabs;
64
81
  double epsrel;
65
82
  size_t limit;
83
+ int limit_given;
66
84
  gsl_function function;
67
85
  integration_callback_params params;
68
- integration_qaws_params qaws_params;
86
+ integration_qaws_params qaws_params = {0};
69
87
  double result;
70
88
  double error;
71
89
  int state = 0;
@@ -74,31 +92,48 @@ VALUE integration_qaws(int argc, VALUE *argv, VALUE self) {
74
92
 
75
93
  rb_scan_args(argc, argv, "6:", &a, &b, &alpha, &beta, &mu, &nu, &options);
76
94
 
77
- integration_options_parse(options, &parsed_options, 0.0, 1e-8, 1000);
95
+ if (!NIL_P(options)) {
96
+ rb_get_kwargs(options, keywords, 0, 5, keyword_values);
97
+ epsabs_value = keyword_values[0];
98
+ epsrel_value = keyword_values[1];
99
+ limit_value = keyword_values[2];
100
+ workspace_value = keyword_values[3];
101
+ table_value = keyword_values[4];
102
+ }
78
103
 
79
- epsabs = parsed_options.epsabs;
80
- epsrel = parsed_options.epsrel;
81
- limit = parsed_options.limit;
104
+ a_double = NUM2DBL(a);
105
+ b_double = NUM2DBL(b);
106
+ alpha_double = NUM2DBL(alpha);
107
+ beta_double = NUM2DBL(beta);
108
+ mu_integer = NUM2INT(mu);
109
+ nu_integer = NUM2INT(nu);
110
+ epsabs = epsabs_value == Qundef ? 0.0 : NUM2DBL(epsabs_value);
111
+ epsrel = epsrel_value == Qundef ? 1e-8 : NUM2DBL(epsrel_value);
112
+ limit = limit_value == Qundef ? 1000 : NUM2SIZET(limit_value);
113
+ limit_given = limit_value != Qundef;
82
114
 
83
115
  integration_function_init(&function, &params);
84
116
 
85
117
  qaws_params.function = &function;
86
- qaws_params.a = NUM2DBL(a);
87
- qaws_params.b = NUM2DBL(b);
88
- qaws_params.alpha = NUM2DBL(alpha);
89
- qaws_params.beta = NUM2DBL(beta);
90
- qaws_params.mu = NUM2INT(mu);
91
- qaws_params.nu = NUM2INT(nu);
118
+ qaws_params.workspace_value = workspace_value;
119
+ qaws_params.table_value = table_value;
120
+ qaws_params.a = a_double;
121
+ qaws_params.b = b_double;
122
+ qaws_params.alpha = alpha_double;
123
+ qaws_params.beta = beta_double;
124
+ qaws_params.mu = mu_integer;
125
+ qaws_params.nu = nu_integer;
92
126
  qaws_params.epsabs = epsabs;
93
127
  qaws_params.epsrel = epsrel;
94
128
  qaws_params.limit = limit;
95
- qaws_params.workspace = NULL;
96
- qaws_params.table = NULL;
129
+ qaws_params.limit_given = limit_given;
97
130
  qaws_params.result = &result;
98
131
  qaws_params.error = &error;
99
132
 
100
133
  rb_protect(integration_run_qaws_with_resources, (VALUE)&qaws_params, &state);
101
134
 
135
+ RB_GC_GUARD(workspace_value);
136
+ RB_GC_GUARD(table_value);
102
137
  RB_GC_GUARD(params.block);
103
138
  RB_GC_GUARD(params.exception);
104
139
 
@@ -0,0 +1,292 @@
1
+ #include "integration_internal.h"
2
+
3
+ #include <float.h>
4
+ #include <math.h>
5
+
6
+ static VALUE integration_cQAWSTable;
7
+
8
+ static int integration_qaws_table_double_equal(double left, double right) {
9
+ double scale = fmax(fabs(left), fabs(right));
10
+
11
+ return fabs(left - right) <= DBL_EPSILON * fmax(1.0, scale) * 4.0;
12
+ }
13
+
14
+ static void integration_qaws_table_free(void *data) {
15
+ integration_qaws_table *table = data;
16
+
17
+ if (table->table != NULL) {
18
+ gsl_integration_qaws_table_free(table->table);
19
+ }
20
+
21
+ xfree(table);
22
+ }
23
+
24
+ static size_t integration_qaws_table_memsize(const void *data) {
25
+ const integration_qaws_table *table = data;
26
+
27
+ if (table == NULL) {
28
+ return 0;
29
+ }
30
+
31
+ return sizeof(integration_qaws_table) +
32
+ (table->table == NULL ? 0 : sizeof(gsl_integration_qaws_table));
33
+ }
34
+
35
+ static const rb_data_type_t integration_qaws_table_type = {
36
+ .wrap_struct_name = "Numo::GSL::Integration::QAWSTable",
37
+ .function =
38
+ {
39
+ .dmark = NULL,
40
+ .dfree = integration_qaws_table_free,
41
+ .dsize = integration_qaws_table_memsize,
42
+ },
43
+ .flags = RUBY_TYPED_FREE_IMMEDIATELY,
44
+ };
45
+
46
+ static VALUE integration_qaws_table_allocate(VALUE klass) {
47
+ integration_qaws_table *table;
48
+ VALUE object = TypedData_Make_Struct(klass, integration_qaws_table,
49
+ &integration_qaws_table_type, table);
50
+
51
+ table->table = NULL;
52
+ table->alpha = 0.0;
53
+ table->beta = 0.0;
54
+ table->mu = 0;
55
+ table->nu = 0;
56
+ table->busy = 0;
57
+
58
+ return object;
59
+ }
60
+
61
+ static VALUE integration_qaws_table_initialize(int argc, VALUE *argv,
62
+ VALUE self) {
63
+ VALUE options;
64
+ VALUE alpha_value;
65
+ VALUE beta_value;
66
+ VALUE mu_value;
67
+ VALUE nu_value;
68
+ ID keywords[] = {rb_intern("alpha"), rb_intern("beta"), rb_intern("mu"),
69
+ rb_intern("nu")};
70
+ VALUE keyword_values[4];
71
+ double alpha;
72
+ double beta;
73
+ int mu;
74
+ int nu;
75
+ integration_qaws_table *table;
76
+
77
+ rb_scan_args(argc, argv, "0:", &options);
78
+
79
+ if (NIL_P(options)) {
80
+ rb_raise(rb_eArgError, "missing keywords: :alpha, :beta, :mu, :nu");
81
+ }
82
+
83
+ rb_get_kwargs(options, keywords, 4, 0, keyword_values);
84
+ alpha_value = keyword_values[0];
85
+ beta_value = keyword_values[1];
86
+ mu_value = keyword_values[2];
87
+ nu_value = keyword_values[3];
88
+
89
+ if (!rb_obj_is_kind_of(alpha_value, rb_cNumeric)) {
90
+ rb_raise(rb_eTypeError, "alpha must be Numeric");
91
+ }
92
+ if (!rb_obj_is_kind_of(beta_value, rb_cNumeric)) {
93
+ rb_raise(rb_eTypeError, "beta must be Numeric");
94
+ }
95
+ if (!RB_INTEGER_TYPE_P(mu_value)) {
96
+ rb_raise(rb_eTypeError, "mu must be an Integer");
97
+ }
98
+ if (!RB_INTEGER_TYPE_P(nu_value)) {
99
+ rb_raise(rb_eTypeError, "nu must be an Integer");
100
+ }
101
+
102
+ alpha = NUM2DBL(alpha_value);
103
+ beta = NUM2DBL(beta_value);
104
+ mu = NUM2INT(mu_value);
105
+ nu = NUM2INT(nu_value);
106
+
107
+ if (!(alpha > -1.0)) {
108
+ rb_raise(rb_eArgError, "alpha must be greater than -1");
109
+ }
110
+ if (!(beta > -1.0)) {
111
+ rb_raise(rb_eArgError, "beta must be greater than -1");
112
+ }
113
+ if (mu != 0 && mu != 1) {
114
+ rb_raise(rb_eArgError, "mu must be 0 or 1");
115
+ }
116
+ if (nu != 0 && nu != 1) {
117
+ rb_raise(rb_eArgError, "nu must be 0 or 1");
118
+ }
119
+
120
+ TypedData_Get_Struct(self, integration_qaws_table,
121
+ &integration_qaws_table_type, table);
122
+ table->alpha = alpha;
123
+ table->beta = beta;
124
+ table->mu = mu;
125
+ table->nu = nu;
126
+ table->table =
127
+ gsl_integration_qaws_table_alloc(alpha, beta, table->mu, table->nu);
128
+
129
+ if (table->table == NULL) {
130
+ rb_memerror();
131
+ }
132
+
133
+ return self;
134
+ }
135
+
136
+ static VALUE integration_qaws_table_alpha(VALUE self) {
137
+ integration_qaws_table *table;
138
+
139
+ TypedData_Get_Struct(self, integration_qaws_table,
140
+ &integration_qaws_table_type, table);
141
+
142
+ return DBL2NUM(table->alpha);
143
+ }
144
+
145
+ static VALUE integration_qaws_table_beta(VALUE self) {
146
+ integration_qaws_table *table;
147
+
148
+ TypedData_Get_Struct(self, integration_qaws_table,
149
+ &integration_qaws_table_type, table);
150
+
151
+ return DBL2NUM(table->beta);
152
+ }
153
+
154
+ static VALUE integration_qaws_table_mu(VALUE self) {
155
+ integration_qaws_table *table;
156
+
157
+ TypedData_Get_Struct(self, integration_qaws_table,
158
+ &integration_qaws_table_type, table);
159
+
160
+ return INT2NUM(table->mu);
161
+ }
162
+
163
+ static VALUE integration_qaws_table_nu(VALUE self) {
164
+ integration_qaws_table *table;
165
+
166
+ TypedData_Get_Struct(self, integration_qaws_table,
167
+ &integration_qaws_table_type, table);
168
+
169
+ return INT2NUM(table->nu);
170
+ }
171
+
172
+ static VALUE integration_qaws_table_closed_p(VALUE self) {
173
+ integration_qaws_table *table;
174
+
175
+ TypedData_Get_Struct(self, integration_qaws_table,
176
+ &integration_qaws_table_type, table);
177
+
178
+ return table->table == NULL ? Qtrue : Qfalse;
179
+ }
180
+
181
+ static VALUE integration_qaws_table_close(VALUE self) {
182
+ integration_qaws_table *table;
183
+
184
+ TypedData_Get_Struct(self, integration_qaws_table,
185
+ &integration_qaws_table_type, table);
186
+
187
+ if (table->busy) {
188
+ rb_raise(rb_eRuntimeError, "table is already in use");
189
+ }
190
+ if (table->table != NULL) {
191
+ gsl_integration_qaws_table_free(table->table);
192
+ table->table = NULL;
193
+ }
194
+
195
+ return Qnil;
196
+ }
197
+
198
+ static VALUE integration_qaws_table_yield(VALUE table) {
199
+ return rb_yield(table);
200
+ }
201
+
202
+ static VALUE integration_qaws_table_open(int argc, VALUE *argv, VALUE klass) {
203
+ VALUE table;
204
+
205
+ table = rb_funcallv_kw(klass, rb_intern("new"), argc, argv, RB_PASS_KEYWORDS);
206
+
207
+ return rb_ensure(integration_qaws_table_yield, table,
208
+ integration_qaws_table_close, table);
209
+ }
210
+
211
+ void integration_qaws_table_use_begin(VALUE table_value, double alpha,
212
+ double beta, int mu, int nu,
213
+ integration_qaws_table_use *use) {
214
+ integration_qaws_table *table;
215
+
216
+ use->table = NULL;
217
+ use->owner = NULL;
218
+
219
+ if (table_value == Qundef) {
220
+ use->table = gsl_integration_qaws_table_alloc(alpha, beta, mu, nu);
221
+ if (use->table == NULL) {
222
+ rb_memerror();
223
+ }
224
+ return;
225
+ }
226
+
227
+ if (!rb_obj_is_kind_of(table_value, integration_cQAWSTable)) {
228
+ rb_raise(rb_eTypeError,
229
+ "table must be a Numo::GSL::Integration::QAWSTable");
230
+ }
231
+
232
+ TypedData_Get_Struct(table_value, integration_qaws_table,
233
+ &integration_qaws_table_type, table);
234
+
235
+ if (table->table == NULL) {
236
+ rb_raise(rb_eRuntimeError, "table is closed");
237
+ }
238
+ if (table->busy) {
239
+ rb_raise(rb_eRuntimeError, "table is already in use");
240
+ }
241
+ if (!integration_qaws_table_double_equal(table->alpha, alpha)) {
242
+ rb_raise(rb_eArgError, "alpha does not match QAWS table");
243
+ }
244
+ if (!integration_qaws_table_double_equal(table->beta, beta)) {
245
+ rb_raise(rb_eArgError, "beta does not match QAWS table");
246
+ }
247
+ if (table->mu != mu) {
248
+ rb_raise(rb_eArgError, "mu does not match QAWS table");
249
+ }
250
+ if (table->nu != nu) {
251
+ rb_raise(rb_eArgError, "nu does not match QAWS table");
252
+ }
253
+
254
+ table->busy = 1;
255
+ use->table = table->table;
256
+ use->owner = table;
257
+ }
258
+
259
+ VALUE integration_qaws_table_use_end(VALUE data) {
260
+ integration_qaws_table_use *use = (integration_qaws_table_use *)data;
261
+
262
+ if (use->owner != NULL) {
263
+ use->owner->busy = 0;
264
+ } else if (use->table != NULL) {
265
+ gsl_integration_qaws_table_free(use->table);
266
+ }
267
+
268
+ use->table = NULL;
269
+ use->owner = NULL;
270
+
271
+ return Qnil;
272
+ }
273
+
274
+ void integration_qaws_table_init(VALUE integration_module) {
275
+ integration_cQAWSTable =
276
+ rb_define_class_under(integration_module, "QAWSTable", rb_cObject);
277
+ rb_define_alloc_func(integration_cQAWSTable, integration_qaws_table_allocate);
278
+ rb_define_method(integration_cQAWSTable, "initialize",
279
+ integration_qaws_table_initialize, -1);
280
+ rb_define_method(integration_cQAWSTable, "alpha",
281
+ integration_qaws_table_alpha, 0);
282
+ rb_define_method(integration_cQAWSTable, "beta", integration_qaws_table_beta,
283
+ 0);
284
+ rb_define_method(integration_cQAWSTable, "mu", integration_qaws_table_mu, 0);
285
+ rb_define_method(integration_cQAWSTable, "nu", integration_qaws_table_nu, 0);
286
+ rb_define_method(integration_cQAWSTable, "closed?",
287
+ integration_qaws_table_closed_p, 0);
288
+ rb_define_method(integration_cQAWSTable, "close",
289
+ integration_qaws_table_close, 0);
290
+ rb_define_singleton_method(integration_cQAWSTable, "open",
291
+ integration_qaws_table_open, -1);
292
+ }
@@ -0,0 +1,194 @@
1
+ #include "integration_internal.h"
2
+
3
+ static VALUE integration_cWorkspace;
4
+
5
+ static void integration_workspace_free(void *data) {
6
+ integration_workspace *workspace = data;
7
+
8
+ if (workspace->workspace != NULL) {
9
+ gsl_integration_workspace_free(workspace->workspace);
10
+ }
11
+
12
+ xfree(workspace);
13
+ }
14
+
15
+ static size_t integration_workspace_memsize(const void *data) {
16
+ return data == NULL ? 0 : sizeof(integration_workspace);
17
+ }
18
+
19
+ static const rb_data_type_t integration_workspace_type = {
20
+ .wrap_struct_name = "Numo::GSL::Integration::Workspace",
21
+ .function =
22
+ {
23
+ .dmark = NULL,
24
+ .dfree = integration_workspace_free,
25
+ .dsize = integration_workspace_memsize,
26
+ },
27
+ .flags = RUBY_TYPED_FREE_IMMEDIATELY,
28
+ };
29
+
30
+ static VALUE integration_workspace_allocate(VALUE klass) {
31
+ integration_workspace *workspace;
32
+ VALUE object = TypedData_Make_Struct(klass, integration_workspace,
33
+ &integration_workspace_type, workspace);
34
+
35
+ workspace->workspace = NULL;
36
+ workspace->limit = 0;
37
+ workspace->busy = 0;
38
+
39
+ return object;
40
+ }
41
+
42
+ static VALUE integration_workspace_initialize(int argc, VALUE *argv,
43
+ VALUE self) {
44
+ VALUE options;
45
+ VALUE limit_value;
46
+ ID keywords[] = {rb_intern("limit")};
47
+ VALUE keyword_values[1];
48
+ integration_workspace *workspace;
49
+
50
+ rb_scan_args(argc, argv, "0:", &options);
51
+ if (NIL_P(options)) {
52
+ rb_raise(rb_eArgError, "missing keyword: :limit");
53
+ }
54
+ rb_get_kwargs(options, keywords, 1, 0, keyword_values);
55
+ limit_value = keyword_values[0];
56
+
57
+ if (!RB_INTEGER_TYPE_P(limit_value)) {
58
+ rb_raise(rb_eTypeError, "limit must be an Integer");
59
+ }
60
+ if (RTEST(rb_funcall(limit_value, rb_intern("<="), 1, INT2FIX(0)))) {
61
+ rb_raise(rb_eArgError, "limit must be positive");
62
+ }
63
+
64
+ TypedData_Get_Struct(self, integration_workspace, &integration_workspace_type,
65
+ workspace);
66
+ workspace->limit = NUM2SIZET(limit_value);
67
+ workspace->workspace = gsl_integration_workspace_alloc(workspace->limit);
68
+ if (workspace->workspace == NULL) {
69
+ rb_memerror();
70
+ }
71
+
72
+ return self;
73
+ }
74
+
75
+ static VALUE integration_workspace_limit(VALUE self) {
76
+ integration_workspace *workspace;
77
+
78
+ TypedData_Get_Struct(self, integration_workspace, &integration_workspace_type,
79
+ workspace);
80
+
81
+ return SIZET2NUM(workspace->limit);
82
+ }
83
+
84
+ static VALUE integration_workspace_closed_p(VALUE self) {
85
+ integration_workspace *workspace;
86
+
87
+ TypedData_Get_Struct(self, integration_workspace, &integration_workspace_type,
88
+ workspace);
89
+
90
+ return workspace->workspace == NULL ? Qtrue : Qfalse;
91
+ }
92
+
93
+ static VALUE integration_workspace_close(VALUE self) {
94
+ integration_workspace *workspace;
95
+
96
+ TypedData_Get_Struct(self, integration_workspace, &integration_workspace_type,
97
+ workspace);
98
+
99
+ if (workspace->busy) {
100
+ rb_raise(rb_eRuntimeError, "workspace is already in use");
101
+ }
102
+ if (workspace->workspace != NULL) {
103
+ gsl_integration_workspace_free(workspace->workspace);
104
+ workspace->workspace = NULL;
105
+ }
106
+
107
+ return Qnil;
108
+ }
109
+
110
+ static VALUE integration_workspace_yield(VALUE workspace) {
111
+ return rb_yield(workspace);
112
+ }
113
+
114
+ static VALUE integration_workspace_open(int argc, VALUE *argv, VALUE klass) {
115
+ VALUE workspace;
116
+
117
+ workspace =
118
+ rb_funcallv_kw(klass, rb_intern("new"), argc, argv, RB_PASS_KEYWORDS);
119
+
120
+ return rb_ensure(integration_workspace_yield, workspace,
121
+ integration_workspace_close, workspace);
122
+ }
123
+
124
+ void integration_workspace_use_begin(VALUE workspace_value, size_t *limit,
125
+ int limit_given,
126
+ integration_workspace_use *use) {
127
+ integration_workspace *workspace;
128
+
129
+ use->workspace = NULL;
130
+ use->owner = NULL;
131
+
132
+ if (workspace_value == Qundef) {
133
+ use->workspace = gsl_integration_workspace_alloc(*limit);
134
+ if (use->workspace == NULL) {
135
+ rb_memerror();
136
+ }
137
+ return;
138
+ }
139
+
140
+ if (!rb_obj_is_kind_of(workspace_value, integration_cWorkspace)) {
141
+ rb_raise(rb_eTypeError,
142
+ "workspace must be a Numo::GSL::Integration::Workspace");
143
+ }
144
+
145
+ TypedData_Get_Struct(workspace_value, integration_workspace,
146
+ &integration_workspace_type, workspace);
147
+ if (workspace->workspace == NULL) {
148
+ rb_raise(rb_eRuntimeError, "workspace is closed");
149
+ }
150
+ if (workspace->busy) {
151
+ rb_raise(rb_eRuntimeError, "workspace is already in use");
152
+ }
153
+ if (limit_given && *limit > workspace->limit) {
154
+ rb_raise(rb_eArgError, "limit exceeds workspace capacity");
155
+ }
156
+ if (!limit_given) {
157
+ *limit = workspace->limit;
158
+ }
159
+
160
+ workspace->busy = 1;
161
+ use->workspace = workspace->workspace;
162
+ use->owner = workspace;
163
+ }
164
+
165
+ VALUE integration_workspace_use_end(VALUE data) {
166
+ integration_workspace_use *use = (integration_workspace_use *)data;
167
+
168
+ if (use->owner != NULL) {
169
+ use->owner->busy = 0;
170
+ } else if (use->workspace != NULL) {
171
+ gsl_integration_workspace_free(use->workspace);
172
+ }
173
+
174
+ use->workspace = NULL;
175
+ use->owner = NULL;
176
+
177
+ return Qnil;
178
+ }
179
+
180
+ void integration_workspace_init(VALUE integration_module) {
181
+ integration_cWorkspace =
182
+ rb_define_class_under(integration_module, "Workspace", rb_cObject);
183
+ rb_define_alloc_func(integration_cWorkspace, integration_workspace_allocate);
184
+ rb_define_method(integration_cWorkspace, "initialize",
185
+ integration_workspace_initialize, -1);
186
+ rb_define_method(integration_cWorkspace, "limit", integration_workspace_limit,
187
+ 0);
188
+ rb_define_method(integration_cWorkspace, "closed?",
189
+ integration_workspace_closed_p, 0);
190
+ rb_define_method(integration_cWorkspace, "close", integration_workspace_close,
191
+ 0);
192
+ rb_define_singleton_method(integration_cWorkspace, "open",
193
+ integration_workspace_open, -1);
194
+ }
@@ -3,7 +3,7 @@
3
3
  module Numo
4
4
  module GSL
5
5
  module Integration
6
- VERSION = "0.4.0"
6
+ VERSION = "0.5.0"
7
7
  end
8
8
  end
9
9
  end