gsl 1.14.5 → 1.14.6

Sign up to get free protection for your applications and to get access to all the features.
data/ChangeLog CHANGED
@@ -1,3 +1,9 @@
1
+ Thu Feb 24 10:27:08 PST 2011
2
+ * Ruby/GSL 1.14.6
3
+ * Add Vector::Complex support to NArray conversions
4
+ * Raise exception when trying to create View from NArray object of
5
+ incompatible type.
6
+
1
7
  Sun Nov 14 17:01:07 PST 2010
2
8
  * Ruby/GSL 1.14.5
3
9
  * Convert docs from rdtool to rdoc
data/Rakefile CHANGED
@@ -8,8 +8,8 @@ spec = Gem::Specification.new do |s|
8
8
  # Basics
9
9
  s.name = 'gsl'
10
10
  s.version = RB_GSL_VERSION
11
- s.summary = 'Ruby interface to GSL'
12
- s.description = 'RubyGSL is a Ruby interface to the GNU Scientific Library, for numerical computing with Ruby'
11
+ s.summary = 'Ruby interface to GNU Scientific Library'
12
+ s.description = 'Ruby/GSL is a Ruby interface to the GNU Scientific Library, for numerical computing with Ruby'
13
13
  #s.platform = Gem::Platform::Ruby
14
14
  s.required_ruby_version = '>= 1.8.1'
15
15
  s.requirements << 'GSL (http://www.gnu.org/software/gsl/)'
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.14.5
1
+ 1.14.6
data/ext/gsl_narray.c CHANGED
@@ -18,6 +18,7 @@ static VALUE rb_gsl_vector_int_to_na(VALUE obj);
18
18
  static VALUE rb_gsl_na_to_gsl_vector_int(VALUE obj, VALUE na);
19
19
 
20
20
  /* GSL::Vector -> NArray */
21
+
21
22
  static VALUE rb_gsl_vector_to_narray(VALUE obj, VALUE klass)
22
23
  {
23
24
  gsl_vector *v = NULL;
@@ -39,9 +40,45 @@ static VALUE rb_gsl_vector_to_narray(VALUE obj, VALUE klass)
39
40
  return nary;
40
41
  }
41
42
 
43
+ static VALUE rb_gsl_vector_complex_to_narray(VALUE obj, VALUE klass)
44
+ {
45
+ gsl_vector_complex *v = NULL;
46
+ VALUE nary;
47
+ int shape[1];
48
+ Data_Get_Struct(obj, gsl_vector_complex, v);
49
+ shape[0] = v->size;
50
+ nary = na_make_object(NA_DCOMPLEX, 1, shape, klass);
51
+ if (v->stride == 1) {
52
+ memcpy(NA_PTR_TYPE(nary,double*), v->data, shape[0]*2*sizeof(double));
53
+ } else {
54
+ int i;
55
+ struct NARRAY *na;
56
+ GetNArray(nary, na);
57
+ for(i=0; i < 2*v->size; i++) {
58
+ (NA_PTR_TYPE(nary,gsl_complex*))[i] = gsl_vector_complex_get(v, i);
59
+ }
60
+ }
61
+ return nary;
62
+ }
63
+
42
64
  static VALUE rb_gsl_vector_to_na(VALUE obj)
43
65
  {
44
- return rb_gsl_vector_to_narray(obj, cNArray);
66
+ VALUE na = Qnil;
67
+
68
+ if(VECTOR_P(obj))
69
+ na = rb_gsl_vector_to_narray(obj, cNArray);
70
+ else if(VECTOR_COMPLEX_P(obj))
71
+ na = rb_gsl_vector_complex_to_narray(obj, cNArray);
72
+ else
73
+ rb_raise(rb_eRuntimeError, "unexpected type '%s'",
74
+ rb_obj_classname(obj));
75
+
76
+ return na;
77
+ }
78
+
79
+ static VALUE rb_gsl_vector_complex_to_na(VALUE obj)
80
+ {
81
+ return rb_gsl_vector_complex_to_narray(obj, cNArray);
45
82
  }
46
83
 
47
84
  static VALUE rb_gsl_vector_to_nvector(VALUE obj)
@@ -49,6 +86,13 @@ static VALUE rb_gsl_vector_to_nvector(VALUE obj)
49
86
  return rb_gsl_vector_to_narray(obj, cNVector);
50
87
  }
51
88
 
89
+ static VALUE rb_gsl_vector_complex_to_nvector(VALUE obj)
90
+ {
91
+ return rb_gsl_vector_complex_to_narray(obj, cNVector);
92
+ }
93
+
94
+ /* GSL::Vector -> NArray view */
95
+
52
96
  static struct NARRAY* rb_gsl_na_view_alloc(int rank, int total, int type)
53
97
  {
54
98
  struct NARRAY *na;
@@ -56,6 +100,8 @@ static struct NARRAY* rb_gsl_na_view_alloc(int rank, int total, int type)
56
100
  na->rank = rank;
57
101
  na->total = total;
58
102
  na->type = type;
103
+ // TODO Set na->ref to a one element NArray of type NAObject that contains
104
+ // the GSL::Vector being referenced.
59
105
  na->ref = Qtrue; /* to initialize */
60
106
  na->shape = (int *) malloc(sizeof(int)*rank);
61
107
  return na;
@@ -70,6 +116,7 @@ static void rb_gsl_na_view_free(struct NARRAY *na)
70
116
  static VALUE rb_gsl_vector_to_narray_ref(VALUE obj, VALUE klass)
71
117
  {
72
118
  gsl_vector *v = NULL;
119
+ gsl_vector_complex *vc = NULL;
73
120
  gsl_vector_int *vi = NULL;
74
121
  VALUE nary;
75
122
  struct NARRAY *na;
@@ -89,8 +136,17 @@ static VALUE rb_gsl_vector_to_narray_ref(VALUE obj, VALUE klass)
89
136
  na = rb_gsl_na_view_alloc(1, vi->size, NA_LINT);
90
137
  na->shape[0] = vi->size;
91
138
  na->ptr = (char *) vi->data;
139
+ } else if (VECTOR_COMPLEX_P(obj)) {
140
+ Data_Get_Struct(obj, gsl_vector_complex, vc);
141
+ if (vc->stride != 1) {
142
+ rb_raise(rb_eRuntimeError, "Cannot make a reference obj: stride!=1");
143
+ }
144
+ na = rb_gsl_na_view_alloc(1, vc->size, NA_DCOMPLEX);
145
+ na->shape[0] = vc->size;
146
+ na->ptr = (char *) vc->data;
92
147
  } else {
93
- rb_raise(rb_eRuntimeError, "???");
148
+ rb_raise(rb_eRuntimeError, "cannot convert %s to NArray reference object",
149
+ rb_obj_classname(obj));
94
150
  }
95
151
  nary = Data_Wrap_Struct(klass, 0, rb_gsl_na_view_free, na);
96
152
  return nary;
@@ -141,68 +197,129 @@ static VALUE rb_gsl_vector_int_to_nvector(VALUE obj)
141
197
  static VALUE rb_gsl_na_to_gsl_vector(VALUE obj, VALUE na)
142
198
  {
143
199
  return Data_Wrap_Struct(cgsl_vector, 0, gsl_vector_free,
144
- na_to_gv(na));
200
+ na_to_gv(na));
145
201
  }
146
202
 
147
203
  static VALUE rb_gsl_na_to_gsl_vector_view(VALUE obj, VALUE na)
148
204
  {
149
205
  return Data_Wrap_Struct(cgsl_vector_view, 0, gsl_vector_view_free,
150
- na_to_gv_view(na));
206
+ na_to_gv_view(na));
207
+ }
208
+
209
+ static VALUE rb_gsl_na_to_gsl_vector_complex(VALUE obj, VALUE na)
210
+ {
211
+ return Data_Wrap_Struct(cgsl_vector_complex, 0, gsl_vector_complex_free,
212
+ na_to_gv_complex(na));
213
+ }
214
+
215
+ static VALUE rb_gsl_na_to_gsl_vector_complex_view(VALUE obj, VALUE na)
216
+ {
217
+ return Data_Wrap_Struct(cgsl_vector_complex_view, 0, gsl_vector_complex_view_free,
218
+ na_to_gv_complex_view(na));
151
219
  }
152
220
 
153
221
  static VALUE rb_gsl_na_to_gsl_vector_int(VALUE obj, VALUE na)
154
222
  {
155
223
  return Data_Wrap_Struct(cgsl_vector_int, 0, gsl_vector_int_free,
156
- na_to_gv_int(na));
224
+ na_to_gv_int(na));
157
225
  }
158
226
 
159
227
  static VALUE rb_gsl_na_to_gsl_vector_int_view(VALUE obj, VALUE na)
160
228
  {
161
229
  return Data_Wrap_Struct(cgsl_vector_int_view, 0, rb_gsl_vector_int_view_free,
162
- na_to_gv_int_view(na));
230
+ na_to_gv_int_view(na));
163
231
  }
164
232
 
165
233
  static VALUE rb_gsl_na_to_gsl_vector_method(VALUE na)
166
234
  {
167
- return Data_Wrap_Struct(cgsl_vector, 0, gsl_vector_free,
168
- na_to_gv(na));
235
+ VALUE v;
236
+
237
+ if(NA_TYPE(na) == NA_SCOMPLEX || NA_TYPE(na) == NA_DCOMPLEX)
238
+ v = Data_Wrap_Struct(cgsl_vector_complex, 0, gsl_vector_complex_free,
239
+ na_to_gv_complex(na));
240
+ else
241
+ v = Data_Wrap_Struct(cgsl_vector, 0, gsl_vector_free,
242
+ na_to_gv(na));
243
+
244
+ return v;
169
245
  }
170
246
 
171
247
  static VALUE rb_gsl_na_to_gsl_vector_view_method(VALUE na)
172
248
  {
173
- return Data_Wrap_Struct(cgsl_vector_view, 0, gsl_vector_view_free,
174
- na_to_gv_view(na));
249
+ VALUE v;
250
+
251
+ if(NA_TYPE(na) == NA_SCOMPLEX || NA_TYPE(na) == NA_DCOMPLEX)
252
+ v = Data_Wrap_Struct(cgsl_vector_complex_view, 0, gsl_vector_complex_view_free,
253
+ na_to_gv_complex_view(na));
254
+ else
255
+ v = Data_Wrap_Struct(cgsl_vector_view, 0, gsl_vector_view_free,
256
+ na_to_gv_view(na));
257
+
258
+ return v;
175
259
  }
176
260
 
177
261
  static VALUE rb_gsl_na_to_gsl_vector_int_method(VALUE na)
178
262
  {
179
263
  return Data_Wrap_Struct(cgsl_vector_int, 0, gsl_vector_int_free,
180
- na_to_gv_int(na));
264
+ na_to_gv_int(na));
181
265
  }
182
266
 
183
267
  static VALUE rb_gsl_na_to_gsl_vector_int_view_method(VALUE na)
184
268
  {
185
269
  return Data_Wrap_Struct(cgsl_vector_int_view, 0, rb_gsl_vector_int_view_free,
186
- na_to_gv_int_view(na));
270
+ na_to_gv_int_view(na));
187
271
  }
188
272
 
189
273
  gsl_vector* na_to_gv(VALUE na)
190
274
  {
191
275
  gsl_vector *v = NULL;
192
- VALUE nary;
276
+ VALUE nary = na;
193
277
  v = gsl_vector_alloc(NA_TOTAL(na));
194
- nary = na_change_type(na, NA_DFLOAT);
195
- memcpy(v->data, NA_PTR_TYPE(nary,double*), v->size*sizeof(double));
278
+ if(NA_TYPE(na) != NA_DFLOAT) {
279
+ nary = na_change_type(na, NA_DFLOAT);
280
+ }
281
+ memcpy(v->data, NA_PTR_TYPE(na,double*), v->size*sizeof(double));
196
282
  return v;
197
283
  }
198
284
 
199
285
  gsl_vector_view* na_to_gv_view(VALUE na)
200
286
  {
201
287
  gsl_vector_view *v = NULL;
202
- VALUE ary2;
288
+
289
+ // Raise exception if na's type is not NA_DFLOAT.
290
+ if(NA_TYPE(na) != NA_DFLOAT)
291
+ rb_raise(rb_eTypeError, "GSL::Vector::View requires NArray be DFLOAT");
292
+
203
293
  v = gsl_vector_view_alloc();
204
- ary2 = na_change_type(na, NA_DFLOAT);
205
- v->vector.data = NA_PTR_TYPE(ary2,double*);
294
+ v->vector.data = NA_PTR_TYPE(na,double*);
295
+ v->vector.size = NA_TOTAL(na);
296
+ v->vector.stride = 1;
297
+ v->vector.owner = 0;
298
+ return v;
299
+ }
300
+
301
+ gsl_vector_complex* na_to_gv_complex(VALUE na)
302
+ {
303
+ gsl_vector_complex *v = NULL;
304
+ VALUE nary = na;
305
+ v = gsl_vector_complex_alloc(NA_TOTAL(na));
306
+ if(NA_TYPE(na) != NA_DCOMPLEX) {
307
+ nary = na_change_type(na, NA_DCOMPLEX);
308
+ }
309
+ memcpy(v->data, NA_PTR_TYPE(na,gsl_complex*), v->size*sizeof(gsl_complex));
310
+ return v;
311
+ }
312
+
313
+ gsl_vector_complex_view* na_to_gv_complex_view(VALUE na)
314
+ {
315
+ gsl_vector_complex_view *v = NULL;
316
+
317
+ // Raise exception if na's type is not NA_DCOMPLEX
318
+ if(NA_TYPE(na) != NA_DCOMPLEX)
319
+ rb_raise(rb_eTypeError, "GSL::Vector::Complex::View requires NArray be DCOMPLEX");
320
+
321
+ v = gsl_vector_complex_view_alloc();
322
+ v->vector.data = NA_PTR_TYPE(na,double*);
206
323
  v->vector.size = NA_TOTAL(na);
207
324
  v->vector.stride = 1;
208
325
  v->vector.owner = 0;
@@ -212,9 +329,11 @@ gsl_vector_view* na_to_gv_view(VALUE na)
212
329
  gsl_vector_int* na_to_gv_int(VALUE na)
213
330
  {
214
331
  gsl_vector_int *v = NULL;
215
- VALUE nary;
332
+ VALUE nary = na;
216
333
  v = gsl_vector_int_alloc(NA_TOTAL(na));
217
- nary = na_change_type(na, NA_LINT);
334
+ if(NA_TYPE(na) != NA_LINT) {
335
+ nary = na_change_type(na, NA_LINT);
336
+ }
218
337
  memcpy(v->data, NA_PTR_TYPE(nary,int*), v->size*sizeof(int));
219
338
  return v;
220
339
  }
@@ -222,10 +341,12 @@ gsl_vector_int* na_to_gv_int(VALUE na)
222
341
  gsl_vector_int_view* na_to_gv_int_view(VALUE na)
223
342
  {
224
343
  gsl_vector_int_view *v = NULL;
225
- VALUE ary2;
344
+
345
+ // Raise exception if na's type is not NA_LINT
346
+ if(NA_TYPE(na) != NA_LINT)
347
+ rb_raise(rb_eTypeError, "GSL::Vector::Int::View requires NArray be LINT");
226
348
  v = rb_gsl_vector_int_view_alloc(NA_TOTAL(na));
227
- ary2 = na_change_type(na, NA_LINT);
228
- v->vector.data = NA_PTR_TYPE(ary2,int*);
349
+ v->vector.data = NA_PTR_TYPE(na,int*);
229
350
  v->vector.size = NA_TOTAL(na);
230
351
  v->vector.stride = 1;
231
352
  v->vector.owner = 0;
@@ -244,7 +365,7 @@ static VALUE rb_gsl_matrix_to_narray(VALUE obj, VALUE klass)
244
365
  nary = na_make_object(NA_DFLOAT, 2, shape, klass);
245
366
  for (i = 0; i < shape[1]; i++) {
246
367
  memcpy(NA_PTR_TYPE(nary,double*)+(i*shape[0]), m->data+(i*m->tda),
247
- shape[0]*sizeof(double));
368
+ shape[0]*sizeof(double));
248
369
  }
249
370
  return nary;
250
371
  }
@@ -271,7 +392,7 @@ static VALUE rb_gsl_matrix_int_to_narray(VALUE obj, VALUE klass)
271
392
  nary = na_make_object(NA_LINT, 2, shape, klass);
272
393
  for (i = 0; i < shape[1]; i++) {
273
394
  memcpy(NA_PTR_TYPE(nary,int*)+(i*shape[0]), m->data+(i*m->tda),
274
- shape[0]*sizeof(int));
395
+ shape[0]*sizeof(int));
275
396
  }
276
397
  return nary;
277
398
  }
@@ -414,6 +535,10 @@ gsl_matrix_view* na_to_gm_view(VALUE nna)
414
535
  gsl_matrix_view *m = NULL;
415
536
  VALUE ary2;
416
537
  struct NARRAY *na = NULL;
538
+
539
+ // Raise exception if nna's type is not NA_DFLOAT
540
+ if(NA_TYPE(nna) != NA_DFLOAT)
541
+ rb_raise(rb_eTypeError, "GSL::Matrix::View requires NArray be DFLOAT");
417
542
  GetNArray(nna, na);
418
543
  m = gsl_matrix_view_alloc();
419
544
  ary2 = na_change_type(nna, NA_DFLOAT);
@@ -442,6 +567,10 @@ gsl_matrix_int_view* na_to_gm_int_view(VALUE nna)
442
567
  gsl_matrix_int_view *m = NULL;
443
568
  VALUE ary2;
444
569
  struct NARRAY *na = NULL;
570
+
571
+ // Raise exception if nna's type is not NA_LINT
572
+ if(NA_TYPE(nna) != NA_LINT)
573
+ rb_raise(rb_eTypeError, "GSL::Matrix::Int::View requires NArray be LINT");
445
574
  GetNArray(nna, na);
446
575
  m = rb_gsl_matrix_int_view_alloc(na->shape[1], na->shape[0]);
447
576
  ary2 = na_change_type(nna, NA_LINT);
@@ -489,14 +618,14 @@ static VALUE rb_gsl_narray_histogram(int argc, VALUE *argv, VALUE obj)
489
618
  break;
490
619
  default:
491
620
  if (VECTOR_P(argv[0])) {
492
- Data_Get_Struct(argv[0], gsl_vector, ranges);
493
- n = ranges->size - 1;
494
- h = gsl_histogram_alloc(n);
495
- gsl_histogram_set_ranges(h, ranges->data, ranges->size);
621
+ Data_Get_Struct(argv[0], gsl_vector, ranges);
622
+ n = ranges->size - 1;
623
+ h = gsl_histogram_alloc(n);
624
+ gsl_histogram_set_ranges(h, ranges->data, ranges->size);
496
625
  } else if (NA_IsNArray(argv[0])) {
497
- ptr_range = get_vector_ptr(argv[0], &stride, &n);
498
- h = gsl_histogram_alloc(n);
499
- gsl_histogram_set_ranges(h, ptr_range, n);
626
+ ptr_range = get_vector_ptr(argv[0], &stride, &n);
627
+ h = gsl_histogram_alloc(n);
628
+ gsl_histogram_set_ranges(h, ptr_range, n);
500
629
  }
501
630
  break;
502
631
  }
@@ -510,7 +639,7 @@ static VALUE rb_gsl_narray_histogram(int argc, VALUE *argv, VALUE obj)
510
639
  break;
511
640
  default:
512
641
  rb_raise(rb_eTypeError, "wrong argument type %s (Array expected)",
513
- rb_class2name(CLASS_OF(argv[1])));
642
+ rb_class2name(CLASS_OF(argv[1])));
514
643
  break;
515
644
  }
516
645
  h = gsl_histogram_alloc(n);
@@ -556,7 +685,7 @@ void Init_gsl_narray(VALUE module)
556
685
  rb_define_singleton_method(cgsl_vector, "to_gv_view", rb_gsl_na_to_gsl_vector_view, 1);
557
686
 
558
687
  rb_define_singleton_method(cgsl_vector, "na_to_gslv_view", rb_gsl_na_to_gsl_vector_view, 1);
559
- rb_define_singleton_method(cgsl_vector, "na_to_gv_view", rb_gsl_na_to_gsl_vector, 1);
688
+ rb_define_singleton_method(cgsl_vector, "na_to_gv_view", rb_gsl_na_to_gsl_vector_view, 1);
560
689
 
561
690
  rb_define_method(cNArray, "to_gv", rb_gsl_na_to_gsl_vector_method, 0);
562
691
  rb_define_alias(cNArray, "to_gslv", "to_gv");
@@ -564,6 +693,31 @@ void Init_gsl_narray(VALUE module)
564
693
  rb_define_alias(cNArray, "to_gslv_view", "to_gv_view");
565
694
  rb_define_alias(cNArray, "to_gv2", "to_gv_view");
566
695
  rb_define_alias(cNArray, "to_gv_ref", "to_gv_view");
696
+ /*****/
697
+ rb_define_method(cgsl_vector_complex, "to_na", rb_gsl_vector_complex_to_na, 0);
698
+ rb_define_alias(cgsl_vector_complex, "to_narray", "to_na");
699
+
700
+ rb_define_method(cgsl_vector_complex, "to_na2", rb_gsl_vector_to_na_ref, 0);
701
+ rb_define_alias(cgsl_vector_complex, "to_narray_ref", "to_na2");
702
+ rb_define_alias(cgsl_vector_complex, "to_na_ref", "to_na2");
703
+
704
+ rb_define_method(cgsl_vector_complex, "to_nv", rb_gsl_vector_complex_to_nvector, 0);
705
+ rb_define_alias(cgsl_vector_complex, "to_nvector", "to_nv");
706
+
707
+ rb_define_method(cgsl_vector_complex, "to_nv2", rb_gsl_vector_to_nvector_ref, 0);
708
+ rb_define_alias(cgsl_vector_complex, "to_nv_ref", "to_nv2");
709
+ rb_define_alias(cgsl_vector_complex, "to_nvector_ref", "to_nv2");
710
+
711
+ rb_define_singleton_method(cgsl_vector_complex, "to_gslv", rb_gsl_na_to_gsl_vector_complex, 1);
712
+ rb_define_singleton_method(cgsl_vector_complex, "to_gv", rb_gsl_na_to_gsl_vector_complex, 1);
713
+ rb_define_singleton_method(cgsl_vector_complex, "na_to_gslv", rb_gsl_na_to_gsl_vector_complex, 1);
714
+ rb_define_singleton_method(cgsl_vector_complex, "na_to_gv", rb_gsl_na_to_gsl_vector_complex, 1);
715
+
716
+ rb_define_singleton_method(cgsl_vector_complex, "to_gslv_view", rb_gsl_na_to_gsl_vector_complex_view, 1);
717
+ rb_define_singleton_method(cgsl_vector_complex, "to_gv_view", rb_gsl_na_to_gsl_vector_complex_view, 1);
718
+ rb_define_singleton_method(cgsl_vector_complex, "na_to_gslv_view", rb_gsl_na_to_gsl_vector_complex_view, 1);
719
+ rb_define_singleton_method(cgsl_vector_complex, "na_to_gv_view", rb_gsl_na_to_gsl_vector_complex_view, 1);
720
+
567
721
  /*****/
568
722
  rb_define_method(cgsl_vector_int, "to_na", rb_gsl_vector_int_to_na, 0);
569
723
  rb_define_alias(cgsl_vector_int, "to_narray", "to_na");
@@ -584,7 +738,7 @@ void Init_gsl_narray(VALUE module)
584
738
  rb_define_singleton_method(cgsl_vector_int, "to_gslv_view", rb_gsl_na_to_gsl_vector_int_view, 1);
585
739
  rb_define_singleton_method(cgsl_vector_int, "to_gv_view", rb_gsl_na_to_gsl_vector_int_view, 1);
586
740
 
587
- rb_define_singleton_method(cgsl_vector_int, "na_to_gslv_view", rb_gsl_na_to_gsl_vector_int, 1);
741
+ rb_define_singleton_method(cgsl_vector_int, "na_to_gslv_view", rb_gsl_na_to_gsl_vector_int_view, 1);
588
742
  rb_define_singleton_method(cgsl_vector_int, "na_to_gv_view", rb_gsl_na_to_gsl_vector_int_view, 1);
589
743
 
590
744
  rb_define_method(cNArray, "to_gv_int", rb_gsl_na_to_gsl_vector_int_method, 0);
@@ -620,6 +774,9 @@ void Init_gsl_narray(VALUE module)
620
774
  rb_define_method(cNArray, "to_gslm_view", rb_gsl_na_to_gsl_matrix_view_method, 0);
621
775
  rb_define_alias(cNArray, "to_gm_view", "to_gslm_view");
622
776
 
777
+ /*****/
778
+ // TODO Complex matrix
779
+
623
780
  /*****/
624
781
  rb_define_method(cgsl_matrix_int, "to_na", rb_gsl_matrix_int_to_na, 0);
625
782
  rb_define_alias(cgsl_matrix_int, "to_narray", "to_na");
@@ -19,4 +19,6 @@ gsl_matrix* na_to_gm(VALUE nna);
19
19
  gsl_matrix_int* na_to_gm_int(VALUE nna);
20
20
  extern VALUE cNVector, cNMatrix;
21
21
 
22
+ gsl_vector_complex* na_to_gv_complex(VALUE na);
23
+ gsl_vector_complex_view* na_to_gv_complex_view(VALUE na);
22
24
  #endif
data/rdoc/index.rdoc CHANGED
@@ -18,7 +18,7 @@
18
18
  # === {}[link:index.html"name="3.2] Using the setup.rb command
19
19
  # If you prefer, Ruby/GSL may still be installed using setup.rb.
20
20
  # 1. Get and install {GSL}[http://www.gnu.org/software/gsl/#downloading"target="_top]. Make sure the command "gsl-config" is in command search path.
21
- # 1. {Download}[http://rubyforge.org/frs/?group_id=285"target="_top] Ruby/GSL, ungzip and untar the archive <tt>rb-gsl-xxx.tar.gz</tt>.
21
+ # 1. {Download}[http://rubyforge.org/frs/?group_id=285"target="_top] Ruby/GSL, ungzip and untar the archive <tt>rb-gsl-xxx.tgz</tt>.
22
22
  # 1. <tt> % cd rb-gsl-xxx/</tt>
23
23
  # 1. <tt> % ruby setup.rb config</tt>
24
24
  # 1. <tt> % ruby setup.rb setup</tt>
data/rdoc/narray.rdoc CHANGED
@@ -10,16 +10,19 @@
10
10
  # ---
11
11
  # * GSL::Vector#to_na
12
12
  # * GSL::Vector#to_nvector
13
+ # * GSL::Vector::Complex#to_na
14
+ # * GSL::Vector::Complex#to_nvector
13
15
  # * GSL::Matrix#to_na
14
16
  # * GSL::Matrix#to_nmatrix
15
17
  #
16
18
  # Convert GSL objects to NArray. The data contained by the GSL objects
17
19
  # are copied to a newly allocated memory block of the NArray objects created.
18
20
  #
19
- #
20
21
  # ---
21
22
  # * GSL::Vector#to_na_ref
22
23
  # * GSL::Vector#to_nvector_ref
24
+ # * GSL::Vector::Complex#to_na_ref
25
+ # * GSL::Vector::Complex#to_nvector_ref
23
26
  # * GSL::Matrix#to_na_ref
24
27
  # * GSL::Matrix#to_nmatrix_ref
25
28
  #
@@ -44,8 +47,9 @@
44
47
  # * NArray#to_gv
45
48
  # * NArray#to_gm
46
49
  #
47
- # Convert NArray objects to <tt>GSL::Vector</tt> or <tt>GSL::Matrix</tt>.
48
- # The data contained by the NArray objects
50
+ # <tt>NArray#to_gv</tt> converts NArray objects to <tt>GSL::Vector</tt> or
51
+ # <tt>GSL::Vector::Complex</tt>. <tt>NArray#to_gm</tt> converts NArray
52
+ # objects to <tt>GSL::Matrix</tt>. The data contained by the NArray objects
49
53
  # are copied to a newly allocated memory block of the GSL objects created.
50
54
  #
51
55
  # ---
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gsl
3
3
  version: !ruby/object:Gem::Version
4
- hash: 37
4
+ hash: 35
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 14
9
- - 5
10
- version: 1.14.5
9
+ - 6
10
+ version: 1.14.6
11
11
  platform: ruby
12
12
  authors:
13
13
  - Yoshiki Tsunesada
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2010-11-14 00:00:00 -08:00
19
+ date: 2011-02-24 00:00:00 -08:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
@@ -35,7 +35,7 @@ dependencies:
35
35
  version: 0.5.9
36
36
  type: :runtime
37
37
  version_requirements: *id001
38
- description: RubyGSL is a Ruby interface to the GNU Scientific Library, for numerical computing with Ruby
38
+ description: Ruby/GSL is a Ruby interface to the GNU Scientific Library, for numerical computing with Ruby
39
39
  email: y-tsunesada@mm.em-net.ne.jp
40
40
  executables: []
41
41
 
@@ -800,6 +800,6 @@ rubyforge_project: rb-gsl
800
800
  rubygems_version: 1.3.7
801
801
  signing_key:
802
802
  specification_version: 3
803
- summary: Ruby interface to GSL
803
+ summary: Ruby interface to GNU Scientific Library
804
804
  test_files: []
805
805