cumo 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (158) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +1 -0
  3. data/3rd_party/LICENSE.txt +60 -0
  4. data/3rd_party/mkmf-cu/lib/mkmf-cu/cli.rb +13 -1
  5. data/LICENSE.txt +1 -62
  6. data/README.md +33 -29
  7. data/bench/cumo_bench.rb +47 -25
  8. data/bench/numo_bench.rb +27 -25
  9. data/docs/src-tree.md +16 -0
  10. data/ext/cumo/cuda/cublas.c +69 -219
  11. data/ext/cumo/cuda/memory_pool_impl.hpp +1 -0
  12. data/ext/cumo/cuda/runtime.c +2 -14
  13. data/ext/cumo/cumo.c +16 -16
  14. data/ext/cumo/include/cumo.h +2 -2
  15. data/ext/cumo/include/cumo/cuda/cublas.h +6 -129
  16. data/ext/cumo/include/cumo/cuda/runtime.h +16 -0
  17. data/ext/cumo/include/cumo/indexer.h +46 -63
  18. data/ext/cumo/include/cumo/intern.h +58 -112
  19. data/ext/cumo/include/cumo/narray.h +214 -185
  20. data/ext/cumo/include/cumo/narray_kernel.h +66 -37
  21. data/ext/cumo/include/cumo/ndloop.h +42 -42
  22. data/ext/cumo/include/cumo/reduce_kernel.h +55 -71
  23. data/ext/cumo/include/cumo/template.h +56 -51
  24. data/ext/cumo/include/cumo/template_kernel.h +31 -31
  25. data/ext/cumo/include/cumo/types/bit.h +3 -3
  26. data/ext/cumo/include/cumo/types/bit_kernel.h +2 -2
  27. data/ext/cumo/include/cumo/types/complex.h +126 -126
  28. data/ext/cumo/include/cumo/types/complex_kernel.h +126 -126
  29. data/ext/cumo/include/cumo/types/complex_macro.h +28 -28
  30. data/ext/cumo/include/cumo/types/complex_macro_kernel.h +20 -20
  31. data/ext/cumo/include/cumo/types/dcomplex.h +5 -5
  32. data/ext/cumo/include/cumo/types/dcomplex_kernel.h +1 -1
  33. data/ext/cumo/include/cumo/types/int_macro.h +1 -1
  34. data/ext/cumo/include/cumo/types/int_macro_kernel.h +1 -1
  35. data/ext/cumo/include/cumo/types/robj_macro.h +30 -30
  36. data/ext/cumo/include/cumo/types/scomplex.h +5 -5
  37. data/ext/cumo/include/cumo/types/scomplex_kernel.h +1 -1
  38. data/ext/cumo/narray/array.c +143 -143
  39. data/ext/cumo/narray/data.c +184 -184
  40. data/ext/cumo/narray/gen/cogen.rb +5 -2
  41. data/ext/cumo/narray/gen/cogen_kernel.rb +5 -2
  42. data/ext/cumo/narray/gen/def/dcomplex.rb +1 -1
  43. data/ext/cumo/narray/gen/def/scomplex.rb +1 -1
  44. data/ext/cumo/narray/gen/erbln.rb +132 -0
  45. data/ext/cumo/narray/gen/erbpp2.rb +18 -13
  46. data/ext/cumo/narray/gen/narray_def.rb +3 -3
  47. data/ext/cumo/narray/gen/spec.rb +2 -2
  48. data/ext/cumo/narray/gen/tmpl/accum.c +15 -15
  49. data/ext/cumo/narray/gen/tmpl/accum_binary.c +22 -22
  50. data/ext/cumo/narray/gen/tmpl/accum_binary_kernel.cu +3 -3
  51. data/ext/cumo/narray/gen/tmpl/accum_index.c +30 -30
  52. data/ext/cumo/narray/gen/tmpl/accum_index_kernel.cu +2 -2
  53. data/ext/cumo/narray/gen/tmpl/accum_kernel.cu +3 -3
  54. data/ext/cumo/narray/gen/tmpl/alloc_func.c +14 -14
  55. data/ext/cumo/narray/gen/tmpl/allocate.c +11 -11
  56. data/ext/cumo/narray/gen/tmpl/aref.c +2 -2
  57. data/ext/cumo/narray/gen/tmpl/aref_cpu.c +4 -4
  58. data/ext/cumo/narray/gen/tmpl/aset.c +2 -2
  59. data/ext/cumo/narray/gen/tmpl/binary.c +28 -28
  60. data/ext/cumo/narray/gen/tmpl/binary2.c +18 -18
  61. data/ext/cumo/narray/gen/tmpl/binary2_kernel.cu +3 -3
  62. data/ext/cumo/narray/gen/tmpl/binary_kernel.cu +6 -6
  63. data/ext/cumo/narray/gen/tmpl/binary_s.c +13 -13
  64. data/ext/cumo/narray/gen/tmpl/binary_s_kernel.cu +3 -3
  65. data/ext/cumo/narray/gen/tmpl/bincount.c +23 -23
  66. data/ext/cumo/narray/gen/tmpl/cast.c +7 -7
  67. data/ext/cumo/narray/gen/tmpl/cast_array.c +3 -3
  68. data/ext/cumo/narray/gen/tmpl/clip.c +38 -38
  69. data/ext/cumo/narray/gen/tmpl/complex_accum_kernel.cu +2 -2
  70. data/ext/cumo/narray/gen/tmpl/cond_binary.c +19 -19
  71. data/ext/cumo/narray/gen/tmpl/cond_binary_kernel.cu +7 -7
  72. data/ext/cumo/narray/gen/tmpl/cond_unary.c +15 -15
  73. data/ext/cumo/narray/gen/tmpl/cum.c +15 -15
  74. data/ext/cumo/narray/gen/tmpl/each.c +9 -9
  75. data/ext/cumo/narray/gen/tmpl/each_with_index.c +9 -9
  76. data/ext/cumo/narray/gen/tmpl/ewcomp.c +15 -15
  77. data/ext/cumo/narray/gen/tmpl/ewcomp_kernel.cu +3 -3
  78. data/ext/cumo/narray/gen/tmpl/extract_cpu.c +5 -5
  79. data/ext/cumo/narray/gen/tmpl/extract_data.c +12 -12
  80. data/ext/cumo/narray/gen/tmpl/eye.c +9 -9
  81. data/ext/cumo/narray/gen/tmpl/eye_kernel.cu +3 -3
  82. data/ext/cumo/narray/gen/tmpl/fill.c +9 -9
  83. data/ext/cumo/narray/gen/tmpl/fill_kernel.cu +6 -6
  84. data/ext/cumo/narray/gen/tmpl/float_accum_kernel.cu +1 -1
  85. data/ext/cumo/narray/gen/tmpl/format.c +11 -11
  86. data/ext/cumo/narray/gen/tmpl/format_to_a.c +8 -8
  87. data/ext/cumo/narray/gen/tmpl/frexp.c +13 -13
  88. data/ext/cumo/narray/gen/tmpl/gemm.c +252 -108
  89. data/ext/cumo/narray/gen/tmpl/inspect.c +1 -1
  90. data/ext/cumo/narray/gen/tmpl/lib.c +2 -2
  91. data/ext/cumo/narray/gen/tmpl/logseq.c +7 -7
  92. data/ext/cumo/narray/gen/tmpl/logseq_kernel.cu +6 -6
  93. data/ext/cumo/narray/gen/tmpl/map_with_index.c +17 -17
  94. data/ext/cumo/narray/gen/tmpl/median.c +10 -10
  95. data/ext/cumo/narray/gen/tmpl/minmax.c +10 -10
  96. data/ext/cumo/narray/gen/tmpl/new_dim0.c +3 -3
  97. data/ext/cumo/narray/gen/tmpl/poly.c +6 -6
  98. data/ext/cumo/narray/gen/tmpl/pow.c +28 -28
  99. data/ext/cumo/narray/gen/tmpl/pow_kernel.cu +6 -6
  100. data/ext/cumo/narray/gen/tmpl/rand.c +10 -10
  101. data/ext/cumo/narray/gen/tmpl/rand_norm.c +7 -7
  102. data/ext/cumo/narray/gen/tmpl/real_accum_kernel.cu +6 -6
  103. data/ext/cumo/narray/gen/tmpl/seq.c +7 -7
  104. data/ext/cumo/narray/gen/tmpl/seq_kernel.cu +6 -6
  105. data/ext/cumo/narray/gen/tmpl/set2.c +20 -20
  106. data/ext/cumo/narray/gen/tmpl/sort.c +11 -11
  107. data/ext/cumo/narray/gen/tmpl/sort_index.c +18 -18
  108. data/ext/cumo/narray/gen/tmpl/store.c +6 -6
  109. data/ext/cumo/narray/gen/tmpl/store_array.c +19 -19
  110. data/ext/cumo/narray/gen/tmpl/store_array_kernel.cu +12 -12
  111. data/ext/cumo/narray/gen/tmpl/store_bit.c +23 -23
  112. data/ext/cumo/narray/gen/tmpl/store_bit_kernel.cu +28 -28
  113. data/ext/cumo/narray/gen/tmpl/store_from.c +16 -16
  114. data/ext/cumo/narray/gen/tmpl/store_from_kernel.cu +12 -12
  115. data/ext/cumo/narray/gen/tmpl/to_a.c +10 -10
  116. data/ext/cumo/narray/gen/tmpl/unary.c +25 -25
  117. data/ext/cumo/narray/gen/tmpl/unary2.c +17 -17
  118. data/ext/cumo/narray/gen/tmpl/unary_kernel.cu +15 -15
  119. data/ext/cumo/narray/gen/tmpl/unary_ret2.c +13 -13
  120. data/ext/cumo/narray/gen/tmpl/unary_s.c +17 -17
  121. data/ext/cumo/narray/gen/tmpl/unary_s_kernel.cu +12 -12
  122. data/ext/cumo/narray/gen/tmpl_bit/allocate.c +9 -9
  123. data/ext/cumo/narray/gen/tmpl_bit/aref.c +2 -2
  124. data/ext/cumo/narray/gen/tmpl_bit/aref_cpu.c +5 -5
  125. data/ext/cumo/narray/gen/tmpl_bit/aset.c +2 -2
  126. data/ext/cumo/narray/gen/tmpl_bit/binary.c +29 -29
  127. data/ext/cumo/narray/gen/tmpl_bit/bit_count.c +14 -14
  128. data/ext/cumo/narray/gen/tmpl_bit/bit_count_cpu.c +21 -21
  129. data/ext/cumo/narray/gen/tmpl_bit/bit_count_kernel.cu +28 -28
  130. data/ext/cumo/narray/gen/tmpl_bit/bit_reduce.c +29 -29
  131. data/ext/cumo/narray/gen/tmpl_bit/each.c +10 -10
  132. data/ext/cumo/narray/gen/tmpl_bit/each_with_index.c +10 -10
  133. data/ext/cumo/narray/gen/tmpl_bit/extract.c +8 -8
  134. data/ext/cumo/narray/gen/tmpl_bit/extract_cpu.c +8 -8
  135. data/ext/cumo/narray/gen/tmpl_bit/fill.c +17 -17
  136. data/ext/cumo/narray/gen/tmpl_bit/format.c +14 -14
  137. data/ext/cumo/narray/gen/tmpl_bit/format_to_a.c +11 -11
  138. data/ext/cumo/narray/gen/tmpl_bit/inspect.c +3 -3
  139. data/ext/cumo/narray/gen/tmpl_bit/mask.c +33 -33
  140. data/ext/cumo/narray/gen/tmpl_bit/store_array.c +19 -19
  141. data/ext/cumo/narray/gen/tmpl_bit/store_bit.c +22 -22
  142. data/ext/cumo/narray/gen/tmpl_bit/store_from.c +18 -18
  143. data/ext/cumo/narray/gen/tmpl_bit/to_a.c +12 -12
  144. data/ext/cumo/narray/gen/tmpl_bit/unary.c +24 -24
  145. data/ext/cumo/narray/gen/tmpl_bit/where.c +16 -16
  146. data/ext/cumo/narray/gen/tmpl_bit/where2.c +20 -20
  147. data/ext/cumo/narray/index.c +213 -213
  148. data/ext/cumo/narray/math.c +27 -27
  149. data/ext/cumo/narray/narray.c +484 -484
  150. data/ext/cumo/narray/ndloop.c +259 -258
  151. data/ext/cumo/narray/rand.c +3 -3
  152. data/ext/cumo/narray/step.c +70 -70
  153. data/ext/cumo/narray/struct.c +139 -139
  154. metadata +6 -7
  155. data/ext/cumo/include/cumo/intern_fwd.h +0 -38
  156. data/lib/erbpp.rb +0 -294
  157. data/lib/erbpp/line_number.rb +0 -137
  158. data/lib/erbpp/narray_def.rb +0 -381
@@ -12,7 +12,6 @@ extern "C" {
12
12
  #include "cumo/compat.h"
13
13
  #include "cumo/template.h"
14
14
  #include "cumo/extconf.h"
15
- #include "cumo/intern_fwd.h"
16
15
 
17
16
  #ifdef HAVE_STDBOOL_H
18
17
  # include <stdbool.h>
@@ -50,13 +49,31 @@ extern "C" {
50
49
  # endif
51
50
  #endif
52
51
 
52
+ #ifndef IS_INTEGER_CLASS
53
+ #ifdef RUBY_INTEGER_UNIFICATION
54
+ #define IS_INTEGER_CLASS(c) ((c)==rb_cInteger)
55
+ #else
56
+ #define IS_INTEGER_CLASS(c) ((c)==rb_cFixnum||(c)==rb_cBignum)
57
+ #endif
58
+ #endif
59
+
60
+ #ifndef SZF
53
61
  #define SZF PRI_SIZE_PREFIX // defined in ruby.h
62
+ #endif
54
63
 
55
64
  #if SIZEOF_LONG==8
56
- # define NUM2INT64(x) NUM2LONG(x)
57
- # define INT642NUM(x) LONG2NUM(x)
58
- # define NUM2UINT64(x) NUM2ULONG(x)
59
- # define UINT642NUM(x) ULONG2NUM(x)
65
+ # ifndef NUM2INT64
66
+ # define NUM2INT64(x) NUM2LONG(x)
67
+ # endif
68
+ # ifndef INT642NUM
69
+ # define INT642NUM(x) LONG2NUM(x)
70
+ # endif
71
+ # ifndef NUM2UINT64
72
+ # define NUM2UINT64(x) NUM2ULONG(x)
73
+ # endif
74
+ # ifndef UINT642NUM
75
+ # define UINT642NUM(x) ULONG2NUM(x)
76
+ # endif
60
77
  # ifndef PRId64
61
78
  # define PRId64 "ld"
62
79
  # endif
@@ -64,10 +81,18 @@ extern "C" {
64
81
  # define PRIu64 "lu"
65
82
  # endif
66
83
  #elif SIZEOF_LONG_LONG==8
67
- # define NUM2INT64(x) NUM2LL(x)
68
- # define INT642NUM(x) LL2NUM(x)
69
- # define NUM2UINT64(x) NUM2ULL(x)
70
- # define UINT642NUM(x) ULL2NUM(x)
84
+ # ifndef NUM2INT64
85
+ # define NUM2INT64(x) NUM2LL(x)
86
+ # endif
87
+ # ifndef INT642NUM
88
+ # define INT642NUM(x) LL2NUM(x)
89
+ # endif
90
+ # ifndef NUM2UINT64
91
+ # define NUM2UINT64(x) NUM2ULL(x)
92
+ # endif
93
+ # ifndef UINT642NUM
94
+ # define UINT642NUM(x) ULL2NUM(x)
95
+ # endif
71
96
  # ifndef PRId64
72
97
  # define PRId64 "lld"
73
98
  # endif
@@ -77,10 +102,18 @@ extern "C" {
77
102
  #endif
78
103
 
79
104
  #if SIZEOF_LONG==4
80
- # define NUM2INT32(x) NUM2LONG(x)
81
- # define INT322NUM(x) LONG2NUM(x)
82
- # define NUM2UINT32(x) NUM2ULONG(x)
83
- # define UINT322NUM(x) ULONG2NUM(x)
105
+ # ifndef NUM2INT32
106
+ # define NUM2INT32(x) NUM2LONG(x)
107
+ # endif
108
+ # ifndef INT322NUM
109
+ # define INT322NUM(x) LONG2NUM(x)
110
+ # endif
111
+ # ifndef NUM2UINT32
112
+ # define NUM2UINT32(x) NUM2ULONG(x)
113
+ # endif
114
+ # ifndef UINT322NUM
115
+ # define UINT322NUM(x) ULONG2NUM(x)
116
+ # endif
84
117
  # ifndef PRId32
85
118
  # define PRId32 "ld"
86
119
  # endif
@@ -88,10 +121,18 @@ extern "C" {
88
121
  # define PRIu32 "lu"
89
122
  # endif
90
123
  #elif SIZEOF_INT==4
91
- # define NUM2INT32(x) NUM2INT(x)
92
- # define INT322NUM(x) INT2NUM(x)
93
- # define NUM2UINT32(x) NUM2UINT(x)
94
- # define UINT322NUM(x) UINT2NUM(x)
124
+ # ifndef NUM2INT32
125
+ # define NUM2INT32(x) NUM2INT(x)
126
+ # endif
127
+ # ifndef INT322NUM
128
+ # define INT322NUM(x) INT2NUM(x)
129
+ # endif
130
+ # ifndef NUM2UINT32
131
+ # define NUM2UINT32(x) NUM2UINT(x)
132
+ # endif
133
+ # ifndef UINT322NUM
134
+ # define UINT322NUM(x) UINT2NUM(x)
135
+ # endif
95
136
  # ifndef PRId32
96
137
  # define PRId32 "d"
97
138
  # endif
@@ -117,29 +158,28 @@ extern "C" {
117
158
  # define TRUE 1
118
159
  #endif
119
160
 
120
- typedef struct { float dat[2]; } scomplex;
121
- typedef struct { double dat[2]; } dcomplex;
122
- typedef int fortran_integer;
161
+ typedef struct { float dat[2]; } cumo_scomplex;
162
+ typedef struct { double dat[2]; } cumo_dcomplex;
123
163
 
124
- #define REAL(x) ((x).dat[0])
125
- #define IMAG(x) ((x).dat[1])
164
+ #define CUMO_REAL(x) ((x).dat[0])
165
+ #define CUMO_IMAG(x) ((x).dat[1])
126
166
 
127
- extern int na_debug_flag;
167
+ extern int cumo_na_debug_flag;
128
168
 
129
- #ifndef CUMO_NARRAY_C
130
- extern VALUE cumo_cNArray;
169
+ #define mCumo rb_mCumo
131
170
  extern VALUE rb_mCumo;
132
- extern VALUE nary_eCastError;
133
- extern VALUE nary_eShapeError;
134
- extern VALUE nary_eOperationError;
135
- extern VALUE nary_eDimensionError;
136
- extern VALUE nary_eValueError;
137
- extern const rb_data_type_t na_data_type;
138
-
139
- //EXTERN const int na_sizeof[NA_NTYPES+1];
140
- #endif
171
+ #define cNArray cumo_cNArray
172
+ extern VALUE cumo_cNArray;
173
+ extern VALUE cumo_na_eCastError;
174
+ extern VALUE cumo_na_eShapeError;
175
+ extern VALUE cumo_na_eOperationError;
176
+ extern VALUE cumo_na_eDimensionError;
177
+ extern VALUE cumo_na_eValueError;
178
+ extern const rb_data_type_t cumo_na_data_type;
179
+
180
+ //EXTERN const int cumo_na_sizeof[CUMO_NA_NTYPES+1];
141
181
 
142
- //#define na_upcast(x,y) cumo_na_upcast(x,y)
182
+ //#define cumo_na_upcast(x,y) cumo_na_upcast(x,y)
143
183
 
144
184
  /* global variables within this module */
145
185
  extern VALUE cumo_cBit;
@@ -156,21 +196,21 @@ extern VALUE cumo_cUInt32;
156
196
  extern VALUE cumo_cUInt16;
157
197
  extern VALUE cumo_cUInt8;
158
198
  extern VALUE cumo_cRObject;
159
- extern VALUE na_cStep;
199
+ extern VALUE cumo_na_cStep;
160
200
  #ifndef HAVE_RB_CCOMPLEX
161
201
  extern VALUE rb_cComplex;
162
202
  #endif
163
203
 
164
- extern VALUE sym_reduce;
165
- extern VALUE sym_option;
166
- extern VALUE sym_loop_opt;
167
- extern VALUE sym_init;
204
+ extern VALUE cumo_sym_reduce;
205
+ extern VALUE cumo_sym_option;
206
+ extern VALUE cumo_sym_loop_opt;
207
+ extern VALUE cumo_sym_init;
168
208
 
169
- #define NARRAY_DATA_T 0x1
170
- #define NARRAY_VIEW_T 0x2
171
- #define NARRAY_FILEMAP_T 0x3
209
+ #define CUMO_NARRAY_DATA_T 0x1
210
+ #define CUMO_NARRAY_VIEW_T 0x2
211
+ #define CUMO_NARRAY_FILEMAP_T 0x3
172
212
 
173
- typedef struct RNArray {
213
+ typedef struct {
174
214
  unsigned char ndim; // # of dimensions
175
215
  unsigned char type;
176
216
  unsigned char flag[2]; // flags
@@ -178,35 +218,35 @@ typedef struct RNArray {
178
218
  size_t size; // # of total elements
179
219
  size_t *shape; // # of elements for each dimension
180
220
  VALUE reduce;
181
- } narray_t;
221
+ } cumo_narray_t;
182
222
 
183
223
 
184
- typedef struct RNArrayData {
185
- narray_t base;
224
+ typedef struct {
225
+ cumo_narray_t base;
186
226
  char *ptr;
187
- } narray_data_t;
227
+ } cumo_narray_data_t;
188
228
 
189
229
 
190
230
  typedef union {
191
231
  ssize_t stride;
192
232
  size_t *index;
193
- } stridx_t;
233
+ } cumo_stridx_t;
194
234
 
195
- typedef struct RNArrayView {
196
- narray_t base;
235
+ typedef struct {
236
+ cumo_narray_t base;
197
237
  VALUE data; // data object
198
238
  size_t offset; // offset of start point from data pointer
199
239
  // :in units of elm.unit_bits
200
240
  // address_unit pointer_unit access_unit data_unit
201
241
  // elm.step_unit = elm.bit_size / elm.access_unit
202
242
  // elm.step_unit = elm.size_bits / elm.unit_bits
203
- stridx_t *stridx; // stride or indices of data pointer for each dimension
204
- } narray_view_t;
243
+ cumo_stridx_t *stridx; // stride or indices of data pointer for each dimension
244
+ } cumo_narray_view_t;
205
245
 
206
246
 
207
247
  // filemap is unimplemented
208
- typedef struct RNArrayFileMap {
209
- narray_t base;
248
+ typedef struct {
249
+ cumo_narray_t base;
210
250
  char *ptr;
211
251
  #ifdef WIN32
212
252
  HANDLE hFile;
@@ -215,7 +255,7 @@ typedef struct RNArrayFileMap {
215
255
  int prot;
216
256
  int flag;
217
257
  #endif
218
- } narray_filemap_t;
258
+ } cumo_narray_filemap_t;
219
259
 
220
260
 
221
261
  // this will be revised in future.
@@ -223,101 +263,101 @@ typedef struct {
223
263
  unsigned int element_bits;
224
264
  unsigned int element_bytes;
225
265
  unsigned int element_stride;
226
- } narray_type_info_t;
266
+ } cumo_narray_type_info_t;
227
267
 
228
268
 
229
- static inline narray_t *
230
- na_get_narray_t(VALUE obj)
269
+ static inline cumo_narray_t *
270
+ cumo_na_get_narray_t(VALUE obj)
231
271
  {
232
- narray_t *na;
272
+ cumo_narray_t *na;
233
273
 
234
- Check_TypedStruct(obj,&na_data_type);
235
- na = (narray_t*)DATA_PTR(obj);
274
+ Check_TypedStruct(obj,&cumo_na_data_type);
275
+ na = (cumo_narray_t*)DATA_PTR(obj);
236
276
  return na;
237
277
  }
238
278
 
239
- static inline narray_t *
240
- _na_get_narray_t(VALUE obj, unsigned char na_type)
279
+ static inline cumo_narray_t *
280
+ _cumo_na_get_narray_t(VALUE obj, unsigned char cumo_na_type)
241
281
  {
242
- narray_t *na;
282
+ cumo_narray_t *na;
243
283
 
244
- Check_TypedStruct(obj,&na_data_type);
245
- na = (narray_t*)DATA_PTR(obj);
246
- if (na->type != na_type) {
247
- rb_bug("unknown type 0x%x (0x%x given)", na_type, na->type);
284
+ Check_TypedStruct(obj,&cumo_na_data_type);
285
+ na = (cumo_narray_t*)DATA_PTR(obj);
286
+ if (na->type != cumo_na_type) {
287
+ rb_bug("unknown type 0x%x (0x%x given)", cumo_na_type, na->type);
248
288
  }
249
289
  return na;
250
290
  }
251
291
 
252
- #define na_get_narray_data_t(obj) (narray_data_t*)_na_get_narray_t(obj,NARRAY_DATA_T)
253
- #define na_get_narray_view_t(obj) (narray_view_t*)_na_get_narray_t(obj,NARRAY_VIEW_T)
254
- #define na_get_narray_filemap_t(obj) (narray_filemap_t*)_na_get_narray_t(obj,NARRAY_FILEMAP_T)
292
+ #define cumo_na_get_narray_data_t(obj) (cumo_narray_data_t*)_cumo_na_get_narray_t(obj,CUMO_NARRAY_DATA_T)
293
+ #define cumo_na_get_narray_view_t(obj) (cumo_narray_view_t*)_cumo_na_get_narray_t(obj,CUMO_NARRAY_VIEW_T)
294
+ #define cumo_na_get_narray_filemap_t(obj) (cumo_narray_filemap_t*)_cumo_na_get_narray_t(obj,CUMO_NARRAY_FILEMAP_T)
255
295
 
256
- #define GetNArray(obj,var) TypedData_Get_Struct(obj, narray_t, &na_data_type, var)
257
- #define GetNArrayView(obj,var) TypedData_Get_Struct(obj, narray_view_t, &na_data_type, var)
258
- #define GetNArrayData(obj,var) TypedData_Get_Struct(obj, narray_data_t, &na_data_type, var)
296
+ #define CumoGetNArray(obj,var) TypedData_Get_Struct(obj, cumo_narray_t, &cumo_na_data_type, var)
297
+ #define CumoGetNArrayView(obj,var) TypedData_Get_Struct(obj, cumo_narray_view_t, &cumo_na_data_type, var)
298
+ #define CumoGetNArrayData(obj,var) TypedData_Get_Struct(obj, cumo_narray_data_t, &cumo_na_data_type, var)
259
299
 
260
- #define SDX_IS_STRIDE(x) ((x).stride&0x1)
261
- #define SDX_IS_INDEX(x) (!SDX_IS_STRIDE(x))
262
- #define SDX_GET_STRIDE(x) ((x).stride>>1)
263
- #define SDX_GET_INDEX(x) ((x).index)
300
+ #define CUMO_SDX_IS_STRIDE(x) ((x).stride&0x1)
301
+ #define CUMO_SDX_IS_INDEX(x) (!CUMO_SDX_IS_STRIDE(x))
302
+ #define CUMO_SDX_GET_STRIDE(x) ((x).stride>>1)
303
+ #define CUMO_SDX_GET_INDEX(x) ((x).index)
264
304
 
265
- #define SDX_SET_STRIDE(x,s) ((x).stride=((s)<<1)|0x1)
266
- #define SDX_SET_INDEX(x,idx) ((x).index=idx)
305
+ #define CUMO_SDX_SET_STRIDE(x,s) ((x).stride=((s)<<1)|0x1)
306
+ #define CUMO_SDX_SET_INDEX(x,idx) ((x).index=idx)
267
307
 
268
- #define RNARRAY(val) ((narray_t*)DATA_PTR(val))
269
- #define RNARRAY_DATA(val) ((narray_data_t*)DATA_PTR(val))
270
- #define RNARRAY_VIEW(val) ((narray_view_t*)DATA_PTR(val))
271
- #define RNARRAY_FILEMAP(val) ((narray_filemap_t*)DATA_PTR(val))
308
+ #define CUMO_RNARRAY(val) ((cumo_narray_t*)DATA_PTR(val))
309
+ #define CUMO_RNARRAY_DATA(val) ((cumo_narray_data_t*)DATA_PTR(val))
310
+ #define CUMO_RNARRAY_VIEW(val) ((cumo_narray_view_t*)DATA_PTR(val))
311
+ #define CUMO_RNARRAY_FILEMAP(val) ((cumo_narray_filemap_t*)DATA_PTR(val))
272
312
 
273
- #define RNARRAY_NDIM(val) (RNARRAY(val)->ndim)
274
- #define RNARRAY_TYPE(val) (RNARRAY(val)->type)
275
- #define RNARRAY_FLAG(val) (RNARRAY(val)->flag)
276
- #define RNARRAY_SIZE(val) (RNARRAY(val)->size)
277
- #define RNARRAY_SHAPE(val) (RNARRAY(val)->shape)
278
- #define RNARRAY_REDUCE(val) (RNARRAY(val)->reduce)
313
+ #define CUMO_RNARRAY_NDIM(val) (CUMO_RNARRAY(val)->ndim)
314
+ #define CUMO_RNARRAY_TYPE(val) (CUMO_RNARRAY(val)->type)
315
+ #define CUMO_RNARRAY_FLAG(val) (CUMO_RNARRAY(val)->flag)
316
+ #define CUMO_RNARRAY_SIZE(val) (CUMO_RNARRAY(val)->size)
317
+ #define CUMO_RNARRAY_SHAPE(val) (CUMO_RNARRAY(val)->shape)
318
+ #define CUMO_RNARRAY_REDUCE(val) (CUMO_RNARRAY(val)->reduce)
279
319
 
280
- #define RNARRAY_DATA_PTR(val) (RNARRAY_DATA(val)->ptr)
281
- #define RNARRAY_VIEW_DATA(val) (RNARRAY_VIEW(val)->data)
282
- #define RNARRAY_VIEW_OFFSET(val) (RNARRAY_VIEW(val)->offset)
283
- #define RNARRAY_VIEW_STRIDX(val) (RNARRAY_VIEW(val)->stridx)
320
+ #define CUMO_RNARRAY_DATA_PTR(val) (CUMO_RNARRAY_DATA(val)->ptr)
321
+ #define CUMO_RNARRAY_VIEW_DATA(val) (CUMO_RNARRAY_VIEW(val)->data)
322
+ #define CUMO_RNARRAY_VIEW_OFFSET(val) (CUMO_RNARRAY_VIEW(val)->offset)
323
+ #define CUMO_RNARRAY_VIEW_STRIDX(val) (CUMO_RNARRAY_VIEW(val)->stridx)
284
324
 
285
- #define NA_NDIM(na) (((narray_t*)na)->ndim)
286
- #define NA_TYPE(na) (((narray_t*)na)->type)
287
- #define NA_SIZE(na) (((narray_t*)na)->size)
288
- #define NA_SHAPE(na) (((narray_t*)na)->shape)
289
- #define NA_REDUCE(na) (((narray_t*)na)->reduce)
325
+ #define CUMO_NA_NDIM(na) (((cumo_narray_t*)na)->ndim)
326
+ #define CUMO_NA_TYPE(na) (((cumo_narray_t*)na)->type)
327
+ #define CUMO_NA_SIZE(na) (((cumo_narray_t*)na)->size)
328
+ #define CUMO_NA_SHAPE(na) (((cumo_narray_t*)na)->shape)
329
+ #define CUMO_NA_REDUCE(na) (((cumo_narray_t*)na)->reduce)
290
330
 
291
- #define NA_FLAG(obj) (na_get_narray_t(obj)->flag)
292
- #define NA_FLAG0(obj) (NA_FLAG(obj)[0])
293
- #define NA_FLAG1(obj) (NA_FLAG(obj)[1])
331
+ #define CUMO_NA_FLAG(obj) (cumo_na_get_narray_t(obj)->flag)
332
+ #define CUMO_NA_FLAG0(obj) (CUMO_NA_FLAG(obj)[0])
333
+ #define CUMO_NA_FLAG1(obj) (CUMO_NA_FLAG(obj)[1])
294
334
 
295
- #define NA_DATA(na) ((narray_data_t*)(na))
296
- #define NA_VIEW(na) ((narray_view_t*)(na))
297
- #define NA_DATA_PTR(na) (NA_DATA(na)->ptr)
298
- #define NA_VIEW_DATA(na) (NA_VIEW(na)->data)
299
- #define NA_VIEW_OFFSET(na) (NA_VIEW(na)->offset)
300
- #define NA_VIEW_STRIDX(na) (NA_VIEW(na)->stridx)
335
+ #define CUMO_NA_DATA(na) ((cumo_narray_data_t*)(na))
336
+ #define CUMO_NA_VIEW(na) ((cumo_narray_view_t*)(na))
337
+ #define CUMO_NA_DATA_PTR(na) (CUMO_NA_DATA(na)->ptr)
338
+ #define CUMO_NA_VIEW_DATA(na) (CUMO_NA_VIEW(na)->data)
339
+ #define CUMO_NA_VIEW_OFFSET(na) (CUMO_NA_VIEW(na)->offset)
340
+ #define CUMO_NA_VIEW_STRIDX(na) (CUMO_NA_VIEW(na)->stridx)
301
341
 
302
- #define NA_IS_INDEX_AT(na,i) (SDX_IS_INDEX(NA_VIEW_STRIDX(na)[i]))
303
- #define NA_IS_STRIDE_AT(na,i) (SDX_IS_STRIDE(NA_VIEW_STRIDX(na)[i]))
304
- #define NA_INDEX_AT(na,i) (SDX_GET_INDEX(NA_VIEW_STRIDX(na)[i]))
305
- #define NA_STRIDE_AT(na,i) (SDX_GET_STRIDE(NA_VIEW_STRIDX(na)[i]))
342
+ #define CUMO_NA_IS_INDEX_AT(na,i) (CUMO_SDX_IS_INDEX(CUMO_NA_VIEW_STRIDX(na)[i]))
343
+ #define CUMO_NA_IS_STRIDE_AT(na,i) (CUMO_SDX_IS_STRIDE(CUMO_NA_VIEW_STRIDX(na)[i]))
344
+ #define CUMO_NA_INDEX_AT(na,i) (CUMO_SDX_GET_INDEX(CUMO_NA_VIEW_STRIDX(na)[i]))
345
+ #define CUMO_NA_STRIDE_AT(na,i) (CUMO_SDX_GET_STRIDE(CUMO_NA_VIEW_STRIDX(na)[i]))
306
346
 
307
- #define NA_FILEMAP_PTR(na) (((narray_filemap_t*)na)->ptr)
347
+ #define CUMO_NA_FILEMAP_PTR(na) (((cumo_narray_filemap_t*)na)->ptr)
308
348
 
309
349
 
310
- #define NA_FL0_TEST(x,f) (NA_FLAG0(x)&(f))
311
- #define NA_FL1_TEST(x,f) (NA_FLAG1(x)&(f))
350
+ #define CUMO_NA_FL0_TEST(x,f) (CUMO_NA_FLAG0(x)&(f))
351
+ #define CUMO_NA_FL1_TEST(x,f) (CUMO_NA_FLAG1(x)&(f))
312
352
 
313
- #define NA_FL0_SET(x,f) do {NA_FLAG0(x) |= (f);} while(0)
314
- #define NA_FL1_SET(x,f) do {NA_FLAG1(x) |= (f);} while(0)
353
+ #define CUMO_NA_FL0_SET(x,f) do {CUMO_NA_FLAG0(x) |= (f);} while(0)
354
+ #define CUMO_NA_FL1_SET(x,f) do {CUMO_NA_FLAG1(x) |= (f);} while(0)
315
355
 
316
- #define NA_FL0_UNSET(x,f) do {NA_FLAG0(x) &= ~(f);} while(0)
317
- #define NA_FL1_UNSET(x,f) do {NA_FLAG1(x) &= ~(f);} while(0)
356
+ #define CUMO_NA_FL0_UNSET(x,f) do {CUMO_NA_FLAG0(x) &= ~(f);} while(0)
357
+ #define CUMO_NA_FL1_UNSET(x,f) do {CUMO_NA_FLAG1(x) &= ~(f);} while(0)
318
358
 
319
- #define NA_FL0_REVERSE(x,f) do {NA_FLAG0(x) ^= (f);} while(0)
320
- #define NA_FL1_REVERSE(x,f) do {NA_FLAG1(x) ^= (f);} while(0)
359
+ #define CUMO_NA_FL0_REVERSE(x,f) do {CUMO_NA_FLAG0(x) ^= (f);} while(0)
360
+ #define CUMO_NA_FL1_REVERSE(x,f) do {CUMO_NA_FLAG1(x) ^= (f);} while(0)
321
361
 
322
362
 
323
363
  /* FLAGS
@@ -328,93 +368,82 @@ _na_get_narray_t(VALUE obj, unsigned char na_type)
328
368
  - matrix or not
329
369
  */
330
370
 
331
- #define NA_FL0_BIG_ENDIAN (0x1<<0)
332
- #define NA_FL0_COLUMN_MAJOR (0x1<<1)
333
- #define NA_FL1_LOCK (0x1<<0)
334
- #define NA_FL1_INPLACE (0x1<<1)
371
+ #define CUMO_NA_FL0_BIG_ENDIAN (0x1<<0)
372
+ #define CUMO_NA_FL0_COLUMN_MAJOR (0x1<<1)
373
+ #define CUMO_NA_FL1_LOCK (0x1<<0)
374
+ #define CUMO_NA_FL1_INPLACE (0x1<<1)
335
375
 
336
- #define TEST_COLUMN_MAJOR(x) NA_FL0_TEST(x,NA_FL0_COLUMN_MAJOR)
337
- #define SET_COLUMN_MAJOR(x) NA_FL0_SET(x,NA_FL0_COLUMN_MAJOR)
338
- #define UNSET_COLUMN_MAJOR(x) NA_FL0_UNSET(x,NA_FL0_COLUMN_MAJOR)
376
+ #define CUMO_TEST_COLUMN_MAJOR(x) CUMO_NA_FL0_TEST(x,CUMO_NA_FL0_COLUMN_MAJOR)
377
+ #define CUMO_SET_COLUMN_MAJOR(x) CUMO_NA_FL0_SET(x,CUMO_NA_FL0_COLUMN_MAJOR)
378
+ #define CUMO_UNSET_COLUMN_MAJOR(x) CUMO_NA_FL0_UNSET(x,CUMO_NA_FL0_COLUMN_MAJOR)
339
379
 
340
- #define TEST_ROW_MAJOR(x) (!TEST_COLUMN_MAJOR(x))
341
- #define SET_ROW_MAJOR(x) UNSET_COLUMN_MAJOR(x)
342
- #define UNSET_ROW_MAJOR(x) SET_COLUMN_MAJOR(x)
380
+ #define CUMO_TEST_ROW_MAJOR(x) (!CUMO_TEST_COLUMN_MAJOR(x))
381
+ #define CUMO_SET_ROW_MAJOR(x) CUMO_UNSET_COLUMN_MAJOR(x)
382
+ #define CUMO_UNSET_ROW_MAJOR(x) CUMO_SET_COLUMN_MAJOR(x)
343
383
 
344
- #define TEST_BIG_ENDIAN(x) NA_FL0_TEST(x,NA_FL0_BIG_ENDIAN)
345
- #define SET_BIG_ENDIAN(x) NA_FL0_SET(x,NA_FL0_BIG_ENDIAN)
346
- #define UNSET_BIG_ENDIAN(x) NA_FL0_UNSET(x,NA_FL0_BIG_ENDIAN)
384
+ #define CUMO_TEST_BIG_ENDIAN(x) CUMO_NA_FL0_TEST(x,CUMO_NA_FL0_BIG_ENDIAN)
385
+ #define CUMO_SET_BIG_ENDIAN(x) CUMO_NA_FL0_SET(x,CUMO_NA_FL0_BIG_ENDIAN)
386
+ #define CUMO_UNSET_BIG_ENDIAN(x) CUMO_NA_FL0_UNSET(x,CUMO_NA_FL0_BIG_ENDIAN)
347
387
 
348
- #define TEST_LITTLE_ENDIAN(x) (!TEST_BIG_ENDIAN(x))
349
- #define SET_LITTLE_ENDIAN(x) UNSET_BIG_ENDIAN(x)
350
- #define UNSET_LITTLE_ENDIAN(x) SET_BIG_ENDIAN(x)
388
+ #define CUMO_TEST_LITTLE_ENDIAN(x) (!CUMO_TEST_BIG_ENDIAN(x))
389
+ #define CUMO_SET_LITTLE_ENDIAN(x) CUMO_UNSET_BIG_ENDIAN(x)
390
+ #define CUMO_UNSET_LITTLE_ENDIAN(x) CUMO_SET_BIG_ENDIAN(x)
351
391
 
352
- #define REVERSE_ENDIAN(x) NA_FL0_REVERSE((x),NA_FL0_BIG_ENDIAN)
392
+ #define CUMO_REVERSE_ENDIAN(x) CUMO_NA_FL0_REVERSE((x),CUMO_NA_FL0_BIG_ENDIAN)
353
393
 
354
- #define TEST_LOCK(x) NA_FL1_TEST(x,NA_FL1_LOCK)
355
- #define SET_LOCK(x) NA_FL1_SET(x,NA_FL1_LOCK)
356
- #define UNSET_LOCK(x) NA_FL1_UNSET(x,NA_FL1_LOCK)
394
+ #define CUMO_TEST_LOCK(x) CUMO_NA_FL1_TEST(x,CUMO_NA_FL1_LOCK)
395
+ #define CUMO_SET_LOCK(x) CUMO_NA_FL1_SET(x,CUMO_NA_FL1_LOCK)
396
+ #define CUMO_UNCUMO_SET_LOCK(x) CUMO_NA_FL1_UNSET(x,CUMO_NA_FL1_LOCK)
357
397
 
358
- #define TEST_INPLACE(x) NA_FL1_TEST(x,NA_FL1_INPLACE)
359
- #define SET_INPLACE(x) NA_FL1_SET(x,NA_FL1_INPLACE)
360
- #define UNSET_INPLACE(x) NA_FL1_UNSET(x,NA_FL1_INPLACE)
398
+ #define CUMO_TEST_INPLACE(x) CUMO_NA_FL1_TEST(x,CUMO_NA_FL1_INPLACE)
399
+ #define CUMO_SET_INPLACE(x) CUMO_NA_FL1_SET(x,CUMO_NA_FL1_INPLACE)
400
+ #define CUMO_UNCUMO_SET_INPLACE(x) CUMO_NA_FL1_UNSET(x,CUMO_NA_FL1_INPLACE)
361
401
 
362
402
  #ifdef DYNAMIC_ENDIAN
363
403
  // not supported
364
404
  #else
365
405
  #ifdef WORDS_BIGENDIAN
366
- #define TEST_HOST_ORDER(x) TEST_BIG_ENDIAN(x)
367
- #define SET_HOST_ORDER(x) SET_BIG_ENDIAN(x)
368
- #define UNSET_HOST_ORDER(x) UNSET_BIG_ENDIAN(x)
369
- #define TEST_BYTE_SWAPPED(x) TEST_LITTLE_ENDIAN(x)
370
- #define SET_BYTE_SWAPPED(x) SET_LITTLE_ENDIAN(x)
371
- #define UNSET_BYTE_SWAPPED(x) UNSET_LITTLE_ENDIAN(x)
372
- #define NA_FL0_INIT NA_FL0_BIG_ENDIAN
406
+ #define CUMO_TEST_HOST_ORDER(x) CUMO_TEST_BIG_ENDIAN(x)
407
+ #define CUMO_SET_HOST_ORDER(x) CUMO_SET_BIG_ENDIAN(x)
408
+ #define CUMO_UNSET_HOST_ORDER(x) CUMO_UNSET_BIG_ENDIAN(x)
409
+ #define CUMO_TEST_BYTE_SWAPPED(x) CUMO_TEST_LITTLE_ENDIAN(x)
410
+ #define CUMO_SET_BYTE_SWAPPED(x) CUMO_SET_LITTLE_ENDIAN(x)
411
+ #define CUMO_UNCUMO_SET_BYTE_SWAPPED(x) CUMO_UNSET_LITTLE_ENDIAN(x)
412
+ #define CUMO_NA_FL0_INIT CUMO_NA_FL0_BIG_ENDIAN
373
413
  #else // LITTLE ENDIAN
374
- #define TEST_HOST_ORDER(x) TEST_LITTLE_ENDIAN(x)
375
- #define SET_HOST_ORDER(x) SET_LITTLE_ENDIAN(x)
376
- #define UNSET_HOST_ORDER(x) UNSET_LITTLE_ENDIAN(x)
377
- #define TEST_BYTE_SWAPPED(x) TEST_BIG_ENDIAN(x)
378
- #define SET_BYTE_SWAPPED(x) SET_BIG_ENDIAN(x)
379
- #define UNSET_BYTE_SWAPPED(x) UNSET_BIG_ENDIAN(x)
380
- #define NA_FL0_INIT 0
414
+ #define CUMO_TEST_HOST_ORDER(x) CUMO_TEST_LITTLE_ENDIAN(x)
415
+ #define CUMO_SET_HOST_ORDER(x) CUMO_SET_LITTLE_ENDIAN(x)
416
+ #define CUMO_UNSET_HOST_ORDER(x) CUMO_UNSET_LITTLE_ENDIAN(x)
417
+ #define CUMO_TEST_BYTE_SWAPPED(x) CUMO_TEST_BIG_ENDIAN(x)
418
+ #define CUMO_SET_BYTE_SWAPPED(x) CUMO_SET_BIG_ENDIAN(x)
419
+ #define CUMO_UNCUMO_SET_BYTE_SWAPPED(x) CUMO_UNSET_BIG_ENDIAN(x)
420
+ #define CUMO_NA_FL0_INIT 0
381
421
  #endif
382
422
  #endif
383
- #define NA_FL1_INIT 0
423
+ #define CUMO_NA_FL1_INIT 0
384
424
 
385
425
 
386
- #define IsNArray(obj) (rb_obj_is_kind_of(obj,cNArray)==Qtrue)
426
+ #define CumoIsNArray(obj) (rb_obj_is_kind_of(obj,cNArray)==Qtrue)
387
427
 
388
- #define DEBUG_PRINT(v) puts(StringValueCStr(rb_funcall(v,rb_intern("inspect"),0)))
428
+ #define CUMO_DEBUG_PRINT(v) puts(StringValueCStr(rb_funcall(v,rb_intern("inspect"),0)))
389
429
 
390
- #define NA_IsNArray(obj) \
430
+ #define CUMO_NA_CumoIsNArray(obj) \
391
431
  (rb_obj_is_kind_of(obj,cNArray)==Qtrue)
392
- #define NA_IsArray(obj) \
432
+ #define CUMO_NA_IsArray(obj) \
393
433
  (TYPE(obj)==T_ARRAY || rb_obj_is_kind_of(obj,cNArray)==Qtrue)
394
434
 
395
- #define NUM2REAL(v) NUM2DBL( rb_funcall((v),na_id_real,0) )
396
- #define NUM2IMAG(v) NUM2DBL( rb_funcall((v),na_id_imag,0) )
397
-
398
- //#define NA_MAX_DIMENSION (int)(sizeof(VALUE)*8-2)
399
- #define NA_MAX_DIMENSION 12
400
- #define NA_MAX_ELMSZ 65535
401
-
402
- typedef unsigned int BIT_DIGIT;
403
- #define BYTE_BIT_DIGIT sizeof(BIT_DIGIT)
404
- #define NB (sizeof(BIT_DIGIT)*8)
405
- #define BALL (~(BIT_DIGIT)0)
406
- #define SLB(n) (((n)==NB)?~(BIT_DIGIT)0:(~(~(BIT_DIGIT)0<<(n))))
407
-
408
- #define ELEMENT_BIT_SIZE "ELEMENT_BIT_SIZE"
409
- #define ELEMENT_BYTE_SIZE "ELEMENT_BYTE_SIZE"
410
- #define CONTIGUOUS_STRIDE "CONTIGUOUS_STRIDE"
435
+ #define CUMO_NUM2REAL(v) NUM2DBL( rb_funcall((v),cumo_na_id_real,0) )
436
+ #define CUMO_NUM2IMAG(v) NUM2DBL( rb_funcall((v),cumo_na_id_imag,0) )
411
437
 
438
+ //#define CUMO_NA_MAX_DIMENSION (int)(sizeof(VALUE)*8-2)
439
+ #define CUMO_NA_MAX_DIMENSION 12
440
+ #define CUMO_NA_MAX_ELMSZ 65535
412
441
 
413
- #ifdef RUBY_INTEGER_UNIFICATION
414
- #define IS_INTEGER_CLASS(c) ((c)==rb_cInteger)
415
- #else
416
- #define IS_INTEGER_CLASS(c) ((c)==rb_cFixnum||(c)==rb_cBignum)
417
- #endif
442
+ typedef unsigned int CUMO_BIT_DIGIT;
443
+ #define CUMO_BYTE_BIT_DIGIT sizeof(CUMO_BIT_DIGIT)
444
+ #define CUMO_NB (sizeof(CUMO_BIT_DIGIT)*8)
445
+ #define CUMO_BALL (~(CUMO_BIT_DIGIT)0)
446
+ #define CUMO_SLB(n) (((n)==CUMO_NB)?~(CUMO_BIT_DIGIT)0:(~(~(CUMO_BIT_DIGIT)0<<(n))))
418
447
 
419
448
  #include "cumo/ndloop.h"
420
449
  #include "cumo/intern.h"