carray 1.2.0 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (75) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +0 -1
  3. data/ca_iter_block.c +32 -30
  4. data/ca_iter_dimension.c +24 -22
  5. data/ca_iter_window.c +25 -23
  6. data/ca_obj_array.c +58 -56
  7. data/ca_obj_bitarray.c +27 -27
  8. data/ca_obj_bitfield.c +46 -45
  9. data/ca_obj_block.c +77 -72
  10. data/ca_obj_fake.c +20 -20
  11. data/ca_obj_farray.c +22 -22
  12. data/ca_obj_field.c +31 -30
  13. data/ca_obj_grid.c +63 -62
  14. data/ca_obj_mapping.c +35 -32
  15. data/ca_obj_object.c +54 -54
  16. data/ca_obj_reduce.c +13 -13
  17. data/ca_obj_refer.c +42 -39
  18. data/ca_obj_repeat.c +50 -47
  19. data/ca_obj_select.c +24 -24
  20. data/ca_obj_shift.c +61 -58
  21. data/ca_obj_transpose.c +52 -51
  22. data/ca_obj_unbound_repeat.c +28 -27
  23. data/ca_obj_window.c +77 -72
  24. data/carray.gemspec +0 -2
  25. data/carray.h +190 -163
  26. data/carray_access.c +137 -136
  27. data/carray_attribute.c +24 -13
  28. data/carray_call_cfunc.c +21 -21
  29. data/carray_cast.c +106 -110
  30. data/carray_cast_func.rb +17 -17
  31. data/carray_class.c +3 -3
  32. data/carray_conversion.c +15 -15
  33. data/carray_copy.c +27 -27
  34. data/carray_core.c +22 -21
  35. data/carray_element.c +55 -47
  36. data/carray_generate.c +32 -32
  37. data/carray_iterator.c +36 -35
  38. data/carray_loop.c +37 -37
  39. data/carray_mask.c +21 -21
  40. data/carray_math.rb +18 -18
  41. data/carray_numeric.c +1 -1
  42. data/carray_operator.c +19 -18
  43. data/carray_order.c +30 -30
  44. data/carray_random.c +34 -32
  45. data/carray_sort_addr.c +12 -12
  46. data/carray_stat.c +127 -127
  47. data/carray_stat_proc.rb +152 -141
  48. data/carray_test.c +16 -16
  49. data/carray_utils.c +58 -56
  50. data/ext/calculus/carray_calculus.c +19 -20
  51. data/ext/calculus/carray_interp.c +12 -11
  52. data/ext/fortio/lib/fortio/fortran_sequential.rb +2 -2
  53. data/ext/fortio/ruby_fortio.c +1 -1
  54. data/ext/imagemap/carray_imagemap.c +14 -14
  55. data/ext/narray/ca_wrap_narray.c +30 -21
  56. data/extconf.rb +5 -0
  57. data/lib/carray/base/basic.rb +4 -3
  58. data/lib/carray/base/serialize.rb +3 -3
  59. data/lib/carray/graphics/gnuplot.rb +10 -7
  60. data/lib/carray/io/csv.rb +14 -9
  61. data/lib/carray/io/imagemagick.rb +7 -0
  62. data/lib/carray/io/sqlite3.rb +6 -4
  63. data/mkmath.rb +20 -20
  64. data/ruby_carray.c +2 -0
  65. data/ruby_ccomplex.c +3 -3
  66. data/test/test_130.rb +23 -0
  67. data/test/test_ALL.rb +2 -1
  68. data/test/test_order.rb +3 -3
  69. data/test/test_stat.rb +2 -2
  70. data/version.h +4 -4
  71. metadata +4 -37
  72. data/examples/ex001.rb +0 -10
  73. data/examples/test-int.rb +0 -13
  74. data/lib/carray/autoload/autoload_io_excel.rb +0 -5
  75. data/lib/carray/io/excel.rb +0 -26
data/ca_obj_select.c CHANGED
@@ -24,9 +24,9 @@ typedef struct {
24
24
  int8_t data_type;
25
25
  int8_t rank;
26
26
  int32_t flags;
27
- int32_t bytes;
28
- int32_t elements;
29
- int32_t *dim; /* point to _dim */
27
+ ca_size_t bytes;
28
+ ca_size_t elements;
29
+ ca_size_t *dim; /* point to _dim */
30
30
  char *ptr;
31
31
  CArray *mask;
32
32
  CArray *parent;
@@ -34,7 +34,7 @@ typedef struct {
34
34
  uint8_t nosync;
35
35
  /* ---------- */
36
36
  CArray *select;
37
- int32_t _dim;
37
+ ca_size_t _dim;
38
38
  } CASelect;
39
39
 
40
40
  /* ------------------------------------------------------------------- */
@@ -43,7 +43,7 @@ static int
43
43
  ca_select_setup (CASelect *ca, CArray *parent, CArray *select, int share)
44
44
  {
45
45
  int8_t data_type;
46
- int32_t bytes;
46
+ ca_size_t bytes;
47
47
  int i;
48
48
 
49
49
  if ( ! ca_is_boolean_type(select) ) {
@@ -157,7 +157,7 @@ ca_select_func_clone (void *ap)
157
157
  }
158
158
 
159
159
  static char *
160
- ca_select_func_ptr_at_addr (void *ap, int32_t addr)
160
+ ca_select_func_ptr_at_addr (void *ap, ca_size_t addr)
161
161
  {
162
162
  CASelect *ca = (CASelect *) ap;
163
163
 
@@ -165,8 +165,8 @@ ca_select_func_ptr_at_addr (void *ap, int32_t addr)
165
165
  return ca->ptr + ca->bytes * addr;
166
166
  }
167
167
  else {
168
- int32_t n, i, a;
169
- int32_t elements = ca->select->elements;
168
+ ca_size_t n, i, a;
169
+ ca_size_t elements = ca->select->elements;
170
170
  boolean8_t s;
171
171
 
172
172
  n = 0;
@@ -192,10 +192,10 @@ ca_select_func_ptr_at_addr (void *ap, int32_t addr)
192
192
  }
193
193
 
194
194
  static char *
195
- ca_select_func_ptr_at_index (void *ap, int32_t *idx)
195
+ ca_select_func_ptr_at_index (void *ap, ca_size_t *idx)
196
196
  {
197
197
  CASelect *ca = (CASelect *) ap;
198
- int32_t addr = idx[0];
198
+ ca_size_t addr = idx[0];
199
199
 
200
200
  if ( ca->ptr ) {
201
201
  return ca->ptr + ca->bytes * addr;
@@ -206,11 +206,11 @@ ca_select_func_ptr_at_index (void *ap, int32_t *idx)
206
206
  }
207
207
 
208
208
  static void
209
- ca_select_func_fetch_addr (void *ap, int32_t addr, void *ptr)
209
+ ca_select_func_fetch_addr (void *ap, ca_size_t addr, void *ptr)
210
210
  {
211
211
  CASelect *ca = (CASelect *) ap;
212
- int32_t n, i, a;
213
- int32_t elements = ca->select->elements;
212
+ ca_size_t n, i, a;
213
+ ca_size_t elements = ca->select->elements;
214
214
  boolean8_t s;
215
215
  n = 0;
216
216
  a = 0;
@@ -227,17 +227,17 @@ ca_select_func_fetch_addr (void *ap, int32_t addr, void *ptr)
227
227
  }
228
228
 
229
229
  static void
230
- ca_select_func_fetch_index (void *ap, int32_t *idx, void *ptr)
230
+ ca_select_func_fetch_index (void *ap, ca_size_t *idx, void *ptr)
231
231
  {
232
232
  ca_select_func_fetch_addr(ap, idx[0], ptr);
233
233
  }
234
234
 
235
235
  static void
236
- ca_select_func_store_addr (void *ap, int32_t addr, void *ptr)
236
+ ca_select_func_store_addr (void *ap, ca_size_t addr, void *ptr)
237
237
  {
238
238
  CASelect *ca = (CASelect *) ap;
239
- int32_t n, i, a;
240
- int32_t elements = ca->select->elements;
239
+ ca_size_t n, i, a;
240
+ ca_size_t elements = ca->select->elements;
241
241
  boolean8_t s;
242
242
  n = 0;
243
243
  a = 0;
@@ -254,7 +254,7 @@ ca_select_func_store_addr (void *ap, int32_t addr, void *ptr)
254
254
  }
255
255
 
256
256
  static void
257
- ca_select_func_store_index (void *ap, int32_t *idx, void *ptr)
257
+ ca_select_func_store_index (void *ap, ca_size_t *idx, void *ptr)
258
258
  {
259
259
  ca_select_func_store_addr(ap, idx[0], ptr);
260
260
  }
@@ -418,7 +418,7 @@ void
418
418
  ca_select_to_ptr (CArray *ca, CArray *select, char *ptr)
419
419
  {
420
420
  boolean8_t *s = (boolean8_t*) select->ptr;
421
- int32_t i;
421
+ ca_size_t i;
422
422
 
423
423
  switch ( ca->bytes ) {
424
424
  case 1: proc_select_to_ptr(int8_t); break;
@@ -427,7 +427,7 @@ ca_select_to_ptr (CArray *ca, CArray *select, char *ptr)
427
427
  case 8: proc_select_to_ptr(float64_t); break;
428
428
  default: {
429
429
  char *p = ptr, *q = ca->ptr;
430
- int32_t bytes = ca->bytes;
430
+ ca_size_t bytes = ca->bytes;
431
431
  for (i=ca->elements; i; i--) {
432
432
  if ( *s ) {
433
433
  memcpy(q, p, bytes);
@@ -459,7 +459,7 @@ void
459
459
  ca_select_from_ptr (CArray *ca, CArray *select, char *ptr)
460
460
  {
461
461
  boolean8_t *s = (boolean8_t *) select->ptr;
462
- int32_t i;
462
+ ca_size_t i;
463
463
 
464
464
  switch ( ca->bytes ) {
465
465
  case 1: proc_select_from_ptr(int8_t); break;
@@ -469,7 +469,7 @@ ca_select_from_ptr (CArray *ca, CArray *select, char *ptr)
469
469
  default: {
470
470
  char *p = ptr;
471
471
  char *q = ca->ptr;
472
- int32_t bytes = ca->bytes;
472
+ ca_size_t bytes = ca->bytes;
473
473
  for (i=ca->elements; i; i--) {
474
474
  if ( *s ) {
475
475
  memcpy(q, p, bytes);
@@ -501,7 +501,7 @@ void
501
501
  ca_select_fill (CArray *ca, CArray *select, char *valp)
502
502
  {
503
503
  boolean8_t *s = (boolean8_t *) select->ptr;
504
- int32_t i;
504
+ ca_size_t i;
505
505
 
506
506
  switch ( ca->bytes ) {
507
507
  case 1: proc_select_fill(int8_t); break;
@@ -510,7 +510,7 @@ ca_select_fill (CArray *ca, CArray *select, char *valp)
510
510
  case 8: proc_select_fill(float64_t); break;
511
511
  default: {
512
512
  char *q = ca->ptr;
513
- int32_t bytes = ca->bytes;
513
+ ca_size_t bytes = ca->bytes;
514
514
  for (i=ca->elements; i; i--) {
515
515
  if ( *s ) {
516
516
  memcpy(q, valp, bytes);
data/ca_obj_shift.c CHANGED
@@ -24,16 +24,16 @@ typedef struct {
24
24
  int8_t data_type;
25
25
  int8_t rank;
26
26
  int32_t flags;
27
- int32_t bytes;
28
- int32_t elements;
29
- int32_t *dim;
27
+ ca_size_t bytes;
28
+ ca_size_t elements;
29
+ ca_size_t *dim;
30
30
  char *ptr;
31
31
  CArray *mask;
32
32
  CArray *parent;
33
33
  uint32_t attach;
34
34
  uint8_t nosync;
35
35
  /* -------------*/
36
- int32_t *shift;
36
+ ca_size_t *shift;
37
37
  char *fill;
38
38
  int8_t *roll;
39
39
  int fill_mask;
@@ -45,10 +45,10 @@ static int8_t CA_OBJ_SHIFT;
45
45
 
46
46
  int
47
47
  ca_shift_setup (CAShift *ca, CArray *parent,
48
- int32_t *shift, char *fill, int8_t *roll)
48
+ ca_size_t *shift, char *fill, int8_t *roll)
49
49
  {
50
50
  int8_t data_type, rank;
51
- int32_t elements, bytes;
51
+ ca_size_t elements, bytes;
52
52
 
53
53
  data_type = parent->data_type;
54
54
  bytes = parent->bytes;
@@ -64,17 +64,17 @@ ca_shift_setup (CAShift *ca, CArray *parent,
64
64
  ca->elements = elements;
65
65
  ca->ptr = NULL;
66
66
  ca->mask = NULL;
67
- ca->dim = ALLOC_N(int32_t, rank);
67
+ ca->dim = ALLOC_N(ca_size_t, rank);
68
68
 
69
69
  ca->parent = parent;
70
70
  ca->attach = 0;
71
71
  ca->nosync = 0;
72
- ca->shift = ALLOC_N(int32_t, rank);
72
+ ca->shift = ALLOC_N(ca_size_t, rank);
73
73
  ca->fill = ALLOC_N(char, ca->bytes);
74
74
  ca->roll = ALLOC_N(int8_t, rank);
75
75
 
76
- memcpy(ca->dim, parent->dim, rank * sizeof(int32_t));
77
- memcpy(ca->shift, shift, rank * sizeof(int32_t));
76
+ memcpy(ca->dim, parent->dim, rank * sizeof(ca_size_t));
77
+ memcpy(ca->shift, shift, rank * sizeof(ca_size_t));
78
78
  memcpy(ca->roll, roll, rank * sizeof(int8_t));
79
79
 
80
80
  if ( fill ) {
@@ -94,7 +94,7 @@ ca_shift_setup (CAShift *ca, CArray *parent,
94
94
  }
95
95
 
96
96
  CAShift *
97
- ca_shift_new (CArray *parent, int32_t *shift, char *fill, int8_t *roll)
97
+ ca_shift_new (CArray *parent, ca_size_t *shift, char *fill, int8_t *roll)
98
98
  {
99
99
  CAShift *ca = ALLOC(CAShift);
100
100
  ca_shift_setup(ca, parent, shift, fill, roll);
@@ -119,11 +119,11 @@ static void ca_shift_attach (CAShift *ca);
119
119
  static void ca_shift_sync (CAShift *ca);
120
120
  static void ca_shift_fill (CAShift *ca, char *ptr);
121
121
 
122
- static int32_t
123
- ca_shift_normalized_roll_shift (CAShift *ca, int32_t i)
122
+ static ca_size_t
123
+ ca_shift_normalized_roll_shift (CAShift *ca, ca_size_t i)
124
124
  {
125
- int32_t dim = ca->dim[i];
126
- int32_t shift = ca->shift[i];
125
+ ca_size_t dim = ca->dim[i];
126
+ ca_size_t shift = ca->shift[i];
127
127
  if ( shift >= 0 ) {
128
128
  return shift % dim;
129
129
  }
@@ -132,12 +132,12 @@ ca_shift_normalized_roll_shift (CAShift *ca, int32_t i)
132
132
  }
133
133
  }
134
134
 
135
- static int32_t
136
- ca_shift_rolled_index (CAShift *ca, int32_t i, int32_t k)
135
+ static ca_size_t
136
+ ca_shift_rolled_index (CAShift *ca, ca_size_t i, ca_size_t k)
137
137
  {
138
- int32_t dim = ca->dim[i];
139
- int32_t shift = ca->shift[i];
140
- int32_t idx = k - shift;
138
+ ca_size_t dim = ca->dim[i];
139
+ ca_size_t shift = ca->shift[i];
140
+ ca_size_t idx = k - shift;
141
141
  if ( idx >= 0 ) {
142
142
  return idx % dim;
143
143
  }
@@ -147,12 +147,12 @@ ca_shift_rolled_index (CAShift *ca, int32_t i, int32_t k)
147
147
  }
148
148
  }
149
149
 
150
- static int32_t
151
- ca_shift_shifted_index (CAShift *ca, int32_t i, int32_t k)
150
+ static ca_size_t
151
+ ca_shift_shifted_index (CAShift *ca, ca_size_t i, ca_size_t k)
152
152
  {
153
- int32_t dim = ca->dim[i];
154
- int32_t shift = ca->shift[i];
155
- int32_t idx = k - shift;
153
+ ca_size_t dim = ca->dim[i];
154
+ ca_size_t shift = ca->shift[i];
155
+ ca_size_t idx = k - shift;
156
156
  if ( idx < 0 || idx >= dim ) {
157
157
  return -1;
158
158
  }
@@ -171,11 +171,11 @@ ca_shift_func_clone (void *ap)
171
171
  }
172
172
 
173
173
  static char *
174
- ca_shift_func_ptr_at_addr (void *ap, int32_t addr)
174
+ ca_shift_func_ptr_at_addr (void *ap, ca_size_t addr)
175
175
  {
176
176
  CAShift *ca = (CAShift *) ap;
177
177
  if ( ! ca->ptr ) {
178
- int32_t idx[CA_RANK_MAX];
178
+ ca_size_t idx[CA_RANK_MAX];
179
179
  ca_addr2index((CArray *)ca, addr, idx);
180
180
  return ca_ptr_at_index(ca, idx);
181
181
  }
@@ -185,13 +185,14 @@ ca_shift_func_ptr_at_addr (void *ap, int32_t addr)
185
185
  }
186
186
 
187
187
  static char *
188
- ca_shift_func_ptr_at_index (void *ap, int32_t *idx)
188
+ ca_shift_func_ptr_at_index (void *ap, ca_size_t *idx)
189
189
  {
190
190
  CAShift *ca = (CAShift *) ap;
191
191
  if ( ! ca->ptr ) {
192
- int32_t *dim = ca->dim;
192
+ ca_size_t *dim = ca->dim;
193
193
  int8_t *roll = ca->roll;
194
- int32_t i, k, n;
194
+ int8_t i;
195
+ ca_size_t k, n;
195
196
  n = 0;
196
197
  for (i=0; i<ca->rank; i++) {
197
198
  k = idx[i];
@@ -221,12 +222,13 @@ ca_shift_func_ptr_at_index (void *ap, int32_t *idx)
221
222
  }
222
223
 
223
224
  static void
224
- ca_shift_func_fetch_index (void *ap, int32_t *idx, void *ptr)
225
+ ca_shift_func_fetch_index (void *ap, ca_size_t *idx, void *ptr)
225
226
  {
226
227
  CAShift *ca = (CAShift *) ap;
227
- int32_t *dim = ca->dim;
228
+ ca_size_t *dim = ca->dim;
228
229
  int8_t *roll = ca->roll;
229
- int32_t i, k, n;
230
+ int8_t i;
231
+ ca_size_t k, n;
230
232
  n = 0;
231
233
  for (i=0; i<ca->rank; i++) {
232
234
  k = idx[i];
@@ -247,12 +249,13 @@ ca_shift_func_fetch_index (void *ap, int32_t *idx, void *ptr)
247
249
  }
248
250
 
249
251
  static void
250
- ca_shift_func_store_index (void *ap, int32_t *idx, void *ptr)
252
+ ca_shift_func_store_index (void *ap, ca_size_t *idx, void *ptr)
251
253
  {
252
254
  CAShift *ca = (CAShift *) ap;
253
- int32_t *dim = ca->dim;
255
+ ca_size_t *dim = ca->dim;
254
256
  int8_t *roll = ca->roll;
255
- int32_t i, k, n;
257
+ int8_t i;
258
+ ca_size_t k, n;
256
259
  n = 0;
257
260
  for (i=0; i<ca->rank; i++) {
258
261
  k = idx[i];
@@ -391,13 +394,13 @@ ca_operation_function_t ca_shift_func = {
391
394
  /* ------------------------------------------------------------------- */
392
395
 
393
396
  static void
394
- ca_shift_attach_loop (CAShift *ca, int16_t level, int32_t *idx, int32_t *idx0,
397
+ ca_shift_attach_loop (CAShift *ca, int16_t level, ca_size_t *idx, ca_size_t *idx0,
395
398
  int32_t fill)
396
399
  {
397
- int32_t dim = ca->dim[level];
398
- int32_t shift = ca->shift[level];
400
+ ca_size_t dim = ca->dim[level];
401
+ ca_size_t shift = ca->shift[level];
399
402
  int8_t roll = ca->roll[level];
400
- int32_t i;
403
+ ca_size_t i;
401
404
 
402
405
  if ( level == ca->rank - 1 ) {
403
406
  if ( fill ) {
@@ -545,18 +548,18 @@ ca_shift_attach_loop (CAShift *ca, int16_t level, int32_t *idx, int32_t *idx0,
545
548
  static void
546
549
  ca_shift_attach (CAShift *ca)
547
550
  {
548
- int32_t idx[CA_RANK_MAX];
549
- int32_t idx0[CA_RANK_MAX];
551
+ ca_size_t idx[CA_RANK_MAX];
552
+ ca_size_t idx0[CA_RANK_MAX];
550
553
  ca_shift_attach_loop(ca, (int16_t) 0, idx, idx0, 0);
551
554
  }
552
555
 
553
556
  static void
554
- ca_shift_sync_loop (CAShift *ca, int16_t level, int32_t *idx, int32_t *idx0)
557
+ ca_shift_sync_loop (CAShift *ca, int16_t level, ca_size_t *idx, ca_size_t *idx0)
555
558
  {
556
- int32_t dim = ca->dim[level];
557
- int32_t shift = ca->shift[level];
559
+ ca_size_t dim = ca->dim[level];
560
+ ca_size_t shift = ca->shift[level];
558
561
  int8_t roll = ca->roll[level];
559
- int32_t i;
562
+ ca_size_t i;
560
563
 
561
564
  if ( level == ca->rank - 1 ) {
562
565
  if ( ! shift ) {
@@ -688,19 +691,19 @@ ca_shift_sync_loop (CAShift *ca, int16_t level, int32_t *idx, int32_t *idx0)
688
691
  static void
689
692
  ca_shift_sync (CAShift *ca)
690
693
  {
691
- int32_t idx[CA_RANK_MAX];
692
- int32_t idx0[CA_RANK_MAX];
694
+ ca_size_t idx[CA_RANK_MAX];
695
+ ca_size_t idx0[CA_RANK_MAX];
693
696
  ca_shift_sync_loop(ca, (int16_t) 0, idx, idx0);
694
697
  }
695
698
 
696
699
  static void
697
700
  ca_shift_fill_loop (CAShift *ca, char *ptr,
698
- int16_t level, int32_t *idx0)
701
+ int16_t level, ca_size_t *idx0)
699
702
  {
700
- int32_t dim = ca->dim[level];
701
- int32_t shift = ca->shift[level];
703
+ ca_size_t dim = ca->dim[level];
704
+ ca_size_t shift = ca->shift[level];
702
705
  int8_t roll = ca->roll[level];
703
- int32_t i;
706
+ ca_size_t i;
704
707
 
705
708
  if ( level == ca->rank - 1 ) {
706
709
  if ( ( ! shift ) || roll ) {
@@ -783,7 +786,7 @@ ca_shift_fill_loop (CAShift *ca, char *ptr,
783
786
  static void
784
787
  ca_shift_fill (CAShift *ca, char *ptr)
785
788
  {
786
- int32_t idx0[CA_RANK_MAX];
789
+ ca_size_t idx0[CA_RANK_MAX];
787
790
  ca_shift_fill_loop(ca, ptr, (int16_t) 0, idx0);
788
791
  }
789
792
 
@@ -811,7 +814,7 @@ rb_ca_shift_set_fill_value (VALUE self, VALUE rfval)
811
814
  */
812
815
 
813
816
  VALUE
814
- rb_ca_shift_new (VALUE cary, int32_t *shift, char *fill, int8_t *roll)
817
+ rb_ca_shift_new (VALUE cary, ca_size_t *shift, char *fill, int8_t *roll)
815
818
  {
816
819
  volatile VALUE obj;
817
820
  CArray *parent;
@@ -838,10 +841,10 @@ rb_ca_shift (int argc, VALUE *argv, VALUE self)
838
841
  volatile VALUE obj, ropt, rfval = CA_NIL, rroll = Qnil, rcs;
839
842
  CArray *ca;
840
843
  CScalar *cs;
841
- int32_t shift[CA_RANK_MAX];
844
+ ca_size_t shift[CA_RANK_MAX];
842
845
  int8_t roll[CA_RANK_MAX];
843
846
  char *fill = NULL;
844
- int32_t i;
847
+ int8_t i;
845
848
 
846
849
  Data_Get_Struct(self, CArray, ca);
847
850
 
@@ -853,7 +856,7 @@ rb_ca_shift (int argc, VALUE *argv, VALUE self)
853
856
  }
854
857
 
855
858
  for (i=0; i<ca->rank; i++) {
856
- shift[i] = NUM2INT(argv[i]);
859
+ shift[i] = NUM2SIZE(argv[i]);
857
860
  }
858
861
 
859
862
  if ( rfval == CA_NIL ) {
@@ -870,7 +873,7 @@ rb_ca_shift (int argc, VALUE *argv, VALUE self)
870
873
  Data_Get_Struct(rcs, CScalar, cs);
871
874
  fill = cs->ptr;
872
875
  if ( ca_is_object_type(ca) ) {
873
- *(VALUE *)fill = INT2FIX(0);
876
+ *(VALUE *)fill = INT2NUM(0);
874
877
  }
875
878
  else {
876
879
  memset(fill, 0, cs->bytes);
data/ca_obj_transpose.c CHANGED
@@ -17,17 +17,17 @@ typedef struct {
17
17
  int8_t data_type;
18
18
  int8_t rank;
19
19
  int32_t flags;
20
- int32_t bytes;
21
- int32_t elements;
22
- int32_t *dim;
20
+ ca_size_t bytes;
21
+ ca_size_t elements;
22
+ ca_size_t *dim;
23
23
  char *ptr;
24
24
  CArray *mask;
25
25
  CArray *parent;
26
26
  uint32_t attach;
27
27
  uint8_t nosync;
28
28
  /* -------------*/
29
- int32_t *imap;
30
- int32_t step;
29
+ ca_size_t *imap;
30
+ ca_size_t step;
31
31
  } CATrans;
32
32
 
33
33
  static int8_t CA_OBJ_TRANSPOSE;
@@ -42,14 +42,15 @@ static VALUE rb_cCATrans;
42
42
  /* ------------------------------------------------------------------- */
43
43
 
44
44
  int
45
- ca_trans_setup (CATrans *ca, CArray *parent, int32_t *imap)
45
+ ca_trans_setup (CATrans *ca, CArray *parent, ca_size_t *imap)
46
46
  {
47
47
  int8_t data_type, rank;
48
- int32_t bytes, elements;
49
- int32_t *dim0;
50
- int32_t newdim[CA_RANK_MAX];
51
- int32_t map[CA_RANK_MAX];
52
- int i, idim, step;
48
+ ca_size_t bytes, elements;
49
+ ca_size_t *dim0;
50
+ ca_size_t newdim[CA_RANK_MAX];
51
+ ca_size_t map[CA_RANK_MAX];
52
+ int8_t i;
53
+ ca_size_t idim, step;
53
54
 
54
55
  data_type = parent->data_type;
55
56
  bytes = parent->bytes;
@@ -89,16 +90,16 @@ ca_trans_setup (CATrans *ca, CArray *parent, int32_t *imap)
89
90
  ca->elements = elements;
90
91
  ca->ptr = NULL;
91
92
  ca->mask = NULL;
92
- ca->dim = ALLOC_N(int32_t, rank);
93
+ ca->dim = ALLOC_N(ca_size_t, rank);
93
94
 
94
95
  ca->parent = parent;
95
96
  ca->attach = 0;
96
97
  ca->nosync = 0;
97
- ca->imap = ALLOC_N(int32_t, rank);
98
+ ca->imap = ALLOC_N(ca_size_t, rank);
98
99
  ca->step = step;
99
100
 
100
- memcpy(ca->dim, newdim, rank * sizeof(int32_t));
101
- memcpy(ca->imap, imap, rank * sizeof(int32_t));
101
+ memcpy(ca->dim, newdim, rank * sizeof(ca_size_t));
102
+ memcpy(ca->imap, imap, rank * sizeof(ca_size_t));
102
103
 
103
104
  if ( ca_has_mask(parent) ) {
104
105
  ca_create_mask(ca);
@@ -108,7 +109,7 @@ ca_trans_setup (CATrans *ca, CArray *parent, int32_t *imap)
108
109
  }
109
110
 
110
111
  CATrans *
111
- ca_trans_new (CArray *parent, int32_t *imap)
112
+ ca_trans_new (CArray *parent, ca_size_t *imap)
112
113
  {
113
114
  CATrans *ca = ALLOC(CATrans);
114
115
  ca_trans_setup(ca, parent, imap);
@@ -142,30 +143,30 @@ ca_trans_func_clone (void *ap)
142
143
  }
143
144
 
144
145
  static char *
145
- ca_trans_func_ptr_at_addr (void *ap, int32_t addr)
146
+ ca_trans_func_ptr_at_addr (void *ap, ca_size_t addr)
146
147
  {
147
148
  CATrans *ca = (CATrans *) ap;
148
149
  if ( ca->ptr ) {
149
150
  return ca->ptr + ca->bytes * addr;
150
151
  }
151
152
  else {
152
- int32_t idx[CA_RANK_MAX];
153
+ ca_size_t idx[CA_RANK_MAX];
153
154
  ca_addr2index((CArray *)ca, addr, idx);
154
155
  return ca_ptr_at_index(ca, idx);
155
156
  }
156
157
  }
157
158
 
158
159
  static char *
159
- ca_trans_func_ptr_at_index (void *ap, int32_t *idx)
160
+ ca_trans_func_ptr_at_index (void *ap, ca_size_t *idx)
160
161
  {
161
162
  CATrans *ca = (CATrans *) ap;
162
163
  if ( ca->ptr ) {
163
164
  return ca_array_func_ptr_at_index(ca, idx);
164
165
  }
165
166
  else {
166
- int32_t *imap = ca->imap;
167
- int32_t idx0[CA_RANK_MAX];
168
- int32_t i;
167
+ ca_size_t *imap = ca->imap;
168
+ ca_size_t idx0[CA_RANK_MAX];
169
+ int8_t i;
169
170
  for (i=0; i<ca->rank; i++) {
170
171
  idx0[imap[i]] = idx[i];
171
172
  }
@@ -174,12 +175,12 @@ ca_trans_func_ptr_at_index (void *ap, int32_t *idx)
174
175
  }
175
176
 
176
177
  static void
177
- ca_trans_func_fetch_index (void *ap, int32_t *idx, void *ptr)
178
+ ca_trans_func_fetch_index (void *ap, ca_size_t *idx, void *ptr)
178
179
  {
179
180
  CATrans *ca = (CATrans *) ap;
180
- int32_t *imap = ca->imap;
181
- int32_t idx0[CA_RANK_MAX];
182
- int32_t i;
181
+ ca_size_t *imap = ca->imap;
182
+ ca_size_t idx0[CA_RANK_MAX];
183
+ int8_t i;
183
184
  for (i=0; i<ca->rank; i++) {
184
185
  idx0[imap[i]] = idx[i];
185
186
  }
@@ -187,12 +188,12 @@ ca_trans_func_fetch_index (void *ap, int32_t *idx, void *ptr)
187
188
  }
188
189
 
189
190
  static void
190
- ca_trans_func_store_index (void *ap, int32_t *idx, void *ptr)
191
+ ca_trans_func_store_index (void *ap, ca_size_t *idx, void *ptr)
191
192
  {
192
193
  CATrans *ca = (CATrans *) ap;
193
- int32_t *imap = ca->imap;
194
- int32_t idx0[CA_RANK_MAX];
195
- int32_t i;
194
+ ca_size_t *imap = ca->imap;
195
+ ca_size_t idx0[CA_RANK_MAX];
196
+ int8_t i;
196
197
  for (i=0; i<ca->rank; i++) {
197
198
  idx0[imap[i]] = idx[i];
198
199
  }
@@ -303,12 +304,12 @@ ca_operation_function_t ca_trans_func = {
303
304
  /* ------------------------------------------------------------------- */
304
305
 
305
306
  static void
306
- ca_trans_attach_loop (CATrans *ca, int8_t level, int32_t *idx, int32_t *idx0)
307
+ ca_trans_attach_loop (CATrans *ca, int8_t level, ca_size_t *idx, ca_size_t *idx0)
307
308
  {
308
- int32_t step = ca->step;
309
- int32_t dim = ca->dim[level];
310
- int32_t *imap = ca->imap;
311
- int32_t i;
309
+ ca_size_t step = ca->step;
310
+ ca_size_t dim = ca->dim[level];
311
+ ca_size_t *imap = ca->imap;
312
+ ca_size_t i;
312
313
 
313
314
  if ( level == ca->rank - 1 ) {
314
315
  idx[level] = 0;
@@ -378,18 +379,18 @@ ca_trans_attach_loop (CATrans *ca, int8_t level, int32_t *idx, int32_t *idx0)
378
379
  static void
379
380
  ca_trans_attach (CATrans *ca)
380
381
  {
381
- int32_t idx[CA_RANK_MAX];
382
- int32_t idx0[CA_RANK_MAX];
382
+ ca_size_t idx[CA_RANK_MAX];
383
+ ca_size_t idx0[CA_RANK_MAX];
383
384
  ca_trans_attach_loop(ca, 0, idx, idx0);
384
385
  }
385
386
 
386
387
  static void
387
- ca_trans_sync_loop (CATrans *ca, int8_t level, int32_t *idx, int32_t *idx0)
388
+ ca_trans_sync_loop (CATrans *ca, int8_t level, ca_size_t *idx, ca_size_t *idx0)
388
389
  {
389
- int32_t step = ca->step;
390
- int32_t dim = ca->dim[level];
391
- int32_t *imap = ca->imap;
392
- int32_t i;
390
+ ca_size_t step = ca->step;
391
+ ca_size_t dim = ca->dim[level];
392
+ ca_size_t *imap = ca->imap;
393
+ ca_size_t i;
393
394
 
394
395
  if ( level == ca->rank - 1 ) {
395
396
  idx[level] = 0;
@@ -459,18 +460,18 @@ ca_trans_sync_loop (CATrans *ca, int8_t level, int32_t *idx, int32_t *idx0)
459
460
  static void
460
461
  ca_trans_sync (CATrans *ca)
461
462
  {
462
- int32_t idx[CA_RANK_MAX];
463
- int32_t idx0[CA_RANK_MAX];
463
+ ca_size_t idx[CA_RANK_MAX];
464
+ ca_size_t idx0[CA_RANK_MAX];
464
465
  ca_trans_sync_loop(ca, 0, idx, idx0);
465
466
  }
466
467
 
467
468
  /*
468
469
  static void
469
470
  ca_trans_fill_loop (CATrans *ca, char *ptr,
470
- int8_t level, int32_t *idx0)
471
+ int8_t level, ca_size_t *idx0)
471
472
  {
472
- int32_t *imap = ca->imap;
473
- int32_t i;
473
+ ca_size_t *imap = ca->imap;
474
+ ca_size_t i;
474
475
 
475
476
  if ( level == ca->rank - 1 ) {
476
477
  for (i=0; i<ca->dim[level]; i++) {
@@ -496,7 +497,7 @@ ca_trans_fill (CATrans *ca, char *ptr)
496
497
  /* ------------------------------------------------------------------- */
497
498
 
498
499
  VALUE
499
- rb_ca_trans_new (VALUE cary, int32_t *imap)
500
+ rb_ca_trans_new (VALUE cary, ca_size_t *imap)
500
501
  {
501
502
  volatile VALUE obj;
502
503
  CArray *parent;
@@ -522,8 +523,8 @@ rb_ca_trans (int argc, VALUE *argv, VALUE self)
522
523
  {
523
524
  volatile VALUE obj;
524
525
  CArray *ca;
525
- int32_t imap[CA_RANK_MAX];
526
- int32_t i;
526
+ ca_size_t imap[CA_RANK_MAX];
527
+ int8_t i;
527
528
 
528
529
  Data_Get_Struct(self, CArray, ca);
529
530
 
@@ -534,7 +535,7 @@ rb_ca_trans (int argc, VALUE *argv, VALUE self)
534
535
  }
535
536
  else if ( argc == ca->rank ) {
536
537
  for (i=0; i<ca->rank; i++) {
537
- imap[i] = NUM2INT(argv[i]);
538
+ imap[i] = NUM2SIZE(argv[i]);
538
539
  }
539
540
  }
540
541
  else {