carray 3.0.0 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.yardopts +2 -1
- data/CHANGELOG.md +325 -3
- data/{NEWS.md → CHANGELOG.v1.md} +1 -1
- data/README.md +32 -32
- data/carray.gemspec +12 -8
- data/ext/ca_axis_group.c +55 -19
- data/ext/ca_binop_dispatch.c +5 -6
- data/ext/ca_binop_dispatch.h +0 -7
- data/ext/ca_categorical_iterator.c +13 -13
- data/ext/ca_for_each_element.h +6 -8
- data/ext/ca_group_iter.c +1 -1
- data/ext/ca_kernel_iterator.c +69 -23
- data/ext/ca_kernel_iterator.h +3 -10
- data/ext/ca_obj_bincmp.c +57 -27
- data/ext/ca_obj_binop.c +86 -30
- data/ext/ca_obj_const_string.c +3 -1
- data/ext/ca_obj_face.c +80 -0
- data/ext/ca_obj_face.h +33 -1
- data/ext/ca_obj_fake.c +11 -0
- data/ext/ca_obj_fixlen_string.c +3 -1
- data/ext/ca_obj_grid.c +11 -3
- data/ext/ca_obj_meld.c +13 -8
- data/ext/ca_obj_moncmp.c +33 -14
- data/ext/ca_obj_monop.c +19 -7
- data/ext/ca_obj_object.c +99 -4
- data/ext/ca_obj_record.c +3 -1
- data/ext/ca_obj_refer.c +30 -6
- data/ext/ca_obj_roll.c +13 -5
- data/ext/ca_obj_select_axis.c +16 -6
- data/ext/ca_obj_shift.c +3 -3
- data/ext/ca_obj_stride.c +106 -23
- data/ext/ca_obj_string.c +3 -1
- data/ext/ca_obj_tile.c +13 -5
- data/ext/ca_obj_time.c +3 -1
- data/ext/ca_obj_timedelta.c +3 -1
- data/ext/ca_obj_transpose.c +1 -1
- data/ext/ca_obj_triop.c +62 -23
- data/ext/ca_obj_window.c +86 -17
- data/ext/ca_op_cmplx64.h +123 -0
- data/ext/ca_op_ipower.c +0 -3
- data/ext/ca_sort_kernels.h +5 -5
- data/ext/ca_sweep_engine.c +78 -35
- data/ext/ca_sweep_engine.h +13 -4
- data/ext/ca_transform_common.c +7 -0
- data/ext/carray.h +127 -130
- data/ext/carray_access.c +56 -34
- data/ext/carray_bincount.c +8 -8
- data/ext/carray_broadcast.c +99 -6
- data/ext/carray_build_flags.h +3 -0
- data/ext/carray_call_cfunc.c +1491 -0
- data/ext/carray_call_cfunc.h +153 -0
- data/ext/carray_cast.c +69 -31
- data/ext/carray_conversion.c +22 -22
- data/ext/carray_copy.c +12 -2
- data/ext/carray_core.c +57 -10
- data/ext/carray_count.c +1 -1
- data/ext/carray_element.c +7 -7
- data/ext/carray_factorize.c +28 -28
- data/ext/carray_hold.c +1 -1
- data/ext/carray_index_classifier.c +7 -21
- data/ext/carray_internal.h +19 -3
- data/ext/carray_kernels_bincmp.c +1 -0
- data/ext/carray_kernels_binop.c +320 -298
- data/ext/carray_kernels_init.c +1095 -0
- data/ext/carray_kernels_map.c +1 -0
- data/ext/carray_kernels_moncmp.c +1 -0
- data/ext/carray_kernels_monop.c +412 -411
- data/ext/carray_kernels_reduce_aggregate.c +88 -87
- data/ext/carray_kernels_reduce_boolean.c +1 -0
- data/ext/carray_kernels_reduce_cumulative.c +54 -53
- data/ext/carray_kernels_reduce_extreme.c +51 -50
- data/ext/carray_kernels_reduce_variance.c +1 -0
- data/ext/carray_kernels_scan.c +1 -0
- data/ext/carray_kernels_search.c +93 -92
- data/ext/carray_kernels_sort.c +1 -0
- data/ext/carray_kernels_triop.c +1 -0
- data/ext/carray_lazy.c +175 -5
- data/ext/carray_mask.c +6 -5
- data/ext/carray_median_percentile.c +1 -1
- data/ext/carray_memory_view.c +46 -21
- data/ext/carray_operator.c +46 -49
- data/ext/carray_partition.c +4 -4
- data/ext/carray_random.c +7 -7
- data/ext/carray_scatter.c +1 -1
- data/ext/carray_sort.c +3 -3
- data/ext/carray_sort_kernel.c +10 -10
- data/ext/carray_test.c +1 -1
- data/ext/extconf.rb +18 -0
- data/ext/mk_call_cfunc.rb +243 -52
- data/ext/mkkernel.rb +354 -100
- data/ext/ruby_carray.c +18 -16
- data/ext/version.h +4 -4
- data/lib/carray/autoload_carray.rb +19 -0
- data/lib/carray/autoload_method_extension.rb +2 -1
- data/lib/carray/axis_group.rb +7 -7
- data/lib/carray/basics.rb +59 -59
- data/lib/carray/bincount_nd.rb +12 -12
- data/lib/carray/block_iterator.rb +24 -14
- data/lib/carray/categorical.rb +4 -4
- data/lib/carray/categorical_iterator.rb +98 -76
- data/lib/carray/conditional.rb +14 -14
- data/lib/carray/construct.rb +21 -0
- data/lib/carray/core_extensions.rb +62 -5
- data/lib/carray/data_type_extension.rb +18 -1
- data/lib/carray/frame/concat.rb +3 -3
- data/lib/carray/frame/convert.rb +1 -1
- data/lib/carray/frame/frame.rb +4 -11
- data/lib/carray/frame/io.rb +159 -2
- data/lib/carray/frame/sort.rb +1 -1
- data/lib/carray/frame/verbs.rb +18 -1
- data/lib/carray/fuse_source.rb +123 -0
- data/lib/carray/fusion.rb +218 -0
- data/lib/carray/histogram.rb +16 -16
- data/lib/carray/inspect.rb +1 -7
- data/lib/carray/iterator.rb +4 -3
- data/lib/carray/lazy.rb +125 -73
- data/lib/carray/meld_reduce.rb +2 -2
- data/lib/carray/methods/align_addr.rb +1 -1
- data/lib/carray/methods/composition.rb +1 -1
- data/lib/carray/methods/is_in.rb +12 -12
- data/lib/carray/methods/locate_addr.rb +6 -1
- data/lib/carray/methods/mask_duplicates.rb +1 -1
- data/lib/carray/methods/meshgrid.rb +4 -5
- data/lib/carray/methods/mode.rb +2 -2
- data/lib/carray/methods/nunique.rb +1 -1
- data/lib/carray/methods/snap.rb +7 -2
- data/lib/carray/methods/unique.rb +3 -3
- data/lib/carray/methods/value_counts.rb +2 -2
- data/lib/carray/runtime.rb +0 -19
- data/lib/carray/slab_iterator.rb +20 -7
- data/lib/carray/string_operation_extension.rb +5 -5
- data/lib/carray/time.rb +890 -491
- data/lib/carray/window_iterator.rb +285 -13
- data/lib/carray.rb +5 -5
- data/yard-stubs/ca_obj_array.rb +385 -0
- data/yard-stubs/ca_obj_bitarray.rb +38 -0
- data/yard-stubs/ca_obj_bitfield.rb +43 -0
- data/yard-stubs/ca_obj_block.rb +73 -0
- data/yard-stubs/ca_obj_byte_swap.rb +56 -0
- data/yard-stubs/ca_obj_fake.rb +31 -0
- data/yard-stubs/ca_obj_farray.rb +32 -0
- data/yard-stubs/ca_obj_field.rb +45 -0
- data/yard-stubs/ca_obj_grid.rb +35 -0
- data/yard-stubs/ca_obj_refer.rb +72 -0
- data/yard-stubs/ca_obj_roll.rb +45 -0
- data/yard-stubs/ca_obj_shift.rb +43 -0
- data/yard-stubs/ca_obj_stride.rb +181 -0
- data/yard-stubs/ca_obj_tile.rb +29 -0
- data/yard-stubs/ca_obj_transpose.rb +40 -0
- data/yard-stubs/ca_obj_window.rb +49 -0
- data/yard-stubs/carray_access.rb +131 -0
- data/yard-stubs/carray_attribute.rb +246 -0
- data/yard-stubs/carray_broadcast.rb +37 -0
- data/yard-stubs/carray_cast.rb +489 -0
- data/yard-stubs/carray_class.rb +65 -0
- data/yard-stubs/carray_conversion.rb +76 -0
- data/yard-stubs/carray_copy.rb +79 -0
- data/yard-stubs/carray_core.rb +114 -0
- data/yard-stubs/carray_count.rb +79 -0
- data/yard-stubs/carray_element.rb +108 -0
- data/yard-stubs/carray_generate.rb +66 -0
- data/yard-stubs/carray_lazy.rb +23 -0
- data/yard-stubs/carray_loop.rb +140 -0
- data/yard-stubs/carray_mask.rb +259 -0
- data/yard-stubs/carray_math.rb +132 -0
- data/yard-stubs/carray_mathfunc.rb +45 -0
- data/yard-stubs/carray_median_percentile.rb +89 -0
- data/yard-stubs/carray_memory_view.rb +163 -0
- data/yard-stubs/carray_order.rb +312 -0
- data/yard-stubs/carray_random.rb +89 -0
- data/yard-stubs/carray_scatter.rb +106 -0
- data/yard-stubs/carray_slab.rb +57 -0
- data/yard-stubs/carray_sort.rb +163 -0
- data/yard-stubs/carray_test.rb +85 -0
- data/yard-stubs/carray_undef.rb +64 -0
- data/yard-stubs/carray_utils.rb +97 -0
- data/yard-stubs/ruby_carray.rb +193 -0
- metadata +59 -10
- data/ext/ca_obj_unbound_repeat.c +0 -496
|
@@ -0,0 +1,489 @@
|
|
|
1
|
+
# DOCUMENTATION ONLY — DO NOT REQUIRE.
|
|
2
|
+
# Stubs for the CA_* cast shorthands, the CArray type-conversion family,
|
|
3
|
+
# and the cast-family class methods defined in ext/carray_cast.c.
|
|
4
|
+
# See yard-stubs/README.md and yard-stubs/STYLE.md.
|
|
5
|
+
|
|
6
|
+
# Container for the global `CA_*` cast shorthands installed by
|
|
7
|
+
# CArray (via `rb_define_global_function`). Each `CA_<TYPE>(obj)`
|
|
8
|
+
# is a top-level function that coerces `obj` (a CArray, Array,
|
|
9
|
+
# Numeric, or anything castable) into a CArray of the named element
|
|
10
|
+
# type, equivalent to `obj.to_ca.as_type(:<type>)`.
|
|
11
|
+
module Kernel
|
|
12
|
+
# @!group CArray cast shorthands
|
|
13
|
+
|
|
14
|
+
# Coerces `obj` into a `:boolean` CArray. @return [CArray]
|
|
15
|
+
def CA_BOOLEAN(obj); end
|
|
16
|
+
# Coerces `obj` into an `:int8` CArray. @return [CArray]
|
|
17
|
+
def CA_INT8(obj); end
|
|
18
|
+
# Coerces `obj` into a `:uint8` CArray. @return [CArray]
|
|
19
|
+
def CA_UINT8(obj); end
|
|
20
|
+
# Coerces `obj` into an `:int16` CArray. @return [CArray]
|
|
21
|
+
def CA_INT16(obj); end
|
|
22
|
+
# Coerces `obj` into a `:uint16` CArray. @return [CArray]
|
|
23
|
+
def CA_UINT16(obj); end
|
|
24
|
+
# Coerces `obj` into an `:int32` CArray. @return [CArray]
|
|
25
|
+
def CA_INT32(obj); end
|
|
26
|
+
# Coerces `obj` into a `:uint32` CArray. @return [CArray]
|
|
27
|
+
def CA_UINT32(obj); end
|
|
28
|
+
# Coerces `obj` into an `:int64` CArray. @return [CArray]
|
|
29
|
+
def CA_INT64(obj); end
|
|
30
|
+
# Coerces `obj` into a `:uint64` CArray. @return [CArray]
|
|
31
|
+
def CA_UINT64(obj); end
|
|
32
|
+
# Coerces `obj` into a `:float32` CArray. @return [CArray]
|
|
33
|
+
def CA_FLOAT32(obj); end
|
|
34
|
+
# Coerces `obj` into a `:float64` CArray. @return [CArray]
|
|
35
|
+
def CA_FLOAT64(obj); end
|
|
36
|
+
# Coerces `obj` into a `:cmplx64` CArray. @return [CArray]
|
|
37
|
+
def CA_CMPLX64(obj); end
|
|
38
|
+
# Coerces `obj` into a `:cmplx128` CArray. @return [CArray]
|
|
39
|
+
def CA_CMPLX128(obj); end
|
|
40
|
+
# Coerces `obj` into an `:object` CArray. @return [CArray]
|
|
41
|
+
def CA_OBJECT(obj); end
|
|
42
|
+
# Coerces `obj` into a `CA_SIZE` (platform native size) CArray.
|
|
43
|
+
# @return [CArray]
|
|
44
|
+
def CA_SIZE(obj); end
|
|
45
|
+
# Coerces `obj` into a `:fixlen` CArray. @return [CArray]
|
|
46
|
+
def CA_FIXLEN(obj); end
|
|
47
|
+
|
|
48
|
+
# Alias of {#CA_UINT8}. @return [CArray]
|
|
49
|
+
def CA_BYTE(obj); end
|
|
50
|
+
# Alias of {#CA_INT16}. @return [CArray]
|
|
51
|
+
def CA_SHORT(obj); end
|
|
52
|
+
# Alias of {#CA_INT32}. @return [CArray]
|
|
53
|
+
def CA_INT(obj); end
|
|
54
|
+
# Alias of {#CA_FLOAT32}. @return [CArray]
|
|
55
|
+
def CA_FLOAT(obj); end
|
|
56
|
+
# Alias of {#CA_FLOAT64}. @return [CArray]
|
|
57
|
+
def CA_DOUBLE(obj); end
|
|
58
|
+
# Alias of {#CA_CMPLX64}. @return [CArray]
|
|
59
|
+
def CA_COMPLEX(obj); end
|
|
60
|
+
# Alias of {#CA_CMPLX128}. @return [CArray]
|
|
61
|
+
def CA_DCOMPLEX(obj); end
|
|
62
|
+
|
|
63
|
+
# @!endgroup
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
class CArray
|
|
67
|
+
# @!group Type casting
|
|
68
|
+
|
|
69
|
+
# -- to_type: eager copy conversion -----------------------------------
|
|
70
|
+
|
|
71
|
+
# @overload to_type(data_type, bytes: nil)
|
|
72
|
+
# Returns a new entity holding the elements of `self` converted to
|
|
73
|
+
# `data_type` (an eager copy that owns its storage). Masked cells are
|
|
74
|
+
# carried across. When `data_type` is a data_class (a CAStruct
|
|
75
|
+
# subclass) the result is wrapped in CARecord.
|
|
76
|
+
#
|
|
77
|
+
# When `self` is an `:object` array and `data_type` is an integer or
|
|
78
|
+
# float type, each cell is parsed with Ruby `Integer()` / `Float()`
|
|
79
|
+
# rules and a cell that cannot be parsed becomes UNDEF (masked) rather
|
|
80
|
+
# than a silent `0.0` or a raise. This is symmetric for float and int:
|
|
81
|
+
# `nil`, `""`, `"xx"`, and (for int targets) a non-integer string such
|
|
82
|
+
# as `"1.5"` all map to UNDEF. Explicit `nan` / `inf` / `infinity`
|
|
83
|
+
# literals (optional sign, case-insensitive, matched as a whole token)
|
|
84
|
+
# are kept as NaN / ±Infinity.
|
|
85
|
+
# @param data_type [Symbol, Integer, Class, String] target element type.
|
|
86
|
+
# @param bytes [Integer, nil] element width in bytes, required for
|
|
87
|
+
# `:fixlen`.
|
|
88
|
+
# @return [CArray]
|
|
89
|
+
def to_type(data_type, bytes: nil); end
|
|
90
|
+
|
|
91
|
+
# @overload boolean
|
|
92
|
+
# Returns a `:boolean` copy of `self`. Short-hand of `to_type(:boolean)`.
|
|
93
|
+
# @return [CArray]
|
|
94
|
+
def boolean; end
|
|
95
|
+
# @overload int8
|
|
96
|
+
# Returns an `:int8` copy of `self`. Short-hand of `to_type(:int8)`.
|
|
97
|
+
# @return [CArray]
|
|
98
|
+
def int8; end
|
|
99
|
+
# @overload uint8
|
|
100
|
+
# Returns a `:uint8` copy of `self`. Short-hand of `to_type(:uint8)`.
|
|
101
|
+
# @return [CArray]
|
|
102
|
+
def uint8; end
|
|
103
|
+
# @overload int16
|
|
104
|
+
# Returns an `:int16` copy of `self`. Short-hand of `to_type(:int16)`.
|
|
105
|
+
# @return [CArray]
|
|
106
|
+
def int16; end
|
|
107
|
+
# @overload uint16
|
|
108
|
+
# Returns a `:uint16` copy of `self`. Short-hand of `to_type(:uint16)`.
|
|
109
|
+
# @return [CArray]
|
|
110
|
+
def uint16; end
|
|
111
|
+
# @overload int32
|
|
112
|
+
# Returns an `:int32` copy of `self`. Short-hand of `to_type(:int32)`.
|
|
113
|
+
# @return [CArray]
|
|
114
|
+
def int32; end
|
|
115
|
+
# @overload uint32
|
|
116
|
+
# Returns a `:uint32` copy of `self`. Short-hand of `to_type(:uint32)`.
|
|
117
|
+
# @return [CArray]
|
|
118
|
+
def uint32; end
|
|
119
|
+
# @overload int64
|
|
120
|
+
# Returns an `:int64` copy of `self`. Short-hand of `to_type(:int64)`.
|
|
121
|
+
# @return [CArray]
|
|
122
|
+
def int64; end
|
|
123
|
+
# @overload uint64
|
|
124
|
+
# Returns a `:uint64` copy of `self`. Short-hand of `to_type(:uint64)`.
|
|
125
|
+
# @return [CArray]
|
|
126
|
+
def uint64; end
|
|
127
|
+
# @overload float32
|
|
128
|
+
# Returns a `:float32` copy of `self`. Short-hand of `to_type(:float32)`.
|
|
129
|
+
# @return [CArray]
|
|
130
|
+
def float32; end
|
|
131
|
+
# @overload float64
|
|
132
|
+
# Returns a `:float64` copy of `self`. Short-hand of `to_type(:float64)`.
|
|
133
|
+
# @return [CArray]
|
|
134
|
+
def float64; end
|
|
135
|
+
# @overload cmplx64
|
|
136
|
+
# Returns a `:cmplx64` copy of `self`. Short-hand of `to_type(:cmplx64)`.
|
|
137
|
+
# @return [CArray]
|
|
138
|
+
def cmplx64; end
|
|
139
|
+
# @overload cmplx128
|
|
140
|
+
# Returns a `:cmplx128` copy of `self`. Short-hand of `to_type(:cmplx128)`.
|
|
141
|
+
# @return [CArray]
|
|
142
|
+
def cmplx128; end
|
|
143
|
+
# @overload object
|
|
144
|
+
# Returns an `:object` copy of `self`. Short-hand of `to_type(:object)`.
|
|
145
|
+
# @return [CArray]
|
|
146
|
+
def object; end
|
|
147
|
+
# @overload fixlen(bytes: nil)
|
|
148
|
+
# Returns a `:fixlen` copy of `self`. Short-hand of
|
|
149
|
+
# `to_type(:fixlen, bytes:)`.
|
|
150
|
+
# @param bytes [Integer, nil] fixed element width in bytes.
|
|
151
|
+
# @return [CArray]
|
|
152
|
+
def fixlen(bytes: nil); end
|
|
153
|
+
|
|
154
|
+
# @overload byte
|
|
155
|
+
# Alias of {#uint8}. @return [CArray]
|
|
156
|
+
def byte; end
|
|
157
|
+
# @overload short
|
|
158
|
+
# Alias of {#int16}. @return [CArray]
|
|
159
|
+
def short; end
|
|
160
|
+
# @overload int
|
|
161
|
+
# Alias of {#int32}. @return [CArray]
|
|
162
|
+
def int; end
|
|
163
|
+
# @overload float
|
|
164
|
+
# Alias of {#float32}. @return [CArray]
|
|
165
|
+
def float; end
|
|
166
|
+
# @overload double
|
|
167
|
+
# Alias of {#float64}. @return [CArray]
|
|
168
|
+
def double; end
|
|
169
|
+
# @overload complex
|
|
170
|
+
# Alias of {#cmplx64}. @return [CArray]
|
|
171
|
+
def complex; end
|
|
172
|
+
# @overload dcomplex
|
|
173
|
+
# Alias of {#cmplx128}. @return [CArray]
|
|
174
|
+
def dcomplex; end
|
|
175
|
+
|
|
176
|
+
# -- as_type: reinterpreting view (no copy) ---------------------------
|
|
177
|
+
|
|
178
|
+
# @overload as_type(data_type, bytes: nil)
|
|
179
|
+
# Returns a {CAFake} view of `self` reinterpreted as `data_type`
|
|
180
|
+
# (with `bytes:` for `:fixlen`). Reads and writes cast on the fly
|
|
181
|
+
# through the shared parent storage; no copy is made. For an eager
|
|
182
|
+
# copy use `arr.as_type(...).to_ca` or {#to_type}.
|
|
183
|
+
#
|
|
184
|
+
# Note: for an `:object` source the on-the-fly cast to a numeric type
|
|
185
|
+
# uses the lenient path and does NOT mask parse failures — a
|
|
186
|
+
# non-numeric string reads as `0.0` (float) and raises for an integer
|
|
187
|
+
# target. Use {#to_type} instead for parse-with-mask (an unparseable
|
|
188
|
+
# cell becomes UNDEF). The `CA_<TYPE>(obj)` construction shorthands
|
|
189
|
+
# take this same non-masking path.
|
|
190
|
+
# A Face refuses: reinterpreting its storage would hand back the
|
|
191
|
+
# bytes its surface exists to hide (the serial instead of the time, the
|
|
192
|
+
# descriptor instead of the string), and no view decodes a surface. Take
|
|
193
|
+
# the values with {#to_type}, or the storage with `face.parent.as_type`.
|
|
194
|
+
# A Numeric Face, whose surface *is* its storage, adapts as usual.
|
|
195
|
+
# @param data_type [Symbol, Integer, Class, String] target element type.
|
|
196
|
+
# @param bytes [Integer, nil] element width in bytes, required for
|
|
197
|
+
# `:fixlen`.
|
|
198
|
+
# @return [CAFake]
|
|
199
|
+
# @raise [TypeError] when `self` is a Face and the request would read its
|
|
200
|
+
# storage under another type.
|
|
201
|
+
def as_type(data_type, bytes: nil); end
|
|
202
|
+
|
|
203
|
+
# @overload as_boolean
|
|
204
|
+
# Returns a {CAFake} `:boolean` view of `self`. Short-hand of
|
|
205
|
+
# `as_type(:boolean)`.
|
|
206
|
+
# @return [CAFake]
|
|
207
|
+
def as_boolean; end
|
|
208
|
+
# @overload as_int8
|
|
209
|
+
# Returns a {CAFake} `:int8` view of `self`. Short-hand of `as_type(:int8)`.
|
|
210
|
+
# @return [CAFake]
|
|
211
|
+
def as_int8; end
|
|
212
|
+
# @overload as_uint8
|
|
213
|
+
# Returns a {CAFake} `:uint8` view of `self`. Short-hand of `as_type(:uint8)`.
|
|
214
|
+
# @return [CAFake]
|
|
215
|
+
def as_uint8; end
|
|
216
|
+
# @overload as_int16
|
|
217
|
+
# Returns a {CAFake} `:int16` view of `self`. Short-hand of `as_type(:int16)`.
|
|
218
|
+
# @return [CAFake]
|
|
219
|
+
def as_int16; end
|
|
220
|
+
# @overload as_uint16
|
|
221
|
+
# Returns a {CAFake} `:uint16` view of `self`. Short-hand of `as_type(:uint16)`.
|
|
222
|
+
# @return [CAFake]
|
|
223
|
+
def as_uint16; end
|
|
224
|
+
# @overload as_int32
|
|
225
|
+
# Returns a {CAFake} `:int32` view of `self`. Short-hand of `as_type(:int32)`.
|
|
226
|
+
# @return [CAFake]
|
|
227
|
+
def as_int32; end
|
|
228
|
+
# @overload as_uint32
|
|
229
|
+
# Returns a {CAFake} `:uint32` view of `self`. Short-hand of `as_type(:uint32)`.
|
|
230
|
+
# @return [CAFake]
|
|
231
|
+
def as_uint32; end
|
|
232
|
+
# @overload as_int64
|
|
233
|
+
# Returns a {CAFake} `:int64` view of `self`. Short-hand of `as_type(:int64)`.
|
|
234
|
+
# @return [CAFake]
|
|
235
|
+
def as_int64; end
|
|
236
|
+
# @overload as_uint64
|
|
237
|
+
# Returns a {CAFake} `:uint64` view of `self`. Short-hand of `as_type(:uint64)`.
|
|
238
|
+
# @return [CAFake]
|
|
239
|
+
def as_uint64; end
|
|
240
|
+
# @overload as_float32
|
|
241
|
+
# Returns a {CAFake} `:float32` view of `self`. Short-hand of
|
|
242
|
+
# `as_type(:float32)`.
|
|
243
|
+
# @return [CAFake]
|
|
244
|
+
def as_float32; end
|
|
245
|
+
# @overload as_float64
|
|
246
|
+
# Returns a {CAFake} `:float64` view of `self`. Short-hand of
|
|
247
|
+
# `as_type(:float64)`.
|
|
248
|
+
# @return [CAFake]
|
|
249
|
+
def as_float64; end
|
|
250
|
+
# @overload as_float128
|
|
251
|
+
# Returns a {CAFake} `:float128` view of `self`. Short-hand of
|
|
252
|
+
# `as_type(:float128)`.
|
|
253
|
+
# @return [CAFake]
|
|
254
|
+
def as_float128; end
|
|
255
|
+
# @overload as_cmplx64
|
|
256
|
+
# Returns a {CAFake} `:cmplx64` view of `self`. Short-hand of
|
|
257
|
+
# `as_type(:cmplx64)`.
|
|
258
|
+
# @return [CAFake]
|
|
259
|
+
def as_cmplx64; end
|
|
260
|
+
# @overload as_cmplx128
|
|
261
|
+
# Returns a {CAFake} `:cmplx128` view of `self`. Short-hand of
|
|
262
|
+
# `as_type(:cmplx128)`.
|
|
263
|
+
# @return [CAFake]
|
|
264
|
+
def as_cmplx128; end
|
|
265
|
+
# @overload as_cmplx256
|
|
266
|
+
# Returns a {CAFake} `:cmplx256` view of `self`. Short-hand of
|
|
267
|
+
# `as_type(:cmplx256)`.
|
|
268
|
+
# @return [CAFake]
|
|
269
|
+
def as_cmplx256; end
|
|
270
|
+
# @overload as_object
|
|
271
|
+
# Returns a {CAFake} `:object` view of `self`. Short-hand of
|
|
272
|
+
# `as_type(:object)`.
|
|
273
|
+
# @return [CAFake]
|
|
274
|
+
def as_object; end
|
|
275
|
+
# @overload as_fixlen(bytes: nil)
|
|
276
|
+
# Returns a {CAFake} `:fixlen` view of `self`. Short-hand of
|
|
277
|
+
# `as_type(:fixlen, bytes:)`.
|
|
278
|
+
# @param bytes [Integer, nil] fixed element width in bytes.
|
|
279
|
+
# @return [CAFake]
|
|
280
|
+
def as_fixlen(bytes: nil); end
|
|
281
|
+
|
|
282
|
+
# @overload as_byte
|
|
283
|
+
# Alias of {#as_uint8}. @return [CAFake]
|
|
284
|
+
def as_byte; end
|
|
285
|
+
# @overload as_short
|
|
286
|
+
# Alias of {#as_int16}. @return [CAFake]
|
|
287
|
+
def as_short; end
|
|
288
|
+
# @overload as_int
|
|
289
|
+
# Alias of {#as_int32}. @return [CAFake]
|
|
290
|
+
def as_int; end
|
|
291
|
+
# @overload as_float
|
|
292
|
+
# Alias of {#as_float32}. @return [CAFake]
|
|
293
|
+
def as_float; end
|
|
294
|
+
# @overload as_double
|
|
295
|
+
# Alias of {#as_float64}. @return [CAFake]
|
|
296
|
+
def as_double; end
|
|
297
|
+
# @overload as_complex
|
|
298
|
+
# Alias of {#as_cmplx64}. @return [CAFake]
|
|
299
|
+
def as_complex; end
|
|
300
|
+
# @overload as_dcomplex
|
|
301
|
+
# Alias of {#as_cmplx128}. @return [CAFake]
|
|
302
|
+
def as_dcomplex; end
|
|
303
|
+
|
|
304
|
+
# -- clip-then-cast ---------------------------------------------------
|
|
305
|
+
|
|
306
|
+
# @!method clip_int8
|
|
307
|
+
# Returns an `:int8` copy of `self` with values clamped to the
|
|
308
|
+
# `:int8` range (-128..127) before casting. @return [CArray]
|
|
309
|
+
# @!method clip_uint8
|
|
310
|
+
# Returns a `:uint8` copy clamped to 0..255. @return [CArray]
|
|
311
|
+
# @!method clip_int16
|
|
312
|
+
# Returns an `:int16` copy clamped to -32768..32767.
|
|
313
|
+
# @return [CArray]
|
|
314
|
+
# @!method clip_uint16
|
|
315
|
+
# Returns a `:uint16` copy clamped to 0..65535. @return [CArray]
|
|
316
|
+
# @!method clip_int32
|
|
317
|
+
# Returns an `:int32` copy clamped to the `:int32` range.
|
|
318
|
+
# @return [CArray]
|
|
319
|
+
# @!method clip_uint32
|
|
320
|
+
# Returns a `:uint32` copy clamped to 0..4294967295.
|
|
321
|
+
# @return [CArray]
|
|
322
|
+
# @!method clip_int64
|
|
323
|
+
# Returns an `:int64` copy clamped to the `:int64` range.
|
|
324
|
+
# @return [CArray]
|
|
325
|
+
# @!method clip_uint64
|
|
326
|
+
# Returns a `:uint64` copy clamped to the `:uint64` range.
|
|
327
|
+
# @return [CArray]
|
|
328
|
+
|
|
329
|
+
# -- coercion ---------------------------------------------------------
|
|
330
|
+
|
|
331
|
+
# @overload cast_with(other)
|
|
332
|
+
# Returns a two-element `[self, other]` array with both operands
|
|
333
|
+
# coerced to a common representation under the CArray casting policy.
|
|
334
|
+
# Non-CArray operands are promoted to a CArray (MemoryView producers
|
|
335
|
+
# are wrapped, Ruby scalars become a CScalar), then the narrower side
|
|
336
|
+
# is wrapped read-only in the common data_type. This is the coercion
|
|
337
|
+
# primitive the binary operators use.
|
|
338
|
+
# @param other [CArray, Object] the second operand.
|
|
339
|
+
# @return [Array(CArray, CArray)]
|
|
340
|
+
# @raise [RuntimeError] when the two data_types have no common type.
|
|
341
|
+
def cast_with(other); end
|
|
342
|
+
|
|
343
|
+
# `coerce` is documented with its definition in ext/carray_operator.c;
|
|
344
|
+
# the bare signature here only attaches it to the "Type casting" group.
|
|
345
|
+
def coerce(other); end # @!visibility public
|
|
346
|
+
|
|
347
|
+
# -- class methods ----------------------------------------------------
|
|
348
|
+
|
|
349
|
+
# @overload wrap_writable(other, data_type = nil)
|
|
350
|
+
# Returns `other` as a CArray you intend to **write into**, reinterpreted
|
|
351
|
+
# as `data_type` when given.
|
|
352
|
+
#
|
|
353
|
+
# The name is a statement of intent, not a property of the result: you are
|
|
354
|
+
# declaring that writes are coming, so only sources that can actually take
|
|
355
|
+
# a write are accepted — a writable CArray, `nil` (a zero-filled CScalar),
|
|
356
|
+
# an object whose `#to_ca` honours `writable: true`, or a writable
|
|
357
|
+
# MemoryView producer (wrapped zero-copy). Anything that would have to be
|
|
358
|
+
# *copied* to become a CArray is refused up front, because a copy would
|
|
359
|
+
# swallow the writes silently. That is the whole difference from
|
|
360
|
+
# {.wrap_readonly}, which is free to copy and so accepts far more.
|
|
361
|
+
#
|
|
362
|
+
# For a foreign object the refusal is the object's own to make: this calls
|
|
363
|
+
# `other.to_ca(writable: true)`, which is the caller's half of the
|
|
364
|
+
# {CArray#to_ca} contract — "give me a CArray *whose writes reach you*" —
|
|
365
|
+
# and a `to_ca` that can only produce a copy raises rather than answering.
|
|
366
|
+
# An object whose `to_ca` predates the keyword raises `ArgumentError`,
|
|
367
|
+
# which is the honest report that it does not implement writable intake.
|
|
368
|
+
#
|
|
369
|
+
# When `data_type` differs from the source element type the result is a
|
|
370
|
+
# type-adapting view over the same storage, and a write reverse-casts
|
|
371
|
+
# through to the source. A Face is refused for that same reason the
|
|
372
|
+
# other way round: the writes would land on the storage its surface
|
|
373
|
+
# hides. Wrap `face.parent` when that is what you mean.
|
|
374
|
+
# @param other [CArray, nil, Object] source to wrap.
|
|
375
|
+
# @param data_type [Symbol, Integer, Class, nil] target element type;
|
|
376
|
+
# `nil` keeps the source type (or `:object` when `other` is `nil`).
|
|
377
|
+
# @return [CArray]
|
|
378
|
+
# @raise [RuntimeError] when `other` is read-only, its MemoryView is
|
|
379
|
+
# read-only, its `to_ca` refuses `writable: true`, or it cannot be
|
|
380
|
+
# wrapped as a CArray.
|
|
381
|
+
# @raise [TypeError] when `other#to_ca` returns something that is not a
|
|
382
|
+
# CArray.
|
|
383
|
+
# @raise [ArgumentError] when `other#to_ca` does not accept `writable:`.
|
|
384
|
+
# @raise [TypeError] when `other` is a Face and `data_type` differs from
|
|
385
|
+
# its surface type.
|
|
386
|
+
def self.wrap_writable(other, data_type = nil); end
|
|
387
|
+
|
|
388
|
+
# @overload wrap_readonly(other, data_type = nil)
|
|
389
|
+
# Returns `other` as a CArray you intend to **only read**, reinterpreted
|
|
390
|
+
# as `data_type` when given.
|
|
391
|
+
#
|
|
392
|
+
# The name is a statement of intent, not a property of the result: you are
|
|
393
|
+
# declaring that nothing will be written back, which frees this call to
|
|
394
|
+
# convert as widely as it can — a conversion that copies is fine when
|
|
395
|
+
# nobody writes to it. So on top of everything {.wrap_writable} takes
|
|
396
|
+
# (a CArray, `nil`, an object responding to `#to_ca`, a MemoryView
|
|
397
|
+
# producer) this also accepts an Array (via `to_ca`) and a Numeric /
|
|
398
|
+
# String / arbitrary object, which become a one-element CScalar. It calls
|
|
399
|
+
# `to_ca` with no arguments, so a copy is welcome here.
|
|
400
|
+
#
|
|
401
|
+
# It does **not** make the source read-only, and does not protect it: for
|
|
402
|
+
# a CArray whose element type already matches you get back the very same
|
|
403
|
+
# object, and a type-adapting view writes through to its source. Keeping
|
|
404
|
+
# the read-only promise is the caller's part of the bargain.
|
|
405
|
+
#
|
|
406
|
+
# Two conversions are worth knowing before you rely on them: with a
|
|
407
|
+
# numeric `data_type` a String is reinterpreted as **raw bytes** (a copy),
|
|
408
|
+
# not parsed, so `"abcd"` with `:uint8` gives four elements; and with
|
|
409
|
+
# `data_type` omitted, anything that is not already CArray-shaped lands on
|
|
410
|
+
# `:object` rather than a guessed numeric type, so pass `data_type`
|
|
411
|
+
# explicitly when the value is headed for a numeric kernel.
|
|
412
|
+
# A Face answers with the same conversion {#to_type} performs, since
|
|
413
|
+
# nothing here promises a view: its surface values for `:object`, and its
|
|
414
|
+
# own `#to_numeric` for a numeric type. Reading its storage instead is
|
|
415
|
+
# `face.parent`.
|
|
416
|
+
# @param other [CArray, Numeric, String, Array, nil, Object] source to
|
|
417
|
+
# wrap.
|
|
418
|
+
# @param data_type [Symbol, Integer, Class, nil] target element type;
|
|
419
|
+
# `nil` keeps the source type for a CArray-shaped source, and is
|
|
420
|
+
# `:object` otherwise.
|
|
421
|
+
# @return [CArray]
|
|
422
|
+
# @raise [TypeError] when `other` is a Face asked for a numeric type and
|
|
423
|
+
# it declares no `#to_numeric`.
|
|
424
|
+
def self.wrap_readonly(other, data_type = nil); end
|
|
425
|
+
|
|
426
|
+
# @overload cast(value)
|
|
427
|
+
# Returns `value` as a CArray. A CArray is returned unchanged; a Ruby
|
|
428
|
+
# value is coerced: Integer to an `:int64` CScalar, Float to
|
|
429
|
+
# `:float64`, true/false to `:boolean`, Complex to `:cmplx128`, Array
|
|
430
|
+
# and Range via `to_ca`, and anything else to an `:object` CScalar.
|
|
431
|
+
# @param value [Object] the value to coerce.
|
|
432
|
+
# @return [CArray]
|
|
433
|
+
def self.cast(value); end
|
|
434
|
+
|
|
435
|
+
# @overload result_type(*args)
|
|
436
|
+
# Returns the common data_type Symbol that all of the given operands
|
|
437
|
+
# can be promoted to under the CArray casting policy.
|
|
438
|
+
#
|
|
439
|
+
# Each argument is classified as either a *data_type representation*
|
|
440
|
+
# or a *value*:
|
|
441
|
+
#
|
|
442
|
+
# - CArray instance -> its `data_type`
|
|
443
|
+
# - Symbol / String / Class -> data_type representation (name lookup)
|
|
444
|
+
# - Integer / Float / Complex / true / false / nil / Object -> *value*,
|
|
445
|
+
# data_type inferred (3 -> `:int64`, 3.14 -> `:float64`,
|
|
446
|
+
# 1+2i -> `:cmplx128`, ...)
|
|
447
|
+
#
|
|
448
|
+
# Values and data_type representations promote uniformly. Integer args
|
|
449
|
+
# are interpreted as *values*, not as data_type codes:
|
|
450
|
+
# `result_type(8)` returns `:int64` because the value 8 is an Integer,
|
|
451
|
+
# not because a data_type code equals 8. Use `result_type(:int64)` or
|
|
452
|
+
# `result_type(CA_INT64)` to be explicit about data_type intent.
|
|
453
|
+
# @param args [Array<CArray, Symbol, String, Class, Object>] operands.
|
|
454
|
+
# @return [Symbol]
|
|
455
|
+
# @raise [ArgumentError] when called with no arguments.
|
|
456
|
+
# @raise [RuntimeError] when two inputs are mutually incompatible
|
|
457
|
+
# (e.g. `:object` with `:fixlen`).
|
|
458
|
+
# @example
|
|
459
|
+
# CArray.result_type(:int32, :float32) #=> :float32
|
|
460
|
+
# CArray.result_type(3, 3.14) #=> :float64
|
|
461
|
+
# CArray.result_type(true, 3) #=> :int64
|
|
462
|
+
def self.result_type(*args); end
|
|
463
|
+
|
|
464
|
+
# @overload promote_list(list, data_type: nil)
|
|
465
|
+
# Returns a copy of `list` in which every element is in a
|
|
466
|
+
# representation that can be uniformly handled (same Face class, or
|
|
467
|
+
# same primitive data_type). The result is suitable as direct input
|
|
468
|
+
# to multi-parent constructors such as {CArray.stack}.
|
|
469
|
+
#
|
|
470
|
+
# With `data_type: nil` (auto-detect): a list of same-class Face
|
|
471
|
+
# elements passes through (CAStack lifts it), unless the class is not
|
|
472
|
+
# portable (CAConstString) or the elements disagree on state
|
|
473
|
+
# (CATime with different units); a list of primitives is
|
|
474
|
+
# promoted via {.result_type} + {.wrap_readonly}; a mix of Face and
|
|
475
|
+
# non-Face, or heterogeneous Face classes, is rejected.
|
|
476
|
+
#
|
|
477
|
+
# With an explicit primitive `data_type`: all-primitive elements are
|
|
478
|
+
# wrapped read-only to the requested type; any Face element is
|
|
479
|
+
# rejected (a Face cannot be coerced to a primitive without losing
|
|
480
|
+
# identity). A Class-shaped `data_type` is rejected.
|
|
481
|
+
# @param list [Array<CArray>] elements to reconcile.
|
|
482
|
+
# @param data_type [Symbol, nil] target element type, or `nil` to
|
|
483
|
+
# auto-detect.
|
|
484
|
+
# @return [Array<CArray>]
|
|
485
|
+
# @raise [ArgumentError] on an empty list or any of the reject cases.
|
|
486
|
+
def self.promote_list(list, data_type: nil); end
|
|
487
|
+
|
|
488
|
+
# @!endgroup
|
|
489
|
+
end
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# DOCUMENTATION ONLY — DO NOT REQUIRE.
|
|
2
|
+
# Stubs for singleton methods defined in ext/carray_class.c.
|
|
3
|
+
# See yard-stubs/README.md and yard-stubs/STYLE.md.
|
|
4
|
+
|
|
5
|
+
class CArray
|
|
6
|
+
class << self
|
|
7
|
+
# @!group Platform inquiries
|
|
8
|
+
|
|
9
|
+
# @overload endian
|
|
10
|
+
# Returns the host byte order as an Integer: `0`
|
|
11
|
+
# (`CA_LITTLE_ENDIAN`) or `1` (`CA_BIG_ENDIAN`). Prefer
|
|
12
|
+
# {.big_endian?} / {.little_endian?} for predicate use.
|
|
13
|
+
# @return [Integer]
|
|
14
|
+
def endian; end
|
|
15
|
+
|
|
16
|
+
# @overload big_endian?
|
|
17
|
+
# Returns `true` if the host byte order is big-endian.
|
|
18
|
+
# @return [Boolean]
|
|
19
|
+
def big_endian?; end
|
|
20
|
+
|
|
21
|
+
# @overload little_endian?
|
|
22
|
+
# Returns `true` if the host byte order is little-endian.
|
|
23
|
+
# @return [Boolean]
|
|
24
|
+
def little_endian?; end
|
|
25
|
+
|
|
26
|
+
# @!endgroup
|
|
27
|
+
|
|
28
|
+
# @!group Data-type inquiries
|
|
29
|
+
|
|
30
|
+
# @overload sizeof(data_type)
|
|
31
|
+
# Returns the byte size of one element of `data_type`. Returns
|
|
32
|
+
# `0` for `:fixlen` (the byte size of a fixlen array is
|
|
33
|
+
# per-instance and read via `CArray#bytes`).
|
|
34
|
+
# @param data_type [Symbol, Integer, Class, String] data type
|
|
35
|
+
# in any accepted form.
|
|
36
|
+
# @return [Integer]
|
|
37
|
+
# @example
|
|
38
|
+
# CArray.sizeof(:int32) # => 4
|
|
39
|
+
# CArray.sizeof(:float64) # => 8
|
|
40
|
+
# CArray.sizeof(:fixlen) # => 0
|
|
41
|
+
def sizeof(data_type); end
|
|
42
|
+
|
|
43
|
+
# @overload data_type_name(data_type)
|
|
44
|
+
# Returns the String name of `data_type` (e.g. `"int32"`,
|
|
45
|
+
# `"float64"`, `"fixlen"`).
|
|
46
|
+
# @param data_type [Symbol, Integer, Class, String]
|
|
47
|
+
# @return [String]
|
|
48
|
+
def data_type_name(data_type); end
|
|
49
|
+
|
|
50
|
+
# @overload data_type_code(data_type)
|
|
51
|
+
# Returns the internal `int8_t` numeric code of `data_type`
|
|
52
|
+
# (e.g. `8` for `:int64`, `11` for `:float64`). Inverse of
|
|
53
|
+
# {.data_type_name}.
|
|
54
|
+
#
|
|
55
|
+
# Primarily used by Ruby-side code that needs to compute kernel
|
|
56
|
+
# op ids (e.g. `CAMonOp::CAST_BASE + code` in
|
|
57
|
+
# `lib/carray/lazy.rb`). End users normally do not need this —
|
|
58
|
+
# compare Symbols or use the `CA_*` constants directly.
|
|
59
|
+
# @param data_type [Symbol, Integer, Class, String]
|
|
60
|
+
# @return [Integer]
|
|
61
|
+
def data_type_code(data_type); end
|
|
62
|
+
|
|
63
|
+
# @!endgroup
|
|
64
|
+
end
|
|
65
|
+
end
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# DOCUMENTATION ONLY — DO NOT REQUIRE.
|
|
2
|
+
# Stubs for methods defined in ext/carray_conversion.c.
|
|
3
|
+
# See yard-stubs/README.md and yard-stubs/STYLE.md.
|
|
4
|
+
|
|
5
|
+
class CArray
|
|
6
|
+
# @!group Copy and conversion
|
|
7
|
+
|
|
8
|
+
# @overload to_a
|
|
9
|
+
# Returns a newly allocated Ruby `Array` containing the element
|
|
10
|
+
# values of `self`. For `ndim >= 2`, the result is nested:
|
|
11
|
+
# `shape == [2, 3]` ⇒ a 2-element `Array` of 3-element `Array`s.
|
|
12
|
+
#
|
|
13
|
+
# Masked cells materialise as `CArray::UNDEF`; the mask state
|
|
14
|
+
# itself is not preserved on the result.
|
|
15
|
+
# @return [Array]
|
|
16
|
+
# @example
|
|
17
|
+
# CArray.float64(2, 3) { |i, j| i + j }.to_a
|
|
18
|
+
# # => [[0.0, 1.0, 2.0], [1.0, 2.0, 3.0]]
|
|
19
|
+
def to_a; end
|
|
20
|
+
|
|
21
|
+
# @overload convert(data_type = nil, bytes: nil) { |elem| ... }
|
|
22
|
+
# Returns a new CArray of the same shape as `self`, each element
|
|
23
|
+
# set to the block's return value applied to the corresponding
|
|
24
|
+
# element of `self`. The output array is built via {#template},
|
|
25
|
+
# so `data_type` (and `bytes:` for `:fixlen`) selects the result
|
|
26
|
+
# type; omit them to inherit `self.data_type`.
|
|
27
|
+
#
|
|
28
|
+
# Masked cells skip the block; if the block returns
|
|
29
|
+
# `CArray::UNDEF`, the corresponding output cell is masked.
|
|
30
|
+
# @param data_type [Symbol, Integer, Class, String, nil]
|
|
31
|
+
# @param bytes [Integer, nil] element byte size for `:fixlen`.
|
|
32
|
+
# @yieldparam elem [Object] one element of `self`.
|
|
33
|
+
# @yieldreturn [Object] value to store in the result.
|
|
34
|
+
# @return [CArray]
|
|
35
|
+
def convert(data_type = nil, bytes: nil, &block); end
|
|
36
|
+
|
|
37
|
+
# @!endgroup
|
|
38
|
+
|
|
39
|
+
# @!group Copy and conversion
|
|
40
|
+
|
|
41
|
+
# @overload dump_binary
|
|
42
|
+
# Returns a new binary String containing the raw element bytes of
|
|
43
|
+
# `self` in row-major order.
|
|
44
|
+
# @return [String]
|
|
45
|
+
# @raise [CArray::DataTypeError] if `self.data_type` is
|
|
46
|
+
# `:object`.
|
|
47
|
+
# @overload dump_binary(io)
|
|
48
|
+
# Writes the raw element bytes of `self` to `io` and returns
|
|
49
|
+
# `io`. `io` may be a `String` (resized and overwritten), an
|
|
50
|
+
# `IO`, or any object responding to `write`.
|
|
51
|
+
# @param io [String, IO, #write]
|
|
52
|
+
# @return [String, IO, Object] the `io` argument.
|
|
53
|
+
# @raise [CArray::DataTypeError] if `self.data_type` is
|
|
54
|
+
# `:object`.
|
|
55
|
+
def dump_binary(io = nil); end
|
|
56
|
+
|
|
57
|
+
# @overload to_s
|
|
58
|
+
# Equivalent to `dump_binary` with no arguments. Returns the raw
|
|
59
|
+
# element bytes of `self` as a binary String.
|
|
60
|
+
# @return [String]
|
|
61
|
+
def to_s; end
|
|
62
|
+
|
|
63
|
+
# @overload load_binary(io)
|
|
64
|
+
# Reads `ca_length(self)` bytes from `io` and overwrites the
|
|
65
|
+
# element data of `self` in row-major order. `io` may be a
|
|
66
|
+
# `String` of the exact size, or any object responding to
|
|
67
|
+
# `read(n, buf = nil)`.
|
|
68
|
+
# @param io [String, IO, #read]
|
|
69
|
+
# @return [self]
|
|
70
|
+
# @raise [RuntimeError] on short read or size mismatch.
|
|
71
|
+
# @raise [CArray::DataTypeError] if `self.data_type` is
|
|
72
|
+
# `:object`.
|
|
73
|
+
def load_binary(io); end
|
|
74
|
+
|
|
75
|
+
# @!endgroup
|
|
76
|
+
end
|