numo-narray-alt 0.9.11 → 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.
Files changed (91) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +0 -1
  3. data/README.md +7 -0
  4. data/ext/numo/narray/numo/narray.h +2 -2
  5. data/ext/numo/narray/numo/types/robj_macro.h +1 -1
  6. data/ext/numo/narray/src/mh/bincount.h +233 -0
  7. data/ext/numo/narray/src/mh/bit/and.h +225 -0
  8. data/ext/numo/narray/src/mh/bit/left_shift.h +225 -0
  9. data/ext/numo/narray/src/mh/bit/not.h +173 -0
  10. data/ext/numo/narray/src/mh/bit/or.h +225 -0
  11. data/ext/numo/narray/src/mh/bit/right_shift.h +225 -0
  12. data/ext/numo/narray/src/mh/bit/xor.h +225 -0
  13. data/ext/numo/narray/src/mh/coerce_cast.h +9 -0
  14. data/ext/numo/narray/src/mh/comp/binary_func.h +37 -0
  15. data/ext/numo/narray/src/mh/comp/eq.h +26 -0
  16. data/ext/numo/narray/src/mh/comp/ge.h +26 -0
  17. data/ext/numo/narray/src/mh/comp/gt.h +26 -0
  18. data/ext/numo/narray/src/mh/comp/le.h +26 -0
  19. data/ext/numo/narray/src/mh/comp/lt.h +26 -0
  20. data/ext/numo/narray/src/mh/comp/ne.h +26 -0
  21. data/ext/numo/narray/src/mh/comp/nearly_eq.h +26 -0
  22. data/ext/numo/narray/src/mh/divmod.h +142 -0
  23. data/ext/numo/narray/src/mh/eye.h +1 -1
  24. data/ext/numo/narray/src/mh/fill.h +94 -0
  25. data/ext/numo/narray/src/mh/format.h +108 -0
  26. data/ext/numo/narray/src/mh/format_to_a.h +89 -0
  27. data/ext/numo/narray/src/mh/inspect.h +33 -0
  28. data/ext/numo/narray/src/mh/isfinite.h +42 -0
  29. data/ext/numo/narray/src/mh/isinf.h +42 -0
  30. data/ext/numo/narray/src/mh/isnan.h +42 -0
  31. data/ext/numo/narray/src/mh/isneginf.h +42 -0
  32. data/ext/numo/narray/src/mh/isposinf.h +42 -0
  33. data/ext/numo/narray/src/mh/math/acos.h +2 -2
  34. data/ext/numo/narray/src/mh/math/acosh.h +2 -2
  35. data/ext/numo/narray/src/mh/math/asin.h +2 -2
  36. data/ext/numo/narray/src/mh/math/asinh.h +2 -2
  37. data/ext/numo/narray/src/mh/math/atan.h +2 -2
  38. data/ext/numo/narray/src/mh/math/atan2.h +3 -3
  39. data/ext/numo/narray/src/mh/math/atanh.h +2 -2
  40. data/ext/numo/narray/src/mh/math/cbrt.h +2 -2
  41. data/ext/numo/narray/src/mh/math/cos.h +2 -2
  42. data/ext/numo/narray/src/mh/math/cosh.h +2 -2
  43. data/ext/numo/narray/src/mh/math/erf.h +2 -2
  44. data/ext/numo/narray/src/mh/math/erfc.h +2 -2
  45. data/ext/numo/narray/src/mh/math/exp.h +2 -2
  46. data/ext/numo/narray/src/mh/math/exp10.h +2 -2
  47. data/ext/numo/narray/src/mh/math/exp2.h +2 -2
  48. data/ext/numo/narray/src/mh/math/expm1.h +2 -2
  49. data/ext/numo/narray/src/mh/math/frexp.h +3 -3
  50. data/ext/numo/narray/src/mh/math/hypot.h +3 -3
  51. data/ext/numo/narray/src/mh/math/ldexp.h +3 -3
  52. data/ext/numo/narray/src/mh/math/log.h +2 -2
  53. data/ext/numo/narray/src/mh/math/log10.h +2 -2
  54. data/ext/numo/narray/src/mh/math/log1p.h +2 -2
  55. data/ext/numo/narray/src/mh/math/log2.h +2 -2
  56. data/ext/numo/narray/src/mh/math/sin.h +2 -2
  57. data/ext/numo/narray/src/mh/math/sinc.h +2 -2
  58. data/ext/numo/narray/src/mh/math/sinh.h +2 -2
  59. data/ext/numo/narray/src/mh/math/sqrt.h +8 -8
  60. data/ext/numo/narray/src/mh/math/tan.h +2 -2
  61. data/ext/numo/narray/src/mh/math/tanh.h +2 -2
  62. data/ext/numo/narray/src/mh/math/unary_func.h +3 -3
  63. data/ext/numo/narray/src/mh/op/add.h +78 -0
  64. data/ext/numo/narray/src/mh/op/binary_func.h +423 -0
  65. data/ext/numo/narray/src/mh/op/div.h +118 -0
  66. data/ext/numo/narray/src/mh/op/mod.h +108 -0
  67. data/ext/numo/narray/src/mh/op/mul.h +78 -0
  68. data/ext/numo/narray/src/mh/op/sub.h +78 -0
  69. data/ext/numo/narray/src/mh/rand.h +2 -2
  70. data/ext/numo/narray/src/mh/round/ceil.h +11 -0
  71. data/ext/numo/narray/src/mh/round/floor.h +11 -0
  72. data/ext/numo/narray/src/mh/round/rint.h +9 -0
  73. data/ext/numo/narray/src/mh/round/round.h +11 -0
  74. data/ext/numo/narray/src/mh/round/trunc.h +11 -0
  75. data/ext/numo/narray/src/mh/round/unary_func.h +127 -0
  76. data/ext/numo/narray/src/mh/to_a.h +78 -0
  77. data/ext/numo/narray/src/t_bit.c +45 -234
  78. data/ext/numo/narray/src/t_dcomplex.c +584 -1809
  79. data/ext/numo/narray/src/t_dfloat.c +429 -2432
  80. data/ext/numo/narray/src/t_int16.c +481 -2283
  81. data/ext/numo/narray/src/t_int32.c +481 -2283
  82. data/ext/numo/narray/src/t_int64.c +481 -2283
  83. data/ext/numo/narray/src/t_int8.c +408 -1873
  84. data/ext/numo/narray/src/t_robject.c +448 -1977
  85. data/ext/numo/narray/src/t_scomplex.c +584 -1809
  86. data/ext/numo/narray/src/t_sfloat.c +429 -2434
  87. data/ext/numo/narray/src/t_uint16.c +480 -2278
  88. data/ext/numo/narray/src/t_uint32.c +480 -2278
  89. data/ext/numo/narray/src/t_uint64.c +480 -2278
  90. data/ext/numo/narray/src/t_uint8.c +407 -1868
  91. metadata +41 -2
@@ -1,7 +1,7 @@
1
1
  #ifndef NUMO_NARRAY_MH_MATH_ATAN2_H
2
2
  #define NUMO_NARRAY_MH_MATH_ATAN2_H 1
3
3
 
4
- #define DEF_NARRAY_FLT_ATAN2_METHOD_FUNC(tDType, tNAryType) \
4
+ #define DEF_NARRAY_FLT_ATAN2_METHOD_FUNC(tDType, tNAryClass) \
5
5
  static void iter_##tDType##_math_s_atan2(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_atan2(VALUE mod, VALUE a1, VALUE a2) { \
23
- ndfunc_arg_in_t ain[2] = { { tNAryType, 0 }, { tNAryType, 0 } }; \
24
- ndfunc_arg_out_t aout[1] = { { tNAryType, 0 } }; \
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_atan2, 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_ATANH_METHOD_FUNC(tDType, tNAryType) \
7
- DEF_NARRAY_FLT_UNARY_MATH_METHOD_FUNC(atanh, tDType, tNAryType)
6
+ #define DEF_NARRAY_FLT_ATANH_METHOD_FUNC(tDType, tNAryClass) \
7
+ DEF_NARRAY_FLT_UNARY_MATH_METHOD_FUNC(atanh, tDType, tNAryClass)
8
8
 
9
9
  #endif /* NUMO_NARRAY_MH_MATH_ATANH_H */
@@ -3,7 +3,7 @@
3
3
 
4
4
  #include "unary_func.h"
5
5
 
6
- #define DEF_NARRAY_FLT_CBRT_METHOD_FUNC(tDType, tNAryType) \
7
- DEF_NARRAY_FLT_UNARY_MATH_METHOD_FUNC(cbrt, tDType, tNAryType)
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, tNAryType) \
7
- DEF_NARRAY_FLT_UNARY_MATH_METHOD_FUNC(cos, tDType, tNAryType)
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, tNAryType) \
7
- DEF_NARRAY_FLT_UNARY_MATH_METHOD_FUNC(cosh, tDType, tNAryType)
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, tNAryType) \
7
- DEF_NARRAY_FLT_UNARY_MATH_METHOD_FUNC(erf, tDType, tNAryType)
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, tNAryType) \
7
- DEF_NARRAY_FLT_UNARY_MATH_METHOD_FUNC(erfc, tDType, tNAryType)
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, tNAryType) \
7
- DEF_NARRAY_FLT_UNARY_MATH_METHOD_FUNC(exp, tDType, tNAryType)
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, tNAryType) \
7
- DEF_NARRAY_FLT_UNARY_MATH_METHOD_FUNC(exp10, tDType, tNAryType)
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, tNAryType) \
7
- DEF_NARRAY_FLT_UNARY_MATH_METHOD_FUNC(exp2, tDType, tNAryType)
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, tNAryType) \
7
- DEF_NARRAY_FLT_UNARY_MATH_METHOD_FUNC(expm1, tDType, tNAryType)
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, tNAryType) \
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] = { { tNAryType, 0 } }; \
25
- ndfunc_arg_out_t aout[2] = { { tNAryType, 0 }, { numo_cInt32, 0 } }; \
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, tNAryType) \
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] = { { tNAryType, 0 }, { tNAryType, 0 } }; \
24
- ndfunc_arg_out_t aout[1] = { { tNAryType, 0 } }; \
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, tNAryType) \
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] = { { tNAryType, 0 }, { tNAryType, 0 } }; \
24
- ndfunc_arg_out_t aout[1] = { { tNAryType, 0 } }; \
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, tNAryType) \
7
- DEF_NARRAY_FLT_UNARY_MATH_METHOD_FUNC(log, tDType, tNAryType)
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, tNAryType) \
7
- DEF_NARRAY_FLT_UNARY_MATH_METHOD_FUNC(log10, tDType, tNAryType)
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, tNAryType) \
7
- DEF_NARRAY_FLT_UNARY_MATH_METHOD_FUNC(log1p, tDType, tNAryType)
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, tNAryType) \
7
- DEF_NARRAY_FLT_UNARY_MATH_METHOD_FUNC(log2, tDType, tNAryType)
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, tNAryType) \
7
- DEF_NARRAY_FLT_UNARY_MATH_METHOD_FUNC(sin, tDType, tNAryType)
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, tNAryType) \
7
- DEF_NARRAY_FLT_UNARY_MATH_METHOD_FUNC(sinc, tDType, tNAryType)
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, tNAryType) \
7
- DEF_NARRAY_FLT_UNARY_MATH_METHOD_FUNC(sinh, tDType, tNAryType)
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, tNAryType) \
7
- DEF_NARRAY_FLT_UNARY_MATH_METHOD_FUNC(sqrt, tDType, tNAryType)
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, tNAryType) \
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] = { { tNAryType, 0 } }; \
101
- ndfunc_arg_out_t aout[1] = { { tNAryType, 0 } }; \
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, tNAryType) \
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] = { { tNAryType, 0 } }; \
198
- ndfunc_arg_out_t aout[1] = { { tNAryType, 0 } }; \
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, tNAryType) \
7
- DEF_NARRAY_FLT_UNARY_MATH_METHOD_FUNC(tan, tDType, tNAryType)
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, tNAryType) \
7
- DEF_NARRAY_FLT_UNARY_MATH_METHOD_FUNC(tanh, tDType, tNAryType)
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, tNAryType) \
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] = { { tNAryType, 0 } }; \
65
- ndfunc_arg_out_t aout[1] = { { tNAryType, 0 } }; \
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,78 @@
1
+ #ifndef NUMO_NARRAY_MH_OP_ADD_H
2
+ #define NUMO_NARRAY_MH_OP_ADD_H 1
3
+
4
+ #include "binary_func.h"
5
+
6
+ #define DEF_NARRAY_ADD_METHOD_FUNC(tDType, tNAryClass) \
7
+ static void iter_##tDType##_add(na_loop_t* const lp) { \
8
+ ITER_BINARY_INIT_VARS() \
9
+ if (is_aligned(p1, sizeof(tDType)) && is_aligned(p2, sizeof(tDType)) && \
10
+ is_aligned(p3, sizeof(tDType))) { \
11
+ if (s1 == sizeof(tDType) && s2 == sizeof(tDType) && s3 == sizeof(tDType)) { \
12
+ ITER_BINARY_INPLACE_OR_NEW_ARY(add, tDType) \
13
+ return; \
14
+ } \
15
+ if (is_aligned_step(s1, sizeof(tDType)) && is_aligned_step(s2, sizeof(tDType)) && \
16
+ is_aligned_step(s3, sizeof(tDType))) { \
17
+ if (s2 == 0) { \
18
+ if (s1 == sizeof(tDType) && s3 == sizeof(tDType)) { \
19
+ ITER_BINARY_INPLACE_OR_NEW_SCL(add, tDType) \
20
+ } else { \
21
+ ITER_BINARY_NEW_PTR_SCL(add, tDType) \
22
+ } \
23
+ } else { \
24
+ ITER_BINARY_INPLACE_OR_NEW_PTR_ARY(add, tDType) \
25
+ } \
26
+ return; \
27
+ } \
28
+ } \
29
+ ITER_BINARY_FALLBACK_LOOP(add, tDType) \
30
+ } \
31
+ DEF_BINARY_SELF_FUNC(add, tDType, tNAryClass) \
32
+ DEF_BINARY_FUNC(add, '+', tDType, tNAryClass)
33
+
34
+ #define DEF_NARRAY_INT8_ADD_METHOD_FUNC(tDType, tNAryClass) \
35
+ static void iter_##tDType##_add(na_loop_t* const lp) { \
36
+ ITER_BINARY_INIT_VARS() \
37
+ if (s2 == 0) { \
38
+ if (s1 == sizeof(tDType) && s3 == sizeof(tDType)) { \
39
+ ITER_BINARY_INPLACE_OR_NEW_SCL(add, tDType) \
40
+ } else { \
41
+ ITER_BINARY_NEW_PTR_SCL(add, tDType) \
42
+ } \
43
+ } else { \
44
+ ITER_BINARY_INPLACE_OR_NEW_PTR_ARY(add, tDType) \
45
+ } \
46
+ } \
47
+ DEF_BINARY_SELF_FUNC(add, tDType, tNAryClass) \
48
+ DEF_BINARY_FUNC(add, '+', tDType, tNAryClass)
49
+
50
+ #define DEF_NARRAY_ROBJ_ADD_METHOD_FUNC() \
51
+ static void iter_robject_add(na_loop_t* const lp) { \
52
+ ITER_BINARY_INIT_VARS() \
53
+ if (s2 == 0) { \
54
+ if (s1 == sizeof(robject) && s3 == sizeof(robject)) { \
55
+ ITER_BINARY_INPLACE_OR_NEW_SCL(add, robject) \
56
+ } else { \
57
+ ITER_BINARY_NEW_PTR_SCL(add, robject) \
58
+ } \
59
+ } else { \
60
+ ITER_BINARY_INPLACE_OR_NEW_PTR_ARY(add, robject) \
61
+ } \
62
+ } \
63
+ DEF_BINARY_SELF_FUNC(add, robject, numo_cRObject) \
64
+ static VALUE robject_add(VALUE self, VALUE other) { \
65
+ return robject_add_self(self, other); \
66
+ }
67
+
68
+ #define DEF_NARRAY_SFLT_ADD_SSE2_METHOD_FUNC() \
69
+ DEF_BINARY_SFLT_SSE2_ITER_FUNC(add, _mm_add_ps) \
70
+ DEF_BINARY_SELF_FUNC(add, sfloat, numo_cSFloat) \
71
+ DEF_BINARY_FUNC(add, '+', sfloat, numo_cSFloat)
72
+
73
+ #define DEF_NARRAY_DFLT_ADD_SSE2_METHOD_FUNC() \
74
+ DEF_BINARY_DFLT_SSE2_ITER_FUNC(add, _mm_add_pd) \
75
+ DEF_BINARY_SELF_FUNC(add, dfloat, numo_cDFloat) \
76
+ DEF_BINARY_FUNC(add, '+', dfloat, numo_cDFloat)
77
+
78
+ #endif /* NUMO_NARRAY_MH_OP_ADD_H */