numo-narray-alt 0.9.6 → 0.9.8

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 (46) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +31 -10
  3. data/ext/numo/narray/SFMT-params19937.h +8 -16
  4. data/ext/numo/narray/numo/narray.h +2 -2
  5. data/ext/numo/narray/numo/types/complex.h +2 -2
  6. data/ext/numo/narray/src/mh/math/acos.h +9 -0
  7. data/ext/numo/narray/src/mh/math/acosh.h +9 -0
  8. data/ext/numo/narray/src/mh/math/asin.h +9 -0
  9. data/ext/numo/narray/src/mh/math/asinh.h +9 -0
  10. data/ext/numo/narray/src/mh/math/atan.h +9 -0
  11. data/ext/numo/narray/src/mh/math/atan2.h +29 -0
  12. data/ext/numo/narray/src/mh/math/atanh.h +9 -0
  13. data/ext/numo/narray/src/mh/math/cbrt.h +9 -0
  14. data/ext/numo/narray/src/mh/math/cos.h +9 -0
  15. data/ext/numo/narray/src/mh/math/cosh.h +9 -0
  16. data/ext/numo/narray/src/mh/math/erf.h +9 -0
  17. data/ext/numo/narray/src/mh/math/erfc.h +9 -0
  18. data/ext/numo/narray/src/mh/math/exp.h +9 -0
  19. data/ext/numo/narray/src/mh/math/exp10.h +9 -0
  20. data/ext/numo/narray/src/mh/math/exp2.h +9 -0
  21. data/ext/numo/narray/src/mh/math/expm1.h +9 -0
  22. data/ext/numo/narray/src/mh/math/frexp.h +30 -0
  23. data/ext/numo/narray/src/mh/math/hypot.h +29 -0
  24. data/ext/numo/narray/src/mh/math/ldexp.h +29 -0
  25. data/ext/numo/narray/src/mh/math/log.h +9 -0
  26. data/ext/numo/narray/src/mh/math/log10.h +9 -0
  27. data/ext/numo/narray/src/mh/math/log1p.h +9 -0
  28. data/ext/numo/narray/src/mh/math/log2.h +9 -0
  29. data/ext/numo/narray/src/mh/math/sin.h +9 -0
  30. data/ext/numo/narray/src/mh/math/sinc.h +9 -0
  31. data/ext/numo/narray/src/mh/math/sinh.h +9 -0
  32. data/ext/numo/narray/src/mh/math/sqrt.h +203 -0
  33. data/ext/numo/narray/src/mh/math/tan.h +9 -0
  34. data/ext/numo/narray/src/mh/math/tanh.h +9 -0
  35. data/ext/numo/narray/src/mh/math/unary_func.h +70 -0
  36. data/ext/numo/narray/src/mh/mean.h +1 -8
  37. data/ext/numo/narray/src/mh/rms.h +1 -8
  38. data/ext/numo/narray/src/mh/stddev.h +1 -8
  39. data/ext/numo/narray/src/mh/var.h +1 -8
  40. data/ext/numo/narray/src/t_dcomplex.c +236 -1707
  41. data/ext/numo/narray/src/t_dfloat.c +66 -1952
  42. data/ext/numo/narray/src/t_robject.c +4 -4
  43. data/ext/numo/narray/src/t_scomplex.c +236 -1707
  44. data/ext/numo/narray/src/t_sfloat.c +66 -1952
  45. data/lib/numo/narray/extra.rb +77 -0
  46. metadata +33 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 819274f9f9bc411b8276d69966bcba8aa94bc6d61f73920f653411729e4ef247
4
- data.tar.gz: c4ccb23dd013573cd80bd8ab73398fd1a67adf6018a8bd55eebff776a69df6d8
3
+ metadata.gz: 0b3599445e17b270ef62828929231b129d12bc263e8492a5b4b6c7768107cc63
4
+ data.tar.gz: f902d9c0c471fd6a32b0e388292468357a2b9828dbe5c2837d5ecbace488351c
5
5
  SHA512:
6
- metadata.gz: 35056f83d76f4c565f45b97ee8c9c992e6e3f3d77bd63b4ad7102d26631e4fbd82caaec87cb188bd2b23baf9785068923c6e54c441a6c188492526c848e2d0c0
7
- data.tar.gz: 78f1154e6e77b6d9848b5a8c1e8d5818b7daeb891f5f476950eff003d7045022f7f57b0518c51c192756bd9b140e5bef737236d168b9918fe2610365388ac2f4
6
+ metadata.gz: 113dda84cc8bf37ee2013b1314a7a3aed1be8746481c6dae136026a376dd5c77c7698775757c2e07bf34a9b6fbf98f4fc7e569ed0085b2c8c6e215328f4958af
7
+ data.tar.gz: e5a1dc3ed30d54dddef769cd9f98e790f2aae0ab781f8be599f46015335387f9afb6c79ab44f91d826119bd2dbc41ba070376784ea32a1d3d8cf25b1aff324a6
data/README.md CHANGED
@@ -5,14 +5,17 @@
5
5
  [![BSD 3-Clause License](https://img.shields.io/badge/License-BSD%203--Clause-orange.svg)](https://github.com/yoshoku/numo-narray-alt/blob/main/LICENSE)
6
6
  [![Documentation](https://img.shields.io/badge/api-reference-blue.svg)](https://gemdocs.org/gems/numo-narray-alt/)
7
7
 
8
- Numo::NArray Alternative is an experimental project forked from [Numo::NArray](https://github.com/ruby-numo/numo-narray).
9
- Its goal is to adopt more modern Ruby features and development practices.
10
- The project owner is also the developer of [Rumale](https://github.com/yoshoku/rumale), a machine learning library,
11
- and may add new features to this project to support the needs of Rumale.
12
- In addition, since Rumale depends on Numo::NArray, namespaces, class names, and method names will be kept unchanged
13
- to allow this library to be used as a drop-in replacement.
14
-
15
- The project owner has the utmost respect for Numo::NArray and its creator, Prof. Masahiro Tanaka.
8
+ Numo::NArray Alternative (numo-narray-alt) is a project forked from
9
+ [Numo::NArray](https://github.com/ruby-numo/numo-narray).
10
+ The project aims to support the latest Ruby features, release bug fixes as quickly as possible,
11
+ and adopt modern development practices.
12
+ In addition, module names, class names, and method names remain unchanged for compatibility,
13
+ making it a drop-in replacement.
14
+ The project owner is also the developer of [Rumale](https://github.com/yoshoku/rumale),
15
+ a machine learning library, and may add new features to numo-narray-alt to support the needs of Rumale.
16
+
17
+ The project owner has the utmost respect for Numo::NArray and its creator,
18
+ Prof. [Masahiro Tanaka](https://github.com/masa16).
16
19
  This project is in no way intended to adversely affect the development of the original Numo::NArray.
17
20
 
18
21
  ## Installation
@@ -23,9 +26,9 @@ $ gem install numo-narray-alt
23
26
 
24
27
  ## Usage
25
28
 
26
- The same as Numo::NArray.
29
+ The usage is exactly the same as Numo::NArray.
27
30
 
28
- ```irb
31
+ ```ruby
29
32
  irb(main):001> require 'numo/narray'
30
33
  => true
31
34
  irb(main):002> x = Numo::DFloat[[1, 2, 3], [4, 5, 6]]
@@ -40,6 +43,17 @@ Numo::DFloat#shape=[2,2]
40
43
  irb(main):004>
41
44
  ```
42
45
 
46
+ ## Documentation
47
+
48
+ - [API Documentation on Gemdocs](https://gemdocs.org/gems/numo-narray-alt/)
49
+ - [Major Changes Since Fork](https://github.com/yoshoku/numo-narray-alt/wiki/Major-Changes-Since-Fork)
50
+
51
+ Since it is compatible with Numo::NArray, the following Numo::NArray documentation is also useful.
52
+
53
+ - [Comparison with Numpy](https://github.com/ruby-numo/numo-narray/wiki/Comparison-with-Numpy)
54
+ - [Numo vs numpy](https://github.com/ruby-numo/numo-narray/wiki/Numo-vs-numpy)
55
+ - [100 narray exercises](https://github.com/ruby-numo/numo-narray/wiki/100-narray-exercises)
56
+
43
57
  ## Related Projects
44
58
 
45
59
  Numo::NArray Alternative is used in the following projects:
@@ -77,6 +91,13 @@ $ bundle exec rubocop
77
91
  $ clang-format --dry-run --Werror --style=file ext/**/*.h ext/**/*.c
78
92
  ```
79
93
 
94
+ This project follows [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/).
95
+ Please run `npm install` to set up husky and commitlint for commit message validation:
96
+
97
+ ```shell
98
+ $ npm install
99
+ ```
100
+
80
101
  ## Contributing
81
102
 
82
103
  Bug reports and pull requests are welcome on GitHub at https://github.com/yoshoku/numo-narray-alt.
@@ -30,22 +30,14 @@
30
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 \
34
- { SL1, SL1, SL1, SL1 }
35
- #define ALTI_SR1 \
36
- { SR1, SR1, SR1, SR1 }
37
- #define ALTI_MSK \
38
- { MSK1, MSK2, MSK3, MSK4 }
39
- #define ALTI_MSK64 \
40
- { MSK2, MSK1, MSK4, MSK3 }
41
- #define ALTI_SL2_PERM \
42
- { 1, 2, 3, 23, 5, 6, 7, 0, 9, 10, 11, 4, 13, 14, 15, 8 }
43
- #define ALTI_SL2_PERM64 \
44
- { 1, 2, 3, 4, 5, 6, 7, 31, 9, 10, 11, 12, 13, 14, 15, 0 }
45
- #define ALTI_SR2_PERM \
46
- { 7, 0, 1, 2, 11, 4, 5, 6, 15, 8, 9, 10, 17, 12, 13, 14 }
47
- #define ALTI_SR2_PERM64 \
48
- { 15, 0, 1, 2, 3, 4, 5, 6, 17, 8, 9, 10, 11, 12, 13, 14 }
33
+ #define ALTI_SL1 { SL1, SL1, SL1, SL1 }
34
+ #define ALTI_SR1 { SR1, SR1, SR1, SR1 }
35
+ #define ALTI_MSK { MSK1, MSK2, MSK3, MSK4 }
36
+ #define ALTI_MSK64 { MSK2, MSK1, MSK4, MSK3 }
37
+ #define ALTI_SL2_PERM { 1, 2, 3, 23, 5, 6, 7, 0, 9, 10, 11, 4, 13, 14, 15, 8 }
38
+ #define ALTI_SL2_PERM64 { 1, 2, 3, 4, 5, 6, 7, 31, 9, 10, 11, 12, 13, 14, 15, 0 }
39
+ #define ALTI_SR2_PERM { 7, 0, 1, 2, 11, 4, 5, 6, 15, 8, 9, 10, 17, 12, 13, 14 }
40
+ #define ALTI_SR2_PERM64 { 15, 0, 1, 2, 3, 4, 5, 6, 17, 8, 9, 10, 11, 12, 13, 14 }
49
41
  #endif /* For OSX */
50
42
  #define IDSTR "SFMT-19937:122-18-1-11-1:dfffffef-ddfecb7f-bffaffff-bffffff6"
51
43
 
@@ -13,8 +13,8 @@ extern "C" {
13
13
  #endif
14
14
  #endif
15
15
 
16
- #define NARRAY_VERSION "0.9.6"
17
- #define NARRAY_VERSION_CODE 960
16
+ #define NARRAY_VERSION "0.9.8"
17
+ #define NARRAY_VERSION_CODE 980
18
18
 
19
19
  #include <math.h>
20
20
  #include "numo/compat.h"
@@ -172,14 +172,14 @@ static inline dtype c_log(dtype x) {
172
172
  static inline dtype c_log2(dtype x) {
173
173
  dtype z;
174
174
  z = c_log(x);
175
- z = c_mul_r(x, M_LOG2E);
175
+ z = c_mul_r(z, M_LOG2E);
176
176
  return z;
177
177
  }
178
178
 
179
179
  static inline dtype c_log10(dtype x) {
180
180
  dtype z;
181
181
  z = c_log(x);
182
- z = c_mul_r(x, M_LOG10E);
182
+ z = c_mul_r(z, M_LOG10E);
183
183
  return z;
184
184
  }
185
185
 
@@ -0,0 +1,9 @@
1
+ #ifndef NUMO_NARRAY_MH_MATH_ACOS_H
2
+ #define NUMO_NARRAY_MH_MATH_ACOS_H 1
3
+
4
+ #include "unary_func.h"
5
+
6
+ #define DEF_NARRAY_FLT_ACOS_METHOD_FUNC(tDType, tNAryType) \
7
+ DEF_NARRAY_FLT_UNARY_MATH_METHOD_FUNC(acos, tDType, tNAryType)
8
+
9
+ #endif /* NUMO_NARRAY_MH_MATH_ACOS_H */
@@ -0,0 +1,9 @@
1
+ #ifndef NUMO_NARRAY_MH_MATH_ACOSH_H
2
+ #define NUMO_NARRAY_MH_MATH_ACOSH_H 1
3
+
4
+ #include "unary_func.h"
5
+
6
+ #define DEF_NARRAY_FLT_ACOSH_METHOD_FUNC(tDType, tNAryType) \
7
+ DEF_NARRAY_FLT_UNARY_MATH_METHOD_FUNC(acosh, tDType, tNAryType)
8
+
9
+ #endif /* NUMO_NARRAY_MH_MATH_ACOSH_H */
@@ -0,0 +1,9 @@
1
+ #ifndef NUMO_NARRAY_MH_MATH_ASIN_H
2
+ #define NUMO_NARRAY_MH_MATH_ASIN_H 1
3
+
4
+ #include "unary_func.h"
5
+
6
+ #define DEF_NARRAY_FLT_ASIN_METHOD_FUNC(tDType, tNAryType) \
7
+ DEF_NARRAY_FLT_UNARY_MATH_METHOD_FUNC(asin, tDType, tNAryType)
8
+
9
+ #endif /* NUMO_NARRAY_MH_MATH_ASIN_H */
@@ -0,0 +1,9 @@
1
+ #ifndef NUMO_NARRAY_MH_MATH_ASINH_H
2
+ #define NUMO_NARRAY_MH_MATH_ASINH_H 1
3
+
4
+ #include "unary_func.h"
5
+
6
+ #define DEF_NARRAY_FLT_ASINH_METHOD_FUNC(tDType, tNAryType) \
7
+ DEF_NARRAY_FLT_UNARY_MATH_METHOD_FUNC(asinh, tDType, tNAryType)
8
+
9
+ #endif /* NUMO_NARRAY_MH_MATH_ASINH_H */
@@ -0,0 +1,9 @@
1
+ #ifndef NUMO_NARRAY_MH_MATH_ATAN_H
2
+ #define NUMO_NARRAY_MH_MATH_ATAN_H 1
3
+
4
+ #include "unary_func.h"
5
+
6
+ #define DEF_NARRAY_FLT_ATAN_METHOD_FUNC(tDType, tNAryType) \
7
+ DEF_NARRAY_FLT_UNARY_MATH_METHOD_FUNC(atan, tDType, tNAryType)
8
+
9
+ #endif /* NUMO_NARRAY_MH_MATH_ATAN_H */
@@ -0,0 +1,29 @@
1
+ #ifndef NUMO_NARRAY_MH_MATH_ATAN2_H
2
+ #define NUMO_NARRAY_MH_MATH_ATAN2_H 1
3
+
4
+ #define DEF_NARRAY_FLT_ATAN2_METHOD_FUNC(tDType, tNAryType) \
5
+ static void iter_##tDType##_math_s_atan2(na_loop_t* const lp) { \
6
+ size_t n; \
7
+ char *p1, *p2, *p3; \
8
+ ssize_t s1, s2, s3; \
9
+ tDType x, y; \
10
+ INIT_COUNTER(lp, n); \
11
+ INIT_PTR(lp, 0, p1, s1); \
12
+ INIT_PTR(lp, 1, p2, s2); \
13
+ INIT_PTR(lp, 2, p3, s3); \
14
+ for (size_t i = 0; i < n; i++) { \
15
+ GET_DATA_STRIDE(p1, s1, tDType, x); \
16
+ GET_DATA_STRIDE(p2, s2, tDType, y); \
17
+ x = m_atan2(x, y); \
18
+ SET_DATA_STRIDE(p3, s3, tDType, x); \
19
+ } \
20
+ } \
21
+ \
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 } }; \
25
+ ndfunc_t ndf = { iter_##tDType##_math_s_atan2, STRIDE_LOOP, 2, 1, ain, aout }; \
26
+ return na_ndloop(&ndf, 2, a1, a2); \
27
+ }
28
+
29
+ #endif /* NUMO_NARRAY_MH_MATH_ATAN2_H */
@@ -0,0 +1,9 @@
1
+ #ifndef NUMO_NARRAY_MH_MATH_ATANH_H
2
+ #define NUMO_NARRAY_MH_MATH_ATANH_H 1
3
+
4
+ #include "unary_func.h"
5
+
6
+ #define DEF_NARRAY_FLT_ATANH_METHOD_FUNC(tDType, tNAryType) \
7
+ DEF_NARRAY_FLT_UNARY_MATH_METHOD_FUNC(atanh, tDType, tNAryType)
8
+
9
+ #endif /* NUMO_NARRAY_MH_MATH_ATANH_H */
@@ -0,0 +1,9 @@
1
+ #ifndef NUMO_NARRAY_MH_MATH_CBRT_H
2
+ #define NUMO_NARRAY_MH_MATH_CBRT_H 1
3
+
4
+ #include "unary_func.h"
5
+
6
+ #define DEF_NARRAY_FLT_CBRT_METHOD_FUNC(tDType, tNAryType) \
7
+ DEF_NARRAY_FLT_UNARY_MATH_METHOD_FUNC(cbrt, tDType, tNAryType)
8
+
9
+ #endif /* NUMO_NARRAY_MH_MATH_CBRT_H */
@@ -0,0 +1,9 @@
1
+ #ifndef NUMO_NARRAY_MH_MATH_COS_H
2
+ #define NUMO_NARRAY_MH_MATH_COS_H 1
3
+
4
+ #include "unary_func.h"
5
+
6
+ #define DEF_NARRAY_FLT_COS_METHOD_FUNC(tDType, tNAryType) \
7
+ DEF_NARRAY_FLT_UNARY_MATH_METHOD_FUNC(cos, tDType, tNAryType)
8
+
9
+ #endif /* NUMO_NARRAY_MH_MATH_COS_H */
@@ -0,0 +1,9 @@
1
+ #ifndef NUMO_NARRAY_MH_MATH_COSH_H
2
+ #define NUMO_NARRAY_MH_MATH_COSH_H 1
3
+
4
+ #include "unary_func.h"
5
+
6
+ #define DEF_NARRAY_FLT_COSH_METHOD_FUNC(tDType, tNAryType) \
7
+ DEF_NARRAY_FLT_UNARY_MATH_METHOD_FUNC(cosh, tDType, tNAryType)
8
+
9
+ #endif /* NUMO_NARRAY_MH_MATH_COSH_H */
@@ -0,0 +1,9 @@
1
+ #ifndef NUMO_NARRAY_MH_MATH_ERF_H
2
+ #define NUMO_NARRAY_MH_MATH_ERF_H 1
3
+
4
+ #include "unary_func.h"
5
+
6
+ #define DEF_NARRAY_FLT_ERF_METHOD_FUNC(tDType, tNAryType) \
7
+ DEF_NARRAY_FLT_UNARY_MATH_METHOD_FUNC(erf, tDType, tNAryType)
8
+
9
+ #endif /* NUMO_NARRAY_MH_MATH_ERF_H */
@@ -0,0 +1,9 @@
1
+ #ifndef NUMO_NARRAY_MH_MATH_ERFC_H
2
+ #define NUMO_NARRAY_MH_MATH_ERFC_H 1
3
+
4
+ #include "unary_func.h"
5
+
6
+ #define DEF_NARRAY_FLT_ERFC_METHOD_FUNC(tDType, tNAryType) \
7
+ DEF_NARRAY_FLT_UNARY_MATH_METHOD_FUNC(erfc, tDType, tNAryType)
8
+
9
+ #endif /* NUMO_NARRAY_MH_MATH_ERFC_H */
@@ -0,0 +1,9 @@
1
+ #ifndef NUMO_NARRAY_MH_MATH_EXP_H
2
+ #define NUMO_NARRAY_MH_MATH_EXP_H 1
3
+
4
+ #include "unary_func.h"
5
+
6
+ #define DEF_NARRAY_FLT_EXP_METHOD_FUNC(tDType, tNAryType) \
7
+ DEF_NARRAY_FLT_UNARY_MATH_METHOD_FUNC(exp, tDType, tNAryType)
8
+
9
+ #endif /* NUMO_NARRAY_MH_MATH_EXP_H */
@@ -0,0 +1,9 @@
1
+ #ifndef NUMO_NARRAY_MH_MATH_EXP10_H
2
+ #define NUMO_NARRAY_MH_MATH_EXP10_H 1
3
+
4
+ #include "unary_func.h"
5
+
6
+ #define DEF_NARRAY_FLT_EXP10_METHOD_FUNC(tDType, tNAryType) \
7
+ DEF_NARRAY_FLT_UNARY_MATH_METHOD_FUNC(exp10, tDType, tNAryType)
8
+
9
+ #endif /* NUMO_NARRAY_MH_MATH_EXP10_H */
@@ -0,0 +1,9 @@
1
+ #ifndef NUMO_NARRAY_MH_MATH_EXP2_H
2
+ #define NUMO_NARRAY_MH_MATH_EXP2_H 1
3
+
4
+ #include "unary_func.h"
5
+
6
+ #define DEF_NARRAY_FLT_EXP2_METHOD_FUNC(tDType, tNAryType) \
7
+ DEF_NARRAY_FLT_UNARY_MATH_METHOD_FUNC(exp2, tDType, tNAryType)
8
+
9
+ #endif /* NUMO_NARRAY_MH_MATH_EXP2_H */
@@ -0,0 +1,9 @@
1
+ #ifndef NUMO_NARRAY_MH_MATH_EXPM1_H
2
+ #define NUMO_NARRAY_MH_MATH_EXPM1_H 1
3
+
4
+ #include "unary_func.h"
5
+
6
+ #define DEF_NARRAY_FLT_EXPM1_METHOD_FUNC(tDType, tNAryType) \
7
+ DEF_NARRAY_FLT_UNARY_MATH_METHOD_FUNC(expm1, tDType, tNAryType)
8
+
9
+ #endif /* NUMO_NARRAY_MH_MATH_EXPM1_H */
@@ -0,0 +1,30 @@
1
+ #ifndef NUMO_NARRAY_MH_MATH_FREXP_H
2
+ #define NUMO_NARRAY_MH_MATH_FREXP_H 1
3
+
4
+ #define DEF_NARRAY_FLT_FREXP_METHOD_FUNC(tDType, tNAryType) \
5
+ static void iter_##tDType##_math_s_frexp(na_loop_t* const lp) { \
6
+ size_t n; \
7
+ char *p1, *p2, *p3; \
8
+ ssize_t s1, s2, s3; \
9
+ tDType x; \
10
+ int y; \
11
+ INIT_COUNTER(lp, n); \
12
+ INIT_PTR(lp, 0, p1, s1); \
13
+ INIT_PTR(lp, 1, p2, s2); \
14
+ INIT_PTR(lp, 2, p3, s3); \
15
+ for (size_t i = 0; i < n; i++) { \
16
+ GET_DATA_STRIDE(p1, s1, tDType, x); \
17
+ x = m_frexp(x, &y); \
18
+ SET_DATA_STRIDE(p2, s2, tDType, x); \
19
+ SET_DATA_STRIDE(p3, s3, int32_t, y); \
20
+ } \
21
+ } \
22
+ \
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 } }; \
26
+ ndfunc_t ndf = { iter_##tDType##_math_s_frexp, STRIDE_LOOP, 1, 2, ain, aout }; \
27
+ return na_ndloop(&ndf, 1, a1); \
28
+ }
29
+
30
+ #endif /* NUMO_NARRAY_MH_MATH_FREXP_H */
@@ -0,0 +1,29 @@
1
+ #ifndef NUMO_NARRAY_MH_MATH_HYPOT_H
2
+ #define NUMO_NARRAY_MH_MATH_HYPOT_H 1
3
+
4
+ #define DEF_NARRAY_FLT_HYPOT_METHOD_FUNC(tDType, tNAryType) \
5
+ static void iter_##tDType##_math_s_hypot(na_loop_t* const lp) { \
6
+ size_t n; \
7
+ char *p1, *p2, *p3; \
8
+ ssize_t s1, s2, s3; \
9
+ tDType x, y; \
10
+ INIT_COUNTER(lp, n); \
11
+ INIT_PTR(lp, 0, p1, s1); \
12
+ INIT_PTR(lp, 1, p2, s2); \
13
+ INIT_PTR(lp, 2, p3, s3); \
14
+ for (size_t i = 0; i < n; i++) { \
15
+ GET_DATA_STRIDE(p1, s1, tDType, x); \
16
+ GET_DATA_STRIDE(p2, s2, tDType, y); \
17
+ x = m_hypot(x, y); \
18
+ SET_DATA_STRIDE(p3, s3, tDType, x); \
19
+ } \
20
+ } \
21
+ \
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 } }; \
25
+ ndfunc_t ndf = { iter_##tDType##_math_s_hypot, STRIDE_LOOP, 2, 1, ain, aout }; \
26
+ return na_ndloop(&ndf, 2, a1, a2); \
27
+ }
28
+
29
+ #endif /* NUMO_NARRAY_MH_MATH_HYPOT_H */
@@ -0,0 +1,29 @@
1
+ #ifndef NUMO_NARRAY_MH_MATH_LDEXP_H
2
+ #define NUMO_NARRAY_MH_MATH_LDEXP_H 1
3
+
4
+ #define DEF_NARRAY_FLT_LDEXP_METHOD_FUNC(tDType, tNAryType) \
5
+ static void iter_##tDType##_math_s_ldexp(na_loop_t* const lp) { \
6
+ size_t n; \
7
+ char *p1, *p2, *p3; \
8
+ ssize_t s1, s2, s3; \
9
+ tDType x, y; \
10
+ INIT_COUNTER(lp, n); \
11
+ INIT_PTR(lp, 0, p1, s1); \
12
+ INIT_PTR(lp, 1, p2, s2); \
13
+ INIT_PTR(lp, 2, p3, s3); \
14
+ for (size_t i = 0; i < n; i++) { \
15
+ GET_DATA_STRIDE(p1, s1, tDType, x); \
16
+ GET_DATA_STRIDE(p2, s2, tDType, y); \
17
+ x = m_ldexp(x, y); \
18
+ SET_DATA_STRIDE(p3, s3, tDType, x); \
19
+ } \
20
+ } \
21
+ \
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 } }; \
25
+ ndfunc_t ndf = { iter_##tDType##_math_s_ldexp, STRIDE_LOOP, 2, 1, ain, aout }; \
26
+ return na_ndloop(&ndf, 2, a1, a2); \
27
+ }
28
+
29
+ #endif /* NUMO_NARRAY_MH_MATH_LDEXP_H */
@@ -0,0 +1,9 @@
1
+ #ifndef NUMO_NARRAY_MH_MATH_LOG_H
2
+ #define NUMO_NARRAY_MH_MATH_LOG_H 1
3
+
4
+ #include "unary_func.h"
5
+
6
+ #define DEF_NARRAY_FLT_LOG_METHOD_FUNC(tDType, tNAryType) \
7
+ DEF_NARRAY_FLT_UNARY_MATH_METHOD_FUNC(log, tDType, tNAryType)
8
+
9
+ #endif /* NUMO_NARRAY_MH_MATH_LOG_H */
@@ -0,0 +1,9 @@
1
+ #ifndef NUMO_NARRAY_MH_MATH_LOG10_H
2
+ #define NUMO_NARRAY_MH_MATH_LOG10_H 1
3
+
4
+ #include "unary_func.h"
5
+
6
+ #define DEF_NARRAY_FLT_LOG10_METHOD_FUNC(tDType, tNAryType) \
7
+ DEF_NARRAY_FLT_UNARY_MATH_METHOD_FUNC(log10, tDType, tNAryType)
8
+
9
+ #endif /* NUMO_NARRAY_MH_MATH_LOG10_H */
@@ -0,0 +1,9 @@
1
+ #ifndef NUMO_NARRAY_MH_MATH_LOG1P_H
2
+ #define NUMO_NARRAY_MH_MATH_LOG1P_H 1
3
+
4
+ #include "unary_func.h"
5
+
6
+ #define DEF_NARRAY_FLT_LOG1P_METHOD_FUNC(tDType, tNAryType) \
7
+ DEF_NARRAY_FLT_UNARY_MATH_METHOD_FUNC(log1p, tDType, tNAryType)
8
+
9
+ #endif /* NUMO_NARRAY_MH_MATH_LOG1P_H */
@@ -0,0 +1,9 @@
1
+ #ifndef NUMO_NARRAY_MH_MATH_LOG2_H
2
+ #define NUMO_NARRAY_MH_MATH_LOG2_H 1
3
+
4
+ #include "unary_func.h"
5
+
6
+ #define DEF_NARRAY_FLT_LOG2_METHOD_FUNC(tDType, tNAryType) \
7
+ DEF_NARRAY_FLT_UNARY_MATH_METHOD_FUNC(log2, tDType, tNAryType)
8
+
9
+ #endif /* NUMO_NARRAY_MH_MATH_LOG2_H */
@@ -0,0 +1,9 @@
1
+ #ifndef NUMO_NARRAY_MH_MATH_SIN_H
2
+ #define NUMO_NARRAY_MH_MATH_SIN_H 1
3
+
4
+ #include "unary_func.h"
5
+
6
+ #define DEF_NARRAY_FLT_SIN_METHOD_FUNC(tDType, tNAryType) \
7
+ DEF_NARRAY_FLT_UNARY_MATH_METHOD_FUNC(sin, tDType, tNAryType)
8
+
9
+ #endif /* NUMO_NARRAY_MH_MATH_SIN_H */
@@ -0,0 +1,9 @@
1
+ #ifndef NUMO_NARRAY_MH_MATH_SINC_H
2
+ #define NUMO_NARRAY_MH_MATH_SINC_H 1
3
+
4
+ #include "unary_func.h"
5
+
6
+ #define DEF_NARRAY_FLT_SINC_METHOD_FUNC(tDType, tNAryType) \
7
+ DEF_NARRAY_FLT_UNARY_MATH_METHOD_FUNC(sinc, tDType, tNAryType)
8
+
9
+ #endif /* NUMO_NARRAY_MH_MATH_SINC_H */
@@ -0,0 +1,9 @@
1
+ #ifndef NUMO_NARRAY_MH_MATH_SINH_H
2
+ #define NUMO_NARRAY_MH_MATH_SINH_H 1
3
+
4
+ #include "unary_func.h"
5
+
6
+ #define DEF_NARRAY_FLT_SINH_METHOD_FUNC(tDType, tNAryType) \
7
+ DEF_NARRAY_FLT_UNARY_MATH_METHOD_FUNC(sinh, tDType, tNAryType)
8
+
9
+ #endif /* NUMO_NARRAY_MH_MATH_SINH_H */