carray 1.3.5 → 1.5.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (195) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSES +22 -0
  3. data/README.md +18 -21
  4. data/Rakefile +31 -0
  5. data/carray.gemspec +13 -26
  6. data/{ca_iter_block.c → ext/ca_iter_block.c} +13 -13
  7. data/{ca_iter_dimension.c → ext/ca_iter_dimension.c} +16 -16
  8. data/{ca_iter_window.c → ext/ca_iter_window.c} +10 -10
  9. data/{ca_obj_array.c → ext/ca_obj_array.c} +60 -55
  10. data/{ca_obj_bitarray.c → ext/ca_obj_bitarray.c} +12 -12
  11. data/{ca_obj_bitfield.c → ext/ca_obj_bitfield.c} +7 -7
  12. data/{ca_obj_block.c → ext/ca_obj_block.c} +42 -42
  13. data/{ca_obj_fake.c → ext/ca_obj_fake.c} +7 -7
  14. data/{ca_obj_farray.c → ext/ca_obj_farray.c} +18 -18
  15. data/{ca_obj_field.c → ext/ca_obj_field.c} +15 -15
  16. data/{ca_obj_grid.c → ext/ca_obj_grid.c} +27 -27
  17. data/{ca_obj_mapping.c → ext/ca_obj_mapping.c} +9 -9
  18. data/{ca_obj_object.c → ext/ca_obj_object.c} +37 -37
  19. data/{ca_obj_reduce.c → ext/ca_obj_reduce.c} +1 -1
  20. data/{ca_obj_refer.c → ext/ca_obj_refer.c} +33 -33
  21. data/{ca_obj_repeat.c → ext/ca_obj_repeat.c} +43 -43
  22. data/{ca_obj_select.c → ext/ca_obj_select.c} +2 -2
  23. data/{ca_obj_shift.c → ext/ca_obj_shift.c} +23 -23
  24. data/{ca_obj_transpose.c → ext/ca_obj_transpose.c} +23 -23
  25. data/{ca_obj_unbound_repeat.c → ext/ca_obj_unbound_repeat.c} +55 -55
  26. data/{ca_obj_window.c → ext/ca_obj_window.c} +26 -26
  27. data/{carray.h → ext/carray.h} +77 -51
  28. data/{carray_access.c → ext/carray_access.c} +133 -91
  29. data/{carray_attribute.c → ext/carray_attribute.c} +12 -12
  30. data/{carray_call_cfunc.c → ext/carray_call_cfunc.c} +0 -0
  31. data/{carray_cast.c → ext/carray_cast.c} +6 -6
  32. data/{carray_cast_func.rb → ext/carray_cast_func.rb} +0 -0
  33. data/{carray_class.c → ext/carray_class.c} +0 -0
  34. data/{carray_conversion.c → ext/carray_conversion.c} +11 -13
  35. data/{carray_copy.c → ext/carray_copy.c} +19 -19
  36. data/{carray_core.c → ext/carray_core.c} +2 -2
  37. data/ext/carray_data_type.c +66 -0
  38. data/{carray_element.c → ext/carray_element.c} +9 -9
  39. data/{carray_generate.c → ext/carray_generate.c} +67 -1
  40. data/{carray_iterator.c → ext/carray_iterator.c} +40 -38
  41. data/{carray_loop.c → ext/carray_loop.c} +24 -24
  42. data/{carray_mask.c → ext/carray_mask.c} +17 -6
  43. data/{carray_math.rb → ext/carray_math.rb} +25 -25
  44. data/ext/{mathfunc/carray_mathfunc.c → carray_mathfunc.c} +0 -0
  45. data/{carray_numeric.c → ext/carray_numeric.c} +1 -1
  46. data/{carray_operator.c → ext/carray_operator.c} +32 -9
  47. data/{carray_order.c → ext/carray_order.c} +2 -153
  48. data/{carray_sort_addr.c → ext/carray_sort_addr.c} +0 -0
  49. data/{carray_stat.c → ext/carray_stat.c} +5 -5
  50. data/{carray_stat_proc.rb → ext/carray_stat_proc.rb} +23 -23
  51. data/{carray_test.c → ext/carray_test.c} +22 -21
  52. data/{carray_undef.c → ext/carray_undef.c} +0 -0
  53. data/{carray_utils.c → ext/carray_utils.c} +0 -0
  54. data/{extconf.rb → ext/extconf.rb} +0 -5
  55. data/{mkmath.rb → ext/mkmath.rb} +12 -2
  56. data/{ruby_carray.c → ext/ruby_carray.c} +9 -2
  57. data/{ruby_ccomplex.c → ext/ruby_ccomplex.c} +0 -0
  58. data/{ruby_float_func.c → ext/ruby_float_func.c} +0 -0
  59. data/{version.h → ext/version.h} +5 -5
  60. data/{version.rb → ext/version.rb} +0 -0
  61. data/lib/carray.rb +49 -7
  62. data/lib/carray/{base/autoload.rb → autoload.rb} +48 -6
  63. data/lib/carray/autoload/autoload_base.rb +1 -5
  64. data/lib/carray/autoload/autoload_gem_cairo.rb +9 -0
  65. data/lib/carray/autoload/autoload_gem_ffi.rb +9 -0
  66. data/lib/carray/autoload/autoload_gem_gnuplot.rb +2 -0
  67. data/lib/carray/autoload/autoload_gem_io_csv.rb +14 -0
  68. data/lib/carray/autoload/autoload_gem_io_pg.rb +6 -0
  69. data/lib/carray/autoload/autoload_gem_io_sqlite3.rb +12 -0
  70. data/lib/carray/autoload/autoload_gem_narray.rb +10 -0
  71. data/lib/carray/autoload/autoload_gem_numo_narray.rb +15 -0
  72. data/lib/carray/autoload/autoload_gem_opencv.rb +16 -0
  73. data/lib/carray/autoload/autoload_gem_random.rb +8 -0
  74. data/lib/carray/autoload/autoload_gem_rmagick.rb +23 -0
  75. data/lib/carray/autoload/{autoload_graphics_zimg.rb → autoload_gem_zimg.rb} +0 -0
  76. data/lib/carray/basic.rb +193 -0
  77. data/lib/carray/compose.rb +291 -0
  78. data/lib/carray/construct.rb +445 -0
  79. data/lib/carray/convert.rb +115 -0
  80. data/lib/carray/{base/inspect.rb → inspect.rb} +6 -6
  81. data/lib/carray/io/imagemagick.rb +1 -1
  82. data/lib/carray/{base/iterator.rb → iterator.rb} +3 -3
  83. data/lib/carray/mask.rb +91 -0
  84. data/lib/carray/{base/math.rb → math.rb} +17 -47
  85. data/lib/carray/math/histogram.rb +7 -7
  86. data/lib/carray/mkmf.rb +8 -0
  87. data/lib/carray/object/ca_obj_pack.rb +8 -8
  88. data/lib/carray/obsolete.rb +272 -0
  89. data/lib/carray/ordering.rb +157 -0
  90. data/lib/carray/{base/serialize.rb → serialize.rb} +28 -53
  91. data/lib/carray/string.rb +190 -0
  92. data/lib/carray/{base/struct.rb → struct.rb} +20 -20
  93. data/lib/carray/{io/table.rb → table.rb} +1 -9
  94. data/lib/carray/testing.rb +56 -0
  95. data/lib/carray/time.rb +78 -0
  96. data/lib/carray/transform.rb +100 -0
  97. data/misc/Methods.ja.md +182 -0
  98. data/{NOTE → misc/NOTE} +0 -0
  99. data/test/test_ALL.rb +0 -2
  100. data/test/test_order.rb +7 -7
  101. data/test/test_ref_store.rb +13 -13
  102. data/test/test_stat.rb +7 -15
  103. data/{devel → utils}/guess_shape.rb +0 -0
  104. data/utils/{diff_method.rb → monkey_patch_methods.rb} +17 -7
  105. metadata +100 -254
  106. data/COPYING +0 -56
  107. data/GPL +0 -340
  108. data/Gemfile +0 -8
  109. data/Gemfile.lock +0 -33
  110. data/LEGAL +0 -50
  111. data/TODO +0 -5
  112. data/carray_random.c +0 -531
  113. data/ext/calculus/carray_calculus.c +0 -931
  114. data/ext/calculus/carray_interp.c +0 -358
  115. data/ext/calculus/extconf.rb +0 -12
  116. data/ext/calculus/lib/autoload/autoload_math_calculus.rb +0 -2
  117. data/ext/calculus/lib/math/calculus.rb +0 -119
  118. data/ext/calculus/lib/math/interp/adapter_interp1d.rb +0 -31
  119. data/ext/fortio/extconf.rb +0 -3
  120. data/ext/fortio/lib/carray/autoload/autoload_fortran_format.rb +0 -5
  121. data/ext/fortio/lib/carray/io/fortran_format.rb +0 -43
  122. data/ext/fortio/lib/fortio.rb +0 -3
  123. data/ext/fortio/lib/fortio/fortran_format.rb +0 -605
  124. data/ext/fortio/lib/fortio/fortran_format.tab.rb +0 -536
  125. data/ext/fortio/lib/fortio/fortran_format.y +0 -215
  126. data/ext/fortio/lib/fortio/fortran_namelist.rb +0 -151
  127. data/ext/fortio/lib/fortio/fortran_namelist.tab.rb +0 -470
  128. data/ext/fortio/lib/fortio/fortran_namelist.y +0 -213
  129. data/ext/fortio/lib/fortio/fortran_sequential.rb +0 -345
  130. data/ext/fortio/ruby_fortio.c +0 -182
  131. data/ext/fortio/test/test_H.rb +0 -5
  132. data/ext/fortio/test/test_T.rb +0 -7
  133. data/ext/fortio/test/test_fortran_format.rb +0 -86
  134. data/ext/fortio/test/test_namelist.rb +0 -25
  135. data/ext/fortio/test/test_namelist_write.rb +0 -10
  136. data/ext/fortio/test/test_sequential.rb +0 -13
  137. data/ext/fortio/test/test_sequential2.rb +0 -13
  138. data/ext/fortio/work/test.rb +0 -10
  139. data/ext/fortio/work/test_e.rb +0 -19
  140. data/ext/fortio/work/test_ep.rb +0 -10
  141. data/ext/fortio/work/test_parse.rb +0 -12
  142. data/ext/imagemap/carray_imagemap.c +0 -495
  143. data/ext/imagemap/doc/call_graph.dot +0 -28
  144. data/ext/imagemap/draw.c +0 -567
  145. data/ext/imagemap/extconf.rb +0 -13
  146. data/ext/imagemap/lib/autoload/autoload_graphics_imagemap.rb +0 -1
  147. data/ext/imagemap/lib/graphics/imagemap.rb +0 -273
  148. data/ext/imagemap/lib/image_map.rb +0 -4
  149. data/ext/imagemap/test/swath_index.rb +0 -83
  150. data/ext/imagemap/test/swath_warp.rb +0 -99
  151. data/ext/imagemap/test/test.rb +0 -23
  152. data/ext/imagemap/test/test_image.rb +0 -42
  153. data/ext/imagemap/test/test_line.rb +0 -14
  154. data/ext/imagemap/test/test_rotate.rb +0 -17
  155. data/ext/imagemap/test/test_triangle.rb +0 -20
  156. data/ext/imagemap/test/test_warp.rb +0 -26
  157. data/ext/mathfunc/extconf.rb +0 -18
  158. data/ext/mathfunc/lib/autoload/autoload_math_mathfunc.rb +0 -1
  159. data/ext/mathfunc/lib/math/mathfunc.rb +0 -15
  160. data/ext/mathfunc/test/test_hypot.rb +0 -5
  161. data/ext/mathfunc/test/test_j0.rb +0 -22
  162. data/ext/mathfunc/test/test_jn.rb +0 -8
  163. data/ext/mathfunc/test/test_sph.rb +0 -9
  164. data/ext/narray/README +0 -22
  165. data/ext/narray/ca_wrap_narray.c +0 -500
  166. data/ext/narray/carray_narray.c +0 -21
  167. data/ext/narray/extconf.rb +0 -57
  168. data/ext/narray/lib/autoload/autoload_math_narray.rb +0 -1
  169. data/ext/narray/lib/autoload/autoload_math_narray_miss.rb +0 -11
  170. data/ext/narray/lib/math/narray.rb +0 -17
  171. data/ext/narray/lib/math/narray_miss.rb +0 -45
  172. data/lib/carray/autoload/autoload_graphics_gnuplot.rb +0 -2
  173. data/lib/carray/autoload/autoload_io_csv.rb +0 -14
  174. data/lib/carray/autoload/autoload_io_pg.rb +0 -6
  175. data/lib/carray/autoload/autoload_io_sqlite3.rb +0 -12
  176. data/lib/carray/autoload/autoload_io_table.rb +0 -1
  177. data/lib/carray/autoload/autoload_math_interp.rb +0 -4
  178. data/lib/carray/base/basic.rb +0 -1090
  179. data/lib/carray/base/obsolete.rb +0 -131
  180. data/lib/carray/graphics/gnuplot.rb +0 -2131
  181. data/lib/carray/graphics/zimg.rb +0 -296
  182. data/lib/carray/io/csv.rb +0 -572
  183. data/lib/carray/io/pg.rb +0 -101
  184. data/lib/carray/io/sqlite3.rb +0 -215
  185. data/lib/carray/math/interp.rb +0 -57
  186. data/lib/carray/math/interp/adapter_gsl_spline.rb +0 -47
  187. data/mt19937ar.c +0 -182
  188. data/mt19937ar.h +0 -86
  189. data/rdoc_main.rb +0 -27
  190. data/rdoc_math.rb +0 -5
  191. data/rdoc_stat.rb +0 -31
  192. data/test/test_narray.rb +0 -64
  193. data/test/test_random.rb +0 -15
  194. data/utils/create_rdoc.sh +0 -9
  195. data/utils/make_tgz.sh +0 -3
@@ -20,7 +20,7 @@ VALUE rb_cCABlock;
20
20
  */
21
21
 
22
22
  static int
23
- ca_block_setup (CABlock *ca, CArray *parent, int8_t rank, ca_size_t *dim,
23
+ ca_block_setup (CABlock *ca, CArray *parent, int8_t ndim, ca_size_t *dim,
24
24
  ca_size_t *start, ca_size_t *step, ca_size_t *count, ca_size_t offset)
25
25
  {
26
26
  int8_t data_type;
@@ -33,7 +33,7 @@ ca_block_setup (CABlock *ca, CArray *parent, int8_t rank, ca_size_t *dim,
33
33
  bytes = parent->bytes;
34
34
 
35
35
  elements = 1;
36
- for (i=0; i<rank; i++) {
36
+ for (i=0; i<ndim; i++) {
37
37
  if ( count[i] < 0 ) {
38
38
  rb_raise(rb_eIndexError,
39
39
  "invalid size for %i-th dimension (negative)", i);
@@ -41,8 +41,8 @@ ca_block_setup (CABlock *ca, CArray *parent, int8_t rank, ca_size_t *dim,
41
41
  elements *= count[i];
42
42
  }
43
43
 
44
- maxdim_index = rank-1;
45
- for (i=rank-2; i>=0; i--) {
44
+ maxdim_index = ndim-1;
45
+ for (i=ndim-2; i>=0; i--) {
46
46
  if ( count[i] > count[maxdim_index] ) {
47
47
  maxdim_index = i;
48
48
  }
@@ -50,7 +50,7 @@ ca_block_setup (CABlock *ca, CArray *parent, int8_t rank, ca_size_t *dim,
50
50
 
51
51
  maxdim_step = 1;
52
52
  maxdim_step0 = step[maxdim_index];
53
- for (i=maxdim_index+1; i<rank; i++) {
53
+ for (i=maxdim_index+1; i<ndim; i++) {
54
54
  maxdim_step *= count[i];
55
55
  maxdim_step0 *= dim[i];
56
56
  }
@@ -58,7 +58,7 @@ ca_block_setup (CABlock *ca, CArray *parent, int8_t rank, ca_size_t *dim,
58
58
  ca->obj_type = CA_OBJ_BLOCK;
59
59
  ca->data_type = data_type;
60
60
  ca->flags = 0;
61
- ca->rank = rank;
61
+ ca->ndim = ndim;
62
62
  ca->bytes = bytes;
63
63
  ca->elements = elements;
64
64
  ca->ptr = NULL;
@@ -67,10 +67,10 @@ ca_block_setup (CABlock *ca, CArray *parent, int8_t rank, ca_size_t *dim,
67
67
  ca->attach = 0;
68
68
  ca->nosync = 0;
69
69
  ca->offset = offset;
70
- ca->start = ALLOC_N(ca_size_t, rank);
71
- ca->step = ALLOC_N(ca_size_t, rank);
72
- ca->count = ALLOC_N(ca_size_t, rank);
73
- ca->size0 = ALLOC_N(ca_size_t, rank);
70
+ ca->start = ALLOC_N(ca_size_t, ndim);
71
+ ca->step = ALLOC_N(ca_size_t, ndim);
72
+ ca->count = ALLOC_N(ca_size_t, ndim);
73
+ ca->size0 = ALLOC_N(ca_size_t, ndim);
74
74
 
75
75
  ca->maxdim_index = maxdim_index;
76
76
  ca->maxdim_step = maxdim_step;
@@ -80,10 +80,10 @@ ca_block_setup (CABlock *ca, CArray *parent, int8_t rank, ca_size_t *dim,
80
80
 
81
81
  ca->dim = ca->count; /* ca->dim should not be free */
82
82
 
83
- memcpy(ca->start, start, rank * sizeof(ca_size_t));
84
- memcpy(ca->step, step, rank * sizeof(ca_size_t));
85
- memcpy(ca->count, count, rank * sizeof(ca_size_t));
86
- memcpy(ca->size0, dim, rank * sizeof(ca_size_t));
83
+ memcpy(ca->start, start, ndim * sizeof(ca_size_t));
84
+ memcpy(ca->step, step, ndim * sizeof(ca_size_t));
85
+ memcpy(ca->count, count, ndim * sizeof(ca_size_t));
86
+ memcpy(ca->size0, dim, ndim * sizeof(ca_size_t));
87
87
 
88
88
  if ( ca_has_mask(parent) ) {
89
89
  ca_create_mask(ca);
@@ -93,11 +93,11 @@ ca_block_setup (CABlock *ca, CArray *parent, int8_t rank, ca_size_t *dim,
93
93
  }
94
94
 
95
95
  CABlock *
96
- ca_block_new (CArray *parent, int8_t rank, ca_size_t *dim,
96
+ ca_block_new (CArray *parent, int8_t ndim, ca_size_t *dim,
97
97
  ca_size_t *start, ca_size_t *step, ca_size_t *count, ca_size_t offset)
98
98
  {
99
99
  CABlock *ca = ALLOC(CABlock);
100
- ca_block_setup(ca, parent, rank, dim, start, step, count, offset);
100
+ ca_block_setup(ca, parent, ndim, dim, start, step, count, offset);
101
101
  return ca;
102
102
  }
103
103
 
@@ -126,7 +126,7 @@ ca_block_func_clone (void *ap)
126
126
  {
127
127
  CABlock *ca = (CABlock *) ap;
128
128
  return ca_block_new(ca->parent,
129
- ca->rank, ca->size0,
129
+ ca->ndim, ca->size0,
130
130
  ca->start, ca->step, ca->count, ca->offset);
131
131
  }
132
132
 
@@ -162,7 +162,7 @@ ca_block_func_ptr_at_index (void *ap, ca_size_t *idx)
162
162
  int8_t i;
163
163
  ca_size_t n;
164
164
  n = start[0] + idx[0]*step[0];
165
- for (i=1; i<ca->rank; i++) {
165
+ for (i=1; i<ca->ndim; i++) {
166
166
  n *= size0[i];
167
167
  n += start[i] + idx[i]*step[i];
168
168
  }
@@ -186,7 +186,7 @@ ca_block_func_fetch_index (void *ap, ca_size_t *idx, void *ptr)
186
186
  int8_t i;
187
187
  ca_size_t n;
188
188
  n = start[0] + idx[0]*step[0];
189
- for (i=1; i<ca->rank; i++) {
189
+ for (i=1; i<ca->ndim; i++) {
190
190
  n *= size0[i];
191
191
  n += start[i] + idx[i]*step[i];
192
192
  }
@@ -204,7 +204,7 @@ ca_block_func_store_index (void *ap, ca_size_t *idx, void *ptr)
204
204
  int8_t i;
205
205
  ca_size_t n;
206
206
  n = start[0] + idx[0]*step[0];
207
- for (i=1; i<ca->rank; i++) {
207
+ for (i=1; i<ca->ndim; i++) {
208
208
  n *= size0[i];
209
209
  n += start[i] + idx[i]*step[i];
210
210
  }
@@ -292,7 +292,7 @@ ca_block_func_create_mask (void *ap)
292
292
  ca_create_mask(ca->parent);
293
293
  ca->mask =
294
294
  (CArray *) ca_block_new(ca->parent->mask,
295
- ca->rank, ca->size0,
295
+ ca->ndim, ca->size0,
296
296
  ca->start, ca->step, ca->count, ca->offset);
297
297
  }
298
298
 
@@ -320,7 +320,7 @@ ca_operation_function_t ca_block_func = {
320
320
  /* ------------------------------------------------------------------- */
321
321
 
322
322
  VALUE
323
- rb_ca_block_new (VALUE cary, int8_t rank, ca_size_t *dim,
323
+ rb_ca_block_new (VALUE cary, int8_t ndim, ca_size_t *dim,
324
324
  ca_size_t *start, ca_size_t *step, ca_size_t *count, ca_size_t offset)
325
325
  {
326
326
  volatile VALUE obj;
@@ -330,7 +330,7 @@ rb_ca_block_new (VALUE cary, int8_t rank, ca_size_t *dim,
330
330
  rb_check_carray_object(cary);
331
331
  Data_Get_Struct(cary, CArray, parent);
332
332
 
333
- ca = ca_block_new(parent, rank, dim, start, step, count, offset);
333
+ ca = ca_block_new(parent, ndim, dim, start, step, count, offset);
334
334
  obj = ca_wrap_struct(ca);
335
335
  rb_ca_set_parent(obj, cary);
336
336
  rb_ca_data_type_inherit(obj, cary);
@@ -351,7 +351,7 @@ ca_block_attach_loop2 (CABlock *ca, int8_t level, ca_size_t saddr, ca_size_t sad
351
351
  ca_size_t count = ca->count[level];
352
352
  ca_size_t addr, addr0, i;
353
353
 
354
- if ( level == ca->rank - 1 ) {
354
+ if ( level == ca->ndim - 1 ) {
355
355
  if ( ca->parent->ptr ) {
356
356
  addr = saddr * ca->dim[level];
357
357
  addr0 = saddr0 * ca->size0[level] + ca->start[level];
@@ -386,7 +386,7 @@ ca_block_attach_loop (CABlock *ca, ca_size_t level, ca_size_t saddr, ca_size_t s
386
386
  ca_size_t count = ca->count[level];
387
387
  ca_size_t addr, addr0, i;
388
388
 
389
- if ( level == ca->rank - 1 ) {
389
+ if ( level == ca->ndim - 1 ) {
390
390
  if ( level == ca->maxdim_index ) {
391
391
  addr = saddr * ca->dim[level];
392
392
  addr0 = saddr0 * ca->size0[level] + ca->start[level];
@@ -431,7 +431,7 @@ static void
431
431
  ca_block_attach (CABlock *ca)
432
432
  {
433
433
  ca_size_t addr = 0, addr0 = 0;
434
- if ( ca->rank <= 2 ) {
434
+ if ( ca->ndim <= 2 ) {
435
435
  ca_block_attach_loop2(ca, 0, addr, addr0);
436
436
  }
437
437
  else {
@@ -445,7 +445,7 @@ ca_block_sync_loop2 (CABlock *ca, int8_t level, ca_size_t saddr, ca_size_t saddr
445
445
  ca_size_t count = ca->count[level];
446
446
  ca_size_t addr, addr0, i;
447
447
 
448
- if ( level == ca->rank - 1 ) {
448
+ if ( level == ca->ndim - 1 ) {
449
449
  if ( ca->parent->ptr ) {
450
450
  addr = saddr * ca->dim[level];
451
451
  addr0 = saddr0 * ca->size0[level] + ca->start[level];
@@ -479,7 +479,7 @@ ca_block_sync_loop (CABlock *ca, int8_t level, ca_size_t saddr, ca_size_t saddr0
479
479
  ca_size_t count = ca->count[level];
480
480
  ca_size_t addr, addr0, i;
481
481
 
482
- if ( level == ca->rank - 1 ) {
482
+ if ( level == ca->ndim - 1 ) {
483
483
  if ( level == ca->maxdim_index ) {
484
484
  addr = saddr * ca->dim[level];
485
485
  addr0 = saddr0 * ca->size0[level] + ca->start[level];
@@ -520,7 +520,7 @@ static void
520
520
  ca_block_sync (CABlock *cb)
521
521
  {
522
522
  ca_size_t addr = 0, addr0 = 0;
523
- if ( cb->rank <= 2 ) {
523
+ if ( cb->ndim <= 2 ) {
524
524
  ca_block_sync_loop2(cb, 0, addr, addr0);
525
525
  }
526
526
  else {
@@ -533,7 +533,7 @@ ca_block_fill_loop2 (CABlock *ca, int8_t level, ca_size_t saddr, char *val)
533
533
  {
534
534
  ca_size_t count = ca->count[level];
535
535
  ca_size_t addr, i;
536
- if ( level == ca->rank - 1 ) {
536
+ if ( level == ca->ndim - 1 ) {
537
537
  addr = saddr * ca->dim[level];
538
538
  mfill_step(ca_ptr_at_addr(ca, addr),
539
539
  ca->bytes, count, ca->step[level], val);
@@ -551,7 +551,7 @@ ca_block_fill_loop (CABlock *ca, int8_t level, ca_size_t saddr, char *val)
551
551
  {
552
552
  ca_size_t count = ca->count[level];
553
553
  ca_size_t addr, i;
554
- if ( level == ca->rank - 1 ) {
554
+ if ( level == ca->ndim - 1 ) {
555
555
  if ( level == ca->maxdim_index ) {
556
556
  addr = saddr * ca->dim[level];
557
557
  mfill_step(ca_ptr_at_addr(ca, addr),
@@ -586,7 +586,7 @@ static void
586
586
  ca_block_fill (CABlock *ca, char *val)
587
587
  {
588
588
  ca_size_t addr = 0;
589
- if ( ca->rank <= 2 ) {
589
+ if ( ca->ndim <= 2 ) {
590
590
  ca_block_fill_loop2(ca, 0, addr, val);
591
591
  }
592
592
  else {
@@ -707,12 +707,12 @@ rb_cb_initialize_copy (VALUE self, VALUE other)
707
707
  Data_Get_Struct(self, CABlock, ca);
708
708
  Data_Get_Struct(other, CABlock, cs);
709
709
 
710
- for (i=0; i<cs->rank; i++) {
710
+ for (i=0; i<cs->ndim; i++) {
711
711
  shrink[i] = 0;
712
712
  }
713
713
 
714
714
  ca_block_setup(ca, cs->parent,
715
- cs->rank, cs->size0, cs->start, cs->step, cs->count, cs->offset);
715
+ cs->ndim, cs->size0, cs->start, cs->step, cs->count, cs->offset);
716
716
 
717
717
  /* CHECK ME : other.parent instead of other ? */
718
718
  rb_ca_set_parent(self, rb_ca_parent(other));
@@ -728,8 +728,8 @@ rb_cb_initialize_copy (VALUE self, VALUE other)
728
728
  CABlock *cb; \
729
729
  int8_t i; \
730
730
  Data_Get_Struct(self, CABlock, cb); \
731
- ary = rb_ary_new2(cb->rank); \
732
- for (i=0; i<cb->rank; i++) { \
731
+ ary = rb_ary_new2(cb->ndim); \
732
+ for (i=0; i<cb->ndim; i++) { \
733
733
  rb_ary_store(ary, i, LONG2NUM(cb->name[i])); \
734
734
  } \
735
735
  return ary; \
@@ -780,13 +780,13 @@ rb_cb_idx2addr0 (int argc, VALUE *argv, VALUE self)
780
780
 
781
781
  Data_Get_Struct(self, CABlock, cb);
782
782
 
783
- if ( argc != cb->rank ) {
783
+ if ( argc != cb->ndim ) {
784
784
  rb_raise(rb_eArgError,
785
- "invalid # of arguments (should be <%i>)", cb->rank);
785
+ "invalid # of arguments (should be <%i>)", cb->ndim);
786
786
  }
787
787
 
788
788
  addr = 0;
789
- for (i=0; i<cb->rank; i++) {
789
+ for (i=0; i<cb->ndim; i++) {
790
790
  idxi = NUM2SIZE(argv[i]);
791
791
  CA_CHECK_INDEX(idxi, cb->dim[i]);
792
792
  addr = cb->size0[i] * addr + cb->start[i] + idxi * cb->step[i];
@@ -815,7 +815,7 @@ rb_cb_addr2addr0 (VALUE self, VALUE raddr)
815
815
  ca_addr2index((CArray*)cb, addr, idx);
816
816
 
817
817
  addr = 0;
818
- for (i=0; i<cb->rank; i++) {
818
+ for (i=0; i<cb->ndim; i++) {
819
819
  addr *= cb->size0[i];
820
820
  addr += cb->start[i] + idx[i] * cb->step[i];
821
821
  }
@@ -840,13 +840,13 @@ rb_cb_move (int argc, VALUE *argv, VALUE self)
840
840
 
841
841
  Data_Get_Struct(self, CABlock, cb);
842
842
 
843
- if ( argc != cb->rank ) {
843
+ if ( argc != cb->ndim ) {
844
844
  rb_raise(rb_eArgError, "invalid # of arguments");
845
845
  }
846
846
 
847
847
  ca_update_mask(cb);
848
848
 
849
- for (i=0; i<cb->rank; i++) {
849
+ for (i=0; i<cb->ndim; i++) {
850
850
  start = NUM2SIZE(argv[i]);
851
851
  if ( start < 0 ) {
852
852
  start += cb->size0[i];
@@ -15,7 +15,7 @@
15
15
  typedef struct {
16
16
  int16_t obj_type;
17
17
  int8_t data_type;
18
- int8_t rank;
18
+ int8_t ndim;
19
19
  int32_t flags;
20
20
  ca_size_t bytes;
21
21
  ca_size_t elements;
@@ -41,7 +41,7 @@ static VALUE rb_cCAFake;
41
41
  int
42
42
  ca_fake_setup (CAFake *ca, CArray *parent, int8_t data_type, ca_size_t bytes)
43
43
  {
44
- int8_t rank;
44
+ int8_t ndim;
45
45
  ca_size_t *dim, elements;
46
46
 
47
47
  /* check arguments */
@@ -49,25 +49,25 @@ ca_fake_setup (CAFake *ca, CArray *parent, int8_t data_type, ca_size_t bytes)
49
49
  CA_CHECK_DATA_TYPE(data_type);
50
50
  CA_CHECK_BYTES(data_type, bytes);
51
51
 
52
- rank = parent->rank;
52
+ ndim = parent->ndim;
53
53
  dim = parent->dim;
54
54
  elements = parent->elements;
55
55
 
56
56
  ca->obj_type = CA_OBJ_FAKE;
57
57
  ca->data_type = data_type;
58
58
  ca->flags = 0;
59
- ca->rank = rank;
59
+ ca->ndim = ndim;
60
60
  ca->bytes = bytes;
61
61
  ca->elements = elements;
62
62
  ca->ptr = NULL;
63
63
  ca->mask = NULL;
64
- ca->dim = ALLOC_N(ca_size_t, rank);
64
+ ca->dim = ALLOC_N(ca_size_t, ndim);
65
65
 
66
66
  ca->parent = parent;
67
67
  ca->attach = 0;
68
68
  ca->nosync = 0;
69
69
 
70
- memcpy(ca->dim, dim, rank * sizeof(ca_size_t));
70
+ memcpy(ca->dim, dim, ndim * sizeof(ca_size_t));
71
71
 
72
72
  if ( ca_has_mask(parent) ) {
73
73
  ca_create_mask(ca);
@@ -288,7 +288,7 @@ ca_fake_func_create_mask (void *ap)
288
288
  }
289
289
  ca->mask =
290
290
  (CArray *) ca_refer_new(ca->parent->mask,
291
- CA_BOOLEAN, ca->rank, ca->dim, 0, 0);
291
+ CA_BOOLEAN, ca->ndim, ca->dim, 0, 0);
292
292
  }
293
293
 
294
294
  ca_operation_function_t ca_fake_func = {
@@ -15,7 +15,7 @@
15
15
  typedef struct {
16
16
  int16_t obj_type;
17
17
  int8_t data_type;
18
- int8_t rank;
18
+ int8_t ndim;
19
19
  int32_t flags;
20
20
  ca_size_t bytes;
21
21
  ca_size_t elements;
@@ -43,14 +43,14 @@ static VALUE rb_cCAFarray;
43
43
  int
44
44
  ca_farray_setup (CAFarray *ca, CArray *parent)
45
45
  {
46
- int8_t rank, data_type;
46
+ int8_t ndim, data_type;
47
47
  ca_size_t *dim, elements, bytes;
48
48
  int i;
49
49
 
50
50
  /* check arguments */
51
51
 
52
52
  data_type = parent->data_type;
53
- rank = parent->rank;
53
+ ndim = parent->ndim;
54
54
  dim = parent->dim;
55
55
  bytes = parent->bytes;
56
56
  elements = parent->elements;
@@ -58,23 +58,23 @@ ca_farray_setup (CAFarray *ca, CArray *parent)
58
58
  ca->obj_type = CA_OBJ_FARRAY;
59
59
  ca->data_type = data_type;
60
60
  ca->flags = 0;
61
- ca->rank = rank;
61
+ ca->ndim = ndim;
62
62
  ca->bytes = bytes;
63
63
  ca->elements = elements;
64
64
  ca->ptr = NULL;
65
65
  ca->mask = NULL;
66
- ca->dim = ALLOC_N(ca_size_t, rank);
66
+ ca->dim = ALLOC_N(ca_size_t, ndim);
67
67
 
68
68
  ca->parent = parent;
69
69
  ca->attach = 0;
70
70
  ca->nosync = 0;
71
71
 
72
- for (i=0; i<rank; i++) {
73
- ca->dim[i] = dim[rank-1-i];
72
+ for (i=0; i<ndim; i++) {
73
+ ca->dim[i] = dim[ndim-1-i];
74
74
  }
75
75
 
76
76
  ca->step = 1;
77
- for (i=1; i<rank; i++) {
77
+ for (i=1; i<ndim; i++) {
78
78
  ca->step *= dim[i];
79
79
  }
80
80
 
@@ -124,11 +124,11 @@ static void
124
124
  ca_farray_func_fetch_index (void *ap, ca_size_t *idx, void *ptr)
125
125
  {
126
126
  CAFarray *ca = (CAFarray *) ap;
127
- int8_t rank = ca->rank;
127
+ int8_t ndim = ca->ndim;
128
128
  ca_size_t idx0[CA_RANK_MAX];
129
129
  int i;
130
- for (i=0; i<rank; i++) {
131
- idx0[i] = idx[rank-1-i];
130
+ for (i=0; i<ndim; i++) {
131
+ idx0[i] = idx[ndim-1-i];
132
132
  }
133
133
  ca_fetch_index(ca->parent, idx0, ptr);
134
134
  }
@@ -137,11 +137,11 @@ static void
137
137
  ca_farray_func_store_index (void *ap, ca_size_t *idx, void *ptr)
138
138
  {
139
139
  CAFarray *ca = (CAFarray *) ap;
140
- int8_t rank = ca->rank;
140
+ int8_t ndim = ca->ndim;
141
141
  ca_size_t idx0[CA_RANK_MAX];
142
142
  int i;
143
- for (i=0; i<rank; i++) {
144
- idx0[i] = idx[rank-1-i];
143
+ for (i=0; i<ndim; i++) {
144
+ idx0[i] = idx[ndim-1-i];
145
145
  }
146
146
  ca_store_index(ca->parent, idx0, ptr);
147
147
  }
@@ -258,7 +258,7 @@ ca_fa_attach_loop (CAFarray *ca, int8_t level, ca_size_t *idx, ca_size_t *idx0)
258
258
  ca_size_t step = ca->step;
259
259
  ca_size_t dim = ca->dim[level];
260
260
  ca_size_t i;
261
- if ( level == ca->rank - 1 ) {
261
+ if ( level == ca->ndim - 1 ) {
262
262
  idx[level] = 0;
263
263
  idx0[0] = 0;
264
264
  switch ( ca->bytes ) {
@@ -315,7 +315,7 @@ ca_fa_attach_loop (CAFarray *ca, int8_t level, ca_size_t *idx, ca_size_t *idx0)
315
315
  }
316
316
  }
317
317
  else {
318
- int level0 = ca->rank - 1 - level;
318
+ int level0 = ca->ndim - 1 - level;
319
319
  for (i=0; i<dim; i++) {
320
320
  idx[level] = i;
321
321
  idx0[level0] = i;
@@ -339,7 +339,7 @@ ca_fa_sync_loop (CAFarray *ca, int8_t level, ca_size_t *idx, ca_size_t *idx0)
339
339
  ca_size_t dim = ca->dim[level];
340
340
  ca_size_t i;
341
341
 
342
- if ( level == ca->rank - 1 ) {
342
+ if ( level == ca->ndim - 1 ) {
343
343
  idx[level] = 0;
344
344
  idx0[0] = 0;
345
345
  switch ( ca->bytes ) {
@@ -398,7 +398,7 @@ ca_fa_sync_loop (CAFarray *ca, int8_t level, ca_size_t *idx, ca_size_t *idx0)
398
398
  else {
399
399
  for (i=0; i<dim; i++) {
400
400
  idx[level] = i;
401
- idx0[ca->rank - 1 - level] = i;
401
+ idx0[ca->ndim - 1 - level] = i;
402
402
  ca_fa_sync_loop(ca, level+1, idx, idx0);
403
403
  }
404
404
  }