carray 1.5.1 → 1.5.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +32 -0
- data/{LICENSES → LICENSE} +0 -0
- data/NEWS.md +83 -0
- data/README.md +34 -18
- data/Rakefile +1 -1
- data/TODO.md +17 -0
- data/carray.gemspec +10 -7
- data/ext/ca_iter_block.c +3 -5
- data/ext/ca_iter_dimension.c +4 -5
- data/ext/ca_iter_window.c +2 -4
- data/ext/ca_obj_array.c +394 -124
- data/ext/ca_obj_bitarray.c +6 -11
- data/ext/ca_obj_bitfield.c +5 -9
- data/ext/ca_obj_block.c +5 -12
- data/ext/ca_obj_fake.c +3 -5
- data/ext/ca_obj_farray.c +3 -5
- data/ext/ca_obj_field.c +15 -17
- data/ext/ca_obj_grid.c +5 -6
- data/ext/ca_obj_mapping.c +2 -4
- data/ext/ca_obj_object.c +3 -5
- data/ext/ca_obj_reduce.c +2 -4
- data/ext/ca_obj_refer.c +11 -15
- data/ext/ca_obj_repeat.c +2 -4
- data/ext/ca_obj_select.c +2 -4
- data/ext/ca_obj_shift.c +3 -5
- data/ext/ca_obj_transpose.c +3 -5
- data/ext/ca_obj_unbound_repeat.c +68 -122
- data/ext/ca_obj_window.c +7 -9
- data/ext/carray.h +17 -8
- data/ext/carray_access.c +183 -58
- data/ext/carray_attribute.c +151 -197
- data/ext/carray_call_cfunc.c +1 -3
- data/ext/carray_cast.c +345 -144
- data/ext/carray_cast_func.rb +1 -2
- data/ext/carray_class.c +28 -36
- data/ext/carray_conversion.c +56 -59
- data/ext/carray_copy.c +16 -32
- data/ext/carray_core.c +73 -60
- data/ext/carray_element.c +25 -44
- data/ext/carray_generate.c +74 -53
- data/ext/carray_iterator.c +13 -15
- data/ext/carray_loop.c +53 -82
- data/ext/carray_mask.c +99 -119
- data/ext/carray_math.rb +28 -12
- data/ext/carray_mathfunc.c +1 -3
- data/ext/carray_numeric.c +42 -45
- data/ext/carray_operator.c +45 -32
- data/ext/carray_order.c +231 -65
- data/ext/carray_sort_addr.c +14 -21
- data/ext/carray_stat.c +1 -3
- data/ext/carray_stat_proc.rb +2 -4
- data/ext/carray_test.c +41 -30
- data/ext/carray_undef.c +1 -11
- data/ext/carray_utils.c +138 -51
- data/ext/extconf.rb +14 -2
- data/ext/mkmath.rb +2 -2
- data/ext/ruby_carray.c +15 -7
- data/ext/ruby_ccomplex.c +2 -4
- data/ext/ruby_float_func.c +1 -3
- data/ext/version.h +5 -7
- data/lib/carray.rb +9 -9
- data/lib/carray/autoload.rb +0 -2
- data/lib/carray/autoload/autoload_gem_numo_narray.rb +6 -6
- data/lib/carray/basic.rb +1 -3
- data/lib/carray/broadcast.rb +101 -0
- data/lib/carray/compose.rb +34 -10
- data/lib/carray/construct.rb +57 -18
- data/lib/carray/info.rb +1 -3
- data/lib/carray/inspect.rb +3 -5
- data/lib/carray/io/imagemagick.rb +1 -3
- data/lib/carray/iterator.rb +3 -3
- data/lib/carray/mask.rb +18 -7
- data/lib/carray/math.rb +4 -6
- data/lib/carray/math/histogram.rb +1 -3
- data/lib/carray/math/recurrence.rb +1 -3
- data/lib/carray/mkmf.rb +1 -3
- data/lib/carray/object/ca_obj_iterator.rb +1 -3
- data/lib/carray/object/ca_obj_link.rb +1 -3
- data/lib/carray/object/ca_obj_pack.rb +1 -3
- data/lib/carray/obsolete.rb +1 -17
- data/lib/carray/ordering.rb +29 -5
- data/lib/carray/serialize.rb +34 -25
- data/lib/carray/string.rb +1 -3
- data/lib/carray/struct.rb +3 -5
- data/lib/carray/testing.rb +5 -10
- data/lib/carray/time.rb +1 -3
- data/lib/carray/transform.rb +12 -3
- data/misc/NOTE +16 -38
- data/spec/Classes/CABitfield_spec.rb +58 -0
- data/spec/Classes/CABlockIterator_spec.rb +114 -0
- data/spec/Classes/CABlock_spec.rb +205 -0
- data/spec/Classes/CAField_spec.rb +39 -0
- data/spec/Classes/CAGrid_spec.rb +75 -0
- data/spec/Classes/CAMap_spec.rb +0 -0
- data/{test/test_CAMapping.rb → spec/Classes/CAMapping_spec.rb} +35 -36
- data/spec/Classes/CAObject_attribute_spec.rb +33 -0
- data/spec/Classes/CAObject_spec.rb +33 -0
- data/spec/Classes/CARefer_spec.rb +93 -0
- data/spec/Classes/CARepeat_spec.rb +65 -0
- data/spec/Classes/CASelect_spec.rb +22 -0
- data/spec/Classes/CAShift_spec.rb +16 -0
- data/spec/Classes/CAStruct_spec.rb +71 -0
- data/{test/test_CATranspose.rb → spec/Classes/CATranspose_spec.rb} +20 -21
- data/spec/Classes/CAUnboudRepeat_spec.rb +102 -0
- data/spec/Classes/CAWindow_spec.rb +54 -0
- data/spec/Classes/CAWrap_spec.rb +8 -0
- data/{test/test_CArray.rb → spec/Classes/CArray_spec.rb} +48 -92
- data/spec/Classes/CScalar_spec.rb +55 -0
- data/spec/Features/feature_130_spec.rb +19 -0
- data/spec/Features/feature_attributes_spec.rb +280 -0
- data/spec/Features/feature_boolean_spec.rb +98 -0
- data/spec/Features/feature_broadcast.rb +116 -0
- data/spec/Features/feature_cast_function.rb +19 -0
- data/spec/Features/feature_cast_spec.rb +33 -0
- data/spec/Features/feature_class_spec.rb +84 -0
- data/spec/Features/feature_complex_spec.rb +42 -0
- data/{test/test_composite.rb → spec/Features/feature_composite_spec.rb} +17 -18
- data/spec/Features/feature_convert_spec.rb +46 -0
- data/spec/Features/feature_copy_spec.rb +123 -0
- data/spec/Features/feature_creation_spec.rb +84 -0
- data/spec/Features/feature_element_spec.rb +144 -0
- data/spec/Features/feature_extream_spec.rb +54 -0
- data/spec/Features/feature_generate_spec.rb +74 -0
- data/spec/Features/feature_index_spec.rb +69 -0
- data/spec/Features/feature_mask_spec.rb +580 -0
- data/spec/Features/feature_math_spec.rb +97 -0
- data/spec/Features/feature_order_spec.rb +146 -0
- data/spec/Features/feature_ref_store_spec.rb +209 -0
- data/spec/Features/feature_serialization_spec.rb +125 -0
- data/spec/Features/feature_stat_spec.rb +397 -0
- data/spec/Features/feature_virtual_spec.rb +48 -0
- data/spec/Features/method_eq_spec.rb +81 -0
- data/spec/Features/method_is_nan_spec.rb +12 -0
- data/spec/Features/method_map_spec.rb +54 -0
- data/spec/Features/method_max_with.rb +20 -0
- data/spec/Features/method_min_with.rb +19 -0
- data/spec/Features/method_ne_spec.rb +18 -0
- data/spec/Features/method_project_spec.rb +188 -0
- data/spec/Features/method_ref_spec.rb +27 -0
- data/spec/Features/method_round_spec.rb +11 -0
- data/spec/Features/method_s_linspace_spec.rb +48 -0
- data/spec/Features/method_s_span_spec.rb +14 -0
- data/spec/Features/method_seq_spec.rb +47 -0
- data/spec/Features/method_sort_with.rb +43 -0
- data/spec/Features/method_sorted_with.rb +29 -0
- data/spec/Features/method_span_spec.rb +42 -0
- data/spec/Features/method_wrap_readonly_spec.rb +43 -0
- data/{test → spec/UnitTest}/test_CAVirtual.rb +0 -0
- data/spec/spec_all.rb +0 -1
- data/utils/convert_test.rb +73 -0
- data/utils/{extract_rdoc.rb → extract_yard.rb} +7 -12
- metadata +74 -58
- data/spec/CABlockIterator/CABlockIterator_spec.rb +0 -113
- data/spec/CArray/bug/store_spec.rb +0 -27
- data/spec/CArray/index/repeat_spec.rb +0 -10
- data/spec/CArray/method/eq_spec.rb +0 -80
- data/spec/CArray/method/is_nan_spec.rb +0 -12
- data/spec/CArray/method/ne_spec.rb +0 -18
- data/spec/CArray/method/round_spec.rb +0 -11
- data/spec/CArray/object/_attribute_spec.rb +0 -32
- data/spec/CArray/object/s_new_spec.rb +0 -31
- data/spec/CArray/serialize/Serialization_spec.rb +0 -89
- data/test/test_130.rb +0 -23
- data/test/test_ALL.rb +0 -49
- data/test/test_CABitfield.rb +0 -59
- data/test/test_CABlock.rb +0 -208
- data/test/test_CAField.rb +0 -40
- data/test/test_CAGrid.rb +0 -76
- data/test/test_CAMmap.rb +0 -11
- data/test/test_CARefer.rb +0 -94
- data/test/test_CARepeat.rb +0 -66
- data/test/test_CASelect.rb +0 -23
- data/test/test_CAShift.rb +0 -17
- data/test/test_CAWindow.rb +0 -55
- data/test/test_CAWrap.rb +0 -9
- data/test/test_CComplex.rb +0 -83
- data/test/test_CScalar.rb +0 -91
- data/test/test_attribute.rb +0 -281
- data/test/test_block_iterator.rb +0 -17
- data/test/test_boolean.rb +0 -99
- data/test/test_cast.rb +0 -33
- data/test/test_class.rb +0 -85
- data/test/test_complex.rb +0 -43
- data/test/test_convert.rb +0 -79
- data/test/test_copy.rb +0 -141
- data/test/test_creation.rb +0 -85
- data/test/test_element.rb +0 -146
- data/test/test_extream.rb +0 -55
- data/test/test_generate.rb +0 -75
- data/test/test_index.rb +0 -71
- data/test/test_mask.rb +0 -578
- data/test/test_math.rb +0 -98
- data/test/test_order.rb +0 -147
- data/test/test_ref_store.rb +0 -211
- data/test/test_stat.rb +0 -406
- data/test/test_struct.rb +0 -72
- data/test/test_virtual.rb +0 -49
data/ext/carray_loop.c
CHANGED
@@ -3,10 +3,8 @@
|
|
3
3
|
carray_loop.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
|
|
@@ -43,18 +41,14 @@ rb_ca_s_each_index_internal (int ndim, VALUE *dim, uint8_t indim, VALUE ridx)
|
|
43
41
|
return ret;
|
44
42
|
}
|
45
43
|
|
46
|
-
/*
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
# (0 0) (0 1) (1 0) (1 1) (2 0) (2 1) (3 0) (3 1)
|
55
|
-
#
|
56
|
-
def CArray.each_index(*argv) # :yields: i0, i1, ...
|
57
|
-
end
|
44
|
+
/* @overload each_index (*shape)
|
45
|
+
|
46
|
+
(Iterator) Iterates with the multi-dimensional indeces for the given
|
47
|
+
dimension numbers.
|
48
|
+
|
49
|
+
CArray.each_index(3,2){|i,j| print "(#{i} #{j}) " }
|
50
|
+
produces:
|
51
|
+
(0 0) (0 1) (1 0) (1 1) (2 0) (2 1) (3 0) (3 1)
|
58
52
|
*/
|
59
53
|
|
60
54
|
static VALUE
|
@@ -69,12 +63,10 @@ rb_ca_s_each_index (int ndim, VALUE *dim, VALUE self)
|
|
69
63
|
|
70
64
|
/* ------------------------------------------------------------------- */
|
71
65
|
|
72
|
-
/*
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
end
|
77
|
-
end
|
66
|
+
/* @overload each () {|elem| ... }
|
67
|
+
|
68
|
+
(Iterator) Iterates all the elements of the object.
|
69
|
+
|
78
70
|
*/
|
79
71
|
|
80
72
|
static VALUE
|
@@ -92,12 +84,10 @@ rb_ca_each (VALUE self)
|
|
92
84
|
return ret;
|
93
85
|
}
|
94
86
|
|
95
|
-
/*
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
end
|
100
|
-
end
|
87
|
+
/* @overload each_with_addr () {|elem, addr| ... }
|
88
|
+
|
89
|
+
(Iterator) Iterates all the elements of the object.
|
90
|
+
|
101
91
|
*/
|
102
92
|
|
103
93
|
static VALUE
|
@@ -115,12 +105,9 @@ rb_ca_each_with_addr (VALUE self)
|
|
115
105
|
return ret;
|
116
106
|
}
|
117
107
|
|
118
|
-
/*
|
119
|
-
|
120
|
-
|
121
|
-
def each_addr() # :yields: addr
|
122
|
-
end
|
123
|
-
end
|
108
|
+
/* @overload each_addr () {|addr| ... }
|
109
|
+
|
110
|
+
(Iterator) Iterates all address of the object.
|
124
111
|
*/
|
125
112
|
|
126
113
|
static VALUE
|
@@ -160,19 +147,16 @@ rb_ca_each_index_internal (VALUE self, int8_t level, VALUE ridx)
|
|
160
147
|
return ret;
|
161
148
|
}
|
162
149
|
|
163
|
-
/*
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
def each_index # :yields: i0, i1, ...
|
174
|
-
end
|
175
|
-
end
|
150
|
+
/* @overload each_index () {|idx| ... }
|
151
|
+
|
152
|
+
(Iterator) Iterates all index of the object.
|
153
|
+
|
154
|
+
CArray.int(3,2).each_index(){|i,j| print "(#{i} #{j}) " }
|
155
|
+
|
156
|
+
<em>produces:</em>
|
157
|
+
|
158
|
+
(0 0) (0 1) (1 0) (1 1) (2 0) (2 1) (3 0) (3 1)
|
159
|
+
|
176
160
|
*/
|
177
161
|
|
178
162
|
static VALUE
|
@@ -187,12 +171,9 @@ rb_ca_each_index (VALUE self)
|
|
187
171
|
return rb_ca_each_index_internal(self, 0, ridx);
|
188
172
|
}
|
189
173
|
|
190
|
-
/*
|
191
|
-
|
192
|
-
|
193
|
-
def map! # :yields: v
|
194
|
-
end
|
195
|
-
end
|
174
|
+
/* @overload map! () {|elem| ... }
|
175
|
+
|
176
|
+
(Iterator, Destructive) Iterates all elements of the object and stores the return from the block to the element.
|
196
177
|
*/
|
197
178
|
|
198
179
|
static VALUE
|
@@ -243,12 +224,10 @@ rb_ca_each_with_index_internal (VALUE self,
|
|
243
224
|
return ret;
|
244
225
|
}
|
245
226
|
|
246
|
-
/*
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
end
|
251
|
-
end
|
227
|
+
/* @overload each_with_index () {|elem, idx| ... }
|
228
|
+
|
229
|
+
[TBD]
|
230
|
+
|
252
231
|
*/
|
253
232
|
|
254
233
|
static VALUE
|
@@ -293,12 +272,10 @@ rb_ca_map_with_index_bang_internal (VALUE self,
|
|
293
272
|
}
|
294
273
|
}
|
295
274
|
|
296
|
-
/*
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
end
|
301
|
-
end
|
275
|
+
/* @overload map_with_index () {|elem, idx| ... }
|
276
|
+
|
277
|
+
[TBD]
|
278
|
+
|
302
279
|
*/
|
303
280
|
|
304
281
|
static VALUE
|
@@ -347,12 +324,10 @@ rb_ca_map_index_bang_internal (VALUE self,
|
|
347
324
|
}
|
348
325
|
}
|
349
326
|
|
350
|
-
/*
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
end
|
355
|
-
end
|
327
|
+
/* @overload map_index! () {|idx| ... }
|
328
|
+
|
329
|
+
[TBD]
|
330
|
+
|
356
331
|
*/
|
357
332
|
|
358
333
|
static VALUE
|
@@ -375,12 +350,10 @@ rb_ca_map_index_bang (VALUE self)
|
|
375
350
|
return self;
|
376
351
|
}
|
377
352
|
|
378
|
-
/*
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
end
|
383
|
-
end
|
353
|
+
/* @overload map_with_addr! () {|elem, addr| ... }
|
354
|
+
|
355
|
+
[TBD]
|
356
|
+
|
384
357
|
*/
|
385
358
|
|
386
359
|
static VALUE
|
@@ -406,12 +379,10 @@ rb_ca_map_with_addr_bang (VALUE self)
|
|
406
379
|
}
|
407
380
|
|
408
381
|
|
409
|
-
/*
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
end
|
414
|
-
end
|
382
|
+
/* @overload map_addr! () {|addr| ... }
|
383
|
+
|
384
|
+
[TBD]
|
385
|
+
|
415
386
|
*/
|
416
387
|
|
417
388
|
static VALUE
|
data/ext/carray_mask.c
CHANGED
@@ -3,10 +3,8 @@
|
|
3
3
|
carray_mask.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
|
|
@@ -565,12 +563,10 @@ ca_allocate_mask_iterator (int n, ...)
|
|
565
563
|
|
566
564
|
/* ------------------------------------------------------------------- */
|
567
565
|
|
568
|
-
/*
|
569
|
-
|
570
|
-
|
571
|
-
|
572
|
-
end
|
573
|
-
end
|
566
|
+
/* @overload has_mask?
|
567
|
+
|
568
|
+
(Masking, Inquiry)
|
569
|
+
Returns true if self has the mask array.
|
574
570
|
*/
|
575
571
|
|
576
572
|
VALUE
|
@@ -581,12 +577,10 @@ rb_ca_has_mask (VALUE self)
|
|
581
577
|
return ( ca_has_mask(ca) ) ? Qtrue : Qfalse;
|
582
578
|
}
|
583
579
|
|
584
|
-
/*
|
585
|
-
|
586
|
-
|
587
|
-
|
588
|
-
end
|
589
|
-
end
|
580
|
+
/* @overload any_masked?
|
581
|
+
|
582
|
+
(Masking, Inquiry)
|
583
|
+
Returns true if self has at least one masked element.
|
590
584
|
*/
|
591
585
|
|
592
586
|
VALUE
|
@@ -597,12 +591,10 @@ rb_ca_is_any_masked (VALUE self)
|
|
597
591
|
return ( ca_is_any_masked(ca) ) ? Qtrue : Qfalse;
|
598
592
|
}
|
599
593
|
|
600
|
-
/*
|
601
|
-
|
602
|
-
|
603
|
-
|
604
|
-
end
|
605
|
-
end
|
594
|
+
/* @overload all_masked?
|
595
|
+
|
596
|
+
(Masking, Inquiry)
|
597
|
+
Returns true if all elements of self are masked.
|
606
598
|
*/
|
607
599
|
|
608
600
|
VALUE
|
@@ -613,12 +605,10 @@ rb_ca_is_all_masked (VALUE self)
|
|
613
605
|
return ( ca_is_all_masked(ca) ) ? Qtrue : Qfalse;
|
614
606
|
}
|
615
607
|
|
616
|
-
/*
|
617
|
-
|
618
|
-
|
619
|
-
|
620
|
-
end
|
621
|
-
end
|
608
|
+
/* @overload create_mask
|
609
|
+
|
610
|
+
(Masking)
|
611
|
+
Creates mask array internally (private method)
|
622
612
|
*/
|
623
613
|
|
624
614
|
static VALUE
|
@@ -631,12 +621,10 @@ rb_ca_create_mask (VALUE self)
|
|
631
621
|
return Qnil;
|
632
622
|
}
|
633
623
|
|
634
|
-
/*
|
635
|
-
|
636
|
-
|
637
|
-
|
638
|
-
end
|
639
|
-
end
|
624
|
+
/* @overload update_mask
|
625
|
+
|
626
|
+
(Masking)
|
627
|
+
Update mask array internally (private method)
|
640
628
|
*/
|
641
629
|
|
642
630
|
/*
|
@@ -650,14 +638,12 @@ rb_ca_update_mask (VALUE self)
|
|
650
638
|
}
|
651
639
|
*/
|
652
640
|
|
653
|
-
/*
|
654
|
-
|
655
|
-
|
656
|
-
|
657
|
-
|
658
|
-
|
659
|
-
end
|
660
|
-
end
|
641
|
+
/* @overload value
|
642
|
+
|
643
|
+
(Masking, Inquiry)
|
644
|
+
Returns new array which refers the data of <code>self</code>.
|
645
|
+
The data of masked elements of <code>self</code> can be accessed
|
646
|
+
via the returned array. The value array can't be set mask.
|
661
647
|
*/
|
662
648
|
|
663
649
|
VALUE
|
@@ -676,13 +662,11 @@ rb_ca_value_array (VALUE self)
|
|
676
662
|
return obj;
|
677
663
|
}
|
678
664
|
|
679
|
-
/*
|
680
|
-
|
681
|
-
|
682
|
-
|
683
|
-
|
684
|
-
end
|
685
|
-
end
|
665
|
+
/* @overload mask
|
666
|
+
|
667
|
+
(Masking, Inquiry)
|
668
|
+
Returns new array which refers the mask state of <code>self</code>.
|
669
|
+
The mask array can't be set mask.
|
686
670
|
*/
|
687
671
|
|
688
672
|
VALUE
|
@@ -707,14 +691,12 @@ rb_ca_mask_array (VALUE self)
|
|
707
691
|
}
|
708
692
|
}
|
709
693
|
|
710
|
-
/*
|
711
|
-
|
712
|
-
|
713
|
-
|
714
|
-
|
715
|
-
|
716
|
-
end
|
717
|
-
end
|
694
|
+
/* @overload mask= (new_mask)
|
695
|
+
|
696
|
+
(Mask, Modification)
|
697
|
+
Asigns <code>new_mask</code> to the mask array of <code>self</code>.
|
698
|
+
If <code>self</code> doesn't have a mask array, it will be created
|
699
|
+
before asignment.
|
718
700
|
*/
|
719
701
|
|
720
702
|
VALUE
|
@@ -756,14 +738,12 @@ rb_ca_set_mask (VALUE self, VALUE rval)
|
|
756
738
|
}
|
757
739
|
}
|
758
740
|
|
759
|
-
/*
|
760
|
-
|
761
|
-
|
762
|
-
|
763
|
-
|
764
|
-
|
765
|
-
end
|
766
|
-
end
|
741
|
+
/* @overload is_masked
|
742
|
+
|
743
|
+
(Masking, Element-Wise Inquiry)
|
744
|
+
Returns new boolean type array of same shape
|
745
|
+
with <code>self</code>. The returned array has 1 for the masked elements and
|
746
|
+
0 for not-masked elements.
|
767
747
|
*/
|
768
748
|
|
769
749
|
VALUE
|
@@ -777,7 +757,12 @@ rb_ca_is_masked (VALUE self)
|
|
777
757
|
|
778
758
|
Data_Get_Struct(self, CArray, ca);
|
779
759
|
|
780
|
-
|
760
|
+
if ( ca_is_scalar(ca) ) {
|
761
|
+
co = cscalar_new(CA_BOOLEAN, ca->bytes, NULL);
|
762
|
+
}
|
763
|
+
else {
|
764
|
+
co = carray_new(CA_BOOLEAN, ca->ndim, ca->dim, ca->bytes, NULL);
|
765
|
+
}
|
781
766
|
|
782
767
|
ca_update_mask(ca);
|
783
768
|
if ( ! ca->mask ) {
|
@@ -799,14 +784,12 @@ rb_ca_is_masked (VALUE self)
|
|
799
784
|
return ca_wrap_struct(co);
|
800
785
|
}
|
801
786
|
|
802
|
-
/*
|
803
|
-
|
804
|
-
|
805
|
-
|
806
|
-
|
807
|
-
|
808
|
-
end
|
809
|
-
end
|
787
|
+
/* @overload is_not_masked
|
788
|
+
|
789
|
+
(Masking, Element-Wise Inquiry)
|
790
|
+
Returns new boolean type array of same shape with <code>self</code>.
|
791
|
+
The returned array has 0 for the masked elements and
|
792
|
+
1 for not-masked elements.
|
810
793
|
*/
|
811
794
|
|
812
795
|
VALUE
|
@@ -820,7 +803,12 @@ rb_ca_is_not_masked (VALUE self)
|
|
820
803
|
|
821
804
|
Data_Get_Struct(self, CArray, ca);
|
822
805
|
|
823
|
-
|
806
|
+
if ( ca_is_scalar(ca) ) {
|
807
|
+
co = cscalar_new(CA_BOOLEAN, ca->bytes, NULL);
|
808
|
+
}
|
809
|
+
else {
|
810
|
+
co = carray_new(CA_BOOLEAN, ca->ndim, ca->dim, ca->bytes, NULL);
|
811
|
+
}
|
824
812
|
|
825
813
|
ca_update_mask(ca);
|
826
814
|
if ( ! ca->mask ) {
|
@@ -842,12 +830,10 @@ rb_ca_is_not_masked (VALUE self)
|
|
842
830
|
return ca_wrap_struct(co);
|
843
831
|
}
|
844
832
|
|
845
|
-
/*
|
846
|
-
|
847
|
-
|
848
|
-
|
849
|
-
end
|
850
|
-
end
|
833
|
+
/* @overload count_masked
|
834
|
+
|
835
|
+
(Masking, Statistics)
|
836
|
+
Returns the number of masked elements.
|
851
837
|
*/
|
852
838
|
|
853
839
|
VALUE
|
@@ -858,12 +844,10 @@ rb_ca_count_masked (VALUE self)
|
|
858
844
|
return SIZE2NUM(ca_count_masked(ca));
|
859
845
|
}
|
860
846
|
|
861
|
-
/*
|
862
|
-
|
863
|
-
|
864
|
-
|
865
|
-
end
|
866
|
-
end
|
847
|
+
/* @overload count_not_masked
|
848
|
+
|
849
|
+
(Masking, Statistics)
|
850
|
+
Returns the number of not-masked elements.
|
867
851
|
*/
|
868
852
|
|
869
853
|
VALUE
|
@@ -874,15 +858,13 @@ rb_ca_count_not_masked (VALUE self)
|
|
874
858
|
return SIZE2NUM(ca_count_not_masked(ca));
|
875
859
|
}
|
876
860
|
|
877
|
-
/*
|
878
|
-
|
879
|
-
|
880
|
-
|
881
|
-
|
882
|
-
|
883
|
-
|
884
|
-
end
|
885
|
-
end
|
861
|
+
/* @overload unmask (fill_value = nil)
|
862
|
+
|
863
|
+
(Masking, Destructive)
|
864
|
+
Unmask all elements of the object.
|
865
|
+
If the optional argument <code>fill_value</code> is given,
|
866
|
+
the masked elements are filled by <code>fill_value</code>.
|
867
|
+
The returned array doesn't have the mask array.
|
886
868
|
*/
|
887
869
|
|
888
870
|
static VALUE
|
@@ -928,15 +910,13 @@ rb_ca_mask_fill (VALUE self, VALUE fval)
|
|
928
910
|
return rb_ca_unmask_method(1, &fval, self);
|
929
911
|
}
|
930
912
|
|
931
|
-
/*
|
932
|
-
|
933
|
-
|
934
|
-
|
935
|
-
|
936
|
-
|
937
|
-
|
938
|
-
end
|
939
|
-
end
|
913
|
+
/* @overload unmask_copy (fill_value = nil)
|
914
|
+
|
915
|
+
(Masking, Conversion)
|
916
|
+
Returns new unmasked array.
|
917
|
+
If the optional argument <code>fill_value</code> is given,
|
918
|
+
the masked elements are filled by <code>fill_value</code>.
|
919
|
+
The returned array doesn't have the mask array.
|
940
920
|
*/
|
941
921
|
|
942
922
|
static VALUE
|
@@ -981,7 +961,11 @@ rb_ca_mask_fill_copy (VALUE self, VALUE fval)
|
|
981
961
|
return rb_ca_unmask_copy_method(1, &fval, self);
|
982
962
|
}
|
983
963
|
|
984
|
-
/*
|
964
|
+
/* @overload invert_mask
|
965
|
+
|
966
|
+
(Masking, Destructive)
|
967
|
+
Inverts mask state.
|
968
|
+
*/
|
985
969
|
|
986
970
|
VALUE
|
987
971
|
rb_ca_invert_mask (VALUE self)
|
@@ -992,13 +976,11 @@ rb_ca_invert_mask (VALUE self)
|
|
992
976
|
return self;
|
993
977
|
}
|
994
978
|
|
995
|
-
/*
|
996
|
-
|
997
|
-
|
998
|
-
|
999
|
-
|
1000
|
-
end
|
1001
|
-
end
|
979
|
+
/* @overload inherit_mask (*others):
|
980
|
+
|
981
|
+
(Masking, Destructive)
|
982
|
+
Sets the mask array of <code>self</code> by the logical sum of
|
983
|
+
the mask states of <code>self</code> and arrays given in arguments.
|
1002
984
|
*/
|
1003
985
|
|
1004
986
|
static VALUE
|
@@ -1073,13 +1055,11 @@ rb_ca_inherit_mask (VALUE self, int n, ...)
|
|
1073
1055
|
return self;
|
1074
1056
|
}
|
1075
1057
|
|
1076
|
-
/*
|
1077
|
-
|
1078
|
-
|
1079
|
-
|
1080
|
-
|
1081
|
-
end
|
1082
|
-
end
|
1058
|
+
/* @overload inherit_mask_replace (*others)
|
1059
|
+
Sets the mask array of <code>self</code> by the logical sum of
|
1060
|
+
the mask states of arrays given in arguments.
|
1061
|
+
This method does not inherit the mask states of itself (different point
|
1062
|
+
from `CArray#inherit_mask`)
|
1083
1063
|
*/
|
1084
1064
|
|
1085
1065
|
static VALUE
|