numo-narray-alt 0.9.5 → 0.9.6
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/Gemfile +3 -0
- data/README.md +13 -0
- data/ext/numo/narray/SFMT-params19937.h +12 -12
- data/ext/numo/narray/array.c +26 -2
- data/ext/numo/narray/data.c +70 -72
- data/ext/numo/narray/extconf.rb +0 -1
- data/ext/numo/narray/index.c +2 -2
- data/ext/numo/narray/kwargs.c +6 -6
- data/ext/numo/narray/math.c +10 -4
- data/ext/numo/narray/narray.c +80 -52
- data/ext/numo/narray/numo/narray.h +20 -20
- data/ext/numo/narray/numo/ndloop.h +1 -1
- data/ext/numo/narray/numo/template.h +80 -80
- data/ext/numo/narray/numo/types/bit.h +76 -0
- data/ext/numo/narray/numo/types/complex.h +2 -2
- data/ext/numo/narray/numo/types/complex_macro.h +27 -26
- data/ext/numo/narray/numo/types/float_macro.h +18 -17
- data/ext/numo/narray/numo/types/real_accum.h +22 -22
- data/ext/numo/narray/numo/types/robj_macro.h +15 -14
- data/ext/numo/narray/numo/types/xint_macro.h +50 -8
- data/ext/numo/narray/rand.c +7 -0
- data/ext/numo/narray/src/mh/mean.h +102 -0
- data/ext/numo/narray/src/mh/rms.h +102 -0
- data/ext/numo/narray/src/mh/stddev.h +103 -0
- data/ext/numo/narray/src/mh/var.h +102 -0
- data/ext/numo/narray/src/t_bit.c +121 -71
- data/ext/numo/narray/src/t_dcomplex.c +248 -387
- data/ext/numo/narray/src/t_dfloat.c +922 -1068
- data/ext/numo/narray/src/t_int16.c +282 -231
- data/ext/numo/narray/src/t_int32.c +282 -231
- data/ext/numo/narray/src/t_int64.c +281 -230
- data/ext/numo/narray/src/t_int8.c +282 -231
- data/ext/numo/narray/src/t_robject.c +278 -405
- data/ext/numo/narray/src/t_scomplex.c +246 -406
- data/ext/numo/narray/src/t_sfloat.c +916 -1058
- data/ext/numo/narray/src/t_uint16.c +282 -231
- data/ext/numo/narray/src/t_uint32.c +282 -231
- data/ext/numo/narray/src/t_uint64.c +282 -231
- data/ext/numo/narray/src/t_uint8.c +282 -231
- data/ext/numo/narray/struct.c +12 -7
- data/lib/numo/narray/extra.rb +8 -5
- metadata +6 -3
- data/ext/numo/narray/src/t_mean.c +0 -105
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 819274f9f9bc411b8276d69966bcba8aa94bc6d61f73920f653411729e4ef247
|
4
|
+
data.tar.gz: c4ccb23dd013573cd80bd8ab73398fd1a67adf6018a8bd55eebff776a69df6d8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 35056f83d76f4c565f45b97ee8c9c992e6e3f3d77bd63b4ad7102d26631e4fbd82caaec87cb188bd2b23baf9785068923c6e54c441a6c188492526c848e2d0c0
|
7
|
+
data.tar.gz: 78f1154e6e77b6d9848b5a8c1e8d5818b7daeb891f5f476950eff003d7045022f7f57b0518c51c192756bd9b140e5bef737236d168b9918fe2610365388ac2f4
|
data/Gemfile
CHANGED
@@ -5,15 +5,18 @@ source 'https://rubygems.org'
|
|
5
5
|
# Specify your gem's dependencies in narray-devel.gemspec
|
6
6
|
gemspec
|
7
7
|
|
8
|
+
gem 'irb', '~> 1.15'
|
8
9
|
gem 'minitest', '~> 5.25'
|
9
10
|
gem 'rake', '~> 13.3'
|
10
11
|
gem 'rake-compiler', '~> 1.3'
|
12
|
+
gem 'rdoc', '~> 6.15'
|
11
13
|
gem 'rubocop', '~> 1.80'
|
12
14
|
gem 'rubocop-minitest', '~> 0.38.2'
|
13
15
|
gem 'rubocop-performance', '~> 1.26'
|
14
16
|
gem 'rubocop-rake', '~> 0.7.1'
|
15
17
|
gem 'simplecov', '~> 0.22.0'
|
16
18
|
gem 'test-unit', '~> 3.7'
|
19
|
+
gem 'yard', '~> 0.9.37'
|
17
20
|
|
18
21
|
group :memcheck, optional: true do
|
19
22
|
gem 'ruby_memcheck', '~> 3.0' if RUBY_VERSION.split('.')[0].to_i >= 3
|
data/README.md
CHANGED
@@ -40,6 +40,19 @@ Numo::DFloat#shape=[2,2]
|
|
40
40
|
irb(main):004>
|
41
41
|
```
|
42
42
|
|
43
|
+
## Related Projects
|
44
|
+
|
45
|
+
Numo::NArray Alternative is used in the following projects:
|
46
|
+
|
47
|
+
- [numo-linalg-alt](https://github.com/yoshoku/numo-linalg-alt): Linear algebra library with BLAS/LAPACK.
|
48
|
+
- [numo-optimize](https://github.com/yoshoku/numo-optimize): Optimization library for minimizing objective functions.
|
49
|
+
- [numo-random](https://github.com/yoshoku/numo-random): Random number generation library with several distributions.
|
50
|
+
- [numo-pocketfft](https://github.com/yoshoku/numo-pocketfft): Fourier transform library with pocketfft.
|
51
|
+
- [numo-libsvm](https://github.com/yoshoku/numo-libsvm): LIBSVM bindings library for numo-narray-alt.
|
52
|
+
- [numo-liblinear](https://github.com/yoshoku/numo-liblinear): LIBLINEAR bindings library for numo-narray-alt.
|
53
|
+
- [numo-linalg-randsvd](https://github.com/yoshoku/numo-linalg-randsvd): Randomized SVD library for numo-linalg-alt.
|
54
|
+
- [rumale](https://github.com/yoshoku/rumale): Machine learning library.
|
55
|
+
|
43
56
|
## Development
|
44
57
|
|
45
58
|
preparation:
|
@@ -21,30 +21,30 @@
|
|
21
21
|
#define ALTI_SR1 (vector unsigned int)(SR1, SR1, SR1, SR1)
|
22
22
|
#define ALTI_MSK (vector unsigned int)(MSK1, MSK2, MSK3, MSK4)
|
23
23
|
#define ALTI_MSK64 (vector unsigned int)(MSK2, MSK1, MSK4, MSK3)
|
24
|
-
#define ALTI_SL2_PERM
|
24
|
+
#define ALTI_SL2_PERM \
|
25
25
|
(vector unsigned char)(1, 2, 3, 23, 5, 6, 7, 0, 9, 10, 11, 4, 13, 14, 15, 8)
|
26
|
-
#define ALTI_SL2_PERM64
|
26
|
+
#define ALTI_SL2_PERM64 \
|
27
27
|
(vector unsigned char)(1, 2, 3, 4, 5, 6, 7, 31, 9, 10, 11, 12, 13, 14, 15, 0)
|
28
|
-
#define ALTI_SR2_PERM
|
28
|
+
#define ALTI_SR2_PERM \
|
29
29
|
(vector unsigned char)(7, 0, 1, 2, 11, 4, 5, 6, 15, 8, 9, 10, 17, 12, 13, 14)
|
30
|
-
#define ALTI_SR2_PERM64
|
30
|
+
#define ALTI_SR2_PERM64 \
|
31
31
|
(vector unsigned char)(15, 0, 1, 2, 3, 4, 5, 6, 17, 8, 9, 10, 11, 12, 13, 14)
|
32
32
|
#else /* For OTHER OSs(Linux?) */
|
33
|
-
#define ALTI_SL1
|
33
|
+
#define ALTI_SL1 \
|
34
34
|
{ SL1, SL1, SL1, SL1 }
|
35
|
-
#define ALTI_SR1
|
35
|
+
#define ALTI_SR1 \
|
36
36
|
{ SR1, SR1, SR1, SR1 }
|
37
|
-
#define ALTI_MSK
|
37
|
+
#define ALTI_MSK \
|
38
38
|
{ MSK1, MSK2, MSK3, MSK4 }
|
39
|
-
#define ALTI_MSK64
|
39
|
+
#define ALTI_MSK64 \
|
40
40
|
{ MSK2, MSK1, MSK4, MSK3 }
|
41
|
-
#define ALTI_SL2_PERM
|
41
|
+
#define ALTI_SL2_PERM \
|
42
42
|
{ 1, 2, 3, 23, 5, 6, 7, 0, 9, 10, 11, 4, 13, 14, 15, 8 }
|
43
|
-
#define ALTI_SL2_PERM64
|
43
|
+
#define ALTI_SL2_PERM64 \
|
44
44
|
{ 1, 2, 3, 4, 5, 6, 7, 31, 9, 10, 11, 12, 13, 14, 15, 0 }
|
45
|
-
#define ALTI_SR2_PERM
|
45
|
+
#define ALTI_SR2_PERM \
|
46
46
|
{ 7, 0, 1, 2, 11, 4, 5, 6, 15, 8, 9, 10, 17, 12, 13, 14 }
|
47
|
-
#define ALTI_SR2_PERM64
|
47
|
+
#define ALTI_SR2_PERM64 \
|
48
48
|
{ 15, 0, 1, 2, 3, 4, 5, 6, 17, 8, 9, 10, 11, 12, 13, 14 }
|
49
49
|
#endif /* For OSX */
|
50
50
|
#define IDSTR "SFMT-19937:122-18-1-11-1:dfffffef-ddfecb7f-bffaffff-bffffff6"
|
data/ext/numo/narray/array.c
CHANGED
@@ -446,8 +446,8 @@ static VALUE na_s_array_type(VALUE mod, VALUE ary) {
|
|
446
446
|
/*
|
447
447
|
Generate NArray object. NArray datatype is automatically selected.
|
448
448
|
@overload [](elements)
|
449
|
-
|
450
|
-
|
449
|
+
@param [Numeric,Array] elements
|
450
|
+
@return [NArray]
|
451
451
|
*/
|
452
452
|
static VALUE nary_s_bracket(VALUE klass, VALUE ary) {
|
453
453
|
VALUE dtype = Qnil;
|
@@ -557,7 +557,31 @@ na_ary_composition_for_struct(VALUE nstruct, VALUE ary)
|
|
557
557
|
*/
|
558
558
|
|
559
559
|
void Init_nary_array(void) {
|
560
|
+
/**
|
561
|
+
* return shape of NArray which would be created from given Array.
|
562
|
+
* @overload array_shape(ary)
|
563
|
+
* @param [Array] ary
|
564
|
+
* @return [Array] shape
|
565
|
+
* @example
|
566
|
+
* Numo::NArray.array_shape([[1, 2, 3],[4, 5, 6]])
|
567
|
+
* # => [2,3]
|
568
|
+
* Numo::NArray.array_shape(Numo::DFloat[[1, 2, 3], [4, 5, 6]])
|
569
|
+
* # => []
|
570
|
+
*/
|
560
571
|
rb_define_singleton_method(cNArray, "array_shape", na_s_array_shape, 1);
|
572
|
+
/**
|
573
|
+
* return type of NArray which would be created from given Array.
|
574
|
+
* @overload array_type(ary)
|
575
|
+
* @param [Array] ary
|
576
|
+
* @return [Class] NArray class
|
577
|
+
* @example
|
578
|
+
* Numo::NArray.array_type([1, 2, 3])
|
579
|
+
* # => Numo::Int32
|
580
|
+
* Numo::NArray.array_type([0, 1, 2i])
|
581
|
+
* # => Numo::DComplex
|
582
|
+
* Numo::NArray.array_type(Numo::DFloat[1, 2, 3])
|
583
|
+
* # => Numo::DFloat
|
584
|
+
*/
|
561
585
|
rb_define_singleton_method(cNArray, "array_type", na_s_array_type, 1);
|
562
586
|
rb_define_singleton_method(cNArray, "new_like", na_s_new_like, 1);
|
563
587
|
|
data/ext/numo/narray/data.c
CHANGED
@@ -14,44 +14,44 @@ static ID id_swap_byte;
|
|
14
14
|
|
15
15
|
// ---------------------------------------------------------------------
|
16
16
|
|
17
|
-
#define LOOP_UNARY_PTR(lp, proc)
|
18
|
-
{
|
19
|
-
size_t i;
|
20
|
-
ssize_t s1, s2;
|
21
|
-
char *p1, *p2;
|
22
|
-
size_t *idx1, *idx2;
|
23
|
-
INIT_COUNTER(lp, i);
|
24
|
-
INIT_PTR_IDX(lp, 0, p1, s1, idx1);
|
25
|
-
INIT_PTR_IDX(lp, 1, p2, s2, idx2);
|
26
|
-
if (idx1) {
|
27
|
-
if (idx2) {
|
28
|
-
for (; i--;) {
|
29
|
-
proc((p1 + *idx1), (p2 + *idx2));
|
30
|
-
idx1++;
|
31
|
-
idx2++;
|
32
|
-
}
|
33
|
-
} else {
|
34
|
-
for (; i--;) {
|
35
|
-
proc((p1 + *idx1), p2);
|
36
|
-
idx1++;
|
37
|
-
p2 += s2;
|
38
|
-
}
|
39
|
-
}
|
40
|
-
} else {
|
41
|
-
if (idx2) {
|
42
|
-
for (; i--;) {
|
43
|
-
proc(p1, (p1 + *idx2));
|
44
|
-
p1 += s1;
|
45
|
-
idx2++;
|
46
|
-
}
|
47
|
-
} else {
|
48
|
-
for (; i--;) {
|
49
|
-
proc(p1, p2);
|
50
|
-
p1 += s1;
|
51
|
-
p2 += s2;
|
52
|
-
}
|
53
|
-
}
|
54
|
-
}
|
17
|
+
#define LOOP_UNARY_PTR(lp, proc) \
|
18
|
+
{ \
|
19
|
+
size_t i; \
|
20
|
+
ssize_t s1, s2; \
|
21
|
+
char *p1, *p2; \
|
22
|
+
size_t *idx1, *idx2; \
|
23
|
+
INIT_COUNTER(lp, i); \
|
24
|
+
INIT_PTR_IDX(lp, 0, p1, s1, idx1); \
|
25
|
+
INIT_PTR_IDX(lp, 1, p2, s2, idx2); \
|
26
|
+
if (idx1) { \
|
27
|
+
if (idx2) { \
|
28
|
+
for (; i--;) { \
|
29
|
+
proc((p1 + *idx1), (p2 + *idx2)); \
|
30
|
+
idx1++; \
|
31
|
+
idx2++; \
|
32
|
+
} \
|
33
|
+
} else { \
|
34
|
+
for (; i--;) { \
|
35
|
+
proc((p1 + *idx1), p2); \
|
36
|
+
idx1++; \
|
37
|
+
p2 += s2; \
|
38
|
+
} \
|
39
|
+
} \
|
40
|
+
} else { \
|
41
|
+
if (idx2) { \
|
42
|
+
for (; i--;) { \
|
43
|
+
proc(p1, (p1 + *idx2)); \
|
44
|
+
p1 += s1; \
|
45
|
+
idx2++; \
|
46
|
+
} \
|
47
|
+
} else { \
|
48
|
+
for (; i--;) { \
|
49
|
+
proc(p1, p2); \
|
50
|
+
p1 += s1; \
|
51
|
+
p2 += s2; \
|
52
|
+
} \
|
53
|
+
} \
|
54
|
+
} \
|
55
55
|
}
|
56
56
|
|
57
57
|
#define m_memcpy(src, dst) memcpy(dst, src, e)
|
@@ -79,14 +79,14 @@ na_store(VALUE self, VALUE src) {
|
|
79
79
|
|
80
80
|
// ---------------------------------------------------------------------
|
81
81
|
|
82
|
-
#define m_swap_byte(q1, q2)
|
83
|
-
{
|
84
|
-
size_t j;
|
85
|
-
memcpy(b1, q1, e);
|
86
|
-
for (j = 0; j < e; j++) {
|
87
|
-
b2[e - 1 - j] = b1[j];
|
88
|
-
}
|
89
|
-
memcpy(q2, b2, e);
|
82
|
+
#define m_swap_byte(q1, q2) \
|
83
|
+
{ \
|
84
|
+
size_t j; \
|
85
|
+
memcpy(b1, q1, e); \
|
86
|
+
for (j = 0; j < e; j++) { \
|
87
|
+
b2[e - 1 - j] = b1[j]; \
|
88
|
+
} \
|
89
|
+
memcpy(q2, b2, e); \
|
90
90
|
}
|
91
91
|
|
92
92
|
static void iter_swap_byte(na_loop_t* const lp) {
|
@@ -156,9 +156,9 @@ static inline int check_axis(int axis, int ndim) {
|
|
156
156
|
/*
|
157
157
|
Interchange two axes.
|
158
158
|
@overload swapaxes(axis1,axis2)
|
159
|
-
|
160
|
-
|
161
|
-
|
159
|
+
@param [Integer] axis1
|
160
|
+
@param [Integer] axis2
|
161
|
+
@return [Numo::NArray] view of NArray.
|
162
162
|
@example
|
163
163
|
x = Numo::Int32[[1,2,3]]
|
164
164
|
|
@@ -231,11 +231,11 @@ static VALUE na_transpose_map(VALUE self, int* map) {
|
|
231
231
|
return view;
|
232
232
|
}
|
233
233
|
|
234
|
-
#define SWAP(a, b, tmp)
|
235
|
-
{
|
236
|
-
tmp = a;
|
237
|
-
a = b;
|
238
|
-
b = tmp;
|
234
|
+
#define SWAP(a, b, tmp) \
|
235
|
+
{ \
|
236
|
+
tmp = a; \
|
237
|
+
a = b; \
|
238
|
+
b = tmp; \
|
239
239
|
}
|
240
240
|
|
241
241
|
static VALUE na_transpose(int argc, VALUE* argv, VALUE self) {
|
@@ -355,9 +355,8 @@ static void na_check_reshape(int argc, VALUE* argv, VALUE self, size_t* shape) {
|
|
355
355
|
Raise exception if self is non-contiguous.
|
356
356
|
|
357
357
|
@overload reshape!(size0,size1,...)
|
358
|
-
|
359
|
-
|
360
|
-
@example
|
358
|
+
@param sizeN [Integer] new shape
|
359
|
+
@return [Numo::NArray] return self.
|
361
360
|
*/
|
362
361
|
static VALUE na_reshape_bang(int argc, VALUE* argv, VALUE self) {
|
363
362
|
size_t* shape;
|
@@ -400,9 +399,8 @@ static VALUE na_reshape_bang(int argc, VALUE* argv, VALUE self) {
|
|
400
399
|
Returns a copied NArray.
|
401
400
|
|
402
401
|
@overload reshape(size0,size1,...)
|
403
|
-
|
404
|
-
|
405
|
-
@example
|
402
|
+
@param sizeN [Integer] new shape
|
403
|
+
@return [Numo::NArray] return self.
|
406
404
|
*/
|
407
405
|
static VALUE na_reshape(int argc, VALUE* argv, VALUE self) {
|
408
406
|
size_t* shape;
|
@@ -545,13 +543,13 @@ na_flatten(VALUE self) {
|
|
545
543
|
/*
|
546
544
|
Returns a diagonal view of NArray
|
547
545
|
@overload diagonal([offset,axes])
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
|
546
|
+
@param [Integer] offset Diagonal offset from the main diagonal.
|
547
|
+
The default is 0. k>0 for diagonals above the main diagonal,
|
548
|
+
and k<0 for diagonals below the main diagonal.
|
549
|
+
@param [Array] axes Array of axes to be used as the 2-d sub-arrays
|
550
|
+
from which the diagonals should be taken. Defaults to last-two
|
551
|
+
axes ([-2,-1]).
|
552
|
+
@return [Numo::NArray] diagonal view of NArray.
|
555
553
|
@example
|
556
554
|
a = Numo::DFloat.new(4,5).seq
|
557
555
|
# => Numo::DFloat#shape=[4,5]
|
@@ -781,11 +779,11 @@ static VALUE na_diagonal(int argc, VALUE* argv, VALUE self) {
|
|
781
779
|
#ifdef SWAP
|
782
780
|
#undef SWAP
|
783
781
|
#endif
|
784
|
-
#define SWAP(a, b, t)
|
785
|
-
{
|
786
|
-
t = a;
|
787
|
-
a = b;
|
788
|
-
b = t;
|
782
|
+
#define SWAP(a, b, t) \
|
783
|
+
{ \
|
784
|
+
t = a; \
|
785
|
+
a = b; \
|
786
|
+
b = t; \
|
789
787
|
}
|
790
788
|
|
791
789
|
static VALUE
|
data/ext/numo/narray/extconf.rb
CHANGED
data/ext/numo/narray/index.c
CHANGED
@@ -1045,8 +1045,8 @@ static VALUE na_slice(int argc, VALUE* argv, VALUE self) {
|
|
1045
1045
|
Similar to numpy's tuple indexing, i.e., `a[[1,2,..],[3,4,..]]`
|
1046
1046
|
Same as Numo::NArray#[] for one-dimensional NArray.
|
1047
1047
|
@overload at(dim0,...,dimL)
|
1048
|
-
|
1049
|
-
|
1048
|
+
@param [Range,Array,Numo::Int32,Numo::Int64] dim0,...,dimL multi-dimensional index arrays.
|
1049
|
+
@return [Numo::NArray] one-dimensional NArray view.
|
1050
1050
|
@see #[]
|
1051
1051
|
|
1052
1052
|
@example
|
data/ext/numo/narray/kwargs.c
CHANGED
@@ -15,10 +15,10 @@ struct RBasicRaw {
|
|
15
15
|
VALUE klass;
|
16
16
|
};
|
17
17
|
|
18
|
-
#define RBASIC_SET_CLASS(obj, cls)
|
19
|
-
do {
|
20
|
-
VALUE _obj_ = (obj);
|
21
|
-
RB_OBJ_WRITE(_obj_, &((struct RBasicRaw*)(_obj_))->klass, cls);
|
18
|
+
#define RBASIC_SET_CLASS(obj, cls) \
|
19
|
+
do { \
|
20
|
+
VALUE _obj_ = (obj); \
|
21
|
+
RB_OBJ_WRITE(_obj_, &((struct RBasicRaw*)(_obj_))->klass, cls); \
|
22
22
|
} while (0)
|
23
23
|
|
24
24
|
/* from class.c */
|
@@ -92,8 +92,8 @@ int rb_get_kwargs(
|
|
92
92
|
VALUE missing = Qnil;
|
93
93
|
st_data_t key;
|
94
94
|
|
95
|
-
#define extract_kwarg(keyword, val)
|
96
|
-
(key = (st_data_t)(keyword), values ? st_delete(rb_hash_tbl_raw(keyword_hash), &key, (val))
|
95
|
+
#define extract_kwarg(keyword, val) \
|
96
|
+
(key = (st_data_t)(keyword), values ? st_delete(rb_hash_tbl_raw(keyword_hash), &key, (val)) \
|
97
97
|
: st_lookup(rb_hash_tbl_raw(keyword_hash), key, (val)))
|
98
98
|
|
99
99
|
if (NIL_P(keyword_hash)) keyword_hash = 0;
|
data/ext/numo/narray/math.c
CHANGED
@@ -72,9 +72,9 @@ static VALUE nary_mathcast(int argc, VALUE* argv) {
|
|
72
72
|
Dispatches method to Math module of upcasted type,
|
73
73
|
eg, Numo::DFloat::Math.
|
74
74
|
@overload method_missing(name,x,...)
|
75
|
-
|
76
|
-
|
77
|
-
|
75
|
+
@param [Symbol] name method name.
|
76
|
+
@param [NArray,Numeric] x input array.
|
77
|
+
@return [NArray] result.
|
78
78
|
*/
|
79
79
|
static VALUE nary_math_method_missing(int argc, VALUE* argv, VALUE mod) {
|
80
80
|
VALUE type, ans, typemod, hash;
|
@@ -101,11 +101,15 @@ static VALUE nary_math_method_missing(int argc, VALUE* argv, VALUE mod) {
|
|
101
101
|
void Init_nary_math(void) {
|
102
102
|
VALUE hCast;
|
103
103
|
|
104
|
+
/**
|
105
|
+
* Document-module: Numo::NMath
|
106
|
+
*
|
107
|
+
* This module provides mathematical functions for NArray.
|
108
|
+
*/
|
104
109
|
numo_mNMath = rb_define_module_under(mNumo, "NMath");
|
105
110
|
rb_define_singleton_method(numo_mNMath, "method_missing", nary_math_method_missing, -1);
|
106
111
|
|
107
112
|
hCast = rb_hash_new();
|
108
|
-
rb_define_const(numo_mNMath, "DISPATCH", hCast);
|
109
113
|
rb_hash_aset(hCast, numo_cInt64, numo_mDFloatMath);
|
110
114
|
rb_hash_aset(hCast, numo_cInt32, numo_mDFloatMath);
|
111
115
|
rb_hash_aset(hCast, numo_cInt16, numo_mDFloatMath);
|
@@ -127,6 +131,8 @@ void Init_nary_math(void) {
|
|
127
131
|
#endif
|
128
132
|
rb_hash_aset(hCast, rb_cFloat, rb_mMath);
|
129
133
|
rb_hash_aset(hCast, rb_cComplex, numo_mDComplexMath);
|
134
|
+
/* Dispatch table representing the corresponding Math module. */
|
135
|
+
rb_define_const(numo_mNMath, "DISPATCH", hCast);
|
130
136
|
|
131
137
|
id_send = rb_intern("send");
|
132
138
|
id_UPCAST = rb_intern("UPCAST");
|