numo-narray-alt 0.9.10 → 0.9.12
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 +0 -1
- data/LICENSE +1 -1
- data/README.md +7 -0
- data/ext/numo/narray/numo/narray.h +2 -2
- data/ext/numo/narray/numo/types/robj_macro.h +1 -1
- data/ext/numo/narray/numo/types/robject.h +1 -1
- data/ext/numo/narray/src/mh/argmax.h +154 -0
- data/ext/numo/narray/src/mh/argmin.h +154 -0
- data/ext/numo/narray/src/mh/bincount.h +233 -0
- data/ext/numo/narray/src/mh/bit/and.h +225 -0
- data/ext/numo/narray/src/mh/bit/left_shift.h +225 -0
- data/ext/numo/narray/src/mh/bit/not.h +173 -0
- data/ext/numo/narray/src/mh/bit/or.h +225 -0
- data/ext/numo/narray/src/mh/bit/right_shift.h +225 -0
- data/ext/numo/narray/src/mh/bit/xor.h +225 -0
- data/ext/numo/narray/src/mh/clip.h +115 -0
- data/ext/numo/narray/src/mh/coerce_cast.h +9 -0
- data/ext/numo/narray/src/mh/comp/binary_func.h +37 -0
- data/ext/numo/narray/src/mh/comp/eq.h +26 -0
- data/ext/numo/narray/src/mh/comp/ge.h +26 -0
- data/ext/numo/narray/src/mh/comp/gt.h +26 -0
- data/ext/numo/narray/src/mh/comp/le.h +26 -0
- data/ext/numo/narray/src/mh/comp/lt.h +26 -0
- data/ext/numo/narray/src/mh/comp/ne.h +26 -0
- data/ext/numo/narray/src/mh/comp/nearly_eq.h +26 -0
- data/ext/numo/narray/src/mh/cumprod.h +98 -0
- data/ext/numo/narray/src/mh/cumsum.h +98 -0
- data/ext/numo/narray/src/mh/divmod.h +142 -0
- data/ext/numo/narray/src/mh/eye.h +82 -0
- data/ext/numo/narray/src/mh/fill.h +94 -0
- data/ext/numo/narray/src/mh/format.h +108 -0
- data/ext/numo/narray/src/mh/format_to_a.h +89 -0
- data/ext/numo/narray/src/mh/inspect.h +33 -0
- data/ext/numo/narray/src/mh/isfinite.h +42 -0
- data/ext/numo/narray/src/mh/isinf.h +42 -0
- data/ext/numo/narray/src/mh/isnan.h +42 -0
- data/ext/numo/narray/src/mh/isneginf.h +42 -0
- data/ext/numo/narray/src/mh/isposinf.h +42 -0
- data/ext/numo/narray/src/mh/logseq.h +69 -0
- data/ext/numo/narray/src/mh/math/acos.h +2 -2
- data/ext/numo/narray/src/mh/math/acosh.h +2 -2
- data/ext/numo/narray/src/mh/math/asin.h +2 -2
- data/ext/numo/narray/src/mh/math/asinh.h +2 -2
- data/ext/numo/narray/src/mh/math/atan.h +2 -2
- data/ext/numo/narray/src/mh/math/atan2.h +3 -3
- data/ext/numo/narray/src/mh/math/atanh.h +2 -2
- data/ext/numo/narray/src/mh/math/cbrt.h +2 -2
- data/ext/numo/narray/src/mh/math/cos.h +2 -2
- data/ext/numo/narray/src/mh/math/cosh.h +2 -2
- data/ext/numo/narray/src/mh/math/erf.h +2 -2
- data/ext/numo/narray/src/mh/math/erfc.h +2 -2
- data/ext/numo/narray/src/mh/math/exp.h +2 -2
- data/ext/numo/narray/src/mh/math/exp10.h +2 -2
- data/ext/numo/narray/src/mh/math/exp2.h +2 -2
- data/ext/numo/narray/src/mh/math/expm1.h +2 -2
- data/ext/numo/narray/src/mh/math/frexp.h +3 -3
- data/ext/numo/narray/src/mh/math/hypot.h +3 -3
- data/ext/numo/narray/src/mh/math/ldexp.h +3 -3
- data/ext/numo/narray/src/mh/math/log.h +2 -2
- data/ext/numo/narray/src/mh/math/log10.h +2 -2
- data/ext/numo/narray/src/mh/math/log1p.h +2 -2
- data/ext/numo/narray/src/mh/math/log2.h +2 -2
- data/ext/numo/narray/src/mh/math/sin.h +2 -2
- data/ext/numo/narray/src/mh/math/sinc.h +2 -2
- data/ext/numo/narray/src/mh/math/sinh.h +2 -2
- data/ext/numo/narray/src/mh/math/sqrt.h +8 -8
- data/ext/numo/narray/src/mh/math/tan.h +2 -2
- data/ext/numo/narray/src/mh/math/tanh.h +2 -2
- data/ext/numo/narray/src/mh/math/unary_func.h +3 -3
- data/ext/numo/narray/src/mh/max.h +69 -0
- data/ext/numo/narray/src/mh/max_index.h +184 -0
- data/ext/numo/narray/src/mh/maximum.h +116 -0
- data/ext/numo/narray/src/mh/min.h +69 -0
- data/ext/numo/narray/src/mh/min_index.h +184 -0
- data/ext/numo/narray/src/mh/minimum.h +116 -0
- data/ext/numo/narray/src/mh/minmax.h +77 -0
- data/ext/numo/narray/src/mh/mulsum.h +185 -0
- data/ext/numo/narray/src/mh/op/add.h +78 -0
- data/ext/numo/narray/src/mh/op/binary_func.h +423 -0
- data/ext/numo/narray/src/mh/op/div.h +118 -0
- data/ext/numo/narray/src/mh/op/mod.h +108 -0
- data/ext/numo/narray/src/mh/op/mul.h +78 -0
- data/ext/numo/narray/src/mh/op/sub.h +78 -0
- data/ext/numo/narray/src/mh/prod.h +69 -0
- data/ext/numo/narray/src/mh/ptp.h +69 -0
- data/ext/numo/narray/src/mh/rand.h +315 -0
- data/ext/numo/narray/src/mh/round/ceil.h +11 -0
- data/ext/numo/narray/src/mh/round/floor.h +11 -0
- data/ext/numo/narray/src/mh/round/rint.h +9 -0
- data/ext/numo/narray/src/mh/round/round.h +11 -0
- data/ext/numo/narray/src/mh/round/trunc.h +11 -0
- data/ext/numo/narray/src/mh/round/unary_func.h +127 -0
- data/ext/numo/narray/src/mh/seq.h +130 -0
- data/ext/numo/narray/src/mh/sum.h +69 -0
- data/ext/numo/narray/src/mh/to_a.h +78 -0
- data/ext/numo/narray/src/t_bit.c +45 -234
- data/ext/numo/narray/src/t_dcomplex.c +608 -2369
- data/ext/numo/narray/src/t_dfloat.c +485 -3736
- data/ext/numo/narray/src/t_int16.c +743 -3444
- data/ext/numo/narray/src/t_int32.c +745 -3445
- data/ext/numo/narray/src/t_int64.c +743 -3446
- data/ext/numo/narray/src/t_int8.c +678 -3040
- data/ext/numo/narray/src/t_robject.c +771 -3548
- data/ext/numo/narray/src/t_scomplex.c +607 -2368
- data/ext/numo/narray/src/t_sfloat.c +440 -3693
- data/ext/numo/narray/src/t_uint16.c +743 -3440
- data/ext/numo/narray/src/t_uint32.c +743 -3440
- data/ext/numo/narray/src/t_uint64.c +743 -3442
- data/ext/numo/narray/src/t_uint8.c +678 -3038
- data/lib/numo/narray.rb +2 -3
- metadata +62 -3
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
#include "unary_func.h"
|
|
5
5
|
|
|
6
|
-
#define DEF_NARRAY_FLT_CBRT_METHOD_FUNC(tDType,
|
|
7
|
-
DEF_NARRAY_FLT_UNARY_MATH_METHOD_FUNC(cbrt, tDType,
|
|
6
|
+
#define DEF_NARRAY_FLT_CBRT_METHOD_FUNC(tDType, tNAryClass) \
|
|
7
|
+
DEF_NARRAY_FLT_UNARY_MATH_METHOD_FUNC(cbrt, tDType, tNAryClass)
|
|
8
8
|
|
|
9
9
|
#endif /* NUMO_NARRAY_MH_MATH_CBRT_H */
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
#include "unary_func.h"
|
|
5
5
|
|
|
6
|
-
#define DEF_NARRAY_FLT_COS_METHOD_FUNC(tDType,
|
|
7
|
-
DEF_NARRAY_FLT_UNARY_MATH_METHOD_FUNC(cos, tDType,
|
|
6
|
+
#define DEF_NARRAY_FLT_COS_METHOD_FUNC(tDType, tNAryClass) \
|
|
7
|
+
DEF_NARRAY_FLT_UNARY_MATH_METHOD_FUNC(cos, tDType, tNAryClass)
|
|
8
8
|
|
|
9
9
|
#endif /* NUMO_NARRAY_MH_MATH_COS_H */
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
#include "unary_func.h"
|
|
5
5
|
|
|
6
|
-
#define DEF_NARRAY_FLT_COSH_METHOD_FUNC(tDType,
|
|
7
|
-
DEF_NARRAY_FLT_UNARY_MATH_METHOD_FUNC(cosh, tDType,
|
|
6
|
+
#define DEF_NARRAY_FLT_COSH_METHOD_FUNC(tDType, tNAryClass) \
|
|
7
|
+
DEF_NARRAY_FLT_UNARY_MATH_METHOD_FUNC(cosh, tDType, tNAryClass)
|
|
8
8
|
|
|
9
9
|
#endif /* NUMO_NARRAY_MH_MATH_COSH_H */
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
#include "unary_func.h"
|
|
5
5
|
|
|
6
|
-
#define DEF_NARRAY_FLT_ERF_METHOD_FUNC(tDType,
|
|
7
|
-
DEF_NARRAY_FLT_UNARY_MATH_METHOD_FUNC(erf, tDType,
|
|
6
|
+
#define DEF_NARRAY_FLT_ERF_METHOD_FUNC(tDType, tNAryClass) \
|
|
7
|
+
DEF_NARRAY_FLT_UNARY_MATH_METHOD_FUNC(erf, tDType, tNAryClass)
|
|
8
8
|
|
|
9
9
|
#endif /* NUMO_NARRAY_MH_MATH_ERF_H */
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
#include "unary_func.h"
|
|
5
5
|
|
|
6
|
-
#define DEF_NARRAY_FLT_ERFC_METHOD_FUNC(tDType,
|
|
7
|
-
DEF_NARRAY_FLT_UNARY_MATH_METHOD_FUNC(erfc, tDType,
|
|
6
|
+
#define DEF_NARRAY_FLT_ERFC_METHOD_FUNC(tDType, tNAryClass) \
|
|
7
|
+
DEF_NARRAY_FLT_UNARY_MATH_METHOD_FUNC(erfc, tDType, tNAryClass)
|
|
8
8
|
|
|
9
9
|
#endif /* NUMO_NARRAY_MH_MATH_ERFC_H */
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
#include "unary_func.h"
|
|
5
5
|
|
|
6
|
-
#define DEF_NARRAY_FLT_EXP_METHOD_FUNC(tDType,
|
|
7
|
-
DEF_NARRAY_FLT_UNARY_MATH_METHOD_FUNC(exp, tDType,
|
|
6
|
+
#define DEF_NARRAY_FLT_EXP_METHOD_FUNC(tDType, tNAryClass) \
|
|
7
|
+
DEF_NARRAY_FLT_UNARY_MATH_METHOD_FUNC(exp, tDType, tNAryClass)
|
|
8
8
|
|
|
9
9
|
#endif /* NUMO_NARRAY_MH_MATH_EXP_H */
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
#include "unary_func.h"
|
|
5
5
|
|
|
6
|
-
#define DEF_NARRAY_FLT_EXP10_METHOD_FUNC(tDType,
|
|
7
|
-
DEF_NARRAY_FLT_UNARY_MATH_METHOD_FUNC(exp10, tDType,
|
|
6
|
+
#define DEF_NARRAY_FLT_EXP10_METHOD_FUNC(tDType, tNAryClass) \
|
|
7
|
+
DEF_NARRAY_FLT_UNARY_MATH_METHOD_FUNC(exp10, tDType, tNAryClass)
|
|
8
8
|
|
|
9
9
|
#endif /* NUMO_NARRAY_MH_MATH_EXP10_H */
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
#include "unary_func.h"
|
|
5
5
|
|
|
6
|
-
#define DEF_NARRAY_FLT_EXP2_METHOD_FUNC(tDType,
|
|
7
|
-
DEF_NARRAY_FLT_UNARY_MATH_METHOD_FUNC(exp2, tDType,
|
|
6
|
+
#define DEF_NARRAY_FLT_EXP2_METHOD_FUNC(tDType, tNAryClass) \
|
|
7
|
+
DEF_NARRAY_FLT_UNARY_MATH_METHOD_FUNC(exp2, tDType, tNAryClass)
|
|
8
8
|
|
|
9
9
|
#endif /* NUMO_NARRAY_MH_MATH_EXP2_H */
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
#include "unary_func.h"
|
|
5
5
|
|
|
6
|
-
#define DEF_NARRAY_FLT_EXPM1_METHOD_FUNC(tDType,
|
|
7
|
-
DEF_NARRAY_FLT_UNARY_MATH_METHOD_FUNC(expm1, tDType,
|
|
6
|
+
#define DEF_NARRAY_FLT_EXPM1_METHOD_FUNC(tDType, tNAryClass) \
|
|
7
|
+
DEF_NARRAY_FLT_UNARY_MATH_METHOD_FUNC(expm1, tDType, tNAryClass)
|
|
8
8
|
|
|
9
9
|
#endif /* NUMO_NARRAY_MH_MATH_EXPM1_H */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#ifndef NUMO_NARRAY_MH_MATH_FREXP_H
|
|
2
2
|
#define NUMO_NARRAY_MH_MATH_FREXP_H 1
|
|
3
3
|
|
|
4
|
-
#define DEF_NARRAY_FLT_FREXP_METHOD_FUNC(tDType,
|
|
4
|
+
#define DEF_NARRAY_FLT_FREXP_METHOD_FUNC(tDType, tNAryClass) \
|
|
5
5
|
static void iter_##tDType##_math_s_frexp(na_loop_t* const lp) { \
|
|
6
6
|
size_t n; \
|
|
7
7
|
char *p1, *p2, *p3; \
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
} \
|
|
22
22
|
\
|
|
23
23
|
static VALUE tDType##_math_s_frexp(VALUE mod, VALUE a1) { \
|
|
24
|
-
ndfunc_arg_in_t ain[1] = { {
|
|
25
|
-
ndfunc_arg_out_t aout[2] = { {
|
|
24
|
+
ndfunc_arg_in_t ain[1] = { { tNAryClass, 0 } }; \
|
|
25
|
+
ndfunc_arg_out_t aout[2] = { { tNAryClass, 0 }, { numo_cInt32, 0 } }; \
|
|
26
26
|
ndfunc_t ndf = { iter_##tDType##_math_s_frexp, STRIDE_LOOP, 1, 2, ain, aout }; \
|
|
27
27
|
return na_ndloop(&ndf, 1, a1); \
|
|
28
28
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#ifndef NUMO_NARRAY_MH_MATH_HYPOT_H
|
|
2
2
|
#define NUMO_NARRAY_MH_MATH_HYPOT_H 1
|
|
3
3
|
|
|
4
|
-
#define DEF_NARRAY_FLT_HYPOT_METHOD_FUNC(tDType,
|
|
4
|
+
#define DEF_NARRAY_FLT_HYPOT_METHOD_FUNC(tDType, tNAryClass) \
|
|
5
5
|
static void iter_##tDType##_math_s_hypot(na_loop_t* const lp) { \
|
|
6
6
|
size_t n; \
|
|
7
7
|
char *p1, *p2, *p3; \
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
} \
|
|
21
21
|
\
|
|
22
22
|
static VALUE tDType##_math_s_hypot(VALUE mod, VALUE a1, VALUE a2) { \
|
|
23
|
-
ndfunc_arg_in_t ain[2] = { {
|
|
24
|
-
ndfunc_arg_out_t aout[1] = { {
|
|
23
|
+
ndfunc_arg_in_t ain[2] = { { tNAryClass, 0 }, { tNAryClass, 0 } }; \
|
|
24
|
+
ndfunc_arg_out_t aout[1] = { { tNAryClass, 0 } }; \
|
|
25
25
|
ndfunc_t ndf = { iter_##tDType##_math_s_hypot, STRIDE_LOOP, 2, 1, ain, aout }; \
|
|
26
26
|
return na_ndloop(&ndf, 2, a1, a2); \
|
|
27
27
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#ifndef NUMO_NARRAY_MH_MATH_LDEXP_H
|
|
2
2
|
#define NUMO_NARRAY_MH_MATH_LDEXP_H 1
|
|
3
3
|
|
|
4
|
-
#define DEF_NARRAY_FLT_LDEXP_METHOD_FUNC(tDType,
|
|
4
|
+
#define DEF_NARRAY_FLT_LDEXP_METHOD_FUNC(tDType, tNAryClass) \
|
|
5
5
|
static void iter_##tDType##_math_s_ldexp(na_loop_t* const lp) { \
|
|
6
6
|
size_t n; \
|
|
7
7
|
char *p1, *p2, *p3; \
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
} \
|
|
21
21
|
\
|
|
22
22
|
static VALUE tDType##_math_s_ldexp(VALUE mod, VALUE a1, VALUE a2) { \
|
|
23
|
-
ndfunc_arg_in_t ain[2] = { {
|
|
24
|
-
ndfunc_arg_out_t aout[1] = { {
|
|
23
|
+
ndfunc_arg_in_t ain[2] = { { tNAryClass, 0 }, { tNAryClass, 0 } }; \
|
|
24
|
+
ndfunc_arg_out_t aout[1] = { { tNAryClass, 0 } }; \
|
|
25
25
|
ndfunc_t ndf = { iter_##tDType##_math_s_ldexp, STRIDE_LOOP, 2, 1, ain, aout }; \
|
|
26
26
|
return na_ndloop(&ndf, 2, a1, a2); \
|
|
27
27
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
#include "unary_func.h"
|
|
5
5
|
|
|
6
|
-
#define DEF_NARRAY_FLT_LOG_METHOD_FUNC(tDType,
|
|
7
|
-
DEF_NARRAY_FLT_UNARY_MATH_METHOD_FUNC(log, tDType,
|
|
6
|
+
#define DEF_NARRAY_FLT_LOG_METHOD_FUNC(tDType, tNAryClass) \
|
|
7
|
+
DEF_NARRAY_FLT_UNARY_MATH_METHOD_FUNC(log, tDType, tNAryClass)
|
|
8
8
|
|
|
9
9
|
#endif /* NUMO_NARRAY_MH_MATH_LOG_H */
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
#include "unary_func.h"
|
|
5
5
|
|
|
6
|
-
#define DEF_NARRAY_FLT_LOG10_METHOD_FUNC(tDType,
|
|
7
|
-
DEF_NARRAY_FLT_UNARY_MATH_METHOD_FUNC(log10, tDType,
|
|
6
|
+
#define DEF_NARRAY_FLT_LOG10_METHOD_FUNC(tDType, tNAryClass) \
|
|
7
|
+
DEF_NARRAY_FLT_UNARY_MATH_METHOD_FUNC(log10, tDType, tNAryClass)
|
|
8
8
|
|
|
9
9
|
#endif /* NUMO_NARRAY_MH_MATH_LOG10_H */
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
#include "unary_func.h"
|
|
5
5
|
|
|
6
|
-
#define DEF_NARRAY_FLT_LOG1P_METHOD_FUNC(tDType,
|
|
7
|
-
DEF_NARRAY_FLT_UNARY_MATH_METHOD_FUNC(log1p, tDType,
|
|
6
|
+
#define DEF_NARRAY_FLT_LOG1P_METHOD_FUNC(tDType, tNAryClass) \
|
|
7
|
+
DEF_NARRAY_FLT_UNARY_MATH_METHOD_FUNC(log1p, tDType, tNAryClass)
|
|
8
8
|
|
|
9
9
|
#endif /* NUMO_NARRAY_MH_MATH_LOG1P_H */
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
#include "unary_func.h"
|
|
5
5
|
|
|
6
|
-
#define DEF_NARRAY_FLT_LOG2_METHOD_FUNC(tDType,
|
|
7
|
-
DEF_NARRAY_FLT_UNARY_MATH_METHOD_FUNC(log2, tDType,
|
|
6
|
+
#define DEF_NARRAY_FLT_LOG2_METHOD_FUNC(tDType, tNAryClass) \
|
|
7
|
+
DEF_NARRAY_FLT_UNARY_MATH_METHOD_FUNC(log2, tDType, tNAryClass)
|
|
8
8
|
|
|
9
9
|
#endif /* NUMO_NARRAY_MH_MATH_LOG2_H */
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
#include "unary_func.h"
|
|
5
5
|
|
|
6
|
-
#define DEF_NARRAY_FLT_SIN_METHOD_FUNC(tDType,
|
|
7
|
-
DEF_NARRAY_FLT_UNARY_MATH_METHOD_FUNC(sin, tDType,
|
|
6
|
+
#define DEF_NARRAY_FLT_SIN_METHOD_FUNC(tDType, tNAryClass) \
|
|
7
|
+
DEF_NARRAY_FLT_UNARY_MATH_METHOD_FUNC(sin, tDType, tNAryClass)
|
|
8
8
|
|
|
9
9
|
#endif /* NUMO_NARRAY_MH_MATH_SIN_H */
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
#include "unary_func.h"
|
|
5
5
|
|
|
6
|
-
#define DEF_NARRAY_FLT_SINC_METHOD_FUNC(tDType,
|
|
7
|
-
DEF_NARRAY_FLT_UNARY_MATH_METHOD_FUNC(sinc, tDType,
|
|
6
|
+
#define DEF_NARRAY_FLT_SINC_METHOD_FUNC(tDType, tNAryClass) \
|
|
7
|
+
DEF_NARRAY_FLT_UNARY_MATH_METHOD_FUNC(sinc, tDType, tNAryClass)
|
|
8
8
|
|
|
9
9
|
#endif /* NUMO_NARRAY_MH_MATH_SINC_H */
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
#include "unary_func.h"
|
|
5
5
|
|
|
6
|
-
#define DEF_NARRAY_FLT_SINH_METHOD_FUNC(tDType,
|
|
7
|
-
DEF_NARRAY_FLT_UNARY_MATH_METHOD_FUNC(sinh, tDType,
|
|
6
|
+
#define DEF_NARRAY_FLT_SINH_METHOD_FUNC(tDType, tNAryClass) \
|
|
7
|
+
DEF_NARRAY_FLT_UNARY_MATH_METHOD_FUNC(sinh, tDType, tNAryClass)
|
|
8
8
|
|
|
9
9
|
#endif /* NUMO_NARRAY_MH_MATH_SINH_H */
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
|
|
4
4
|
#include "unary_func.h"
|
|
5
5
|
|
|
6
|
-
#define DEF_NARRAY_FLT_SQRT_METHOD_FUNC(tDType,
|
|
7
|
-
DEF_NARRAY_FLT_UNARY_MATH_METHOD_FUNC(sqrt, tDType,
|
|
6
|
+
#define DEF_NARRAY_FLT_SQRT_METHOD_FUNC(tDType, tNAryClass) \
|
|
7
|
+
DEF_NARRAY_FLT_UNARY_MATH_METHOD_FUNC(sqrt, tDType, tNAryClass)
|
|
8
8
|
|
|
9
|
-
#define DEF_NARRAY_FLT_SQRT_SSE2_SGL_METHOD_FUNC(tDType,
|
|
9
|
+
#define DEF_NARRAY_FLT_SQRT_SSE2_SGL_METHOD_FUNC(tDType, tNAryClass) \
|
|
10
10
|
static void iter_##tDType##_math_s_sqrt(na_loop_t* const lp) { \
|
|
11
11
|
size_t i = 0; \
|
|
12
12
|
size_t n; \
|
|
@@ -97,13 +97,13 @@
|
|
|
97
97
|
} \
|
|
98
98
|
\
|
|
99
99
|
static VALUE tDType##_math_s_sqrt(VALUE mod, VALUE a1) { \
|
|
100
|
-
ndfunc_arg_in_t ain[1] = { {
|
|
101
|
-
ndfunc_arg_out_t aout[1] = { {
|
|
100
|
+
ndfunc_arg_in_t ain[1] = { { tNAryClass, 0 } }; \
|
|
101
|
+
ndfunc_arg_out_t aout[1] = { { tNAryClass, 0 } }; \
|
|
102
102
|
ndfunc_t ndf = { iter_##tDType##_math_s_sqrt, FULL_LOOP, 1, 1, ain, aout }; \
|
|
103
103
|
return na_ndloop(&ndf, 1, a1); \
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
-
#define DEF_NARRAY_FLT_SQRT_SSE2_DBL_METHOD_FUNC(tDType,
|
|
106
|
+
#define DEF_NARRAY_FLT_SQRT_SSE2_DBL_METHOD_FUNC(tDType, tNAryClass) \
|
|
107
107
|
static void iter_##tDType##_math_s_sqrt(na_loop_t* const lp) { \
|
|
108
108
|
size_t i = 0; \
|
|
109
109
|
size_t n; \
|
|
@@ -194,8 +194,8 @@
|
|
|
194
194
|
} \
|
|
195
195
|
\
|
|
196
196
|
static VALUE tDType##_math_s_sqrt(VALUE mod, VALUE a1) { \
|
|
197
|
-
ndfunc_arg_in_t ain[1] = { {
|
|
198
|
-
ndfunc_arg_out_t aout[1] = { {
|
|
197
|
+
ndfunc_arg_in_t ain[1] = { { tNAryClass, 0 } }; \
|
|
198
|
+
ndfunc_arg_out_t aout[1] = { { tNAryClass, 0 } }; \
|
|
199
199
|
ndfunc_t ndf = { iter_##tDType##_math_s_sqrt, FULL_LOOP, 1, 1, ain, aout }; \
|
|
200
200
|
return na_ndloop(&ndf, 1, a1); \
|
|
201
201
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
#include "unary_func.h"
|
|
5
5
|
|
|
6
|
-
#define DEF_NARRAY_FLT_TAN_METHOD_FUNC(tDType,
|
|
7
|
-
DEF_NARRAY_FLT_UNARY_MATH_METHOD_FUNC(tan, tDType,
|
|
6
|
+
#define DEF_NARRAY_FLT_TAN_METHOD_FUNC(tDType, tNAryClass) \
|
|
7
|
+
DEF_NARRAY_FLT_UNARY_MATH_METHOD_FUNC(tan, tDType, tNAryClass)
|
|
8
8
|
|
|
9
9
|
#endif /* NUMO_NARRAY_MH_MATH_TAN_H */
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
#include "unary_func.h"
|
|
5
5
|
|
|
6
|
-
#define DEF_NARRAY_FLT_TANH_METHOD_FUNC(tDType,
|
|
7
|
-
DEF_NARRAY_FLT_UNARY_MATH_METHOD_FUNC(tanh, tDType,
|
|
6
|
+
#define DEF_NARRAY_FLT_TANH_METHOD_FUNC(tDType, tNAryClass) \
|
|
7
|
+
DEF_NARRAY_FLT_UNARY_MATH_METHOD_FUNC(tanh, tDType, tNAryClass)
|
|
8
8
|
|
|
9
9
|
#endif /* NUMO_NARRAY_MH_MATH_TANH_H */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#ifndef NUMO_NARRAY_MH_MATH_UNARY_FUNC_H
|
|
2
2
|
#define NUMO_NARRAY_MH_MATH_UNARY_FUNC_H 1
|
|
3
3
|
|
|
4
|
-
#define DEF_NARRAY_FLT_UNARY_MATH_METHOD_FUNC(fMathFunc, tDType,
|
|
4
|
+
#define DEF_NARRAY_FLT_UNARY_MATH_METHOD_FUNC(fMathFunc, tDType, tNAryClass) \
|
|
5
5
|
static void iter_##tDType##_math_s_##fMathFunc(na_loop_t* const lp) { \
|
|
6
6
|
size_t n; \
|
|
7
7
|
char *p1, *p2; \
|
|
@@ -61,8 +61,8 @@
|
|
|
61
61
|
} \
|
|
62
62
|
\
|
|
63
63
|
static VALUE tDType##_math_s_##fMathFunc(VALUE mod, VALUE a1) { \
|
|
64
|
-
ndfunc_arg_in_t ain[1] = { {
|
|
65
|
-
ndfunc_arg_out_t aout[1] = { {
|
|
64
|
+
ndfunc_arg_in_t ain[1] = { { tNAryClass, 0 } }; \
|
|
65
|
+
ndfunc_arg_out_t aout[1] = { { tNAryClass, 0 } }; \
|
|
66
66
|
ndfunc_t ndf = { iter_##tDType##_math_s_##fMathFunc, FULL_LOOP, 1, 1, ain, aout }; \
|
|
67
67
|
return na_ndloop(&ndf, 1, a1); \
|
|
68
68
|
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
#ifndef NUMO_NARRAY_MH_MAX_H
|
|
2
|
+
#define NUMO_NARRAY_MH_MAX_H 1
|
|
3
|
+
|
|
4
|
+
#define DEF_NARRAY_FLT_MAX_METHOD_FUNC(tDType, tNAryClass) \
|
|
5
|
+
static void iter_##tDType##_max(na_loop_t* const lp) { \
|
|
6
|
+
size_t n; \
|
|
7
|
+
char* p1; \
|
|
8
|
+
char* p2; \
|
|
9
|
+
ssize_t s1; \
|
|
10
|
+
\
|
|
11
|
+
INIT_COUNTER(lp, n); \
|
|
12
|
+
INIT_PTR(lp, 0, p1, s1); \
|
|
13
|
+
p2 = NDL_PTR(lp, 1); \
|
|
14
|
+
\
|
|
15
|
+
*(tDType*)p2 = f_max(n, p1, s1); \
|
|
16
|
+
} \
|
|
17
|
+
\
|
|
18
|
+
static void iter_##tDType##_max_nan(na_loop_t* const lp) { \
|
|
19
|
+
size_t n; \
|
|
20
|
+
char* p1; \
|
|
21
|
+
char* p2; \
|
|
22
|
+
ssize_t s1; \
|
|
23
|
+
\
|
|
24
|
+
INIT_COUNTER(lp, n); \
|
|
25
|
+
INIT_PTR(lp, 0, p1, s1); \
|
|
26
|
+
p2 = NDL_PTR(lp, 1); \
|
|
27
|
+
\
|
|
28
|
+
*(tDType*)p2 = f_max_nan(n, p1, s1); \
|
|
29
|
+
} \
|
|
30
|
+
\
|
|
31
|
+
static VALUE tDType##_max(int argc, VALUE* argv, VALUE self) { \
|
|
32
|
+
ndfunc_arg_in_t ain[2] = { { tNAryClass, 0 }, { sym_reduce, 0 } }; \
|
|
33
|
+
ndfunc_arg_out_t aout[1] = { { tNAryClass, 0 } }; \
|
|
34
|
+
ndfunc_t ndf = { \
|
|
35
|
+
iter_##tDType##_max, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout \
|
|
36
|
+
}; \
|
|
37
|
+
VALUE reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, iter_##tDType##_max_nan); \
|
|
38
|
+
VALUE v = na_ndloop(&ndf, 2, self, reduce); \
|
|
39
|
+
\
|
|
40
|
+
return rb_funcall(v, rb_intern("extract"), 0); \
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
#define DEF_NARRAY_INT_MAX_METHOD_FUNC(tDType, tNAryClass) \
|
|
44
|
+
static void iter_##tDType##_max(na_loop_t* const lp) { \
|
|
45
|
+
size_t n; \
|
|
46
|
+
char* p1; \
|
|
47
|
+
char* p2; \
|
|
48
|
+
ssize_t s1; \
|
|
49
|
+
\
|
|
50
|
+
INIT_COUNTER(lp, n); \
|
|
51
|
+
INIT_PTR(lp, 0, p1, s1); \
|
|
52
|
+
p2 = NDL_PTR(lp, 1); \
|
|
53
|
+
\
|
|
54
|
+
*(tDType*)p2 = f_max(n, p1, s1); \
|
|
55
|
+
} \
|
|
56
|
+
\
|
|
57
|
+
static VALUE tDType##_max(int argc, VALUE* argv, VALUE self) { \
|
|
58
|
+
ndfunc_arg_in_t ain[2] = { { tNAryClass, 0 }, { sym_reduce, 0 } }; \
|
|
59
|
+
ndfunc_arg_out_t aout[1] = { { tNAryClass, 0 } }; \
|
|
60
|
+
ndfunc_t ndf = { \
|
|
61
|
+
iter_##tDType##_max, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout \
|
|
62
|
+
}; \
|
|
63
|
+
VALUE reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, 0); \
|
|
64
|
+
VALUE v = na_ndloop(&ndf, 2, self, reduce); \
|
|
65
|
+
\
|
|
66
|
+
return rb_funcall(v, rb_intern("extract"), 0); \
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
#endif /* NUMO_NARRAY_MH_MAX_H */
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
#ifndef NUMO_NARRAY_MH_MAX_INDEX_H
|
|
2
|
+
#define NUMO_NARRAY_MH_MAX_INDEX_H 1
|
|
3
|
+
|
|
4
|
+
#define DEF_NARRAY_FLT_MAX_INDEX_METHOD_FUNC(tDType) \
|
|
5
|
+
static void iter_##tDType##_max_index_index64(na_loop_t* const lp) { \
|
|
6
|
+
size_t n; \
|
|
7
|
+
size_t idx; \
|
|
8
|
+
char* d_ptr; \
|
|
9
|
+
char* i_ptr; \
|
|
10
|
+
char* o_ptr; \
|
|
11
|
+
ssize_t d_step; \
|
|
12
|
+
ssize_t i_step; \
|
|
13
|
+
\
|
|
14
|
+
INIT_COUNTER(lp, n); \
|
|
15
|
+
INIT_PTR(lp, 0, d_ptr, d_step); \
|
|
16
|
+
\
|
|
17
|
+
idx = f_max_index(n, d_ptr, d_step); \
|
|
18
|
+
\
|
|
19
|
+
INIT_PTR(lp, 1, i_ptr, i_step); \
|
|
20
|
+
o_ptr = NDL_PTR(lp, 2); \
|
|
21
|
+
*(int64_t*)o_ptr = *(int64_t*)(i_ptr + i_step * idx); \
|
|
22
|
+
} \
|
|
23
|
+
\
|
|
24
|
+
static void iter_##tDType##_max_index_index32(na_loop_t* const lp) { \
|
|
25
|
+
size_t n; \
|
|
26
|
+
size_t idx; \
|
|
27
|
+
char* d_ptr; \
|
|
28
|
+
char* i_ptr; \
|
|
29
|
+
char* o_ptr; \
|
|
30
|
+
ssize_t d_step; \
|
|
31
|
+
ssize_t i_step; \
|
|
32
|
+
\
|
|
33
|
+
INIT_COUNTER(lp, n); \
|
|
34
|
+
INIT_PTR(lp, 0, d_ptr, d_step); \
|
|
35
|
+
\
|
|
36
|
+
idx = f_max_index(n, d_ptr, d_step); \
|
|
37
|
+
\
|
|
38
|
+
INIT_PTR(lp, 1, i_ptr, i_step); \
|
|
39
|
+
o_ptr = NDL_PTR(lp, 2); \
|
|
40
|
+
*(int32_t*)o_ptr = *(int32_t*)(i_ptr + i_step * idx); \
|
|
41
|
+
} \
|
|
42
|
+
\
|
|
43
|
+
static void iter_##tDType##_max_index_index64_nan(na_loop_t* const lp) { \
|
|
44
|
+
size_t n; \
|
|
45
|
+
size_t idx; \
|
|
46
|
+
char* d_ptr; \
|
|
47
|
+
char* i_ptr; \
|
|
48
|
+
char* o_ptr; \
|
|
49
|
+
ssize_t d_step; \
|
|
50
|
+
ssize_t i_step; \
|
|
51
|
+
\
|
|
52
|
+
INIT_COUNTER(lp, n); \
|
|
53
|
+
INIT_PTR(lp, 0, d_ptr, d_step); \
|
|
54
|
+
\
|
|
55
|
+
idx = f_max_index_nan(n, d_ptr, d_step); \
|
|
56
|
+
\
|
|
57
|
+
INIT_PTR(lp, 1, i_ptr, i_step); \
|
|
58
|
+
o_ptr = NDL_PTR(lp, 2); \
|
|
59
|
+
*(int64_t*)o_ptr = *(int64_t*)(i_ptr + i_step * idx); \
|
|
60
|
+
} \
|
|
61
|
+
\
|
|
62
|
+
static void iter_##tDType##_max_index_index32_nan(na_loop_t* const lp) { \
|
|
63
|
+
size_t n; \
|
|
64
|
+
size_t idx; \
|
|
65
|
+
char* d_ptr; \
|
|
66
|
+
char* i_ptr; \
|
|
67
|
+
char* o_ptr; \
|
|
68
|
+
ssize_t d_step; \
|
|
69
|
+
ssize_t i_step; \
|
|
70
|
+
\
|
|
71
|
+
INIT_COUNTER(lp, n); \
|
|
72
|
+
INIT_PTR(lp, 0, d_ptr, d_step); \
|
|
73
|
+
\
|
|
74
|
+
idx = f_max_index_nan(n, d_ptr, d_step); \
|
|
75
|
+
\
|
|
76
|
+
INIT_PTR(lp, 1, i_ptr, i_step); \
|
|
77
|
+
o_ptr = NDL_PTR(lp, 2); \
|
|
78
|
+
*(int32_t*)o_ptr = *(int32_t*)(i_ptr + i_step * idx); \
|
|
79
|
+
} \
|
|
80
|
+
\
|
|
81
|
+
static VALUE tDType##_max_index(int argc, VALUE* argv, VALUE self) { \
|
|
82
|
+
narray_t* na; \
|
|
83
|
+
VALUE idx; \
|
|
84
|
+
VALUE reduce; \
|
|
85
|
+
ndfunc_arg_in_t ain[3] = { { Qnil, 0 }, { Qnil, 0 }, { sym_reduce, 0 } }; \
|
|
86
|
+
ndfunc_arg_out_t aout[1] = { { 0, 0, 0 } }; \
|
|
87
|
+
ndfunc_t ndf = { 0, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE | NDF_EXTRACT, 3, 1, ain, aout }; \
|
|
88
|
+
\
|
|
89
|
+
GetNArray(self, na); \
|
|
90
|
+
if (na->ndim == 0) { \
|
|
91
|
+
return INT2FIX(0); \
|
|
92
|
+
} \
|
|
93
|
+
\
|
|
94
|
+
if (na->size > (~(u_int32_t)0)) { \
|
|
95
|
+
aout[0].type = numo_cInt64; \
|
|
96
|
+
idx = nary_new(numo_cInt64, na->ndim, na->shape); \
|
|
97
|
+
ndf.func = iter_##tDType##_max_index_index64; \
|
|
98
|
+
reduce = na_reduce_dimension( \
|
|
99
|
+
argc, argv, 1, &self, &ndf, iter_##tDType##_max_index_index64_nan \
|
|
100
|
+
); \
|
|
101
|
+
} else { \
|
|
102
|
+
aout[0].type = numo_cInt32; \
|
|
103
|
+
idx = nary_new(numo_cInt32, na->ndim, na->shape); \
|
|
104
|
+
ndf.func = iter_##tDType##_max_index_index32; \
|
|
105
|
+
reduce = na_reduce_dimension( \
|
|
106
|
+
argc, argv, 1, &self, &ndf, iter_##tDType##_max_index_index32_nan \
|
|
107
|
+
); \
|
|
108
|
+
} \
|
|
109
|
+
\
|
|
110
|
+
rb_funcall(idx, rb_intern("seq"), 0); \
|
|
111
|
+
\
|
|
112
|
+
return na_ndloop(&ndf, 3, self, idx, reduce); \
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
#define DEF_NARRAY_INT_MAX_INDEX_METHOD_FUNC(tDType) \
|
|
116
|
+
static void iter_##tDType##_max_index_index64(na_loop_t* const lp) { \
|
|
117
|
+
size_t n; \
|
|
118
|
+
size_t idx; \
|
|
119
|
+
char* d_ptr; \
|
|
120
|
+
char* i_ptr; \
|
|
121
|
+
char* o_ptr; \
|
|
122
|
+
ssize_t d_step; \
|
|
123
|
+
ssize_t i_step; \
|
|
124
|
+
\
|
|
125
|
+
INIT_COUNTER(lp, n); \
|
|
126
|
+
INIT_PTR(lp, 0, d_ptr, d_step); \
|
|
127
|
+
\
|
|
128
|
+
idx = f_max_index(n, d_ptr, d_step); \
|
|
129
|
+
\
|
|
130
|
+
INIT_PTR(lp, 1, i_ptr, i_step); \
|
|
131
|
+
o_ptr = NDL_PTR(lp, 2); \
|
|
132
|
+
*(int64_t*)o_ptr = *(int64_t*)(i_ptr + i_step * idx); \
|
|
133
|
+
} \
|
|
134
|
+
\
|
|
135
|
+
static void iter_##tDType##_max_index_index32(na_loop_t* const lp) { \
|
|
136
|
+
size_t n; \
|
|
137
|
+
size_t idx; \
|
|
138
|
+
char* d_ptr; \
|
|
139
|
+
char* i_ptr; \
|
|
140
|
+
char* o_ptr; \
|
|
141
|
+
ssize_t d_step; \
|
|
142
|
+
ssize_t i_step; \
|
|
143
|
+
\
|
|
144
|
+
INIT_COUNTER(lp, n); \
|
|
145
|
+
INIT_PTR(lp, 0, d_ptr, d_step); \
|
|
146
|
+
\
|
|
147
|
+
idx = f_max_index(n, d_ptr, d_step); \
|
|
148
|
+
\
|
|
149
|
+
INIT_PTR(lp, 1, i_ptr, i_step); \
|
|
150
|
+
o_ptr = NDL_PTR(lp, 2); \
|
|
151
|
+
*(int32_t*)o_ptr = *(int32_t*)(i_ptr + i_step * idx); \
|
|
152
|
+
} \
|
|
153
|
+
\
|
|
154
|
+
static VALUE tDType##_max_index(int argc, VALUE* argv, VALUE self) { \
|
|
155
|
+
narray_t* na; \
|
|
156
|
+
VALUE idx; \
|
|
157
|
+
VALUE reduce; \
|
|
158
|
+
ndfunc_arg_in_t ain[3] = { { Qnil, 0 }, { Qnil, 0 }, { sym_reduce, 0 } }; \
|
|
159
|
+
ndfunc_arg_out_t aout[1] = { { 0, 0, 0 } }; \
|
|
160
|
+
ndfunc_t ndf = { 0, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE | NDF_EXTRACT, 3, 1, ain, aout }; \
|
|
161
|
+
\
|
|
162
|
+
GetNArray(self, na); \
|
|
163
|
+
if (na->ndim == 0) { \
|
|
164
|
+
return INT2FIX(0); \
|
|
165
|
+
} \
|
|
166
|
+
\
|
|
167
|
+
if (na->size > (~(u_int32_t)0)) { \
|
|
168
|
+
aout[0].type = numo_cInt64; \
|
|
169
|
+
idx = nary_new(numo_cInt64, na->ndim, na->shape); \
|
|
170
|
+
ndf.func = iter_##tDType##_max_index_index64; \
|
|
171
|
+
reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, 0); \
|
|
172
|
+
} else { \
|
|
173
|
+
aout[0].type = numo_cInt32; \
|
|
174
|
+
idx = nary_new(numo_cInt32, na->ndim, na->shape); \
|
|
175
|
+
ndf.func = iter_##tDType##_max_index_index32; \
|
|
176
|
+
reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, 0); \
|
|
177
|
+
} \
|
|
178
|
+
\
|
|
179
|
+
rb_funcall(idx, rb_intern("seq"), 0); \
|
|
180
|
+
\
|
|
181
|
+
return na_ndloop(&ndf, 3, self, idx, reduce); \
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
#endif /* NUMO_NARRAY_MH_MAX_INDEX_H */
|