carray 1.5.1 → 1.5.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (174) hide show
  1. checksums.yaml +4 -4
  2. data/{LICENSES → LICENSE} +0 -0
  3. data/NEWS.md +42 -0
  4. data/README.md +5 -5
  5. data/TODO.md +16 -0
  6. data/carray.gemspec +9 -5
  7. data/ext/ca_iter_block.c +3 -5
  8. data/ext/ca_iter_dimension.c +4 -5
  9. data/ext/ca_iter_window.c +2 -4
  10. data/ext/ca_obj_array.c +394 -124
  11. data/ext/ca_obj_bitarray.c +3 -5
  12. data/ext/ca_obj_bitfield.c +3 -5
  13. data/ext/ca_obj_block.c +6 -8
  14. data/ext/ca_obj_fake.c +3 -5
  15. data/ext/ca_obj_farray.c +3 -5
  16. data/ext/ca_obj_field.c +15 -17
  17. data/ext/ca_obj_grid.c +5 -6
  18. data/ext/ca_obj_mapping.c +2 -4
  19. data/ext/ca_obj_object.c +3 -5
  20. data/ext/ca_obj_reduce.c +2 -4
  21. data/ext/ca_obj_refer.c +5 -7
  22. data/ext/ca_obj_repeat.c +2 -4
  23. data/ext/ca_obj_select.c +2 -4
  24. data/ext/ca_obj_shift.c +3 -5
  25. data/ext/ca_obj_transpose.c +3 -5
  26. data/ext/ca_obj_unbound_repeat.c +58 -81
  27. data/ext/ca_obj_window.c +7 -9
  28. data/ext/carray.h +13 -8
  29. data/ext/carray_access.c +111 -18
  30. data/ext/carray_attribute.c +136 -197
  31. data/ext/carray_call_cfunc.c +1 -3
  32. data/ext/carray_cast.c +344 -143
  33. data/ext/carray_cast_func.rb +1 -2
  34. data/ext/carray_class.c +28 -36
  35. data/ext/carray_conversion.c +49 -59
  36. data/ext/carray_copy.c +16 -32
  37. data/ext/carray_core.c +51 -44
  38. data/ext/carray_element.c +25 -44
  39. data/ext/carray_generate.c +71 -50
  40. data/ext/carray_iterator.c +13 -15
  41. data/ext/carray_loop.c +53 -82
  42. data/ext/carray_mask.c +87 -117
  43. data/ext/carray_math.rb +8 -10
  44. data/ext/carray_mathfunc.c +1 -3
  45. data/ext/carray_numeric.c +19 -3
  46. data/ext/carray_operator.c +45 -32
  47. data/ext/carray_order.c +72 -65
  48. data/ext/carray_sort_addr.c +14 -21
  49. data/ext/carray_stat.c +1 -3
  50. data/ext/carray_stat_proc.rb +2 -4
  51. data/ext/carray_test.c +28 -30
  52. data/ext/carray_undef.c +1 -3
  53. data/ext/carray_utils.c +12 -4
  54. data/ext/extconf.rb +1 -1
  55. data/ext/mkmath.rb +1 -1
  56. data/ext/ruby_carray.c +11 -6
  57. data/ext/ruby_ccomplex.c +1 -3
  58. data/ext/ruby_float_func.c +1 -3
  59. data/ext/version.h +5 -7
  60. data/lib/carray.rb +2 -0
  61. data/lib/carray/autoload/autoload_gem_numo_narray.rb +6 -6
  62. data/lib/carray/broadcast.rb +45 -0
  63. data/lib/carray/construct.rb +21 -4
  64. data/lib/carray/iterator.rb +1 -0
  65. data/lib/carray/ordering.rb +28 -2
  66. data/spec/Classes/CABitfield_spec.rb +58 -0
  67. data/spec/Classes/CABlockIterator_spec.rb +114 -0
  68. data/spec/Classes/CABlock_spec.rb +205 -0
  69. data/spec/Classes/CAField_spec.rb +39 -0
  70. data/spec/Classes/CAGrid_spec.rb +75 -0
  71. data/spec/Classes/CAMap_spec.rb +0 -0
  72. data/{test/test_CAMapping.rb → spec/Classes/CAMapping_spec.rb} +35 -36
  73. data/spec/Classes/CAObject_attribute_spec.rb +33 -0
  74. data/spec/Classes/CAObject_spec.rb +33 -0
  75. data/spec/Classes/CARefer_spec.rb +93 -0
  76. data/spec/Classes/CARepeat_spec.rb +65 -0
  77. data/spec/Classes/CASelect_spec.rb +22 -0
  78. data/spec/Classes/CAShift_spec.rb +16 -0
  79. data/spec/Classes/CAStruct_spec.rb +71 -0
  80. data/{test/test_CATranspose.rb → spec/Classes/CATranspose_spec.rb} +20 -21
  81. data/spec/Classes/CAUnboudRepeat_spec.rb +78 -0
  82. data/spec/Classes/CAWindow_spec.rb +54 -0
  83. data/spec/Classes/CAWrap_spec.rb +8 -0
  84. data/{test/test_CArray.rb → spec/Classes/CArray_spec.rb} +48 -92
  85. data/spec/Classes/CScalar_spec.rb +55 -0
  86. data/spec/Features/feature_130_spec.rb +19 -0
  87. data/spec/Features/feature_attributes_spec.rb +280 -0
  88. data/spec/Features/feature_boolean_spec.rb +97 -0
  89. data/spec/Features/feature_broadcast.rb +100 -0
  90. data/spec/Features/feature_cast_function.rb +19 -0
  91. data/spec/Features/feature_cast_spec.rb +33 -0
  92. data/spec/Features/feature_class_spec.rb +84 -0
  93. data/spec/Features/feature_complex_spec.rb +42 -0
  94. data/{test/test_composite.rb → spec/Features/feature_composite_spec.rb} +17 -18
  95. data/spec/Features/feature_convert_spec.rb +46 -0
  96. data/spec/Features/feature_copy_spec.rb +123 -0
  97. data/spec/Features/feature_creation_spec.rb +84 -0
  98. data/spec/Features/feature_element_spec.rb +144 -0
  99. data/spec/Features/feature_extream_spec.rb +54 -0
  100. data/spec/Features/feature_generate_spec.rb +74 -0
  101. data/spec/Features/feature_index_spec.rb +69 -0
  102. data/spec/Features/feature_mask_spec.rb +574 -0
  103. data/spec/Features/feature_math_spec.rb +97 -0
  104. data/spec/Features/feature_order_spec.rb +146 -0
  105. data/spec/Features/feature_ref_store_spec.rb +209 -0
  106. data/spec/Features/feature_serialization_spec.rb +125 -0
  107. data/spec/Features/feature_stat_spec.rb +397 -0
  108. data/spec/Features/feature_virtual_spec.rb +48 -0
  109. data/spec/Features/method_eq_spec.rb +81 -0
  110. data/spec/Features/method_is_nan_spec.rb +12 -0
  111. data/spec/Features/method_map_spec.rb +54 -0
  112. data/spec/Features/method_max_with.rb +20 -0
  113. data/spec/Features/method_min_with.rb +19 -0
  114. data/spec/Features/method_ne_spec.rb +18 -0
  115. data/spec/Features/method_project_spec.rb +188 -0
  116. data/spec/Features/method_ref_spec.rb +27 -0
  117. data/spec/Features/method_round_spec.rb +11 -0
  118. data/spec/Features/method_s_linspace_spec.rb +48 -0
  119. data/spec/Features/method_s_span_spec.rb +14 -0
  120. data/spec/Features/method_seq_spec.rb +47 -0
  121. data/spec/Features/method_sort_with.rb +43 -0
  122. data/spec/Features/method_sorted_with.rb +29 -0
  123. data/spec/Features/method_span_spec.rb +42 -0
  124. data/spec/Features/method_wrap_readonly_spec.rb +43 -0
  125. data/{test → spec/UnitTest}/test_CAVirtual.rb +0 -0
  126. data/spec/spec_all.rb +0 -1
  127. data/utils/convert_test.rb +73 -0
  128. data/utils/{extract_rdoc.rb → extract_yard.rb} +7 -12
  129. metadata +77 -60
  130. data/spec/CABlockIterator/CABlockIterator_spec.rb +0 -113
  131. data/spec/CArray/bug/store_spec.rb +0 -27
  132. data/spec/CArray/index/repeat_spec.rb +0 -10
  133. data/spec/CArray/method/eq_spec.rb +0 -80
  134. data/spec/CArray/method/is_nan_spec.rb +0 -12
  135. data/spec/CArray/method/ne_spec.rb +0 -18
  136. data/spec/CArray/method/round_spec.rb +0 -11
  137. data/spec/CArray/object/_attribute_spec.rb +0 -32
  138. data/spec/CArray/object/s_new_spec.rb +0 -31
  139. data/spec/CArray/serialize/Serialization_spec.rb +0 -89
  140. data/test/test_130.rb +0 -23
  141. data/test/test_ALL.rb +0 -49
  142. data/test/test_CABitfield.rb +0 -59
  143. data/test/test_CABlock.rb +0 -208
  144. data/test/test_CAField.rb +0 -40
  145. data/test/test_CAGrid.rb +0 -76
  146. data/test/test_CAMmap.rb +0 -11
  147. data/test/test_CARefer.rb +0 -94
  148. data/test/test_CARepeat.rb +0 -66
  149. data/test/test_CASelect.rb +0 -23
  150. data/test/test_CAShift.rb +0 -17
  151. data/test/test_CAWindow.rb +0 -55
  152. data/test/test_CAWrap.rb +0 -9
  153. data/test/test_CComplex.rb +0 -83
  154. data/test/test_CScalar.rb +0 -91
  155. data/test/test_attribute.rb +0 -281
  156. data/test/test_block_iterator.rb +0 -17
  157. data/test/test_boolean.rb +0 -99
  158. data/test/test_cast.rb +0 -33
  159. data/test/test_class.rb +0 -85
  160. data/test/test_complex.rb +0 -43
  161. data/test/test_convert.rb +0 -79
  162. data/test/test_copy.rb +0 -141
  163. data/test/test_creation.rb +0 -85
  164. data/test/test_element.rb +0 -146
  165. data/test/test_extream.rb +0 -55
  166. data/test/test_generate.rb +0 -75
  167. data/test/test_index.rb +0 -71
  168. data/test/test_mask.rb +0 -578
  169. data/test/test_math.rb +0 -98
  170. data/test/test_order.rb +0 -147
  171. data/test/test_ref_store.rb +0 -211
  172. data/test/test_stat.rb +0 -406
  173. data/test/test_struct.rb +0 -72
  174. data/test/test_virtual.rb +0 -49
@@ -3,10 +3,8 @@
3
3
  ca_obj_repeat.c
4
4
 
5
5
  This file is part of Ruby/CArray extension library.
6
- You can redistribute it and/or modify it under the terms of
7
- the Ruby Licence.
8
6
 
9
- Copyright (C) 2005 Hiroki Motoyoshi
7
+ Copyright (C) 2005-2020 Hiroki Motoyoshi
10
8
 
11
9
  ---------------------------------------------------------------------------- */
12
10
 
@@ -14,7 +12,7 @@
14
12
 
15
13
  VALUE rb_cCARepeat;
16
14
 
17
- /* rdoc:
15
+ /* yard:
18
16
  class CARepeat < CAVirtual # :nodoc:
19
17
  end
20
18
  */
@@ -3,10 +3,8 @@
3
3
  ca_obj_select.c
4
4
 
5
5
  This file is part of Ruby/CArray extension library.
6
- You can redistribute it and/or modify it under the terms of
7
- the Ruby Licence.
8
6
 
9
- Copyright (C) 2005 Hiroki Motoyoshi
7
+ Copyright (C) 2005-2020 Hiroki Motoyoshi
10
8
 
11
9
  ---------------------------------------------------------------------------- */
12
10
 
@@ -14,7 +12,7 @@
14
12
 
15
13
  VALUE rb_cCASelect;
16
14
 
17
- /* rdoc:
15
+ /* yard:
18
16
  class CASelect < CAVirtual # :nodoc:
19
17
  end
20
18
  */
@@ -3,16 +3,14 @@
3
3
  ca_obj_shift.c
4
4
 
5
5
  This file is part of Ruby/CArray extension library.
6
- You can redistribute it and/or modify it under the terms of
7
- the Ruby Licence.
8
6
 
9
- Copyright (C) 2005 Hiroki Motoyoshi
7
+ Copyright (C) 2005-2020 Hiroki Motoyoshi
10
8
 
11
9
  ---------------------------------------------------------------------------- */
12
10
 
13
11
  #include "carray.h"
14
12
 
15
- /* rdoc:
13
+ /* yard:
16
14
  class CAShift < CAVirtual # :nodoc:
17
15
  end
18
16
  */
@@ -828,7 +826,7 @@ rb_ca_shift_new (VALUE cary, ca_size_t *shift, char *fill, int8_t *roll)
828
826
  return obj;
829
827
  }
830
828
 
831
- /* rdoc:
829
+ /* yard:
832
830
  class CArray
833
831
  def shifted
834
832
  end
@@ -3,10 +3,8 @@
3
3
  ca_obj_transpose.c
4
4
 
5
5
  This file is part of Ruby/CArray extension library.
6
- You can redistribute it and/or modify it under the terms of
7
- the Ruby Licence.
8
6
 
9
- Copyright (C) 2005 Hiroki Motoyoshi
7
+ Copyright (C) 2005-2020 Hiroki Motoyoshi
10
8
 
11
9
  ---------------------------------------------------------------------------- */
12
10
 
@@ -34,7 +32,7 @@ static int8_t CA_OBJ_TRANSPOSE;
34
32
 
35
33
  static VALUE rb_cCATrans;
36
34
 
37
- /* rdoc:
35
+ /* yard:
38
36
  class CATranspose < CAVirtual # :nodoc:
39
37
  end
40
38
  */
@@ -511,7 +509,7 @@ rb_ca_trans_new (VALUE cary, ca_size_t *imap)
511
509
  return obj;
512
510
  }
513
511
 
514
- /* rdoc:
512
+ /* yard:
515
513
  class CArray
516
514
  def transposed
517
515
  end
@@ -3,10 +3,8 @@
3
3
  ca_obj_unbound_repeat.c
4
4
 
5
5
  This file is part of Ruby/CArray extension library.
6
- You can redistribute it and/or modify it under the terms of
7
- the Ruby Licence.
8
6
 
9
- Copyright (C) 2005 Hiroki Motoyoshi
7
+ Copyright (C) 2005-2020 Hiroki Motoyoshi
10
8
 
11
9
  ---------------------------------------------------------------------------- */
12
10
 
@@ -14,7 +12,7 @@
14
12
 
15
13
  VALUE rb_cCAUnboundRepeat;
16
14
 
17
- /* rdoc:
15
+ /* yard:
18
16
  class CAUnboundRepeat < CArray
19
17
  end
20
18
  */
@@ -23,8 +21,9 @@ int
23
21
  ca_ubrep_setup (CAUnboundRepeat *ca, CArray *parent,
24
22
  int32_t rep_ndim, ca_size_t *rep_dim)
25
23
  {
26
- int8_t data_type, ndim;
24
+ int8_t data_type;
27
25
  ca_size_t bytes, elements;
26
+ int8_t i;
28
27
 
29
28
  /* check arguments */
30
29
 
@@ -32,18 +31,17 @@ ca_ubrep_setup (CAUnboundRepeat *ca, CArray *parent,
32
31
 
33
32
  data_type = parent->data_type;
34
33
  bytes = parent->bytes;
35
- ndim = parent->ndim;
36
34
  elements = parent->elements;
37
35
 
38
36
  ca->obj_type = CA_OBJ_UNBOUND_REPEAT;
39
37
  ca->data_type = data_type;
40
38
  ca->flags = 0;
41
- ca->ndim = ndim;
39
+ ca->ndim = rep_ndim;
42
40
  ca->bytes = bytes;
43
41
  ca->elements = elements;
44
42
  ca->ptr = NULL;
45
43
  ca->mask = NULL;
46
- ca->dim = ALLOC_N(ca_size_t, ndim);
44
+ ca->dim = ALLOC_N(ca_size_t, rep_ndim);
47
45
 
48
46
  ca->parent = parent;
49
47
  ca->attach = 0;
@@ -52,9 +50,17 @@ ca_ubrep_setup (CAUnboundRepeat *ca, CArray *parent,
52
50
  ca->rep_ndim = rep_ndim;
53
51
  ca->rep_dim = ALLOC_N(ca_size_t, rep_ndim);
54
52
 
55
- memcpy(ca->dim, parent->dim, ndim * sizeof(ca_size_t));
56
53
  memcpy(ca->rep_dim, rep_dim, rep_ndim * sizeof(ca_size_t));
57
54
 
55
+ for (i=0; i<ca->ndim; i++) {
56
+ if ( ca->rep_dim[i] ) {
57
+ ca->dim[i] = ca->rep_dim[i];
58
+ }
59
+ else {
60
+ ca->dim[i] = 1;
61
+ }
62
+ }
63
+
58
64
  if ( ca_has_mask(parent) ) {
59
65
  ca_create_mask(ca);
60
66
  }
@@ -238,6 +244,36 @@ ca_operation_function_t ca_ubrep_func = {
238
244
 
239
245
  /* ------------------------------------------------------------------- */
240
246
 
247
+ VALUE
248
+ rb_ca_ubrep_shave (VALUE self, VALUE other)
249
+ {
250
+ CAUnboundRepeat *ca;
251
+ CArray *co;
252
+ int8_t ndim, i;
253
+ ca_size_t dim[CA_RANK_MAX];
254
+
255
+ rb_check_carray_object(self);
256
+ rb_check_carray_object(other);
257
+
258
+ Data_Get_Struct(self, CAUnboundRepeat, ca);
259
+ Data_Get_Struct(other, CArray, co);
260
+
261
+ if ( ca->elements != co->elements ) {
262
+ rb_raise(rb_eRuntimeError, "mismatch in # of elements");
263
+ }
264
+
265
+ ndim = 0;
266
+ for (i=0; i<ca->ndim; i++) {
267
+ if ( ca->rep_dim[i] ) {
268
+ dim[ndim] = ca->rep_dim[i];
269
+ ndim += 1;
270
+ }
271
+ }
272
+
273
+ return rb_ca_refer_new(other, co->data_type, ndim, dim, co->bytes, 0);
274
+ }
275
+
276
+
241
277
  VALUE
242
278
  rb_ca_ubrep_new (VALUE cary, int32_t rep_ndim, ca_size_t *rep_dim)
243
279
  {
@@ -257,80 +293,24 @@ VALUE
257
293
  rb_ca_unbound_repeat (int argc, VALUE *argv, VALUE self)
258
294
  {
259
295
  CArray *ca;
260
- ca_size_t ndim, dim[CA_RANK_MAX];
296
+ int8_t ndim;
297
+ ca_size_t dim[CA_RANK_MAX];
261
298
  int32_t rep_ndim;
262
299
  ca_size_t rep_dim[CA_RANK_MAX];
263
- ca_size_t count, i;
300
+ ca_size_t elements, count, i;
264
301
 
265
302
  Data_Get_Struct(self, CArray, ca);
266
303
 
267
- if ( argc == 1 && argv[0] == ID2SYM(rb_intern("*")) ) {
268
- CAUnboundRepeat *cr = (CAUnboundRepeat *) ca;
269
- volatile VALUE args;
270
- int repeatable = 0;
271
- args = rb_ary_new();
272
- if ( rb_obj_is_kind_of(self, rb_cCAUnboundRepeat) ) {
273
- repeatable = 1;
274
- for (i=0; i<cr->rep_ndim; i++) {
275
- if ( cr->rep_dim[i] == 1 ) {
276
- rb_ary_push(args, ID2SYM(rb_intern("*")));
277
- repeatable = 1;
278
- }
279
- else if ( cr->rep_dim[i] > 1 ) {
280
- rb_ary_push(args, Qnil);
281
- }
282
- else {
283
- rb_ary_push(args, ID2SYM(rb_intern("*")));
284
- }
285
- }
286
- }
287
- else {
288
- for (i=0; i<ca->ndim; i++) {
289
- if ( ca->dim[i] == 1 ) {
290
- rb_ary_push(args, ID2SYM(rb_intern("*")));
291
- repeatable = 1;
292
- }
293
- else {
294
- rb_ary_push(args, Qnil);
295
- }
296
- }
297
- }
298
- if ( ! repeatable ) {
299
- return self;
300
- }
301
- else {
302
- return rb_ca_unbound_repeat((int)RARRAY_LEN(args), RARRAY_PTR(args), self);
303
- }
304
- }
305
- else if ( argc == 2 &&
306
- argv[0] == ID2SYM(rb_intern("*")) &&
307
- rb_obj_is_carray(argv[1]) ) {
308
- volatile VALUE args, obj;
309
- args = ID2SYM(rb_intern("*"));
310
- obj = rb_ca_unbound_repeat(1, (VALUE*)&args, self);
311
- return ca_ubrep_bind_with(obj, argv[1]);
312
- }
313
- else if ( argc == 2 &&
314
- argv[1] == ID2SYM(rb_intern("*")) &&
315
- rb_obj_is_carray(argv[0]) ) {
316
- volatile VALUE args, obj;
317
- args = ID2SYM(rb_intern("*"));
318
- obj = rb_ca_unbound_repeat(1, (VALUE*)&args, self);
319
- return ca_ubrep_bind_with(obj, argv[0]);
320
- }
321
-
322
304
  rep_ndim = argc;
323
305
 
324
306
  count = 0;
325
307
  ndim = 0;
326
308
 
309
+ elements = 1;
327
310
  for (i=0; i<rep_ndim; i++) {
328
311
  if ( rb_obj_is_kind_of(argv[i], rb_cSymbol) ) {
329
312
  if ( argv[i] == ID2SYM(rb_intern("*")) ) {
330
313
  rep_dim[i] = 0;
331
- if ( ca->dim[count] == 1 ) {
332
- count++;
333
- }
334
314
  }
335
315
  else {
336
316
  rb_raise(rb_eArgError, "unknown symbol (!= ':*') in arguments");
@@ -342,21 +322,17 @@ rb_ca_unbound_repeat (int argc, VALUE *argv, VALUE self)
342
322
  }
343
323
  rep_dim[i] = ca->dim[count];
344
324
  dim[ndim] = ca->dim[count];
325
+ elements *= ca->dim[count];
345
326
  count++; ndim++;
346
327
  }
347
328
  }
348
329
 
349
- if ( count != ca->ndim ) {
350
- rb_raise(rb_eRuntimeError, "too small # of nil");
330
+ if ( elements != ca->elements ) {
331
+ rb_raise(rb_eArgError, "mismatch in entity elements (%lli for %lli)", elements, ca->elements);
351
332
  }
352
333
 
353
334
  if ( ndim != ca->ndim ) {
354
- volatile VALUE par, obj;
355
- par = rb_ca_refer_new(self, ca->data_type, ndim, dim, ca->bytes, 0);
356
- obj = rb_ca_ubrep_new(par, rep_ndim, rep_dim);
357
- rb_ivar_set(obj, rb_intern("__real_parent__"), par);
358
- rb_ca_set_parent(obj, self);
359
- return obj;
335
+ rb_raise(rb_eArgError, "invalid number of nil's (%i for %i)", ndim, ca->ndim);
360
336
  }
361
337
  else {
362
338
  return rb_ca_ubrep_new(self, rep_ndim, rep_dim);
@@ -450,11 +426,11 @@ ca_ubrep_bind2 (VALUE self, int32_t new_ndim, ca_size_t *new_dim)
450
426
  return rb_ca_ubrep_new(rep, new_ndim, upr_spec);
451
427
  }
452
428
  else {
453
- return rb_ca_repeat_new(self, new_ndim, rep_spec);
429
+ return rb_ca_repeat_new(rb_ca_parent(self), new_ndim, rep_spec);
454
430
  }
455
431
  }
456
432
 
457
- /* rdoc:
433
+ /* yard:
458
434
  class CAUnboundRepeat
459
435
  def bind_with(other)
460
436
  end
@@ -484,7 +460,7 @@ ca_ubrep_bind_with (VALUE self, VALUE other)
484
460
  }
485
461
  }
486
462
 
487
- /* rdoc:
463
+ /* yard:
488
464
  class CAUnboundRepeat
489
465
  def bind(*index)
490
466
  end
@@ -503,6 +479,7 @@ rb_ca_ubrep_bind (int argc, VALUE *argv, VALUE self)
503
479
  if ( ca->rep_ndim != argc ) {
504
480
  rb_raise(rb_eArgError, "invalid new_ndim");
505
481
  }
482
+
506
483
  for (i=0; i<argc; i++) {
507
484
  if ( ca->rep_dim[i] == 0 ) {
508
485
  rep_spec[i] = NUM2SIZE(argv[i]);
@@ -512,7 +489,7 @@ rb_ca_ubrep_bind (int argc, VALUE *argv, VALUE self)
512
489
  }
513
490
  }
514
491
 
515
- return rb_ca_repeat_new(self, argc, rep_spec);
492
+ return rb_ca_repeat_new(rb_ca_parent(self), argc, rep_spec);
516
493
  }
517
494
 
518
495
  static VALUE
@@ -3,10 +3,8 @@
3
3
  ca_obj_window.c
4
4
 
5
5
  This file is part of Ruby/CArray extension library.
6
- You can redistribute it and/or modify it under the terms of
7
- the Ruby Licence.
8
6
 
9
- Copyright (C) 2005 Hiroki Motoyoshi
7
+ Copyright (C) 2005-2020 Hiroki Motoyoshi
10
8
 
11
9
  ---------------------------------------------------------------------------- */
12
10
 
@@ -17,7 +15,7 @@
17
15
  VALUE rb_cCAWindow;
18
16
  int8_t CA_OBJ_WINDOW;
19
17
 
20
- /* rdoc:
18
+ /* yard:
21
19
  class CAWindow < CAVirtual # :nodoc:
22
20
  end
23
21
  */
@@ -703,7 +701,7 @@ rb_ca_window_new (VALUE cary,
703
701
  return obj;
704
702
  }
705
703
 
706
- /* rdoc:
704
+ /* yard:
707
705
  class CArray
708
706
  def window (*argv)
709
707
  end
@@ -837,7 +835,7 @@ rb_ca_window_initialize_copy (VALUE self, VALUE other)
837
835
  return self;
838
836
  }
839
837
 
840
- /* rdoc:
838
+ /* yard:
841
839
  class CAWindow
842
840
  def index2addr0 (idx)
843
841
  end
@@ -874,7 +872,7 @@ rb_ca_window_idx2addr0 (int argc, VALUE *argv, VALUE self)
874
872
  }
875
873
  }
876
874
 
877
- /* rdoc:
875
+ /* yard:
878
876
  class CAWindow
879
877
  def addr2addr0 (addr)
880
878
  end
@@ -928,7 +926,7 @@ rb_ca_window_move (int argc, VALUE *argv, VALUE self)
928
926
  return self;
929
927
  }
930
928
 
931
- /* rdoc:
929
+ /* yard:
932
930
  class CAWindow
933
931
  def fill_value
934
932
  end
@@ -976,7 +974,7 @@ rb_ca_window_get_bounds (VALUE self)
976
974
  return ary; \
977
975
  }
978
976
 
979
- /* rdoc:
977
+ /* yard:
980
978
  class CAWindow
981
979
  def size0
982
980
  end
@@ -3,10 +3,8 @@
3
3
  carray.h
4
4
 
5
5
  This file is part of Ruby/CArray extension library.
6
- You can redistribute it and/or modify it under the terms of
7
- the Ruby Licence.
8
6
 
9
- Copyright (C) 2005 Hiroki Motoyoshi
7
+ Copyright (C) 2005-2020 Hiroki Motoyoshi
10
8
 
11
9
  ---------------------------------------------------------------------------- */
12
10
 
@@ -760,6 +758,7 @@ typedef struct {
760
758
  CArray *select;
761
759
  VALUE block;
762
760
  VALUE symbol;
761
+ int8_t range_check;
763
762
  } CAIndexInfo;
764
763
 
765
764
  /* -------------------------------------------------------------------- */
@@ -785,10 +784,10 @@ VALUE rb_ca_call_binop (VALUE self, VALUE other, ca_binop_func_t func[]);
785
784
  VALUE rb_ca_call_binop_bang (VALUE self, VALUE other, ca_binop_func_t func[]);
786
785
  VALUE rb_ca_call_moncmp (VALUE self, ca_moncmp_func_t func[]);
787
786
  VALUE rb_ca_call_bincmp (VALUE self, VALUE other, ca_bincmp_func_t func[]);
788
- void ca_monop_not_implement(ca_size_t n, char *ptr1, char *ptr2);
789
- void ca_binop_not_implement(ca_size_t n, char *ptr1, char *ptr2, char *ptr3);
790
- void ca_moncmp_not_implement(ca_size_t n, char *ptr1, char *ptr2);
791
- void ca_bincmp_not_implement(ca_size_t n, char *ptr1, char *ptr2, char *ptr3);
787
+ void ca_monop_not_implement(ca_size_t n, char *ptr1, char *ptr2) __attribute__((noreturn));
788
+ void ca_binop_not_implement(ca_size_t n, char *ptr1, char *ptr2, char *ptr3) __attribute__((noreturn));
789
+ void ca_moncmp_not_implement(ca_size_t n, char *ptr1, char *ptr2) __attribute__((noreturn));
790
+ void ca_bincmp_not_implement(ca_size_t n, char *ptr1, char *ptr2, char *ptr3) __attribute__((noreturn));
792
791
  VALUE ca_math_call (VALUE mod, VALUE arg, ID id);
793
792
 
794
793
  /* -------------------------------------------------------------------- */
@@ -819,6 +818,9 @@ VALUE rb_carray_new (int8_t data_type,
819
818
  VALUE rb_carray_new_safe (int8_t data_type,
820
819
  int8_t ndim, ca_size_t *dim, ca_size_t bytes, CArray *mask);
821
820
 
821
+ VALUE rb_ca_wrap_new (int8_t data_type,
822
+ int8_t ndim, ca_size_t *dim, ca_size_t bytes, CArray *mask, char *ptr);
823
+
822
824
  CAWrap *ca_wrap_new (int8_t data_type,
823
825
  int8_t ndim, ca_size_t *dim, ca_size_t bytes,
824
826
  CArray *mask, char *ptr);
@@ -888,6 +890,9 @@ CARepeat *ca_repeat_new (CArray *carray, int8_t ndim, ca_size_t *count);
888
890
  VALUE rb_ca_repeat_new (VALUE cary, int8_t ndim, ca_size_t *count);
889
891
  VALUE rb_ca_repeat (int argc, VALUE *argv, VALUE self);
890
892
 
893
+ /* --- ca_obj_unbound_repeat.c --- */
894
+
895
+ VALUE rb_ca_ubrep_shave (VALUE self, VALUE other);
891
896
  VALUE rb_ca_ubrep_new (VALUE cary, int32_t rep_ndim, ca_size_t *rep_dim);
892
897
  VALUE ca_ubrep_bind_with (VALUE self, VALUE other);
893
898
 
@@ -1064,7 +1069,7 @@ void ca_parse_range_without_check (VALUE arg, ca_size_t size,
1064
1069
  ca_size_t *offset, ca_size_t *count, ca_size_t *step);
1065
1070
 
1066
1071
  int ca_equal (void *ap, void *bp);
1067
- void ca_zerodiv(void);
1072
+ void ca_zerodiv(void) __attribute__((noreturn));
1068
1073
  int32_t ca_rand (double rmax);
1069
1074
  ca_size_t ca_bounds_normalize_index (int8_t bounds, ca_size_t size0, ca_size_t k);
1070
1075