carray 1.1.4 → 1.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/COPYING +56 -0
- data/GPL +340 -0
- data/Gemfile +9 -0
- data/Gemfile.lock +33 -0
- data/LEGAL +50 -0
- data/NOTE +73 -0
- data/Rakefile +20 -0
- data/TODO +5 -0
- data/ca_iter_block.c +242 -0
- data/ca_iter_dimension.c +287 -0
- data/ca_iter_window.c +202 -0
- data/ca_obj_array.c +1189 -0
- data/ca_obj_bitarray.c +523 -0
- data/ca_obj_bitfield.c +636 -0
- data/ca_obj_block.c +885 -0
- data/ca_obj_fake.c +405 -0
- data/ca_obj_farray.c +482 -0
- data/ca_obj_field.c +625 -0
- data/ca_obj_grid.c +738 -0
- data/ca_obj_mapping.c +614 -0
- data/ca_obj_object.c +777 -0
- data/ca_obj_reduce.c +299 -0
- data/ca_obj_refer.c +627 -0
- data/ca_obj_repeat.c +640 -0
- data/ca_obj_select.c +558 -0
- data/ca_obj_shift.c +952 -0
- data/ca_obj_transpose.c +582 -0
- data/ca_obj_unbound_repeat.c +557 -0
- data/ca_obj_window.c +1023 -0
- data/carray.h +1381 -0
- data/carray_access.c +1798 -0
- data/carray_attribute.c +903 -0
- data/carray_call_cfunc.c +1107 -0
- data/carray_cast.c +1155 -0
- data/carray_cast_func.rb +498 -0
- data/carray_class.c +132 -0
- data/carray_conversion.c +518 -0
- data/carray_copy.c +453 -0
- data/carray_core.c +1307 -0
- data/carray_element.c +572 -0
- data/carray_generate.c +681 -0
- data/carray_iterator.c +630 -0
- data/carray_loop.c +462 -0
- data/carray_mask.c +1174 -0
- data/carray_math.rb +834 -0
- data/carray_numeric.c +257 -0
- data/carray_operator.c +582 -0
- data/carray_order.c +1040 -0
- data/carray_random.c +529 -0
- data/carray_sort_addr.c +261 -0
- data/carray_stat.c +2102 -0
- data/carray_stat_proc.rb +1990 -0
- data/carray_test.c +602 -0
- data/carray_undef.c +69 -0
- data/carray_utils.c +740 -0
- data/ext/calculus/carray_calculus.c +792 -0
- data/ext/calculus/carray_interp.c +355 -0
- data/ext/calculus/extconf.rb +12 -0
- data/ext/calculus/lib/autoload/autoload_math_calculus.rb +2 -0
- data/ext/calculus/lib/math/calculus.rb +119 -0
- data/ext/calculus/lib/math/interp/adapter_interp1d.rb +31 -0
- data/ext/dataframe/API.txt +11 -0
- data/ext/dataframe/extconf.rb +3 -0
- data/ext/dataframe/lib/carray/autoload/autoload_dataframe_dataframe.rb +14 -0
- data/ext/dataframe/lib/carray/dataframe/dataframe.rb +1104 -0
- data/ext/dataframe/sample/test_uniq_sort.rb +5 -0
- data/ext/fortio/extconf.rb +3 -0
- data/ext/fortio/lib/carray/autoload/autoload_fortran_format.rb +5 -0
- data/ext/fortio/lib/carray/io/fortran_format.rb +43 -0
- data/ext/fortio/lib/fortio.rb +3 -0
- data/ext/fortio/lib/fortio/fortran_format.rb +603 -0
- data/ext/fortio/lib/fortio/fortran_format.tab.rb +536 -0
- data/ext/fortio/lib/fortio/fortran_format.y +215 -0
- data/ext/fortio/lib/fortio/fortran_namelist.rb +151 -0
- data/ext/fortio/lib/fortio/fortran_namelist.tab.rb +470 -0
- data/ext/fortio/lib/fortio/fortran_namelist.y +213 -0
- data/ext/fortio/lib/fortio/fortran_sequential.rb +345 -0
- data/ext/fortio/ruby_fortio.c +182 -0
- data/ext/fortio/test/test_H.rb +5 -0
- data/ext/fortio/test/test_T.rb +7 -0
- data/ext/fortio/test/test_fortran_format.rb +86 -0
- data/ext/fortio/test/test_namelist.rb +25 -0
- data/ext/fortio/test/test_sequential.rb +13 -0
- data/ext/fortio/test/test_sequential2.rb +13 -0
- data/ext/fortio/work/test.rb +10 -0
- data/ext/fortio/work/test_e.rb +19 -0
- data/ext/fortio/work/test_ep.rb +10 -0
- data/ext/fortio/work/test_parse.rb +12 -0
- data/ext/imagemap/carray_imagemap.c +495 -0
- data/ext/imagemap/doc/call_graph.dot +28 -0
- data/ext/imagemap/draw.c +567 -0
- data/ext/imagemap/extconf.rb +13 -0
- data/ext/imagemap/lib/autoload/autoload_graphics_imagemap.rb +1 -0
- data/ext/imagemap/lib/graphics/imagemap.rb +273 -0
- data/ext/imagemap/lib/image_map.rb +4 -0
- data/ext/imagemap/test/swath_index.rb +83 -0
- data/ext/imagemap/test/swath_warp.rb +99 -0
- data/ext/imagemap/test/test.rb +23 -0
- data/ext/imagemap/test/test_image.rb +42 -0
- data/ext/imagemap/test/test_line.rb +14 -0
- data/ext/imagemap/test/test_rotate.rb +17 -0
- data/ext/imagemap/test/test_triangle.rb +20 -0
- data/ext/imagemap/test/test_warp.rb +26 -0
- data/ext/mathfunc/carray_mathfunc.c +321 -0
- data/ext/mathfunc/extconf.rb +18 -0
- data/ext/mathfunc/lib/autoload/autoload_math_mathfunc.rb +1 -0
- data/ext/mathfunc/lib/math/mathfunc.rb +15 -0
- data/ext/mathfunc/test/test_hypot.rb +5 -0
- data/ext/mathfunc/test/test_j0.rb +22 -0
- data/ext/mathfunc/test/test_jn.rb +8 -0
- data/ext/mathfunc/test/test_sph.rb +9 -0
- data/ext/narray/README +22 -0
- data/ext/narray/ca_wrap_narray.c +491 -0
- data/ext/narray/carray_narray.c +21 -0
- data/ext/narray/extconf.rb +57 -0
- data/ext/narray/lib/autoload/autoload_math_narray.rb +1 -0
- data/ext/narray/lib/autoload/autoload_math_narray_miss.rb +11 -0
- data/ext/narray/lib/math/narray.rb +17 -0
- data/ext/narray/lib/math/narray_miss.rb +45 -0
- data/extconf.rb +3 -25
- data/lib/carray.rb +28 -0
- data/lib/carray/autoload/autoload_base.rb +23 -0
- data/lib/carray/autoload/autoload_graphics_gnuplot.rb +2 -0
- data/lib/carray/autoload/autoload_io_csv.rb +14 -0
- data/lib/carray/autoload/autoload_io_excel.rb +5 -0
- data/lib/carray/autoload/autoload_io_imagemagick.rb +6 -0
- data/lib/carray/autoload/autoload_io_pg.rb +6 -0
- data/lib/carray/autoload/autoload_io_sqlite3.rb +12 -0
- data/lib/carray/autoload/autoload_io_table.rb +1 -0
- data/lib/carray/autoload/autoload_math_histogram.rb +5 -0
- data/lib/carray/autoload/autoload_math_interp.rb +4 -0
- data/lib/carray/autoload/autoload_math_recurrence.rb +6 -0
- data/lib/carray/autoload/autoload_object_iterator.rb +1 -0
- data/lib/carray/autoload/autoload_object_link.rb +1 -0
- data/lib/carray/autoload/autoload_object_pack.rb +2 -0
- data/lib/carray/base/autoload.rb +94 -0
- data/lib/carray/base/basic.rb +1051 -0
- data/lib/carray/base/inspect.rb +252 -0
- data/lib/carray/base/iterator.rb +367 -0
- data/lib/carray/base/math.rb +403 -0
- data/lib/carray/base/obsolete.rb +93 -0
- data/lib/carray/base/serialize.rb +260 -0
- data/lib/carray/base/struct.rb +634 -0
- data/lib/carray/graphics/gnuplot.rb +2116 -0
- data/lib/carray/info.rb +112 -0
- data/lib/carray/io/csv.rb +560 -0
- data/lib/carray/io/excel.rb +26 -0
- data/lib/carray/io/imagemagick.rb +231 -0
- data/lib/carray/io/pg.rb +101 -0
- data/lib/carray/io/sqlite3.rb +202 -0
- data/lib/carray/io/table.rb +77 -0
- data/lib/carray/math/histogram.rb +179 -0
- data/lib/carray/math/interp.rb +57 -0
- data/lib/carray/math/interp/adapter_gsl_spline.rb +47 -0
- data/lib/carray/math/recurrence.rb +95 -0
- data/lib/carray/mkmf.rb +145 -0
- data/lib/carray/object/ca_obj_iterator.rb +52 -0
- data/lib/carray/object/ca_obj_link.rb +52 -0
- data/lib/carray/object/ca_obj_pack.rb +101 -0
- data/mkmath.rb +731 -0
- data/mt19937ar.c +182 -0
- data/mt19937ar.h +86 -0
- data/rdoc_main.rb +27 -0
- data/rdoc_math.rb +5 -0
- data/rdoc_stat.rb +31 -0
- data/ruby_carray.c +242 -0
- data/ruby_ccomplex.c +497 -0
- data/ruby_float_func.c +83 -0
- data/spec/CABlockIterator/CABlockIterator_spec.rb +113 -0
- data/spec/CArray/bug/store_spec.rb +27 -0
- data/spec/CArray/index/repeat_spec.rb +10 -0
- data/spec/CArray/method/eq_spec.rb +80 -0
- data/spec/CArray/method/is_nan_spec.rb +12 -0
- data/spec/CArray/method/ne_spec.rb +18 -0
- data/spec/CArray/method/round_spec.rb +11 -0
- data/spec/CArray/object/_attribute_spec.rb +32 -0
- data/spec/CArray/object/s_new_spec.rb +31 -0
- data/spec/CArray/serialize/Serialization_spec.rb +89 -0
- data/spec/spec_all.rb +11 -0
- data/test/test_ALL.rb +50 -0
- data/test/test_CABitfield.rb +59 -0
- data/test/test_CABlock.rb +208 -0
- data/test/test_CAField.rb +40 -0
- data/test/test_CAGrid.rb +76 -0
- data/test/test_CAMapping.rb +106 -0
- data/test/test_CAMmap.rb +11 -0
- data/test/test_CARefer.rb +94 -0
- data/test/test_CARepeat.rb +66 -0
- data/test/test_CASelect.rb +23 -0
- data/test/test_CAShift.rb +17 -0
- data/test/test_CATranspose.rb +61 -0
- data/test/test_CAVirtual.rb +214 -0
- data/test/test_CAWindow.rb +55 -0
- data/test/test_CAWrap.rb +9 -0
- data/test/test_CArray.rb +228 -0
- data/test/test_CComplex.rb +83 -0
- data/test/test_CScalar.rb +91 -0
- data/test/test_attribute.rb +281 -0
- data/test/test_block_iterator.rb +17 -0
- data/test/test_boolean.rb +99 -0
- data/test/test_cast.rb +33 -0
- data/test/test_class.rb +85 -0
- data/test/test_complex.rb +43 -0
- data/test/test_composite.rb +125 -0
- data/test/test_convert.rb +79 -0
- data/test/test_copy.rb +141 -0
- data/test/test_creation.rb +85 -0
- data/test/test_element.rb +146 -0
- data/test/test_extream.rb +55 -0
- data/test/test_generate.rb +75 -0
- data/test/test_index.rb +71 -0
- data/test/test_mask.rb +578 -0
- data/test/test_math.rb +98 -0
- data/test/test_narray.rb +64 -0
- data/test/test_order.rb +147 -0
- data/test/test_random.rb +15 -0
- data/test/test_ref_store.rb +211 -0
- data/test/test_stat.rb +414 -0
- data/test/test_struct.rb +72 -0
- data/test/test_virtual.rb +49 -0
- data/utils/ca_ase.rb +21 -0
- data/utils/ca_methods.rb +15 -0
- data/utils/cast_checker.rb +30 -0
- data/utils/create_rdoc.sh +9 -0
- data/utils/diff_method.rb +52 -0
- data/utils/extract_rdoc.rb +27 -0
- data/utils/make_tgz.sh +3 -0
- data/utils/remove_resource_fork.sh +5 -0
- data/version.h +3 -3
- metadata +266 -1
data/carray.h
ADDED
@@ -0,0 +1,1381 @@
|
|
1
|
+
/* ---------------------------------------------------------------------------
|
2
|
+
|
3
|
+
carray.h
|
4
|
+
|
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
|
+
|
9
|
+
Copyright (C) 2005 Hiroki Motoyoshi
|
10
|
+
|
11
|
+
---------------------------------------------------------------------------- */
|
12
|
+
|
13
|
+
#ifndef CARRAY_H
|
14
|
+
#define CARRAY_H
|
15
|
+
|
16
|
+
#include "ruby.h"
|
17
|
+
|
18
|
+
/* -------------------------------------------------------------------- */
|
19
|
+
|
20
|
+
#include "carray_config.h"
|
21
|
+
|
22
|
+
/* -------------------------------------------------------------------- */
|
23
|
+
|
24
|
+
#ifndef RSTRING_PTR
|
25
|
+
# define RSTRING_PTR(s) (RSTRING(s)->ptr)
|
26
|
+
#endif
|
27
|
+
#ifndef RSTRING_LEN
|
28
|
+
# define RSTRING_LEN(s) (RSTRING(s)->len)
|
29
|
+
#endif
|
30
|
+
|
31
|
+
#ifndef RARRAY_PTR
|
32
|
+
# define RARRAY_PTR(a) (RARRAY(a)->ptr)
|
33
|
+
#endif
|
34
|
+
#ifndef RARRAY_LEN
|
35
|
+
# define RARRAY_LEN(a) (RARRAY(a)->len)
|
36
|
+
#endif
|
37
|
+
|
38
|
+
#ifndef NUM2ULL
|
39
|
+
# define NUM2ULL(x) NUM2LL(x)
|
40
|
+
#endif
|
41
|
+
|
42
|
+
/* -------------------------------------------------------------------- */
|
43
|
+
|
44
|
+
#include <float.h>
|
45
|
+
|
46
|
+
#ifdef HAVE_SYS_TYPES_H
|
47
|
+
# include <sys/types.h>
|
48
|
+
#endif
|
49
|
+
|
50
|
+
#ifdef HAVE_STDINT_H
|
51
|
+
# include <stdint.h>
|
52
|
+
#endif
|
53
|
+
|
54
|
+
typedef char dummy_t;
|
55
|
+
|
56
|
+
#ifndef HAVE_TYPE_INT8_T
|
57
|
+
# define HAVE_TYPE_INT8_T 1
|
58
|
+
typedef signed char int8_t;
|
59
|
+
#endif
|
60
|
+
|
61
|
+
typedef int8_t boolean8_t;
|
62
|
+
|
63
|
+
#ifndef HAVE_TYPE_UINT8_T
|
64
|
+
# define HAVE_TYPE_UINT8_T 1
|
65
|
+
typedef unsigned char uint8_t;
|
66
|
+
#endif
|
67
|
+
|
68
|
+
#ifndef HAVE_TYPE_INT16_T
|
69
|
+
# if SIZEOF_SHORT == 2
|
70
|
+
# define HAVE_TYPE_INT16_T 1
|
71
|
+
typedef short int16_t;
|
72
|
+
# else
|
73
|
+
typedef dummy_t int16_t;
|
74
|
+
# endif
|
75
|
+
#endif
|
76
|
+
|
77
|
+
#ifndef HAVE_TYPE_UINT16_T
|
78
|
+
# if SIZEOF_SHORT == 2
|
79
|
+
# define HAVE_TYPE_UINT16_T 1
|
80
|
+
typedef unsigned short uint16_t;
|
81
|
+
# else
|
82
|
+
typedef dummy_t uint16_t;
|
83
|
+
# endif
|
84
|
+
#endif
|
85
|
+
|
86
|
+
#ifndef HAVE_TYPE_INT32_T
|
87
|
+
# if SIZEOF_LONG == 4
|
88
|
+
# define HAVE_TYPE_INT32_T 1
|
89
|
+
typedef long int32_t;
|
90
|
+
# else
|
91
|
+
# if SIZEOF_INT == 4
|
92
|
+
# define HAVE_TYPE_INT32_T 1
|
93
|
+
typedef int int32_t;
|
94
|
+
# else
|
95
|
+
typedef dummy_t uint32_t;
|
96
|
+
# endif
|
97
|
+
# endif
|
98
|
+
#endif
|
99
|
+
|
100
|
+
#ifndef HAVE_TYPE_UINT32_T
|
101
|
+
# if SIZEOF_LONG == 4
|
102
|
+
# define HAVE_TYPE_UINT32_T 1
|
103
|
+
typedef unsigned long uint32_t;
|
104
|
+
# else
|
105
|
+
# if SIZEOF_INT == 4
|
106
|
+
# define HAVE_TYPE_UINT32_T 1
|
107
|
+
typedef unsigned int uint32_t;
|
108
|
+
# else
|
109
|
+
typedef dummy_t uint32_t;
|
110
|
+
# endif
|
111
|
+
# endif
|
112
|
+
#endif
|
113
|
+
|
114
|
+
#ifndef HAVE_TYPE_INT64_T
|
115
|
+
# if HAVE_LONG_LONG == 1 && SIZEOF_LONG_LONG == 8
|
116
|
+
# define HAVE_TYPE_INT64_T 1
|
117
|
+
typedef long long int64_t;
|
118
|
+
# else
|
119
|
+
typedef dummy_t int64_t;
|
120
|
+
# endif
|
121
|
+
#endif
|
122
|
+
|
123
|
+
#ifndef HAVE_TYPE_UINT64_T
|
124
|
+
# if HAVE_LONG_LONG == 1 && SIZEOF_LONG_LONG == 8
|
125
|
+
# define HAVE_TYPE_UINT64_T 1
|
126
|
+
typedef unsigned long long uint64_t;
|
127
|
+
# else
|
128
|
+
typedef dummy_t uint64_t;
|
129
|
+
# endif
|
130
|
+
#endif
|
131
|
+
|
132
|
+
#if HAVE_TYPE_FLOAT == 1 && SIZEOF_FLOAT == 4
|
133
|
+
# define HAVE_TYPE_FLOAT32_T 1
|
134
|
+
typedef float float32_t;
|
135
|
+
#else
|
136
|
+
typedef dummy_t float32_t;
|
137
|
+
#endif
|
138
|
+
|
139
|
+
#if HAVE_TYPE_DOUBLE == 1 && SIZEOF_DOUBLE == 8
|
140
|
+
# define HAVE_TYPE_FLOAT64_T 1
|
141
|
+
typedef double float64_t;
|
142
|
+
#else
|
143
|
+
typedef dummy_t float64_t;
|
144
|
+
#endif
|
145
|
+
|
146
|
+
/* float128_t is currently disabled in extconf.rb */
|
147
|
+
|
148
|
+
#if HAVE_TYPE_LONG_DOUBLE == 1 && SIZEOF_LONG_DOUBLE == 16
|
149
|
+
# define HAVE_TYPE_FLOAT128_T 1
|
150
|
+
typedef long double float128_t;
|
151
|
+
#else
|
152
|
+
typedef dummy_t float128_t;
|
153
|
+
#endif
|
154
|
+
|
155
|
+
#ifdef HAVE_COMPLEX_H
|
156
|
+
# include <complex.h>
|
157
|
+
#endif
|
158
|
+
|
159
|
+
#ifdef HAVE_TYPE_FLOAT_COMPLEX
|
160
|
+
# define HAVE_TYPE_CMPLX64_T 1
|
161
|
+
typedef float complex cmplx64_t;
|
162
|
+
#else
|
163
|
+
typedef dummy_t cmplx64_t;
|
164
|
+
#endif
|
165
|
+
|
166
|
+
#ifdef HAVE_TYPE_DOUBLE_COMPLEX
|
167
|
+
# define HAVE_TYPE_CMPLX128_T 1
|
168
|
+
typedef double complex cmplx128_t;
|
169
|
+
#else
|
170
|
+
typedef dummy_t cmplx128_t;
|
171
|
+
#endif
|
172
|
+
|
173
|
+
/* cmplx256_t is currently disabled in extconf.rb */
|
174
|
+
|
175
|
+
#if HAVE_TYPE_LONG_DOUBLE_COMPLEX == 1 && SIZEOF_LONG_DOUBLE_COMPLEX == 32
|
176
|
+
# define HAVE_TYPE_CMPLX256_T 1
|
177
|
+
typedef long double complex cmplx256_t;
|
178
|
+
#else
|
179
|
+
typedef dummy_t cmplx256_t;
|
180
|
+
#endif
|
181
|
+
|
182
|
+
#include <stddef.h>
|
183
|
+
|
184
|
+
#define CA_ALIGN_VOIDP offsetof(struct { char c; void *x; }, x)
|
185
|
+
#define CA_ALIGN_INT8 offsetof(struct { char c; int8_t x; }, x)
|
186
|
+
#define CA_ALIGN_INT16 offsetof(struct { char c; int16_t x; }, x)
|
187
|
+
#define CA_ALIGN_INT32 offsetof(struct { char c; int32_t x; }, x)
|
188
|
+
#define CA_ALIGN_INT64 offsetof(struct { char c; int64_t x; }, x)
|
189
|
+
#define CA_ALIGN_FLOAT32 offsetof(struct { char c; float32_t x; }, x)
|
190
|
+
#define CA_ALIGN_FLOAT64 offsetof(struct { char c; float64_t x; }, x)
|
191
|
+
#define CA_ALIGN_FLOAT128 offsetof(struct { char c; float128_t x; }, x)
|
192
|
+
#define CA_ALIGN_CMPLX64 offsetof(struct { char c; cmplx64_t x; }, x)
|
193
|
+
#define CA_ALIGN_CMPLX128 offsetof(struct { char c; cmplx128_t x; }, x)
|
194
|
+
#define CA_ALIGN_CMPLX256 offsetof(struct { char c; cmplx256_t x; }, x)
|
195
|
+
#define CA_ALIGN_OBJECT offsetof(struct { char c; VALUE x; }, x)
|
196
|
+
|
197
|
+
/* -------------------------------------------------------------------- */
|
198
|
+
|
199
|
+
#define CA_OBJ_TYPE_MAX 256
|
200
|
+
#define CA_RANK_MAX 16
|
201
|
+
#define CA_LENGTH_MAX 0x7fffffff
|
202
|
+
#define CA_ATTACH_MAX 0x80000000
|
203
|
+
|
204
|
+
#define CA_FLAG_SCALAR 1
|
205
|
+
#define CA_FLAG_MASK_ARRAY 2
|
206
|
+
#define CA_FLAG_VALUE_ARRAY 4
|
207
|
+
#define CA_FLAG_READ_ONLY 8
|
208
|
+
#define CA_FLAG_SHARE_INDEX 16
|
209
|
+
#define CA_FLAG_NOT_DATA_CLASS 32
|
210
|
+
#define CA_FLAG_CYCLE_CHECK 64
|
211
|
+
|
212
|
+
enum {
|
213
|
+
CA_LITTLE_ENDIAN = 0,
|
214
|
+
CA_BIG_ENDIAN = 1
|
215
|
+
};
|
216
|
+
|
217
|
+
enum {
|
218
|
+
CA_REAL_ARRAY,
|
219
|
+
CA_VIRTUAL_ARRAY
|
220
|
+
};
|
221
|
+
|
222
|
+
enum {
|
223
|
+
CA_OBJ_ARRAY,
|
224
|
+
CA_OBJ_ARRAY_WRAP,
|
225
|
+
CA_OBJ_SCALAR,
|
226
|
+
CA_OBJ_REFER,
|
227
|
+
CA_OBJ_BLOCK,
|
228
|
+
CA_OBJ_SELECT,
|
229
|
+
CA_OBJ_OBJECT,
|
230
|
+
CA_OBJ_REPEAT,
|
231
|
+
CA_OBJ_UNBOUND_REPEAT,
|
232
|
+
};
|
233
|
+
|
234
|
+
enum {
|
235
|
+
CA_NONE = -1, /* -1 */
|
236
|
+
CA_FIXLEN, /* 0 */
|
237
|
+
CA_BOOLEAN, /* 1 */
|
238
|
+
CA_INT8, /* 2 */
|
239
|
+
CA_UINT8, /* 3 */
|
240
|
+
CA_INT16, /* 4 */
|
241
|
+
CA_UINT16, /* 5 */
|
242
|
+
CA_INT32, /* 6 */
|
243
|
+
CA_UINT32, /* 7 */
|
244
|
+
CA_INT64, /* 8 */
|
245
|
+
CA_UINT64, /* 9 */
|
246
|
+
CA_FLOAT32, /* 10 */
|
247
|
+
CA_FLOAT64, /* 11 */
|
248
|
+
CA_FLOAT128, /* 12 */
|
249
|
+
CA_CMPLX64, /* 13 */
|
250
|
+
CA_CMPLX128, /* 14 */
|
251
|
+
CA_CMPLX256, /* 15 */
|
252
|
+
CA_OBJECT, /* 16 */
|
253
|
+
CA_NTYPE, /* 17 */
|
254
|
+
CA_BYTE = CA_UINT8,
|
255
|
+
CA_SHORT = CA_INT16,
|
256
|
+
CA_INT = CA_INT32,
|
257
|
+
CA_FLOAT = CA_FLOAT32,
|
258
|
+
CA_DOUBLE = CA_FLOAT64,
|
259
|
+
CA_COMPLEX = CA_CMPLX64,
|
260
|
+
CA_DCOMPLEX = CA_CMPLX128,
|
261
|
+
}; /* CA_DATA_TYPE */
|
262
|
+
|
263
|
+
enum {
|
264
|
+
CA_BOUNDS_RUBY = 1,
|
265
|
+
CA_BOUNDS_STRICT,
|
266
|
+
CA_BOUNDS_NEAREST,
|
267
|
+
CA_BOUNDS_PERIODIC,
|
268
|
+
CA_BOUNDS_REFLECT,
|
269
|
+
CA_BOUNDS_FILL,
|
270
|
+
CA_BOUNDS_MASK,
|
271
|
+
}; /* CA_BOUNDS_TYPE for CAWindow */
|
272
|
+
|
273
|
+
/* -------------------------------------------------------------------- */
|
274
|
+
|
275
|
+
typedef struct {
|
276
|
+
int32_t obj_type;
|
277
|
+
int32_t entity_type;
|
278
|
+
void (*free_object) (void *ap);
|
279
|
+
void * (*clone) (void *ap);
|
280
|
+
char * (*ptr_at_addr) (void *ap, int32_t addr);
|
281
|
+
char * (*ptr_at_index) (void *ap, int32_t *idx);
|
282
|
+
void (*fetch_addr) (void *ap, int32_t addr, void *data);
|
283
|
+
void (*fetch_index) (void *ap, int32_t *idx, void *data);
|
284
|
+
void (*store_addr) (void *ap, int32_t addr, void *data);
|
285
|
+
void (*store_index) (void *ap, int32_t *idx, void *data);
|
286
|
+
void (*allocate) (void *ap);
|
287
|
+
void (*attach) (void *ap);
|
288
|
+
void (*sync) (void *ap);
|
289
|
+
void (*detach) (void *ap);
|
290
|
+
void (*copy_data) (void *ap, void *data);
|
291
|
+
void (*sync_data) (void *ap, void *data);
|
292
|
+
void (*fill_data) (void *ap, void *data);
|
293
|
+
void (*create_mask) (void *ap);
|
294
|
+
} ca_operation_function_t;
|
295
|
+
|
296
|
+
/* default operation_function */
|
297
|
+
|
298
|
+
void * ca_array_func_clone (void *ap);
|
299
|
+
char * ca_array_func_ptr_at_addr (void *ap, int32_t addr);
|
300
|
+
char * ca_array_func_ptr_at_index (void *ap, int32_t *idx);
|
301
|
+
void ca_array_func_fetch_addr (void *ap, int32_t addr, void *ptr);
|
302
|
+
void ca_array_func_fetch_index (void *ap, int32_t *idx, void *ptr);
|
303
|
+
void ca_array_func_store_addr (void *ap, int32_t addr, void *ptr);
|
304
|
+
void ca_array_func_store_index (void *ap, int32_t *idx, void *ptr);
|
305
|
+
void ca_array_func_allocate (void *ap);
|
306
|
+
void ca_array_func_attach (void *ap);
|
307
|
+
void ca_array_func_sync (void *ap);
|
308
|
+
void ca_array_func_detach (void *ap);
|
309
|
+
void ca_array_func_copy_data (void *ap, void *ptr);
|
310
|
+
void ca_array_func_sync_data (void *ap, void *ptr);
|
311
|
+
void ca_array_func_fill_data (void *ap, void *val);
|
312
|
+
void ca_array_func_create_mask (void *ap);
|
313
|
+
|
314
|
+
/* -------------------------------------------------------------------- */
|
315
|
+
|
316
|
+
/* CArray : base class of all carray object */
|
317
|
+
|
318
|
+
typedef struct _CArray CArray;
|
319
|
+
|
320
|
+
struct _CArray {
|
321
|
+
int16_t obj_type;
|
322
|
+
int8_t data_type;
|
323
|
+
int8_t rank;
|
324
|
+
int32_t flags;
|
325
|
+
int32_t bytes;
|
326
|
+
int32_t elements;
|
327
|
+
int32_t *dim;
|
328
|
+
char *ptr;
|
329
|
+
CArray *mask;
|
330
|
+
}; /* 28 + 4*rank (bytes) */
|
331
|
+
|
332
|
+
typedef CArray CAWrap;
|
333
|
+
|
334
|
+
typedef struct {
|
335
|
+
int16_t obj_type;
|
336
|
+
int8_t data_type;
|
337
|
+
int8_t rank;
|
338
|
+
int32_t flags;
|
339
|
+
int32_t bytes;
|
340
|
+
int32_t elements;
|
341
|
+
int32_t *dim;
|
342
|
+
char *ptr;
|
343
|
+
CArray *mask;
|
344
|
+
int32_t _dim;
|
345
|
+
} CScalar; /* 32 (bytes) */
|
346
|
+
|
347
|
+
typedef struct {
|
348
|
+
int16_t obj_type;
|
349
|
+
int8_t data_type;
|
350
|
+
int8_t rank;
|
351
|
+
int32_t flags;
|
352
|
+
int32_t bytes;
|
353
|
+
int32_t elements;
|
354
|
+
int32_t *dim;
|
355
|
+
char *ptr;
|
356
|
+
CArray *mask;
|
357
|
+
CArray *parent;
|
358
|
+
uint32_t attach;
|
359
|
+
uint8_t nosync;
|
360
|
+
} CAVirtual; /* 40 + 4*(rank) (bytes) */
|
361
|
+
|
362
|
+
typedef struct {
|
363
|
+
int16_t obj_type;
|
364
|
+
int8_t data_type;
|
365
|
+
int8_t rank;
|
366
|
+
int32_t flags;
|
367
|
+
int32_t bytes;
|
368
|
+
int32_t elements;
|
369
|
+
int32_t *dim;
|
370
|
+
char *ptr;
|
371
|
+
CArray *mask;
|
372
|
+
CArray *parent;
|
373
|
+
uint32_t attach;
|
374
|
+
uint8_t nosync;
|
375
|
+
/* ---------- */
|
376
|
+
int8_t is_deformed; /* 0 : not deformed */
|
377
|
+
/* 1 : deformed */
|
378
|
+
/* -2 : divided */
|
379
|
+
/* 2 : spanned */
|
380
|
+
int32_t ratio;
|
381
|
+
int32_t offset;
|
382
|
+
CArray *mask0;
|
383
|
+
} CARefer; /* 52 + 4*(rank) (bytes) */
|
384
|
+
|
385
|
+
typedef struct {
|
386
|
+
int16_t obj_type;
|
387
|
+
int8_t data_type;
|
388
|
+
int8_t rank;
|
389
|
+
int32_t flags;
|
390
|
+
int32_t bytes;
|
391
|
+
int32_t elements;
|
392
|
+
int32_t *dim;
|
393
|
+
char *ptr;
|
394
|
+
CArray *mask;
|
395
|
+
CArray *parent;
|
396
|
+
uint32_t attach;
|
397
|
+
uint8_t nosync;
|
398
|
+
/* ---------- */
|
399
|
+
int8_t maxdim_index;
|
400
|
+
int32_t maxdim_step;
|
401
|
+
int32_t maxdim_step0;
|
402
|
+
int32_t offset;
|
403
|
+
int32_t *start;
|
404
|
+
int32_t *step;
|
405
|
+
int32_t *count;
|
406
|
+
int32_t *size0;
|
407
|
+
} CABlock; /* 68 + 20*(rank) (bytes) */
|
408
|
+
|
409
|
+
typedef struct {
|
410
|
+
int16_t obj_type;
|
411
|
+
int8_t data_type;
|
412
|
+
int8_t rank;
|
413
|
+
int32_t flags;
|
414
|
+
int32_t bytes;
|
415
|
+
int32_t elements;
|
416
|
+
int32_t *dim;
|
417
|
+
char *ptr;
|
418
|
+
CArray *mask;
|
419
|
+
CArray *parent;
|
420
|
+
uint32_t attach;
|
421
|
+
uint8_t nosync;
|
422
|
+
/* ---------- */
|
423
|
+
uint8_t bounds;
|
424
|
+
int32_t *start;
|
425
|
+
int32_t *count;
|
426
|
+
int32_t *size0;
|
427
|
+
char *fill;
|
428
|
+
} CAWindow; /* 56 + 16*(rank) + 1*(bytes) (bytes) */
|
429
|
+
|
430
|
+
typedef struct {
|
431
|
+
int16_t obj_type;
|
432
|
+
int8_t data_type;
|
433
|
+
int8_t rank;
|
434
|
+
int32_t flags;
|
435
|
+
int32_t bytes;
|
436
|
+
int32_t elements;
|
437
|
+
int32_t *dim;
|
438
|
+
char *ptr;
|
439
|
+
CArray *mask;
|
440
|
+
CArray *parent;
|
441
|
+
uint32_t attach;
|
442
|
+
uint8_t nosync;
|
443
|
+
/* -------------*/
|
444
|
+
CArray *data;
|
445
|
+
VALUE self;
|
446
|
+
} CAObject; /* 48 + 4*(rank) (bytes) */
|
447
|
+
|
448
|
+
/*
|
449
|
+
CAObjectMask is an internal class
|
450
|
+
used only as mask array of CAObject.
|
451
|
+
*/
|
452
|
+
|
453
|
+
typedef struct {
|
454
|
+
int16_t obj_type;
|
455
|
+
int8_t data_type;
|
456
|
+
int8_t rank;
|
457
|
+
int32_t flags;
|
458
|
+
int32_t bytes;
|
459
|
+
int32_t elements;
|
460
|
+
int32_t *dim;
|
461
|
+
char *ptr;
|
462
|
+
CArray *mask;
|
463
|
+
/* -------------*/
|
464
|
+
VALUE array;
|
465
|
+
} CAObjectMask;
|
466
|
+
|
467
|
+
typedef struct {
|
468
|
+
int16_t obj_type;
|
469
|
+
int8_t data_type;
|
470
|
+
int8_t rank;
|
471
|
+
int32_t flags;
|
472
|
+
int32_t bytes;
|
473
|
+
int32_t elements;
|
474
|
+
int32_t *dim;
|
475
|
+
char *ptr;
|
476
|
+
CArray *mask;
|
477
|
+
CArray *parent;
|
478
|
+
uint32_t attach;
|
479
|
+
uint8_t nosync;
|
480
|
+
/* -------------*/
|
481
|
+
int32_t *count;
|
482
|
+
int32_t repeat_level;
|
483
|
+
int32_t repeat_num;
|
484
|
+
int32_t contig_level;
|
485
|
+
int32_t contig_num;
|
486
|
+
} CARepeat; /* 60 + 8*(rank) (bytes) */
|
487
|
+
|
488
|
+
typedef struct {
|
489
|
+
int16_t obj_type;
|
490
|
+
int8_t data_type;
|
491
|
+
int8_t rank;
|
492
|
+
int32_t flags;
|
493
|
+
int32_t bytes;
|
494
|
+
int32_t elements;
|
495
|
+
int32_t *dim;
|
496
|
+
char *ptr;
|
497
|
+
CArray *mask;
|
498
|
+
CArray *parent;
|
499
|
+
uint32_t attach;
|
500
|
+
uint8_t nosync;
|
501
|
+
/* -------------*/
|
502
|
+
int8_t rep_rank;
|
503
|
+
int32_t *rep_dim;
|
504
|
+
} CAUnboundRepeat; /* 44 + 8*(rank) (bytes) */
|
505
|
+
|
506
|
+
/*
|
507
|
+
CAReduce is an internal class
|
508
|
+
used only in reference as data_type with different byte size
|
509
|
+
*/
|
510
|
+
|
511
|
+
typedef struct {
|
512
|
+
int16_t obj_type;
|
513
|
+
int8_t data_type;
|
514
|
+
int8_t rank;
|
515
|
+
int32_t flags;
|
516
|
+
int32_t bytes;
|
517
|
+
int32_t elements;
|
518
|
+
int32_t *dim;
|
519
|
+
char *ptr;
|
520
|
+
CArray *mask;
|
521
|
+
CArray *parent;
|
522
|
+
uint32_t attach;
|
523
|
+
uint8_t nosync;
|
524
|
+
/* ---- */
|
525
|
+
int32_t count;
|
526
|
+
int32_t offset;
|
527
|
+
} CAReduce;
|
528
|
+
|
529
|
+
/* -------------------------------------------------------------------- */
|
530
|
+
|
531
|
+
typedef struct {
|
532
|
+
int8_t rank;
|
533
|
+
int32_t dim[CA_RANK_MAX];
|
534
|
+
CArray *reference;
|
535
|
+
CArray * (*kernel_at_addr)(void *, int32_t, CArray *);
|
536
|
+
CArray * (*kernel_at_index)(void *, int32_t *, CArray *);
|
537
|
+
CArray * (*kernel_move_to_addr)(void *, int32_t, CArray *);
|
538
|
+
CArray * (*kernel_move_to_index)(void *, int32_t *, CArray *);
|
539
|
+
} CAIterator;
|
540
|
+
|
541
|
+
/* -------------------------------------------------------------------- */
|
542
|
+
|
543
|
+
extern VALUE rb_cCArray;
|
544
|
+
extern VALUE rb_cCAVirtual;
|
545
|
+
extern VALUE rb_cCScalar;
|
546
|
+
extern VALUE rb_cCAWrap;
|
547
|
+
extern VALUE rb_cCARefer;
|
548
|
+
extern VALUE rb_cCABlock;
|
549
|
+
extern VALUE rb_cCASelect;
|
550
|
+
extern VALUE rb_cCAObject;
|
551
|
+
extern VALUE rb_cCARepeat;
|
552
|
+
extern VALUE rb_cCAUnboundRepeat;
|
553
|
+
extern VALUE rb_cCAIterator;
|
554
|
+
|
555
|
+
extern VALUE rb_mCA;
|
556
|
+
extern VALUE rb_mCAMath;
|
557
|
+
extern VALUE rb_eCADataTypeError;
|
558
|
+
|
559
|
+
/* -------------------------------------------------------------------- */
|
560
|
+
|
561
|
+
extern const int ca_endian;
|
562
|
+
extern const int32_t ca_valid[CA_NTYPE];
|
563
|
+
extern const int32_t ca_sizeof[CA_NTYPE];
|
564
|
+
extern const char * ca_type_name[CA_NTYPE];
|
565
|
+
extern const int ca_cast_table[CA_NTYPE][CA_NTYPE];
|
566
|
+
extern const int ca_cast_table2[CA_NTYPE][CA_NTYPE];
|
567
|
+
|
568
|
+
extern VALUE ca_class[CA_OBJ_TYPE_MAX];
|
569
|
+
extern ca_operation_function_t ca_func[CA_OBJ_TYPE_MAX];
|
570
|
+
extern int ca_obj_num;
|
571
|
+
|
572
|
+
#define CAVIRTUAL(x) ((CAVirtual *)(x))
|
573
|
+
|
574
|
+
#define ca_set_flag(ca, flag) ( ca->flags |= flag )
|
575
|
+
#define ca_unset_flag(ca, flag) ( ca->flags &= ~flag )
|
576
|
+
#define ca_test_flag(ca, flag) (( ca->flags & flag ) ? 1 : 0)
|
577
|
+
|
578
|
+
/* -------------------------------------------------------------------- */
|
579
|
+
|
580
|
+
#define CA_CHECK_DATA_TYPE(data_type) \
|
581
|
+
if ( data_type <= CA_NONE || data_type >= CA_NTYPE ) { \
|
582
|
+
rb_raise(rb_eRuntimeError, "invalid data_type id %i", data_type); \
|
583
|
+
} \
|
584
|
+
if ( ! ca_valid[data_type] ) { \
|
585
|
+
rb_raise(rb_eRuntimeError, "data_type %s is disabled", ca_type_name[data_type]); \
|
586
|
+
}
|
587
|
+
|
588
|
+
#define CA_CHECK_DATA_TYPE_NUMERIC(data_type) \
|
589
|
+
if ( data_type <= CA_NONE || data_type >= CA_NTYPE || !ca_valid[data_type] || data_type == CA_FIXLEN || data_type == CA_OBJECT ) { \
|
590
|
+
rb_raise(rb_eRuntimeError, "invalid numeric data type"); \
|
591
|
+
}
|
592
|
+
|
593
|
+
#define CA_CHECK_RANK(rank) \
|
594
|
+
if ( rank <= 0 || rank > CA_RANK_MAX ) { \
|
595
|
+
rb_raise(rb_eRuntimeError, "invalid rank"); \
|
596
|
+
}
|
597
|
+
|
598
|
+
#define CA_CHECK_DIM(rank, dim) \
|
599
|
+
{ \
|
600
|
+
int32_t i_; \
|
601
|
+
for (i_=0; i_<rank; i_++) { \
|
602
|
+
if ( dim[i_] < 0 ) { \
|
603
|
+
rb_raise(rb_eRuntimeError, "negative size dimension at %i-dim", i_); \
|
604
|
+
} \
|
605
|
+
} \
|
606
|
+
}
|
607
|
+
|
608
|
+
#define CA_CHECK_BYTES(data_type, bytes) \
|
609
|
+
if ( data_type == CA_FIXLEN ) { \
|
610
|
+
if ( bytes < 0 ) { \
|
611
|
+
rb_raise(rb_eRuntimeError, "invalid bytes"); \
|
612
|
+
} \
|
613
|
+
} \
|
614
|
+
else { \
|
615
|
+
bytes = ca_sizeof[data_type]; \
|
616
|
+
if ( bytes <= 0 ) { \
|
617
|
+
rb_raise(rb_eRuntimeError, "invalid bytes"); \
|
618
|
+
} \
|
619
|
+
}
|
620
|
+
|
621
|
+
#define CA_CHECK_INDEX(index, dim) \
|
622
|
+
if ( index < 0 ) { \
|
623
|
+
index += (dim); \
|
624
|
+
} \
|
625
|
+
if ( index < 0 || index >= (dim) ) { \
|
626
|
+
rb_raise(rb_eIndexError, "index out of range ( %i <=> 0..%i )", index, dim-1); \
|
627
|
+
}
|
628
|
+
|
629
|
+
#define CA_CHECK_BOUND(ca, idx) \
|
630
|
+
{ \
|
631
|
+
int32_t i; \
|
632
|
+
for (i=0; i<ca->rank; i++) { \
|
633
|
+
if ( idx[i] < 0 || idx[i] >= ca->dim[i] ) { \
|
634
|
+
rb_raise(rb_eRuntimeError, "index out of range at %i-dim ( %i <=> 0..%i )", i, idx[i], ca->dim[i]-1); \
|
635
|
+
} \
|
636
|
+
} \
|
637
|
+
}
|
638
|
+
|
639
|
+
/* -------------------------------------------------------------------- */
|
640
|
+
|
641
|
+
/* class CComplex */
|
642
|
+
|
643
|
+
#ifdef HAVE_COMPLEX_H
|
644
|
+
extern VALUE rb_cCComplex;
|
645
|
+
double complex rb_num2cc(VALUE num);
|
646
|
+
VALUE rb_ccomplex_new (double complex c);
|
647
|
+
VALUE rb_ccomplex_new2 (double re, double im);
|
648
|
+
# define NUM2CC rb_num2cc
|
649
|
+
# define CC2NUM rb_ccomplex_new
|
650
|
+
#else
|
651
|
+
# define rb_ccomplex_new(c) \
|
652
|
+
(rb_raise(rb_eRuntimeError, "CComplex not defined"), Qnil)
|
653
|
+
# define rb_ccomplex_new2(re,im) \
|
654
|
+
(rb_raise(rb_eRuntimeError, "CComplex not defined"), Qnil)
|
655
|
+
# define NUM2CC(n) \
|
656
|
+
(rb_raise(rb_eRuntimeError, "CComplex not defined"), 0)
|
657
|
+
# define CC2NUM(c) \
|
658
|
+
(rb_raise(rb_eRuntimeError, "CComplex not defined"), Qnil)
|
659
|
+
#endif
|
660
|
+
|
661
|
+
VALUE BOOL2OBJ (boolean8_t x);
|
662
|
+
boolean8_t OBJ2BOOL (VALUE v);
|
663
|
+
|
664
|
+
unsigned long rb_obj2ulong (VALUE);
|
665
|
+
long rb_obj2long (VALUE);
|
666
|
+
#define OBJ2LONG(x) (FIXNUM_P(x)?FIX2LONG(x):rb_obj2long((VALUE)x))
|
667
|
+
#define OBJ2ULONG(x) rb_obj2ulong((VALUE)x)
|
668
|
+
|
669
|
+
long long rb_obj2ll (VALUE);
|
670
|
+
unsigned long long rb_obj2ull (VALUE);
|
671
|
+
#define OBJ2LL(x) (FIXNUM_P(x)?FIX2LONG(x):rb_obj2ll((VALUE)x))
|
672
|
+
#define OBJ2ULL(x) rb_obj2ull((VALUE)x)
|
673
|
+
|
674
|
+
double OBJ2DBL (VALUE v);
|
675
|
+
|
676
|
+
/* -------------------------------------------------------------------- */
|
677
|
+
|
678
|
+
/* index parsing */
|
679
|
+
|
680
|
+
enum {
|
681
|
+
CA_REG_NONE,
|
682
|
+
CA_REG_ALL,
|
683
|
+
CA_REG_ADDRESS,
|
684
|
+
CA_REG_ADDRESS_COMPLEX,
|
685
|
+
CA_REG_POINT,
|
686
|
+
CA_REG_BLOCK,
|
687
|
+
CA_REG_SELECT,
|
688
|
+
CA_REG_ITERATOR,
|
689
|
+
CA_REG_REPEAT,
|
690
|
+
CA_REG_GRID,
|
691
|
+
CA_REG_MAPPING,
|
692
|
+
CA_REG_METHOD_CALL,
|
693
|
+
CA_REG_UNBOUND_REPEAT,
|
694
|
+
CA_REG_MEMBER,
|
695
|
+
}; /* CA_REGION_TYPE */
|
696
|
+
|
697
|
+
enum {
|
698
|
+
CA_IDX_SCALAR,
|
699
|
+
CA_IDX_ALL,
|
700
|
+
CA_IDX_BLOCK,
|
701
|
+
CA_IDX_SYMBOL,
|
702
|
+
CA_IDX_REPEAT
|
703
|
+
}; /* CA_INDEX_TYPE */
|
704
|
+
|
705
|
+
typedef union {
|
706
|
+
int32_t scalar;
|
707
|
+
struct {
|
708
|
+
int32_t start;
|
709
|
+
int32_t step;
|
710
|
+
int32_t count;
|
711
|
+
} block;
|
712
|
+
struct {
|
713
|
+
ID id;
|
714
|
+
VALUE spec;
|
715
|
+
} symbol;
|
716
|
+
} CAIndex;
|
717
|
+
|
718
|
+
typedef struct {
|
719
|
+
int16_t type;
|
720
|
+
int16_t rank;
|
721
|
+
int32_t index_type[CA_RANK_MAX];
|
722
|
+
CAIndex index[CA_RANK_MAX];
|
723
|
+
CArray *select;
|
724
|
+
VALUE block;
|
725
|
+
VALUE symbol;
|
726
|
+
} CAIndexInfo;
|
727
|
+
|
728
|
+
/* -------------------------------------------------------------------- */
|
729
|
+
|
730
|
+
typedef void (*ca_monop_func_t)();
|
731
|
+
typedef void (*ca_binop_func_t)();
|
732
|
+
typedef void (*ca_moncmp_func_t)();
|
733
|
+
typedef void (*ca_bincmp_func_t)();
|
734
|
+
|
735
|
+
VALUE rb_ca_call_monop (VALUE self, ca_monop_func_t func[]);
|
736
|
+
VALUE rb_ca_call_monop_bang (VALUE self, ca_monop_func_t func[]);
|
737
|
+
VALUE rb_ca_call_binop (VALUE self, VALUE other, ca_binop_func_t func[]);
|
738
|
+
VALUE rb_ca_call_binop_bang (VALUE self, VALUE other, ca_binop_func_t func[]);
|
739
|
+
VALUE rb_ca_call_moncmp (VALUE self, ca_moncmp_func_t func[]);
|
740
|
+
VALUE rb_ca_call_bincmp (VALUE self, VALUE other, ca_bincmp_func_t func[]);
|
741
|
+
void ca_monop_not_implement(int32_t n, char *ptr1, char *ptr2);
|
742
|
+
void ca_binop_not_implement(int32_t n, char *ptr1, char *ptr2, char *ptr3);
|
743
|
+
void ca_moncmp_not_implement(int32_t n, char *ptr1, char *ptr2);
|
744
|
+
void ca_bincmp_not_implement(int32_t n, char *ptr1, char *ptr2, char *ptr3);
|
745
|
+
VALUE ca_math_call (VALUE mod, VALUE arg, ID id);
|
746
|
+
|
747
|
+
/* -------------------------------------------------------------------- */
|
748
|
+
|
749
|
+
/* --- ca_obj_array.c --- */
|
750
|
+
|
751
|
+
int carray_setup (CArray *ca,
|
752
|
+
int8_t data_type, int8_t rank, int32_t *dim,
|
753
|
+
int32_t bytes, CArray *mask);
|
754
|
+
|
755
|
+
int carray_safe_setup (CArray *ca,
|
756
|
+
int8_t data_type, int8_t rank, int32_t *dim,
|
757
|
+
int32_t bytes, CArray *mask);
|
758
|
+
|
759
|
+
int ca_wrap_setup_null (CArray *ca,
|
760
|
+
int8_t data_type, int8_t rank, int32_t *dim,
|
761
|
+
int32_t bytes, CArray *mask);
|
762
|
+
|
763
|
+
void free_carray (void *ap);
|
764
|
+
void free_ca_wrap (void *ap);
|
765
|
+
|
766
|
+
CArray *carray_new (int8_t data_type,
|
767
|
+
int8_t rank, int32_t *dim, int32_t bytes, CArray *ma);
|
768
|
+
CArray *carray_new_safe (int8_t data_type,
|
769
|
+
int8_t rank, int32_t *dim, int32_t bytes, CArray *mask);
|
770
|
+
VALUE rb_carray_new (int8_t data_type,
|
771
|
+
int8_t rank, int32_t *dim, int32_t bytes, CArray *mask);
|
772
|
+
VALUE rb_carray_new_safe (int8_t data_type,
|
773
|
+
int8_t rank, int32_t *dim, int32_t bytes, CArray *mask);
|
774
|
+
|
775
|
+
CAWrap *ca_wrap_new (int8_t data_type,
|
776
|
+
int8_t rank, int32_t *dim, int32_t bytes,
|
777
|
+
CArray *mask, char *ptr);
|
778
|
+
|
779
|
+
CAWrap *ca_wrap_new_null (int8_t data_type,
|
780
|
+
int8_t rank, int32_t *dim, int32_t bytes,
|
781
|
+
CArray *mask);
|
782
|
+
|
783
|
+
CScalar *cscalar_new (int8_t data_type, int32_t bytes, CArray *ma);
|
784
|
+
CScalar *cscalar_new2 (int8_t data_type, int32_t bytes, char *val);
|
785
|
+
VALUE rb_cscalar_new (int8_t data_type, int32_t bytes, CArray *mask);
|
786
|
+
VALUE rb_cscalar_new_with_value (int8_t data_type, int32_t bytes, VALUE rval);
|
787
|
+
|
788
|
+
/* --- ca_obj_refer.c --- */
|
789
|
+
|
790
|
+
CARefer *ca_refer_new (CArray *ca,
|
791
|
+
int8_t data_type, int8_t rank, int32_t *dim,
|
792
|
+
int32_t bytes, int32_t offset);
|
793
|
+
VALUE rb_ca_refer_new (VALUE self,
|
794
|
+
int8_t data_type, int8_t rank, int32_t *dim,
|
795
|
+
int32_t bytes, int32_t offset);
|
796
|
+
|
797
|
+
/* --- ca_obj_farray.c --- */
|
798
|
+
|
799
|
+
VALUE rb_ca_farray (VALUE self);
|
800
|
+
|
801
|
+
/* --- ca_obj_block.c --- */
|
802
|
+
|
803
|
+
CABlock *ca_block_new (CArray *carray,
|
804
|
+
int8_t rank, int32_t *dim,
|
805
|
+
int32_t *start, int32_t *step, int32_t *count,
|
806
|
+
int32_t offset);
|
807
|
+
VALUE rb_ca_block_new (VALUE cary, int8_t rank, int32_t *dim,
|
808
|
+
int32_t *start, int32_t *step, int32_t *count,
|
809
|
+
int32_t offset);
|
810
|
+
|
811
|
+
/* --- ca_obj_select.c --- */
|
812
|
+
|
813
|
+
VALUE rb_ca_select_new (VALUE cary, VALUE select);
|
814
|
+
VALUE rb_ca_select_new_share (VALUE cary, VALUE select);
|
815
|
+
|
816
|
+
/* --- ca_obj_grid.c --- */
|
817
|
+
|
818
|
+
VALUE rb_ca_grid_new (VALUE cary, int32_t *dim, CArray **grid);
|
819
|
+
VALUE rb_ca_grid (int argc, VALUE *argv, VALUE self);
|
820
|
+
|
821
|
+
/* --- ca_obj_mapping.c --- */
|
822
|
+
|
823
|
+
VALUE rb_ca_mapping_new (VALUE cary, CArray *mapper);
|
824
|
+
VALUE rb_ca_mapping (int argc, VALUE *argv, VALUE self);
|
825
|
+
|
826
|
+
/* --- ca_obj_field.c --- */
|
827
|
+
|
828
|
+
VALUE rb_ca_field_new (VALUE cary,
|
829
|
+
int32_t offset, int8_t data_type, int32_t bytes);
|
830
|
+
VALUE rb_ca_field (int argc, VALUE *argv, VALUE self);
|
831
|
+
|
832
|
+
/* --- ca_obj_fake.c --- */
|
833
|
+
|
834
|
+
VALUE rb_ca_fake_new (VALUE cary, int8_t data_type, int32_t bytes);
|
835
|
+
VALUE rb_ca_fake_type (VALUE self, VALUE rtype, VALUE rbytes);
|
836
|
+
|
837
|
+
/* --- ca_obj_repeat.c --- */
|
838
|
+
|
839
|
+
CARepeat *ca_repeat_new (CArray *carray, int8_t rank, int32_t *count);
|
840
|
+
|
841
|
+
VALUE rb_ca_repeat_new (VALUE cary, int8_t rank, int32_t *count);
|
842
|
+
VALUE rb_ca_repeat (int argc, VALUE *argv, VALUE self);
|
843
|
+
|
844
|
+
VALUE rb_ca_ubrep_new (VALUE cary, int32_t rep_rank, int32_t *rep_dim);
|
845
|
+
VALUE ca_ubrep_bind_with (VALUE self, VALUE other);
|
846
|
+
|
847
|
+
/* --- ca_obj_reduce.c --- */
|
848
|
+
|
849
|
+
CAReduce *ca_reduce_new (CArray *carray, int32_t count, int32_t offset);
|
850
|
+
|
851
|
+
/* --- ca_iter_dimension --- */
|
852
|
+
|
853
|
+
VALUE rb_dim_iter_new (VALUE vca, CAIndexInfo *info);
|
854
|
+
|
855
|
+
/* -------------------------------------------------------------------- */
|
856
|
+
|
857
|
+
/* API : defining new array */
|
858
|
+
|
859
|
+
void * malloc_with_check(size_t size);
|
860
|
+
|
861
|
+
int ca_install_obj_type (VALUE klass, ca_operation_function_t func);
|
862
|
+
|
863
|
+
void ca_mark (void *ap);
|
864
|
+
void ca_free (void *ap);
|
865
|
+
void ca_free_nop (void *ap);
|
866
|
+
|
867
|
+
#define ca_length(ca) ((ca)->elements * (ca)->bytes)
|
868
|
+
|
869
|
+
/* API : query of array properties */
|
870
|
+
|
871
|
+
int ca_is_scalar (void *ap);
|
872
|
+
#define ca_is_entity(ca) ( ca_func[(ca)->obj_type].entity_type == CA_REAL_ARRAY )
|
873
|
+
int ca_is_virtual (void *ap);
|
874
|
+
int ca_is_readonly (void *ap);
|
875
|
+
int ca_is_value_array (void *ap);
|
876
|
+
int ca_is_mask_array (void *ap);
|
877
|
+
|
878
|
+
#define ca_is_attached(ca) ( (ca)->ptr != NULL )
|
879
|
+
#define ca_is_empty(ca) ( (ca)->elements == 0 )
|
880
|
+
|
881
|
+
#define ca_is_caobject(ca) ( (ca)->obj_type == CA_OBJ_OBJECT )
|
882
|
+
|
883
|
+
int ca_is_fixlen_type (void *ap);
|
884
|
+
int ca_is_boolean_type (void *ap);
|
885
|
+
int ca_is_numeric_type (void *ap);
|
886
|
+
int ca_is_integer_type (void *ap);
|
887
|
+
int ca_is_unsigned_type (void *ap);
|
888
|
+
int ca_is_float_type (void *ap);
|
889
|
+
int ca_is_complex_type (void *ap);
|
890
|
+
int ca_is_object_type (void *ap);
|
891
|
+
|
892
|
+
/* API : check of array properties */
|
893
|
+
|
894
|
+
void ca_check_type (void *ap, int8_t data_type);
|
895
|
+
#define ca_check_data_type(ap, data_type) ca_check_type(ap, data_type)
|
896
|
+
void ca_check_rank (void *ap, int rank);
|
897
|
+
void ca_check_shape (void *ap, int rank, int32_t *dim);
|
898
|
+
void ca_check_same_data_type (void *ap1, void *ap2);
|
899
|
+
void ca_check_same_rank (void *ap1, void *ap2);
|
900
|
+
void ca_check_same_elements (void *ap1, void *ap2);
|
901
|
+
void ca_check_same_shape (void *ap1, void *ap2);
|
902
|
+
void ca_check_index (void *ap, int32_t *idx);
|
903
|
+
void ca_check_data_class (VALUE rtype);
|
904
|
+
int ca_is_valid_index (void *ap, int32_t *idx);
|
905
|
+
|
906
|
+
/* API : allocate, attach, update, sync, detach */
|
907
|
+
|
908
|
+
void ca_allocate (void *ap);
|
909
|
+
void ca_attach (void *ca);
|
910
|
+
void ca_update (void *ca);
|
911
|
+
void ca_sync (void *ca);
|
912
|
+
void ca_detach (void *ca);
|
913
|
+
|
914
|
+
void ca_allocate_n (int n, ...);
|
915
|
+
void ca_attach_n (int n, ...);
|
916
|
+
void ca_update_n (int n, ...);
|
917
|
+
void ca_sync_n (int n, ...);
|
918
|
+
void ca_detach_n (int n, ...);
|
919
|
+
|
920
|
+
/* API : copying */
|
921
|
+
|
922
|
+
void *ca_clone (void *ap); /* use rb_obj_clone() */
|
923
|
+
CArray *ca_copy (void *ap); /* use rb_ca_copy() */
|
924
|
+
CArray *ca_template (void *ap); /* use rb_ca_template() */
|
925
|
+
CArray *ca_template_safe (void *ap); /* use rb_ca_template() */
|
926
|
+
CArray *ca_template_safe2 (void *ap, int8_t data_type, int32_t bytes);
|
927
|
+
/* use rb_ca_template() */
|
928
|
+
|
929
|
+
void ca_paste (void *ap, int32_t *idx, void *sp);
|
930
|
+
void ca_cut (void *ap, int32_t *offset, void *sp);
|
931
|
+
void ca_fill (void *ap, void *ptr);
|
932
|
+
|
933
|
+
/* API : fetch, store */
|
934
|
+
|
935
|
+
void ca_addr2index (void *ap, int32_t addr, int32_t *idx);
|
936
|
+
int32_t ca_index2addr (void *ap, int32_t *idx);
|
937
|
+
|
938
|
+
void *ca_ptr_at_index (void *ap, int32_t *idx);
|
939
|
+
void *ca_ptr_at_addr (void *ap, int32_t addr);
|
940
|
+
|
941
|
+
void ca_fetch_index (void *ap, int32_t *idx, void *ptr);
|
942
|
+
void ca_fetch_addr (void *ap, int32_t addr, void *ptr);
|
943
|
+
void ca_store_index (void *ap, int32_t *idx, void *ptr);
|
944
|
+
void ca_store_addr (void *ap, int32_t addr, void *ptr);
|
945
|
+
|
946
|
+
void ca_copy_data (void *ap, char *ptr);
|
947
|
+
void ca_sync_data (void *ap, char *ptr);
|
948
|
+
void ca_fill_data (void *ap, void *ptr);
|
949
|
+
|
950
|
+
/* API : mask handling */
|
951
|
+
|
952
|
+
extern VALUE CA_UNDEF;
|
953
|
+
extern VALUE CA_NIL;
|
954
|
+
|
955
|
+
boolean8_t *ca_mask_ptr (void *ap);
|
956
|
+
int ca_has_mask (void *ap);
|
957
|
+
int ca_is_any_masked (void *ap);
|
958
|
+
int ca_is_all_masked (void *ap);
|
959
|
+
void ca_update_mask (void *ap);
|
960
|
+
void ca_create_mask (void *ap);
|
961
|
+
void ca_clear_mask (void *ap);
|
962
|
+
void ca_setup_mask (void *ap, CArray *mask);
|
963
|
+
void ca_copy_mask (void *ap, void *ao);
|
964
|
+
void ca_copy_mask_overlay_n (void *ap, int32_t elements, int n, CArray **slist);
|
965
|
+
void ca_copy_mask_overlay (void *ap, int32_t elements, int n, ...);
|
966
|
+
void ca_copy_mask_overwrite_n (void *ap, int32_t elements, int n, CArray **slist);
|
967
|
+
void ca_copy_mask_overwrite (void *ap, int32_t elements, int n, ...);
|
968
|
+
int32_t ca_count_masked (void *ap);
|
969
|
+
int32_t ca_count_not_masked (void *ap);
|
970
|
+
void ca_unmask (void *ap, char *fill_value);
|
971
|
+
CArray *ca_unmasked_copy (void *ap, char *fill_value);
|
972
|
+
|
973
|
+
/* API : cast, conversion */
|
974
|
+
|
975
|
+
typedef void (*ca_cast_func_t)(int32_t, CArray *, void *, CArray *, void *, boolean8_t *);
|
976
|
+
extern ca_cast_func_t ca_cast_func_table[CA_NTYPE][CA_NTYPE];
|
977
|
+
void ca_cast_block(int32_t n, void *a1, void *ptr1, void *a2, void *ptr2);
|
978
|
+
void ca_cast_block_with_mask (int32_t n, void *ap1, void *ptr1,
|
979
|
+
void *ap2, void *ptr2, boolean8_t *m);
|
980
|
+
void ca_ptr2ptr (void *ca1, void *ptr1, void *ca2, void *ptr2);
|
981
|
+
void ca_ptr2val (void *ap1, void *ptr1, int8_t data_type2, void *ptr2);
|
982
|
+
void ca_val2ptr (int8_t data_type1, void *ptr1, void *ap2, void *ptr2);
|
983
|
+
void ca_val2val (int8_t data_type1, void *ptr1, int8_t data_type2, void *ptr2);
|
984
|
+
VALUE ca_ptr2obj (void *ap, void *ptr); /* use rb_ca_ptr2obj() */
|
985
|
+
void ca_obj2ptr (void *ap, VALUE obj, void *ptr); /* use rb_ca_ptr2obj() */
|
986
|
+
|
987
|
+
void ca_block_from_carray(CArray *cs,
|
988
|
+
int32_t *start, int32_t *step, int32_t *count, CArray *ca);
|
989
|
+
|
990
|
+
#define ca_wrap_writable(obj, data_type) \
|
991
|
+
(obj = rb_ca_wrap_writable(obj, INT2NUM(data_type)), (CArray*) DATA_PTR(obj))
|
992
|
+
#define ca_wrap_readonly(obj, data_type) \
|
993
|
+
(obj = rb_ca_wrap_readonly(obj, INT2NUM(data_type)), (CArray*) DATA_PTR(obj))
|
994
|
+
|
995
|
+
VALUE rb_carray_wrap_ptr (int8_t data_type,
|
996
|
+
int8_t rank, int32_t *dim, int32_t bytes,
|
997
|
+
CArray *mask, char *ptr, VALUE refer);
|
998
|
+
|
999
|
+
void * ca_to_cptr (void *ap);
|
1000
|
+
|
1001
|
+
/* API : utils */
|
1002
|
+
|
1003
|
+
boolean8_t *ca_allocate_mask_iterator (int n, ...);
|
1004
|
+
boolean8_t *ca_allocate_mask_iterator_n (int n, CArray **slist);
|
1005
|
+
|
1006
|
+
int32_t ca_get_loop_count (int n, ...);
|
1007
|
+
int32_t ca_set_iterator (int n, ...);
|
1008
|
+
|
1009
|
+
void ca_swap_bytes (char *p, int32_t bytes, int32_t elements);
|
1010
|
+
void ca_parse_range (VALUE vrange, int size,
|
1011
|
+
int *offset, int *count, int *step);
|
1012
|
+
void ca_parse_range_without_check (VALUE arg, int size,
|
1013
|
+
int *offset, int *count, int *step);
|
1014
|
+
|
1015
|
+
int ca_equal (void *ap, void *bp);
|
1016
|
+
void ca_zerodiv(void);
|
1017
|
+
int32_t ca_rand (double rmax);
|
1018
|
+
int32_t ca_bounds_normalize_index (int8_t bounds, int32_t size0, int32_t k);
|
1019
|
+
|
1020
|
+
/* API : high level */
|
1021
|
+
|
1022
|
+
/* parsing options */
|
1023
|
+
VALUE rb_pop_options (int *argc, VALUE **argv);
|
1024
|
+
void rb_scan_options (VALUE opt, const char *spec_in, ...);
|
1025
|
+
void rb_set_options (VALUE opt, const char *spec_in, ...);
|
1026
|
+
|
1027
|
+
/* predicates for check object is carray or cscalar */
|
1028
|
+
#define rb_obj_is_carray(obj) rb_obj_is_kind_of(obj, rb_cCArray)
|
1029
|
+
VALUE rb_obj_is_cscalar (VALUE obj);
|
1030
|
+
void rb_check_carray_object (VALUE arg);
|
1031
|
+
|
1032
|
+
/* specific Data_Wrap_Struct for carray */
|
1033
|
+
VALUE ca_wrap_struct (void *ap);
|
1034
|
+
|
1035
|
+
/* query data_type */
|
1036
|
+
int8_t rb_ca_guess_type (VALUE obj);
|
1037
|
+
void rb_ca_guess_type_and_bytes (VALUE rtype, VALUE rbytes,
|
1038
|
+
int8_t *data_type, int32_t *bytes);
|
1039
|
+
int rb_ca_is_type (VALUE arg, int type);
|
1040
|
+
|
1041
|
+
/* scan index */
|
1042
|
+
void rb_ca_scan_index (int ca_rank, int32_t *ca_dim, int32_t elements,
|
1043
|
+
int argc, VALUE *argv, CAIndexInfo *info);
|
1044
|
+
|
1045
|
+
/* cast */
|
1046
|
+
void rb_ca_cast_self (volatile VALUE *self);
|
1047
|
+
void rb_ca_cast_self_or_other (volatile VALUE *self, volatile VALUE *other);
|
1048
|
+
void rb_ca_cast_other (VALUE *self, volatile VALUE *other);
|
1049
|
+
|
1050
|
+
VALUE rb_ca_wrap_writable (VALUE obj, VALUE vtype);
|
1051
|
+
VALUE rb_ca_wrap_readonly (VALUE obj, VALUE vtype);
|
1052
|
+
|
1053
|
+
/* inheritance */
|
1054
|
+
VALUE rb_ca_data_type_inherit (VALUE self, VALUE other);
|
1055
|
+
VALUE rb_ca_data_type_import (VALUE self, VALUE data_type);
|
1056
|
+
VALUE rb_ca_set_parent (VALUE self, VALUE obj);
|
1057
|
+
/* call once for a virtual carray */
|
1058
|
+
|
1059
|
+
/* freeze and decraration of modifing contents of carray */
|
1060
|
+
VALUE rb_ca_freeze (VALUE self);
|
1061
|
+
void rb_ca_modify (VALUE self);
|
1062
|
+
|
1063
|
+
/* attributes */
|
1064
|
+
VALUE rb_ca_obj_type (VALUE self);
|
1065
|
+
VALUE rb_ca_data_type (VALUE self);
|
1066
|
+
VALUE rb_ca_rank (VALUE self);
|
1067
|
+
VALUE rb_ca_bytes (VALUE self);
|
1068
|
+
VALUE rb_ca_elements (VALUE self);
|
1069
|
+
VALUE rb_ca_dim (VALUE self);
|
1070
|
+
VALUE rb_ca_dim0 (VALUE self);
|
1071
|
+
VALUE rb_ca_dim1 (VALUE self);
|
1072
|
+
VALUE rb_ca_dim2 (VALUE self);
|
1073
|
+
VALUE rb_ca_dim3 (VALUE self);
|
1074
|
+
VALUE rb_ca_data_type_name (VALUE self);
|
1075
|
+
VALUE rb_ca_parent (VALUE self);
|
1076
|
+
|
1077
|
+
VALUE rb_ca_is_fixlen_type (VALUE self);
|
1078
|
+
VALUE rb_ca_is_boolean_type (VALUE self);
|
1079
|
+
VALUE rb_ca_is_integer_type (VALUE self);
|
1080
|
+
VALUE rb_ca_is_unsigned_type (VALUE self);
|
1081
|
+
VALUE rb_ca_is_float_type (VALUE self);
|
1082
|
+
VALUE rb_ca_is_complex_type (VALUE self);
|
1083
|
+
VALUE rb_ca_is_object_type (VALUE self);
|
1084
|
+
|
1085
|
+
VALUE rb_ca_is_entity (VALUE self);
|
1086
|
+
VALUE rb_ca_is_virtual (VALUE self);
|
1087
|
+
VALUE rb_ca_is_attached (VALUE self);
|
1088
|
+
VALUE rb_ca_is_empty (VALUE self);
|
1089
|
+
VALUE rb_ca_is_read_only (VALUE self);
|
1090
|
+
VALUE rb_ca_is_mask_array (VALUE self);
|
1091
|
+
VALUE rb_ca_is_value_array (VALUE self);
|
1092
|
+
|
1093
|
+
VALUE rb_ca_is_scalar (VALUE self);
|
1094
|
+
|
1095
|
+
/* data class access (struct) */
|
1096
|
+
VALUE rb_obj_is_data_class (VALUE rtype);
|
1097
|
+
VALUE rb_ca_has_data_class (VALUE self);
|
1098
|
+
VALUE rb_ca_data_class (VALUE self);
|
1099
|
+
VALUE rb_ca_data_class_decode (VALUE self, VALUE str);
|
1100
|
+
VALUE rb_ca_data_class_encode (VALUE self, VALUE obj);
|
1101
|
+
VALUE rb_ca_members (VALUE self);
|
1102
|
+
VALUE rb_ca_field_as_member (VALUE self, VALUE sym);
|
1103
|
+
VALUE rb_ca_fields_at (int argc, VALUE *argv, VALUE self);
|
1104
|
+
VALUE rb_ca_fields (VALUE self);
|
1105
|
+
|
1106
|
+
/* mask */
|
1107
|
+
|
1108
|
+
VALUE rb_ca_has_mask (VALUE self);
|
1109
|
+
VALUE rb_ca_is_any_masked (VALUE self);
|
1110
|
+
VALUE rb_ca_is_all_masked (VALUE self);
|
1111
|
+
VALUE rb_ca_value_array (VALUE self);
|
1112
|
+
VALUE rb_ca_mask_array (VALUE self);
|
1113
|
+
VALUE rb_ca_set_mask (VALUE self, VALUE val);
|
1114
|
+
VALUE rb_ca_is_masked (VALUE self);
|
1115
|
+
VALUE rb_ca_is_not_masked (VALUE self);
|
1116
|
+
VALUE rb_ca_count_masked (VALUE self);
|
1117
|
+
VALUE rb_ca_count_not_masked (VALUE self);
|
1118
|
+
VALUE rb_ca_unmask (VALUE self);
|
1119
|
+
VALUE rb_ca_mask_fill (VALUE self, VALUE fval);
|
1120
|
+
VALUE rb_ca_unmask_copy (VALUE self);
|
1121
|
+
VALUE rb_ca_mask_fill_copy (VALUE self, VALUE fval);
|
1122
|
+
VALUE rb_ca_inherit_mask_replace_n (VALUE self, int argc, VALUE *argv);
|
1123
|
+
VALUE rb_ca_inherit_mask_replace (VALUE self, int n, ...);
|
1124
|
+
VALUE rb_ca_inherit_mask_n (VALUE self, int argc, VALUE *argv);
|
1125
|
+
VALUE rb_ca_inherit_mask (VALUE self, int n, ...);
|
1126
|
+
|
1127
|
+
/* copy */
|
1128
|
+
|
1129
|
+
VALUE rb_ca_copy (VALUE self);
|
1130
|
+
VALUE rb_ca_template (VALUE self);
|
1131
|
+
VALUE rb_ca_template_with_type (VALUE self, VALUE rtype, VALUE rbytes);
|
1132
|
+
VALUE rb_ca_template_n (int n, ...);
|
1133
|
+
|
1134
|
+
VALUE rb_ca_fill (VALUE self, VALUE val);
|
1135
|
+
VALUE rb_ca_fill_copy (VALUE self, VALUE val);
|
1136
|
+
|
1137
|
+
/* address calculation */
|
1138
|
+
VALUE rb_ca_addr2index (VALUE self, VALUE raddr);
|
1139
|
+
|
1140
|
+
/* elemental access like ca[i,j,k] or ca[addr] */
|
1141
|
+
VALUE rb_ca_ptr2obj (VALUE self, void *ptr);
|
1142
|
+
#define rb_ca_fetch_ptr(self, ptr) rb_ca_ptr2obj(self, ptr)
|
1143
|
+
VALUE rb_ca_fetch_index (VALUE self, int32_t *idx);
|
1144
|
+
VALUE rb_ca_fetch_addr (VALUE self, int32_t addr);
|
1145
|
+
VALUE rb_ca_fetch (VALUE self, VALUE index);
|
1146
|
+
VALUE rb_ca_fetch2 (VALUE self, int n, VALUE *vindex);
|
1147
|
+
|
1148
|
+
VALUE rb_ca_obj2ptr (VALUE self, VALUE val, void *ptr);
|
1149
|
+
#define rb_ca_store_ptr(self, ptr, val) rb_ca_obj2ptr(self, val, ptr)
|
1150
|
+
VALUE rb_ca_store_index (VALUE self, int32_t *idx, VALUE val);
|
1151
|
+
VALUE rb_ca_store_addr (VALUE self, int32_t addr, VALUE val);
|
1152
|
+
VALUE rb_ca_store (VALUE self, VALUE index, VALUE val);
|
1153
|
+
VALUE rb_ca_store2 (VALUE self, int n, VALUE *vindex, VALUE val);
|
1154
|
+
VALUE rb_ca_store_all (VALUE self, VALUE val);
|
1155
|
+
|
1156
|
+
/* elemental operations */
|
1157
|
+
VALUE rb_ca_elem_swap (VALUE self, VALUE vidx1, VALUE vidx2);
|
1158
|
+
VALUE rb_ca_elem_copy (VALUE self, VALUE vidx1, VALUE vidx2);
|
1159
|
+
VALUE rb_ca_elem_store (VALUE self, VALUE vidx, VALUE obj);
|
1160
|
+
VALUE rb_ca_elem_fetch (VALUE self, VALUE vidx);
|
1161
|
+
VALUE rb_ca_elem_incr (VALUE self, VALUE vidx1);
|
1162
|
+
VALUE rb_ca_elem_decr (VALUE self, VALUE vidx1);
|
1163
|
+
VALUE rb_ca_elem_test_masked (VALUE self, VALUE vidx1);
|
1164
|
+
|
1165
|
+
/* data type conversion */
|
1166
|
+
VALUE rb_ca_ptr2ptr (VALUE ra1, void *ptr1, VALUE ra2, void *ptr2);
|
1167
|
+
#define rb_ca_cast_ptr (VALUE ra1, void *ptr1, VALUE ra2, void *ptr2);
|
1168
|
+
VALUE rb_ca_cast_block (int32_t n, VALUE ra1, void *ptr1,
|
1169
|
+
VALUE ra2, void *ptr2);
|
1170
|
+
|
1171
|
+
VALUE rb_ca_to_type (VALUE self, VALUE rtype, VALUE rbytes);
|
1172
|
+
VALUE rb_ca_to_boolean (VALUE self);
|
1173
|
+
VALUE rb_ca_to_int8 (VALUE self);
|
1174
|
+
VALUE rb_ca_to_uint8 (VALUE self);
|
1175
|
+
VALUE rb_ca_to_int16 (VALUE self);
|
1176
|
+
VALUE rb_ca_to_uint16 (VALUE self);
|
1177
|
+
VALUE rb_ca_to_int32 (VALUE self);
|
1178
|
+
VALUE rb_ca_to_uint32 (VALUE self);
|
1179
|
+
VALUE rb_ca_to_int64 (VALUE self);
|
1180
|
+
VALUE rb_ca_to_uint64 (VALUE self);
|
1181
|
+
VALUE rb_ca_to_float32 (VALUE self);
|
1182
|
+
VALUE rb_ca_to_float64 (VALUE self);
|
1183
|
+
VALUE rb_ca_to_float128 (VALUE self);
|
1184
|
+
VALUE rb_ca_to_cmplx64 (VALUE self);
|
1185
|
+
VALUE rb_ca_to_cmplx128 (VALUE self);
|
1186
|
+
VALUE rb_ca_to_cmplx256 (VALUE self);
|
1187
|
+
VALUE rb_ca_to_VALUE (VALUE self);
|
1188
|
+
#define rb_ca_to_object(self) rb_ca_to_VALUE(self)
|
1189
|
+
|
1190
|
+
/* to ruby's array */
|
1191
|
+
VALUE rb_ca_to_a (VALUE self);
|
1192
|
+
|
1193
|
+
/* generation */
|
1194
|
+
VALUE rb_ca_seq_bang (VALUE self, VALUE offset, VALUE step);
|
1195
|
+
VALUE rb_ca_seq_bang2 (VALUE self, int n, VALUE *args);
|
1196
|
+
VALUE rb_ca_seq (VALUE self, VALUE offset, VALUE step);
|
1197
|
+
VALUE rb_ca_seq2 (VALUE self, int n, VALUE *args);
|
1198
|
+
VALUE rb_ca_where (VALUE self);
|
1199
|
+
|
1200
|
+
/* elemental byte swap */
|
1201
|
+
VALUE rb_ca_swap_bytes_bang (VALUE self);
|
1202
|
+
VALUE rb_ca_swap_bytes (VALUE self);
|
1203
|
+
|
1204
|
+
/* API : CAMath functions */
|
1205
|
+
VALUE ca_call_cfunc_1 (void (*func)(void *p0),
|
1206
|
+
const char *fsync,
|
1207
|
+
VALUE rcx0);
|
1208
|
+
|
1209
|
+
VALUE ca_call_cfunc_2 (void (*func)(void*,void*),
|
1210
|
+
const char *fsync,
|
1211
|
+
VALUE rcy,
|
1212
|
+
VALUE rcx1);
|
1213
|
+
|
1214
|
+
VALUE ca_call_cfunc_3 (void (*func)(void*,void*,void*),
|
1215
|
+
const char *fsync,
|
1216
|
+
VALUE rcy,
|
1217
|
+
VALUE rcx1,
|
1218
|
+
VALUE rcx2);
|
1219
|
+
|
1220
|
+
VALUE ca_call_cfunc_4 (void (*func)(void*,void*,void*,void*),
|
1221
|
+
const char *fsync,
|
1222
|
+
VALUE rcy,
|
1223
|
+
VALUE rcx1,
|
1224
|
+
VALUE rcx2,
|
1225
|
+
VALUE rcx3);
|
1226
|
+
|
1227
|
+
VALUE ca_call_cfunc_5 (void (*func)(void*,void*,void*,void*,void*),
|
1228
|
+
const char *fsync,
|
1229
|
+
VALUE rcy,
|
1230
|
+
VALUE rcx1,
|
1231
|
+
VALUE rcx2,
|
1232
|
+
VALUE rcx3,
|
1233
|
+
VALUE rcx4);
|
1234
|
+
|
1235
|
+
VALUE ca_call_cfunc_6 (void (*func)(void*,void*,void*,void*,void*,void*),
|
1236
|
+
const char *fsync,
|
1237
|
+
VALUE rcy,
|
1238
|
+
VALUE rcx1,
|
1239
|
+
VALUE rcx2,
|
1240
|
+
VALUE rcx3,
|
1241
|
+
VALUE rcx4,
|
1242
|
+
VALUE rcx5);
|
1243
|
+
|
1244
|
+
VALUE ca_call_cfunc_7 (void (*func)(void*,void*,void*,void*,void*,void*,void*),
|
1245
|
+
const char *fsync,
|
1246
|
+
VALUE rcy,
|
1247
|
+
VALUE rcx1,
|
1248
|
+
VALUE rcx2,
|
1249
|
+
VALUE rcx3,
|
1250
|
+
VALUE rcx4,
|
1251
|
+
VALUE rcx5,
|
1252
|
+
VALUE rcx6);
|
1253
|
+
|
1254
|
+
VALUE ca_call_cfunc_1_1 (int8_t dty,
|
1255
|
+
int8_t dtx,
|
1256
|
+
void (*mathfunc)(void*,void*), VALUE rx);
|
1257
|
+
|
1258
|
+
VALUE ca_call_cfunc_1_2 (int8_t dty,
|
1259
|
+
int8_t dtx1,
|
1260
|
+
int8_t dtx2,
|
1261
|
+
void (*mathfunc)(void*,void*,void*),
|
1262
|
+
volatile VALUE rx1, volatile VALUE rx2);
|
1263
|
+
|
1264
|
+
VALUE ca_call_cfunc_1_3 (int8_t dty,
|
1265
|
+
int8_t dtx1,
|
1266
|
+
int8_t dtx2,
|
1267
|
+
int8_t dtx3,
|
1268
|
+
void (*mathfunc)(void*,void*,void*,void*),
|
1269
|
+
volatile VALUE rx1,
|
1270
|
+
volatile VALUE rx2,
|
1271
|
+
volatile VALUE rx3);
|
1272
|
+
|
1273
|
+
VALUE ca_call_cfunc_1_4 (int8_t dty,
|
1274
|
+
int8_t dtx1,
|
1275
|
+
int8_t dtx2,
|
1276
|
+
int8_t dtx3,
|
1277
|
+
int8_t dtx4,
|
1278
|
+
void (*mathfunc)(void*,void*,void*,void*,void*),
|
1279
|
+
volatile VALUE rx1,
|
1280
|
+
volatile VALUE rx2,
|
1281
|
+
volatile VALUE rx3,
|
1282
|
+
volatile VALUE rx4);
|
1283
|
+
|
1284
|
+
VALUE ca_call_cfunc_1_5 (int8_t dty,
|
1285
|
+
int8_t dtx1,
|
1286
|
+
int8_t dtx2,
|
1287
|
+
int8_t dtx3,
|
1288
|
+
int8_t dtx4,
|
1289
|
+
int8_t dtx5,
|
1290
|
+
void (*mathfunc)(void*,void*,void*,void*,void*,void*),
|
1291
|
+
volatile VALUE rx1,
|
1292
|
+
volatile VALUE rx2,
|
1293
|
+
volatile VALUE rx3,
|
1294
|
+
volatile VALUE rx4,
|
1295
|
+
volatile VALUE rx5);
|
1296
|
+
|
1297
|
+
VALUE ca_call_cfunc_1_6 (int8_t dty,
|
1298
|
+
int8_t dtx1,
|
1299
|
+
int8_t dtx2,
|
1300
|
+
int8_t dtx3,
|
1301
|
+
int8_t dtx4,
|
1302
|
+
int8_t dtx5,
|
1303
|
+
int8_t dtx6,
|
1304
|
+
void (*mathfunc)(void*,void*,void*,void*,void*,void*,void*),
|
1305
|
+
volatile VALUE rx1,
|
1306
|
+
volatile VALUE rx2,
|
1307
|
+
volatile VALUE rx3,
|
1308
|
+
volatile VALUE rx4,
|
1309
|
+
volatile VALUE rx5,
|
1310
|
+
volatile VALUE rx6);
|
1311
|
+
|
1312
|
+
VALUE ca_call_cfunc_2_1 (int8_t dty1,
|
1313
|
+
int8_t dty2,
|
1314
|
+
int8_t dtx1,
|
1315
|
+
void (*mathfunc)(void*,void*,void*),
|
1316
|
+
volatile VALUE rx1);
|
1317
|
+
|
1318
|
+
VALUE ca_call_cfunc_2_2 (int8_t dty1,
|
1319
|
+
int8_t dty2,
|
1320
|
+
int8_t dtx1,
|
1321
|
+
int8_t dtx2,
|
1322
|
+
void (*mathfunc)(void*,void*,void*,void*),
|
1323
|
+
volatile VALUE rx1,
|
1324
|
+
volatile VALUE rx2);
|
1325
|
+
|
1326
|
+
VALUE ca_call_cfunc_2_3 (int8_t dty1,
|
1327
|
+
int8_t dty2,
|
1328
|
+
int8_t dtx1,
|
1329
|
+
int8_t dtx2,
|
1330
|
+
int8_t dtx3,
|
1331
|
+
void (*mathfunc)(void*,void*,void*,void*,void*),
|
1332
|
+
volatile VALUE rx1,
|
1333
|
+
volatile VALUE rx2,
|
1334
|
+
volatile VALUE rx3);
|
1335
|
+
|
1336
|
+
VALUE ca_call_cfunc_2_4 (int8_t dty1,
|
1337
|
+
int8_t dty2,
|
1338
|
+
int8_t dtx1,
|
1339
|
+
int8_t dtx2,
|
1340
|
+
int8_t dtx3,
|
1341
|
+
int8_t dtx4,
|
1342
|
+
void (*mathfunc)(void*,void*,void*,void*,void*,void*),
|
1343
|
+
volatile VALUE rx1,
|
1344
|
+
volatile VALUE rx2,
|
1345
|
+
volatile VALUE rx3,
|
1346
|
+
volatile VALUE rx4) ;
|
1347
|
+
|
1348
|
+
VALUE ca_call_cfunc_3_1 (int8_t dty1,
|
1349
|
+
int8_t dty2,
|
1350
|
+
int8_t dty3,
|
1351
|
+
int8_t dtx1,
|
1352
|
+
void (*mathfunc)(void*,void*,void*,void*),
|
1353
|
+
volatile VALUE rx1);
|
1354
|
+
|
1355
|
+
VALUE ca_call_cfunc_3_2 (int8_t dty1,
|
1356
|
+
int8_t dty2,
|
1357
|
+
int8_t dty3,
|
1358
|
+
int8_t dtx1,
|
1359
|
+
int8_t dtx2,
|
1360
|
+
void (*mathfunc)(void*,void*,void*,void*,void*),
|
1361
|
+
volatile VALUE rx1,
|
1362
|
+
volatile VALUE rx2);
|
1363
|
+
|
1364
|
+
VALUE ca_call_cfunc_3_3 (int8_t dty1,
|
1365
|
+
int8_t dty2,
|
1366
|
+
int8_t dty3,
|
1367
|
+
int8_t dtx1,
|
1368
|
+
int8_t dtx2,
|
1369
|
+
int8_t dtx3,
|
1370
|
+
void (*mathfunc)(void*,void*,void*,void*,void*,void*),
|
1371
|
+
volatile VALUE rx1,
|
1372
|
+
volatile VALUE rx2,
|
1373
|
+
volatile VALUE rx3);
|
1374
|
+
|
1375
|
+
/* -------------------------------------------------------------------- */
|
1376
|
+
|
1377
|
+
void ca_debug ();
|
1378
|
+
|
1379
|
+
/* -------------------------------------------------------------------- */
|
1380
|
+
|
1381
|
+
#endif
|