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.
- checksums.yaml +4 -4
- data/README.md +31 -10
- data/ext/numo/narray/SFMT-params19937.h +8 -16
- data/ext/numo/narray/numo/narray.h +2 -2
- data/ext/numo/narray/numo/types/complex.h +2 -2
- data/ext/numo/narray/src/mh/math/acos.h +9 -0
- data/ext/numo/narray/src/mh/math/acosh.h +9 -0
- data/ext/numo/narray/src/mh/math/asin.h +9 -0
- data/ext/numo/narray/src/mh/math/asinh.h +9 -0
- data/ext/numo/narray/src/mh/math/atan.h +9 -0
- data/ext/numo/narray/src/mh/math/atan2.h +29 -0
- data/ext/numo/narray/src/mh/math/atanh.h +9 -0
- data/ext/numo/narray/src/mh/math/cbrt.h +9 -0
- data/ext/numo/narray/src/mh/math/cos.h +9 -0
- data/ext/numo/narray/src/mh/math/cosh.h +9 -0
- data/ext/numo/narray/src/mh/math/erf.h +9 -0
- data/ext/numo/narray/src/mh/math/erfc.h +9 -0
- data/ext/numo/narray/src/mh/math/exp.h +9 -0
- data/ext/numo/narray/src/mh/math/exp10.h +9 -0
- data/ext/numo/narray/src/mh/math/exp2.h +9 -0
- data/ext/numo/narray/src/mh/math/expm1.h +9 -0
- data/ext/numo/narray/src/mh/math/frexp.h +30 -0
- data/ext/numo/narray/src/mh/math/hypot.h +29 -0
- data/ext/numo/narray/src/mh/math/ldexp.h +29 -0
- data/ext/numo/narray/src/mh/math/log.h +9 -0
- data/ext/numo/narray/src/mh/math/log10.h +9 -0
- data/ext/numo/narray/src/mh/math/log1p.h +9 -0
- data/ext/numo/narray/src/mh/math/log2.h +9 -0
- data/ext/numo/narray/src/mh/math/sin.h +9 -0
- data/ext/numo/narray/src/mh/math/sinc.h +9 -0
- data/ext/numo/narray/src/mh/math/sinh.h +9 -0
- data/ext/numo/narray/src/mh/math/sqrt.h +203 -0
- data/ext/numo/narray/src/mh/math/tan.h +9 -0
- data/ext/numo/narray/src/mh/math/tanh.h +9 -0
- data/ext/numo/narray/src/mh/math/unary_func.h +70 -0
- data/ext/numo/narray/src/mh/mean.h +1 -8
- data/ext/numo/narray/src/mh/rms.h +1 -8
- data/ext/numo/narray/src/mh/stddev.h +1 -8
- data/ext/numo/narray/src/mh/var.h +1 -8
- data/ext/numo/narray/src/t_dcomplex.c +236 -1707
- data/ext/numo/narray/src/t_dfloat.c +66 -1952
- data/ext/numo/narray/src/t_robject.c +4 -4
- data/ext/numo/narray/src/t_scomplex.c +236 -1707
- data/ext/numo/narray/src/t_sfloat.c +66 -1952
- data/lib/numo/narray/extra.rb +77 -0
- metadata +33 -3
|
@@ -46,13 +46,75 @@ extern VALUE cRT;
|
|
|
46
46
|
#include "mh/var.h"
|
|
47
47
|
#include "mh/stddev.h"
|
|
48
48
|
#include "mh/rms.h"
|
|
49
|
+
#include "mh/math/sqrt.h"
|
|
50
|
+
#include "mh/math/cbrt.h"
|
|
51
|
+
#include "mh/math/log.h"
|
|
52
|
+
#include "mh/math/log2.h"
|
|
53
|
+
#include "mh/math/log10.h"
|
|
54
|
+
#include "mh/math/exp.h"
|
|
55
|
+
#include "mh/math/exp2.h"
|
|
56
|
+
#include "mh/math/exp10.h"
|
|
57
|
+
#include "mh/math/sin.h"
|
|
58
|
+
#include "mh/math/cos.h"
|
|
59
|
+
#include "mh/math/tan.h"
|
|
60
|
+
#include "mh/math/asin.h"
|
|
61
|
+
#include "mh/math/acos.h"
|
|
62
|
+
#include "mh/math/atan.h"
|
|
63
|
+
#include "mh/math/sinh.h"
|
|
64
|
+
#include "mh/math/cosh.h"
|
|
65
|
+
#include "mh/math/tanh.h"
|
|
66
|
+
#include "mh/math/asinh.h"
|
|
67
|
+
#include "mh/math/acosh.h"
|
|
68
|
+
#include "mh/math/atanh.h"
|
|
69
|
+
#include "mh/math/sinc.h"
|
|
70
|
+
#include "mh/math/atan2.h"
|
|
71
|
+
#include "mh/math/hypot.h"
|
|
72
|
+
#include "mh/math/erf.h"
|
|
73
|
+
#include "mh/math/erfc.h"
|
|
74
|
+
#include "mh/math/log1p.h"
|
|
75
|
+
#include "mh/math/expm1.h"
|
|
76
|
+
#include "mh/math/ldexp.h"
|
|
77
|
+
#include "mh/math/frexp.h"
|
|
49
78
|
|
|
50
79
|
typedef float sfloat; // Type aliases for shorter notation
|
|
51
80
|
// following the codebase naming convention.
|
|
52
|
-
DEF_NARRAY_FLT_MEAN_METHOD_FUNC(sfloat,
|
|
53
|
-
DEF_NARRAY_FLT_VAR_METHOD_FUNC(sfloat,
|
|
54
|
-
DEF_NARRAY_FLT_STDDEV_METHOD_FUNC(sfloat,
|
|
55
|
-
DEF_NARRAY_FLT_RMS_METHOD_FUNC(sfloat,
|
|
81
|
+
DEF_NARRAY_FLT_MEAN_METHOD_FUNC(sfloat, numo_cSFloat, float, numo_cSFloat)
|
|
82
|
+
DEF_NARRAY_FLT_VAR_METHOD_FUNC(sfloat, numo_cSFloat, float, numo_cSFloat)
|
|
83
|
+
DEF_NARRAY_FLT_STDDEV_METHOD_FUNC(sfloat, numo_cSFloat, float, numo_cSFloat)
|
|
84
|
+
DEF_NARRAY_FLT_RMS_METHOD_FUNC(sfloat, numo_cSFloat, float, numo_cSFloat)
|
|
85
|
+
#ifdef __SSE2__
|
|
86
|
+
DEF_NARRAY_FLT_SQRT_SSE2_SGL_METHOD_FUNC(sfloat, numo_cSFloat)
|
|
87
|
+
#else
|
|
88
|
+
DEF_NARRAY_FLT_SQRT_METHOD_FUNC(sfloat, numo_cSFloat)
|
|
89
|
+
#endif
|
|
90
|
+
DEF_NARRAY_FLT_CBRT_METHOD_FUNC(sfloat, numo_cSFloat)
|
|
91
|
+
DEF_NARRAY_FLT_LOG_METHOD_FUNC(sfloat, numo_cSFloat)
|
|
92
|
+
DEF_NARRAY_FLT_LOG2_METHOD_FUNC(sfloat, numo_cSFloat)
|
|
93
|
+
DEF_NARRAY_FLT_LOG10_METHOD_FUNC(sfloat, numo_cSFloat)
|
|
94
|
+
DEF_NARRAY_FLT_EXP_METHOD_FUNC(sfloat, numo_cSFloat)
|
|
95
|
+
DEF_NARRAY_FLT_EXP2_METHOD_FUNC(sfloat, numo_cSFloat)
|
|
96
|
+
DEF_NARRAY_FLT_EXP10_METHOD_FUNC(sfloat, numo_cSFloat)
|
|
97
|
+
DEF_NARRAY_FLT_SIN_METHOD_FUNC(sfloat, numo_cSFloat)
|
|
98
|
+
DEF_NARRAY_FLT_COS_METHOD_FUNC(sfloat, numo_cSFloat)
|
|
99
|
+
DEF_NARRAY_FLT_TAN_METHOD_FUNC(sfloat, numo_cSFloat)
|
|
100
|
+
DEF_NARRAY_FLT_ASIN_METHOD_FUNC(sfloat, numo_cSFloat)
|
|
101
|
+
DEF_NARRAY_FLT_ACOS_METHOD_FUNC(sfloat, numo_cSFloat)
|
|
102
|
+
DEF_NARRAY_FLT_ATAN_METHOD_FUNC(sfloat, numo_cSFloat)
|
|
103
|
+
DEF_NARRAY_FLT_SINH_METHOD_FUNC(sfloat, numo_cSFloat)
|
|
104
|
+
DEF_NARRAY_FLT_COSH_METHOD_FUNC(sfloat, numo_cSFloat)
|
|
105
|
+
DEF_NARRAY_FLT_TANH_METHOD_FUNC(sfloat, numo_cSFloat)
|
|
106
|
+
DEF_NARRAY_FLT_ASINH_METHOD_FUNC(sfloat, numo_cSFloat)
|
|
107
|
+
DEF_NARRAY_FLT_ACOSH_METHOD_FUNC(sfloat, numo_cSFloat)
|
|
108
|
+
DEF_NARRAY_FLT_ATANH_METHOD_FUNC(sfloat, numo_cSFloat)
|
|
109
|
+
DEF_NARRAY_FLT_SINC_METHOD_FUNC(sfloat, numo_cSFloat)
|
|
110
|
+
DEF_NARRAY_FLT_ATAN2_METHOD_FUNC(sfloat, numo_cSFloat)
|
|
111
|
+
DEF_NARRAY_FLT_HYPOT_METHOD_FUNC(sfloat, numo_cSFloat)
|
|
112
|
+
DEF_NARRAY_FLT_ERF_METHOD_FUNC(sfloat, numo_cSFloat)
|
|
113
|
+
DEF_NARRAY_FLT_ERFC_METHOD_FUNC(sfloat, numo_cSFloat)
|
|
114
|
+
DEF_NARRAY_FLT_LOG1P_METHOD_FUNC(sfloat, numo_cSFloat)
|
|
115
|
+
DEF_NARRAY_FLT_EXPM1_METHOD_FUNC(sfloat, numo_cSFloat)
|
|
116
|
+
DEF_NARRAY_FLT_LDEXP_METHOD_FUNC(sfloat, numo_cSFloat)
|
|
117
|
+
DEF_NARRAY_FLT_FREXP_METHOD_FUNC(sfloat, numo_cSFloat)
|
|
56
118
|
|
|
57
119
|
static VALUE sfloat_store(VALUE, VALUE);
|
|
58
120
|
|
|
@@ -6294,1954 +6356,6 @@ static VALUE sfloat_median(int argc, VALUE* argv, VALUE self) {
|
|
|
6294
6356
|
|
|
6295
6357
|
VALUE mTM;
|
|
6296
6358
|
|
|
6297
|
-
static void iter_sfloat_math_s_sqrt(na_loop_t* const lp) {
|
|
6298
|
-
size_t i = 0, n;
|
|
6299
|
-
char *p1, *p2;
|
|
6300
|
-
ssize_t s1, s2;
|
|
6301
|
-
size_t *idx1, *idx2;
|
|
6302
|
-
dtype x;
|
|
6303
|
-
|
|
6304
|
-
#ifdef __SSE2__
|
|
6305
|
-
size_t cnt;
|
|
6306
|
-
size_t cnt_simd_loop = -1;
|
|
6307
|
-
|
|
6308
|
-
__m128 a;
|
|
6309
|
-
|
|
6310
|
-
size_t num_pack; // Number of elements packed for SIMD.
|
|
6311
|
-
num_pack = SIMD_ALIGNMENT_SIZE / sizeof(dtype);
|
|
6312
|
-
#endif
|
|
6313
|
-
INIT_COUNTER(lp, n);
|
|
6314
|
-
INIT_PTR_IDX(lp, 0, p1, s1, idx1);
|
|
6315
|
-
INIT_PTR_IDX(lp, 1, p2, s2, idx2);
|
|
6316
|
-
|
|
6317
|
-
if (idx1) {
|
|
6318
|
-
if (idx2) {
|
|
6319
|
-
for (i = 0; i < n; i++) {
|
|
6320
|
-
GET_DATA_INDEX(p1, idx1, dtype, x);
|
|
6321
|
-
x = m_sqrt(x);
|
|
6322
|
-
SET_DATA_INDEX(p2, idx2, dtype, x);
|
|
6323
|
-
}
|
|
6324
|
-
} else {
|
|
6325
|
-
for (i = 0; i < n; i++) {
|
|
6326
|
-
GET_DATA_INDEX(p1, idx1, dtype, x);
|
|
6327
|
-
x = m_sqrt(x);
|
|
6328
|
-
SET_DATA_STRIDE(p2, s2, dtype, x);
|
|
6329
|
-
}
|
|
6330
|
-
}
|
|
6331
|
-
} else {
|
|
6332
|
-
if (idx2) {
|
|
6333
|
-
for (i = 0; i < n; i++) {
|
|
6334
|
-
GET_DATA_STRIDE(p1, s1, dtype, x);
|
|
6335
|
-
x = m_sqrt(x);
|
|
6336
|
-
SET_DATA_INDEX(p2, idx2, dtype, x);
|
|
6337
|
-
}
|
|
6338
|
-
} else {
|
|
6339
|
-
//
|
|
6340
|
-
if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype))) {
|
|
6341
|
-
if (s1 == sizeof(dtype) && s2 == sizeof(dtype)) {
|
|
6342
|
-
#ifdef __SSE2__
|
|
6343
|
-
//
|
|
6344
|
-
// Check number of elements. & Check same alignment.
|
|
6345
|
-
if ((n >= num_pack) &&
|
|
6346
|
-
is_same_aligned2(&((dtype*)p1)[i], &((dtype*)p2)[i], SIMD_ALIGNMENT_SIZE)) {
|
|
6347
|
-
// Calculate up to the position just before the start of SIMD computation.
|
|
6348
|
-
cnt = get_count_of_elements_not_aligned_to_simd_size(
|
|
6349
|
-
&((dtype*)p1)[i], SIMD_ALIGNMENT_SIZE, sizeof(dtype)
|
|
6350
|
-
);
|
|
6351
|
-
#endif
|
|
6352
|
-
#ifdef __SSE2__
|
|
6353
|
-
for (i = 0; i < cnt; i++) {
|
|
6354
|
-
#else
|
|
6355
|
-
for (i = 0; i < n; i++) {
|
|
6356
|
-
#endif
|
|
6357
|
-
((dtype*)p2)[i] = m_sqrt(((dtype*)p1)[i]);
|
|
6358
|
-
}
|
|
6359
|
-
|
|
6360
|
-
#ifdef __SSE2__
|
|
6361
|
-
// Get the count of SIMD computation loops.
|
|
6362
|
-
cnt_simd_loop = (n - i) % num_pack;
|
|
6363
|
-
|
|
6364
|
-
// SIMD computation.
|
|
6365
|
-
if (p1 == p2) { // inplace case
|
|
6366
|
-
for (; i < n - cnt_simd_loop; i += num_pack) {
|
|
6367
|
-
a = _mm_load_ps(&((dtype*)p1)[i]);
|
|
6368
|
-
a = _mm_sqrt_ps(a);
|
|
6369
|
-
_mm_store_ps(&((dtype*)p1)[i], a);
|
|
6370
|
-
}
|
|
6371
|
-
} else {
|
|
6372
|
-
for (; i < n - cnt_simd_loop; i += num_pack) {
|
|
6373
|
-
a = _mm_load_ps(&((dtype*)p1)[i]);
|
|
6374
|
-
a = _mm_sqrt_ps(a);
|
|
6375
|
-
_mm_stream_ps(&((dtype*)p2)[i], a);
|
|
6376
|
-
}
|
|
6377
|
-
}
|
|
6378
|
-
}
|
|
6379
|
-
// Compute the remainder of the SIMD operation.
|
|
6380
|
-
if (cnt_simd_loop != 0) {
|
|
6381
|
-
//
|
|
6382
|
-
for (; i < n; i++) {
|
|
6383
|
-
((dtype*)p2)[i] = m_sqrt(((dtype*)p1)[i]);
|
|
6384
|
-
}
|
|
6385
|
-
//
|
|
6386
|
-
}
|
|
6387
|
-
//
|
|
6388
|
-
#endif
|
|
6389
|
-
return;
|
|
6390
|
-
}
|
|
6391
|
-
if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype))) {
|
|
6392
|
-
//
|
|
6393
|
-
for (i = 0; i < n; i++) {
|
|
6394
|
-
*(dtype*)p2 = m_sqrt(*(dtype*)p1);
|
|
6395
|
-
p1 += s1;
|
|
6396
|
-
p2 += s2;
|
|
6397
|
-
}
|
|
6398
|
-
return;
|
|
6399
|
-
//
|
|
6400
|
-
}
|
|
6401
|
-
}
|
|
6402
|
-
for (i = 0; i < n; i++) {
|
|
6403
|
-
GET_DATA_STRIDE(p1, s1, dtype, x);
|
|
6404
|
-
x = m_sqrt(x);
|
|
6405
|
-
SET_DATA_STRIDE(p2, s2, dtype, x);
|
|
6406
|
-
}
|
|
6407
|
-
//
|
|
6408
|
-
}
|
|
6409
|
-
}
|
|
6410
|
-
}
|
|
6411
|
-
|
|
6412
|
-
static VALUE sfloat_math_s_sqrt(VALUE mod, VALUE a1) {
|
|
6413
|
-
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
|
6414
|
-
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
|
6415
|
-
ndfunc_t ndf = { iter_sfloat_math_s_sqrt, FULL_LOOP, 1, 1, ain, aout };
|
|
6416
|
-
|
|
6417
|
-
return na_ndloop(&ndf, 1, a1);
|
|
6418
|
-
}
|
|
6419
|
-
|
|
6420
|
-
static void iter_sfloat_math_s_cbrt(na_loop_t* const lp) {
|
|
6421
|
-
size_t i = 0, n;
|
|
6422
|
-
char *p1, *p2;
|
|
6423
|
-
ssize_t s1, s2;
|
|
6424
|
-
size_t *idx1, *idx2;
|
|
6425
|
-
dtype x;
|
|
6426
|
-
|
|
6427
|
-
INIT_COUNTER(lp, n);
|
|
6428
|
-
INIT_PTR_IDX(lp, 0, p1, s1, idx1);
|
|
6429
|
-
INIT_PTR_IDX(lp, 1, p2, s2, idx2);
|
|
6430
|
-
|
|
6431
|
-
if (idx1) {
|
|
6432
|
-
if (idx2) {
|
|
6433
|
-
for (i = 0; i < n; i++) {
|
|
6434
|
-
GET_DATA_INDEX(p1, idx1, dtype, x);
|
|
6435
|
-
x = m_cbrt(x);
|
|
6436
|
-
SET_DATA_INDEX(p2, idx2, dtype, x);
|
|
6437
|
-
}
|
|
6438
|
-
} else {
|
|
6439
|
-
for (i = 0; i < n; i++) {
|
|
6440
|
-
GET_DATA_INDEX(p1, idx1, dtype, x);
|
|
6441
|
-
x = m_cbrt(x);
|
|
6442
|
-
SET_DATA_STRIDE(p2, s2, dtype, x);
|
|
6443
|
-
}
|
|
6444
|
-
}
|
|
6445
|
-
} else {
|
|
6446
|
-
if (idx2) {
|
|
6447
|
-
for (i = 0; i < n; i++) {
|
|
6448
|
-
GET_DATA_STRIDE(p1, s1, dtype, x);
|
|
6449
|
-
x = m_cbrt(x);
|
|
6450
|
-
SET_DATA_INDEX(p2, idx2, dtype, x);
|
|
6451
|
-
}
|
|
6452
|
-
} else {
|
|
6453
|
-
//
|
|
6454
|
-
if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype))) {
|
|
6455
|
-
if (s1 == sizeof(dtype) && s2 == sizeof(dtype)) {
|
|
6456
|
-
//
|
|
6457
|
-
for (; i < n; i++) {
|
|
6458
|
-
((dtype*)p2)[i] = m_cbrt(((dtype*)p1)[i]);
|
|
6459
|
-
}
|
|
6460
|
-
//
|
|
6461
|
-
return;
|
|
6462
|
-
}
|
|
6463
|
-
if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype))) {
|
|
6464
|
-
//
|
|
6465
|
-
for (i = 0; i < n; i++) {
|
|
6466
|
-
*(dtype*)p2 = m_cbrt(*(dtype*)p1);
|
|
6467
|
-
p1 += s1;
|
|
6468
|
-
p2 += s2;
|
|
6469
|
-
}
|
|
6470
|
-
return;
|
|
6471
|
-
//
|
|
6472
|
-
}
|
|
6473
|
-
}
|
|
6474
|
-
for (i = 0; i < n; i++) {
|
|
6475
|
-
GET_DATA_STRIDE(p1, s1, dtype, x);
|
|
6476
|
-
x = m_cbrt(x);
|
|
6477
|
-
SET_DATA_STRIDE(p2, s2, dtype, x);
|
|
6478
|
-
}
|
|
6479
|
-
//
|
|
6480
|
-
}
|
|
6481
|
-
}
|
|
6482
|
-
}
|
|
6483
|
-
|
|
6484
|
-
static VALUE sfloat_math_s_cbrt(VALUE mod, VALUE a1) {
|
|
6485
|
-
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
|
6486
|
-
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
|
6487
|
-
ndfunc_t ndf = { iter_sfloat_math_s_cbrt, FULL_LOOP, 1, 1, ain, aout };
|
|
6488
|
-
|
|
6489
|
-
return na_ndloop(&ndf, 1, a1);
|
|
6490
|
-
}
|
|
6491
|
-
|
|
6492
|
-
static void iter_sfloat_math_s_log(na_loop_t* const lp) {
|
|
6493
|
-
size_t i = 0, n;
|
|
6494
|
-
char *p1, *p2;
|
|
6495
|
-
ssize_t s1, s2;
|
|
6496
|
-
size_t *idx1, *idx2;
|
|
6497
|
-
dtype x;
|
|
6498
|
-
|
|
6499
|
-
INIT_COUNTER(lp, n);
|
|
6500
|
-
INIT_PTR_IDX(lp, 0, p1, s1, idx1);
|
|
6501
|
-
INIT_PTR_IDX(lp, 1, p2, s2, idx2);
|
|
6502
|
-
|
|
6503
|
-
if (idx1) {
|
|
6504
|
-
if (idx2) {
|
|
6505
|
-
for (i = 0; i < n; i++) {
|
|
6506
|
-
GET_DATA_INDEX(p1, idx1, dtype, x);
|
|
6507
|
-
x = m_log(x);
|
|
6508
|
-
SET_DATA_INDEX(p2, idx2, dtype, x);
|
|
6509
|
-
}
|
|
6510
|
-
} else {
|
|
6511
|
-
for (i = 0; i < n; i++) {
|
|
6512
|
-
GET_DATA_INDEX(p1, idx1, dtype, x);
|
|
6513
|
-
x = m_log(x);
|
|
6514
|
-
SET_DATA_STRIDE(p2, s2, dtype, x);
|
|
6515
|
-
}
|
|
6516
|
-
}
|
|
6517
|
-
} else {
|
|
6518
|
-
if (idx2) {
|
|
6519
|
-
for (i = 0; i < n; i++) {
|
|
6520
|
-
GET_DATA_STRIDE(p1, s1, dtype, x);
|
|
6521
|
-
x = m_log(x);
|
|
6522
|
-
SET_DATA_INDEX(p2, idx2, dtype, x);
|
|
6523
|
-
}
|
|
6524
|
-
} else {
|
|
6525
|
-
//
|
|
6526
|
-
if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype))) {
|
|
6527
|
-
if (s1 == sizeof(dtype) && s2 == sizeof(dtype)) {
|
|
6528
|
-
//
|
|
6529
|
-
for (; i < n; i++) {
|
|
6530
|
-
((dtype*)p2)[i] = m_log(((dtype*)p1)[i]);
|
|
6531
|
-
}
|
|
6532
|
-
//
|
|
6533
|
-
return;
|
|
6534
|
-
}
|
|
6535
|
-
if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype))) {
|
|
6536
|
-
//
|
|
6537
|
-
for (i = 0; i < n; i++) {
|
|
6538
|
-
*(dtype*)p2 = m_log(*(dtype*)p1);
|
|
6539
|
-
p1 += s1;
|
|
6540
|
-
p2 += s2;
|
|
6541
|
-
}
|
|
6542
|
-
return;
|
|
6543
|
-
//
|
|
6544
|
-
}
|
|
6545
|
-
}
|
|
6546
|
-
for (i = 0; i < n; i++) {
|
|
6547
|
-
GET_DATA_STRIDE(p1, s1, dtype, x);
|
|
6548
|
-
x = m_log(x);
|
|
6549
|
-
SET_DATA_STRIDE(p2, s2, dtype, x);
|
|
6550
|
-
}
|
|
6551
|
-
//
|
|
6552
|
-
}
|
|
6553
|
-
}
|
|
6554
|
-
}
|
|
6555
|
-
|
|
6556
|
-
static VALUE sfloat_math_s_log(VALUE mod, VALUE a1) {
|
|
6557
|
-
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
|
6558
|
-
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
|
6559
|
-
ndfunc_t ndf = { iter_sfloat_math_s_log, FULL_LOOP, 1, 1, ain, aout };
|
|
6560
|
-
|
|
6561
|
-
return na_ndloop(&ndf, 1, a1);
|
|
6562
|
-
}
|
|
6563
|
-
|
|
6564
|
-
static void iter_sfloat_math_s_log2(na_loop_t* const lp) {
|
|
6565
|
-
size_t i = 0, n;
|
|
6566
|
-
char *p1, *p2;
|
|
6567
|
-
ssize_t s1, s2;
|
|
6568
|
-
size_t *idx1, *idx2;
|
|
6569
|
-
dtype x;
|
|
6570
|
-
|
|
6571
|
-
INIT_COUNTER(lp, n);
|
|
6572
|
-
INIT_PTR_IDX(lp, 0, p1, s1, idx1);
|
|
6573
|
-
INIT_PTR_IDX(lp, 1, p2, s2, idx2);
|
|
6574
|
-
|
|
6575
|
-
if (idx1) {
|
|
6576
|
-
if (idx2) {
|
|
6577
|
-
for (i = 0; i < n; i++) {
|
|
6578
|
-
GET_DATA_INDEX(p1, idx1, dtype, x);
|
|
6579
|
-
x = m_log2(x);
|
|
6580
|
-
SET_DATA_INDEX(p2, idx2, dtype, x);
|
|
6581
|
-
}
|
|
6582
|
-
} else {
|
|
6583
|
-
for (i = 0; i < n; i++) {
|
|
6584
|
-
GET_DATA_INDEX(p1, idx1, dtype, x);
|
|
6585
|
-
x = m_log2(x);
|
|
6586
|
-
SET_DATA_STRIDE(p2, s2, dtype, x);
|
|
6587
|
-
}
|
|
6588
|
-
}
|
|
6589
|
-
} else {
|
|
6590
|
-
if (idx2) {
|
|
6591
|
-
for (i = 0; i < n; i++) {
|
|
6592
|
-
GET_DATA_STRIDE(p1, s1, dtype, x);
|
|
6593
|
-
x = m_log2(x);
|
|
6594
|
-
SET_DATA_INDEX(p2, idx2, dtype, x);
|
|
6595
|
-
}
|
|
6596
|
-
} else {
|
|
6597
|
-
//
|
|
6598
|
-
if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype))) {
|
|
6599
|
-
if (s1 == sizeof(dtype) && s2 == sizeof(dtype)) {
|
|
6600
|
-
//
|
|
6601
|
-
for (; i < n; i++) {
|
|
6602
|
-
((dtype*)p2)[i] = m_log2(((dtype*)p1)[i]);
|
|
6603
|
-
}
|
|
6604
|
-
//
|
|
6605
|
-
return;
|
|
6606
|
-
}
|
|
6607
|
-
if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype))) {
|
|
6608
|
-
//
|
|
6609
|
-
for (i = 0; i < n; i++) {
|
|
6610
|
-
*(dtype*)p2 = m_log2(*(dtype*)p1);
|
|
6611
|
-
p1 += s1;
|
|
6612
|
-
p2 += s2;
|
|
6613
|
-
}
|
|
6614
|
-
return;
|
|
6615
|
-
//
|
|
6616
|
-
}
|
|
6617
|
-
}
|
|
6618
|
-
for (i = 0; i < n; i++) {
|
|
6619
|
-
GET_DATA_STRIDE(p1, s1, dtype, x);
|
|
6620
|
-
x = m_log2(x);
|
|
6621
|
-
SET_DATA_STRIDE(p2, s2, dtype, x);
|
|
6622
|
-
}
|
|
6623
|
-
//
|
|
6624
|
-
}
|
|
6625
|
-
}
|
|
6626
|
-
}
|
|
6627
|
-
|
|
6628
|
-
static VALUE sfloat_math_s_log2(VALUE mod, VALUE a1) {
|
|
6629
|
-
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
|
6630
|
-
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
|
6631
|
-
ndfunc_t ndf = { iter_sfloat_math_s_log2, FULL_LOOP, 1, 1, ain, aout };
|
|
6632
|
-
|
|
6633
|
-
return na_ndloop(&ndf, 1, a1);
|
|
6634
|
-
}
|
|
6635
|
-
|
|
6636
|
-
static void iter_sfloat_math_s_log10(na_loop_t* const lp) {
|
|
6637
|
-
size_t i = 0, n;
|
|
6638
|
-
char *p1, *p2;
|
|
6639
|
-
ssize_t s1, s2;
|
|
6640
|
-
size_t *idx1, *idx2;
|
|
6641
|
-
dtype x;
|
|
6642
|
-
|
|
6643
|
-
INIT_COUNTER(lp, n);
|
|
6644
|
-
INIT_PTR_IDX(lp, 0, p1, s1, idx1);
|
|
6645
|
-
INIT_PTR_IDX(lp, 1, p2, s2, idx2);
|
|
6646
|
-
|
|
6647
|
-
if (idx1) {
|
|
6648
|
-
if (idx2) {
|
|
6649
|
-
for (i = 0; i < n; i++) {
|
|
6650
|
-
GET_DATA_INDEX(p1, idx1, dtype, x);
|
|
6651
|
-
x = m_log10(x);
|
|
6652
|
-
SET_DATA_INDEX(p2, idx2, dtype, x);
|
|
6653
|
-
}
|
|
6654
|
-
} else {
|
|
6655
|
-
for (i = 0; i < n; i++) {
|
|
6656
|
-
GET_DATA_INDEX(p1, idx1, dtype, x);
|
|
6657
|
-
x = m_log10(x);
|
|
6658
|
-
SET_DATA_STRIDE(p2, s2, dtype, x);
|
|
6659
|
-
}
|
|
6660
|
-
}
|
|
6661
|
-
} else {
|
|
6662
|
-
if (idx2) {
|
|
6663
|
-
for (i = 0; i < n; i++) {
|
|
6664
|
-
GET_DATA_STRIDE(p1, s1, dtype, x);
|
|
6665
|
-
x = m_log10(x);
|
|
6666
|
-
SET_DATA_INDEX(p2, idx2, dtype, x);
|
|
6667
|
-
}
|
|
6668
|
-
} else {
|
|
6669
|
-
//
|
|
6670
|
-
if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype))) {
|
|
6671
|
-
if (s1 == sizeof(dtype) && s2 == sizeof(dtype)) {
|
|
6672
|
-
//
|
|
6673
|
-
for (; i < n; i++) {
|
|
6674
|
-
((dtype*)p2)[i] = m_log10(((dtype*)p1)[i]);
|
|
6675
|
-
}
|
|
6676
|
-
//
|
|
6677
|
-
return;
|
|
6678
|
-
}
|
|
6679
|
-
if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype))) {
|
|
6680
|
-
//
|
|
6681
|
-
for (i = 0; i < n; i++) {
|
|
6682
|
-
*(dtype*)p2 = m_log10(*(dtype*)p1);
|
|
6683
|
-
p1 += s1;
|
|
6684
|
-
p2 += s2;
|
|
6685
|
-
}
|
|
6686
|
-
return;
|
|
6687
|
-
//
|
|
6688
|
-
}
|
|
6689
|
-
}
|
|
6690
|
-
for (i = 0; i < n; i++) {
|
|
6691
|
-
GET_DATA_STRIDE(p1, s1, dtype, x);
|
|
6692
|
-
x = m_log10(x);
|
|
6693
|
-
SET_DATA_STRIDE(p2, s2, dtype, x);
|
|
6694
|
-
}
|
|
6695
|
-
//
|
|
6696
|
-
}
|
|
6697
|
-
}
|
|
6698
|
-
}
|
|
6699
|
-
|
|
6700
|
-
static VALUE sfloat_math_s_log10(VALUE mod, VALUE a1) {
|
|
6701
|
-
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
|
6702
|
-
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
|
6703
|
-
ndfunc_t ndf = { iter_sfloat_math_s_log10, FULL_LOOP, 1, 1, ain, aout };
|
|
6704
|
-
|
|
6705
|
-
return na_ndloop(&ndf, 1, a1);
|
|
6706
|
-
}
|
|
6707
|
-
|
|
6708
|
-
static void iter_sfloat_math_s_exp(na_loop_t* const lp) {
|
|
6709
|
-
size_t i = 0, n;
|
|
6710
|
-
char *p1, *p2;
|
|
6711
|
-
ssize_t s1, s2;
|
|
6712
|
-
size_t *idx1, *idx2;
|
|
6713
|
-
dtype x;
|
|
6714
|
-
|
|
6715
|
-
INIT_COUNTER(lp, n);
|
|
6716
|
-
INIT_PTR_IDX(lp, 0, p1, s1, idx1);
|
|
6717
|
-
INIT_PTR_IDX(lp, 1, p2, s2, idx2);
|
|
6718
|
-
|
|
6719
|
-
if (idx1) {
|
|
6720
|
-
if (idx2) {
|
|
6721
|
-
for (i = 0; i < n; i++) {
|
|
6722
|
-
GET_DATA_INDEX(p1, idx1, dtype, x);
|
|
6723
|
-
x = m_exp(x);
|
|
6724
|
-
SET_DATA_INDEX(p2, idx2, dtype, x);
|
|
6725
|
-
}
|
|
6726
|
-
} else {
|
|
6727
|
-
for (i = 0; i < n; i++) {
|
|
6728
|
-
GET_DATA_INDEX(p1, idx1, dtype, x);
|
|
6729
|
-
x = m_exp(x);
|
|
6730
|
-
SET_DATA_STRIDE(p2, s2, dtype, x);
|
|
6731
|
-
}
|
|
6732
|
-
}
|
|
6733
|
-
} else {
|
|
6734
|
-
if (idx2) {
|
|
6735
|
-
for (i = 0; i < n; i++) {
|
|
6736
|
-
GET_DATA_STRIDE(p1, s1, dtype, x);
|
|
6737
|
-
x = m_exp(x);
|
|
6738
|
-
SET_DATA_INDEX(p2, idx2, dtype, x);
|
|
6739
|
-
}
|
|
6740
|
-
} else {
|
|
6741
|
-
//
|
|
6742
|
-
if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype))) {
|
|
6743
|
-
if (s1 == sizeof(dtype) && s2 == sizeof(dtype)) {
|
|
6744
|
-
//
|
|
6745
|
-
for (; i < n; i++) {
|
|
6746
|
-
((dtype*)p2)[i] = m_exp(((dtype*)p1)[i]);
|
|
6747
|
-
}
|
|
6748
|
-
//
|
|
6749
|
-
return;
|
|
6750
|
-
}
|
|
6751
|
-
if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype))) {
|
|
6752
|
-
//
|
|
6753
|
-
for (i = 0; i < n; i++) {
|
|
6754
|
-
*(dtype*)p2 = m_exp(*(dtype*)p1);
|
|
6755
|
-
p1 += s1;
|
|
6756
|
-
p2 += s2;
|
|
6757
|
-
}
|
|
6758
|
-
return;
|
|
6759
|
-
//
|
|
6760
|
-
}
|
|
6761
|
-
}
|
|
6762
|
-
for (i = 0; i < n; i++) {
|
|
6763
|
-
GET_DATA_STRIDE(p1, s1, dtype, x);
|
|
6764
|
-
x = m_exp(x);
|
|
6765
|
-
SET_DATA_STRIDE(p2, s2, dtype, x);
|
|
6766
|
-
}
|
|
6767
|
-
//
|
|
6768
|
-
}
|
|
6769
|
-
}
|
|
6770
|
-
}
|
|
6771
|
-
|
|
6772
|
-
static VALUE sfloat_math_s_exp(VALUE mod, VALUE a1) {
|
|
6773
|
-
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
|
6774
|
-
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
|
6775
|
-
ndfunc_t ndf = { iter_sfloat_math_s_exp, FULL_LOOP, 1, 1, ain, aout };
|
|
6776
|
-
|
|
6777
|
-
return na_ndloop(&ndf, 1, a1);
|
|
6778
|
-
}
|
|
6779
|
-
|
|
6780
|
-
static void iter_sfloat_math_s_exp2(na_loop_t* const lp) {
|
|
6781
|
-
size_t i = 0, n;
|
|
6782
|
-
char *p1, *p2;
|
|
6783
|
-
ssize_t s1, s2;
|
|
6784
|
-
size_t *idx1, *idx2;
|
|
6785
|
-
dtype x;
|
|
6786
|
-
|
|
6787
|
-
INIT_COUNTER(lp, n);
|
|
6788
|
-
INIT_PTR_IDX(lp, 0, p1, s1, idx1);
|
|
6789
|
-
INIT_PTR_IDX(lp, 1, p2, s2, idx2);
|
|
6790
|
-
|
|
6791
|
-
if (idx1) {
|
|
6792
|
-
if (idx2) {
|
|
6793
|
-
for (i = 0; i < n; i++) {
|
|
6794
|
-
GET_DATA_INDEX(p1, idx1, dtype, x);
|
|
6795
|
-
x = m_exp2(x);
|
|
6796
|
-
SET_DATA_INDEX(p2, idx2, dtype, x);
|
|
6797
|
-
}
|
|
6798
|
-
} else {
|
|
6799
|
-
for (i = 0; i < n; i++) {
|
|
6800
|
-
GET_DATA_INDEX(p1, idx1, dtype, x);
|
|
6801
|
-
x = m_exp2(x);
|
|
6802
|
-
SET_DATA_STRIDE(p2, s2, dtype, x);
|
|
6803
|
-
}
|
|
6804
|
-
}
|
|
6805
|
-
} else {
|
|
6806
|
-
if (idx2) {
|
|
6807
|
-
for (i = 0; i < n; i++) {
|
|
6808
|
-
GET_DATA_STRIDE(p1, s1, dtype, x);
|
|
6809
|
-
x = m_exp2(x);
|
|
6810
|
-
SET_DATA_INDEX(p2, idx2, dtype, x);
|
|
6811
|
-
}
|
|
6812
|
-
} else {
|
|
6813
|
-
//
|
|
6814
|
-
if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype))) {
|
|
6815
|
-
if (s1 == sizeof(dtype) && s2 == sizeof(dtype)) {
|
|
6816
|
-
//
|
|
6817
|
-
for (; i < n; i++) {
|
|
6818
|
-
((dtype*)p2)[i] = m_exp2(((dtype*)p1)[i]);
|
|
6819
|
-
}
|
|
6820
|
-
//
|
|
6821
|
-
return;
|
|
6822
|
-
}
|
|
6823
|
-
if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype))) {
|
|
6824
|
-
//
|
|
6825
|
-
for (i = 0; i < n; i++) {
|
|
6826
|
-
*(dtype*)p2 = m_exp2(*(dtype*)p1);
|
|
6827
|
-
p1 += s1;
|
|
6828
|
-
p2 += s2;
|
|
6829
|
-
}
|
|
6830
|
-
return;
|
|
6831
|
-
//
|
|
6832
|
-
}
|
|
6833
|
-
}
|
|
6834
|
-
for (i = 0; i < n; i++) {
|
|
6835
|
-
GET_DATA_STRIDE(p1, s1, dtype, x);
|
|
6836
|
-
x = m_exp2(x);
|
|
6837
|
-
SET_DATA_STRIDE(p2, s2, dtype, x);
|
|
6838
|
-
}
|
|
6839
|
-
//
|
|
6840
|
-
}
|
|
6841
|
-
}
|
|
6842
|
-
}
|
|
6843
|
-
|
|
6844
|
-
static VALUE sfloat_math_s_exp2(VALUE mod, VALUE a1) {
|
|
6845
|
-
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
|
6846
|
-
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
|
6847
|
-
ndfunc_t ndf = { iter_sfloat_math_s_exp2, FULL_LOOP, 1, 1, ain, aout };
|
|
6848
|
-
|
|
6849
|
-
return na_ndloop(&ndf, 1, a1);
|
|
6850
|
-
}
|
|
6851
|
-
|
|
6852
|
-
static void iter_sfloat_math_s_exp10(na_loop_t* const lp) {
|
|
6853
|
-
size_t i = 0, n;
|
|
6854
|
-
char *p1, *p2;
|
|
6855
|
-
ssize_t s1, s2;
|
|
6856
|
-
size_t *idx1, *idx2;
|
|
6857
|
-
dtype x;
|
|
6858
|
-
|
|
6859
|
-
INIT_COUNTER(lp, n);
|
|
6860
|
-
INIT_PTR_IDX(lp, 0, p1, s1, idx1);
|
|
6861
|
-
INIT_PTR_IDX(lp, 1, p2, s2, idx2);
|
|
6862
|
-
|
|
6863
|
-
if (idx1) {
|
|
6864
|
-
if (idx2) {
|
|
6865
|
-
for (i = 0; i < n; i++) {
|
|
6866
|
-
GET_DATA_INDEX(p1, idx1, dtype, x);
|
|
6867
|
-
x = m_exp10(x);
|
|
6868
|
-
SET_DATA_INDEX(p2, idx2, dtype, x);
|
|
6869
|
-
}
|
|
6870
|
-
} else {
|
|
6871
|
-
for (i = 0; i < n; i++) {
|
|
6872
|
-
GET_DATA_INDEX(p1, idx1, dtype, x);
|
|
6873
|
-
x = m_exp10(x);
|
|
6874
|
-
SET_DATA_STRIDE(p2, s2, dtype, x);
|
|
6875
|
-
}
|
|
6876
|
-
}
|
|
6877
|
-
} else {
|
|
6878
|
-
if (idx2) {
|
|
6879
|
-
for (i = 0; i < n; i++) {
|
|
6880
|
-
GET_DATA_STRIDE(p1, s1, dtype, x);
|
|
6881
|
-
x = m_exp10(x);
|
|
6882
|
-
SET_DATA_INDEX(p2, idx2, dtype, x);
|
|
6883
|
-
}
|
|
6884
|
-
} else {
|
|
6885
|
-
//
|
|
6886
|
-
if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype))) {
|
|
6887
|
-
if (s1 == sizeof(dtype) && s2 == sizeof(dtype)) {
|
|
6888
|
-
//
|
|
6889
|
-
for (; i < n; i++) {
|
|
6890
|
-
((dtype*)p2)[i] = m_exp10(((dtype*)p1)[i]);
|
|
6891
|
-
}
|
|
6892
|
-
//
|
|
6893
|
-
return;
|
|
6894
|
-
}
|
|
6895
|
-
if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype))) {
|
|
6896
|
-
//
|
|
6897
|
-
for (i = 0; i < n; i++) {
|
|
6898
|
-
*(dtype*)p2 = m_exp10(*(dtype*)p1);
|
|
6899
|
-
p1 += s1;
|
|
6900
|
-
p2 += s2;
|
|
6901
|
-
}
|
|
6902
|
-
return;
|
|
6903
|
-
//
|
|
6904
|
-
}
|
|
6905
|
-
}
|
|
6906
|
-
for (i = 0; i < n; i++) {
|
|
6907
|
-
GET_DATA_STRIDE(p1, s1, dtype, x);
|
|
6908
|
-
x = m_exp10(x);
|
|
6909
|
-
SET_DATA_STRIDE(p2, s2, dtype, x);
|
|
6910
|
-
}
|
|
6911
|
-
//
|
|
6912
|
-
}
|
|
6913
|
-
}
|
|
6914
|
-
}
|
|
6915
|
-
|
|
6916
|
-
static VALUE sfloat_math_s_exp10(VALUE mod, VALUE a1) {
|
|
6917
|
-
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
|
6918
|
-
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
|
6919
|
-
ndfunc_t ndf = { iter_sfloat_math_s_exp10, FULL_LOOP, 1, 1, ain, aout };
|
|
6920
|
-
|
|
6921
|
-
return na_ndloop(&ndf, 1, a1);
|
|
6922
|
-
}
|
|
6923
|
-
|
|
6924
|
-
static void iter_sfloat_math_s_sin(na_loop_t* const lp) {
|
|
6925
|
-
size_t i = 0, n;
|
|
6926
|
-
char *p1, *p2;
|
|
6927
|
-
ssize_t s1, s2;
|
|
6928
|
-
size_t *idx1, *idx2;
|
|
6929
|
-
dtype x;
|
|
6930
|
-
|
|
6931
|
-
INIT_COUNTER(lp, n);
|
|
6932
|
-
INIT_PTR_IDX(lp, 0, p1, s1, idx1);
|
|
6933
|
-
INIT_PTR_IDX(lp, 1, p2, s2, idx2);
|
|
6934
|
-
|
|
6935
|
-
if (idx1) {
|
|
6936
|
-
if (idx2) {
|
|
6937
|
-
for (i = 0; i < n; i++) {
|
|
6938
|
-
GET_DATA_INDEX(p1, idx1, dtype, x);
|
|
6939
|
-
x = m_sin(x);
|
|
6940
|
-
SET_DATA_INDEX(p2, idx2, dtype, x);
|
|
6941
|
-
}
|
|
6942
|
-
} else {
|
|
6943
|
-
for (i = 0; i < n; i++) {
|
|
6944
|
-
GET_DATA_INDEX(p1, idx1, dtype, x);
|
|
6945
|
-
x = m_sin(x);
|
|
6946
|
-
SET_DATA_STRIDE(p2, s2, dtype, x);
|
|
6947
|
-
}
|
|
6948
|
-
}
|
|
6949
|
-
} else {
|
|
6950
|
-
if (idx2) {
|
|
6951
|
-
for (i = 0; i < n; i++) {
|
|
6952
|
-
GET_DATA_STRIDE(p1, s1, dtype, x);
|
|
6953
|
-
x = m_sin(x);
|
|
6954
|
-
SET_DATA_INDEX(p2, idx2, dtype, x);
|
|
6955
|
-
}
|
|
6956
|
-
} else {
|
|
6957
|
-
//
|
|
6958
|
-
if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype))) {
|
|
6959
|
-
if (s1 == sizeof(dtype) && s2 == sizeof(dtype)) {
|
|
6960
|
-
//
|
|
6961
|
-
for (; i < n; i++) {
|
|
6962
|
-
((dtype*)p2)[i] = m_sin(((dtype*)p1)[i]);
|
|
6963
|
-
}
|
|
6964
|
-
//
|
|
6965
|
-
return;
|
|
6966
|
-
}
|
|
6967
|
-
if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype))) {
|
|
6968
|
-
//
|
|
6969
|
-
for (i = 0; i < n; i++) {
|
|
6970
|
-
*(dtype*)p2 = m_sin(*(dtype*)p1);
|
|
6971
|
-
p1 += s1;
|
|
6972
|
-
p2 += s2;
|
|
6973
|
-
}
|
|
6974
|
-
return;
|
|
6975
|
-
//
|
|
6976
|
-
}
|
|
6977
|
-
}
|
|
6978
|
-
for (i = 0; i < n; i++) {
|
|
6979
|
-
GET_DATA_STRIDE(p1, s1, dtype, x);
|
|
6980
|
-
x = m_sin(x);
|
|
6981
|
-
SET_DATA_STRIDE(p2, s2, dtype, x);
|
|
6982
|
-
}
|
|
6983
|
-
//
|
|
6984
|
-
}
|
|
6985
|
-
}
|
|
6986
|
-
}
|
|
6987
|
-
|
|
6988
|
-
static VALUE sfloat_math_s_sin(VALUE mod, VALUE a1) {
|
|
6989
|
-
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
|
6990
|
-
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
|
6991
|
-
ndfunc_t ndf = { iter_sfloat_math_s_sin, FULL_LOOP, 1, 1, ain, aout };
|
|
6992
|
-
|
|
6993
|
-
return na_ndloop(&ndf, 1, a1);
|
|
6994
|
-
}
|
|
6995
|
-
|
|
6996
|
-
static void iter_sfloat_math_s_cos(na_loop_t* const lp) {
|
|
6997
|
-
size_t i = 0, n;
|
|
6998
|
-
char *p1, *p2;
|
|
6999
|
-
ssize_t s1, s2;
|
|
7000
|
-
size_t *idx1, *idx2;
|
|
7001
|
-
dtype x;
|
|
7002
|
-
|
|
7003
|
-
INIT_COUNTER(lp, n);
|
|
7004
|
-
INIT_PTR_IDX(lp, 0, p1, s1, idx1);
|
|
7005
|
-
INIT_PTR_IDX(lp, 1, p2, s2, idx2);
|
|
7006
|
-
|
|
7007
|
-
if (idx1) {
|
|
7008
|
-
if (idx2) {
|
|
7009
|
-
for (i = 0; i < n; i++) {
|
|
7010
|
-
GET_DATA_INDEX(p1, idx1, dtype, x);
|
|
7011
|
-
x = m_cos(x);
|
|
7012
|
-
SET_DATA_INDEX(p2, idx2, dtype, x);
|
|
7013
|
-
}
|
|
7014
|
-
} else {
|
|
7015
|
-
for (i = 0; i < n; i++) {
|
|
7016
|
-
GET_DATA_INDEX(p1, idx1, dtype, x);
|
|
7017
|
-
x = m_cos(x);
|
|
7018
|
-
SET_DATA_STRIDE(p2, s2, dtype, x);
|
|
7019
|
-
}
|
|
7020
|
-
}
|
|
7021
|
-
} else {
|
|
7022
|
-
if (idx2) {
|
|
7023
|
-
for (i = 0; i < n; i++) {
|
|
7024
|
-
GET_DATA_STRIDE(p1, s1, dtype, x);
|
|
7025
|
-
x = m_cos(x);
|
|
7026
|
-
SET_DATA_INDEX(p2, idx2, dtype, x);
|
|
7027
|
-
}
|
|
7028
|
-
} else {
|
|
7029
|
-
//
|
|
7030
|
-
if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype))) {
|
|
7031
|
-
if (s1 == sizeof(dtype) && s2 == sizeof(dtype)) {
|
|
7032
|
-
//
|
|
7033
|
-
for (; i < n; i++) {
|
|
7034
|
-
((dtype*)p2)[i] = m_cos(((dtype*)p1)[i]);
|
|
7035
|
-
}
|
|
7036
|
-
//
|
|
7037
|
-
return;
|
|
7038
|
-
}
|
|
7039
|
-
if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype))) {
|
|
7040
|
-
//
|
|
7041
|
-
for (i = 0; i < n; i++) {
|
|
7042
|
-
*(dtype*)p2 = m_cos(*(dtype*)p1);
|
|
7043
|
-
p1 += s1;
|
|
7044
|
-
p2 += s2;
|
|
7045
|
-
}
|
|
7046
|
-
return;
|
|
7047
|
-
//
|
|
7048
|
-
}
|
|
7049
|
-
}
|
|
7050
|
-
for (i = 0; i < n; i++) {
|
|
7051
|
-
GET_DATA_STRIDE(p1, s1, dtype, x);
|
|
7052
|
-
x = m_cos(x);
|
|
7053
|
-
SET_DATA_STRIDE(p2, s2, dtype, x);
|
|
7054
|
-
}
|
|
7055
|
-
//
|
|
7056
|
-
}
|
|
7057
|
-
}
|
|
7058
|
-
}
|
|
7059
|
-
|
|
7060
|
-
static VALUE sfloat_math_s_cos(VALUE mod, VALUE a1) {
|
|
7061
|
-
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
|
7062
|
-
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
|
7063
|
-
ndfunc_t ndf = { iter_sfloat_math_s_cos, FULL_LOOP, 1, 1, ain, aout };
|
|
7064
|
-
|
|
7065
|
-
return na_ndloop(&ndf, 1, a1);
|
|
7066
|
-
}
|
|
7067
|
-
|
|
7068
|
-
static void iter_sfloat_math_s_tan(na_loop_t* const lp) {
|
|
7069
|
-
size_t i = 0, n;
|
|
7070
|
-
char *p1, *p2;
|
|
7071
|
-
ssize_t s1, s2;
|
|
7072
|
-
size_t *idx1, *idx2;
|
|
7073
|
-
dtype x;
|
|
7074
|
-
|
|
7075
|
-
INIT_COUNTER(lp, n);
|
|
7076
|
-
INIT_PTR_IDX(lp, 0, p1, s1, idx1);
|
|
7077
|
-
INIT_PTR_IDX(lp, 1, p2, s2, idx2);
|
|
7078
|
-
|
|
7079
|
-
if (idx1) {
|
|
7080
|
-
if (idx2) {
|
|
7081
|
-
for (i = 0; i < n; i++) {
|
|
7082
|
-
GET_DATA_INDEX(p1, idx1, dtype, x);
|
|
7083
|
-
x = m_tan(x);
|
|
7084
|
-
SET_DATA_INDEX(p2, idx2, dtype, x);
|
|
7085
|
-
}
|
|
7086
|
-
} else {
|
|
7087
|
-
for (i = 0; i < n; i++) {
|
|
7088
|
-
GET_DATA_INDEX(p1, idx1, dtype, x);
|
|
7089
|
-
x = m_tan(x);
|
|
7090
|
-
SET_DATA_STRIDE(p2, s2, dtype, x);
|
|
7091
|
-
}
|
|
7092
|
-
}
|
|
7093
|
-
} else {
|
|
7094
|
-
if (idx2) {
|
|
7095
|
-
for (i = 0; i < n; i++) {
|
|
7096
|
-
GET_DATA_STRIDE(p1, s1, dtype, x);
|
|
7097
|
-
x = m_tan(x);
|
|
7098
|
-
SET_DATA_INDEX(p2, idx2, dtype, x);
|
|
7099
|
-
}
|
|
7100
|
-
} else {
|
|
7101
|
-
//
|
|
7102
|
-
if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype))) {
|
|
7103
|
-
if (s1 == sizeof(dtype) && s2 == sizeof(dtype)) {
|
|
7104
|
-
//
|
|
7105
|
-
for (; i < n; i++) {
|
|
7106
|
-
((dtype*)p2)[i] = m_tan(((dtype*)p1)[i]);
|
|
7107
|
-
}
|
|
7108
|
-
//
|
|
7109
|
-
return;
|
|
7110
|
-
}
|
|
7111
|
-
if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype))) {
|
|
7112
|
-
//
|
|
7113
|
-
for (i = 0; i < n; i++) {
|
|
7114
|
-
*(dtype*)p2 = m_tan(*(dtype*)p1);
|
|
7115
|
-
p1 += s1;
|
|
7116
|
-
p2 += s2;
|
|
7117
|
-
}
|
|
7118
|
-
return;
|
|
7119
|
-
//
|
|
7120
|
-
}
|
|
7121
|
-
}
|
|
7122
|
-
for (i = 0; i < n; i++) {
|
|
7123
|
-
GET_DATA_STRIDE(p1, s1, dtype, x);
|
|
7124
|
-
x = m_tan(x);
|
|
7125
|
-
SET_DATA_STRIDE(p2, s2, dtype, x);
|
|
7126
|
-
}
|
|
7127
|
-
//
|
|
7128
|
-
}
|
|
7129
|
-
}
|
|
7130
|
-
}
|
|
7131
|
-
|
|
7132
|
-
static VALUE sfloat_math_s_tan(VALUE mod, VALUE a1) {
|
|
7133
|
-
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
|
7134
|
-
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
|
7135
|
-
ndfunc_t ndf = { iter_sfloat_math_s_tan, FULL_LOOP, 1, 1, ain, aout };
|
|
7136
|
-
|
|
7137
|
-
return na_ndloop(&ndf, 1, a1);
|
|
7138
|
-
}
|
|
7139
|
-
|
|
7140
|
-
static void iter_sfloat_math_s_asin(na_loop_t* const lp) {
|
|
7141
|
-
size_t i = 0, n;
|
|
7142
|
-
char *p1, *p2;
|
|
7143
|
-
ssize_t s1, s2;
|
|
7144
|
-
size_t *idx1, *idx2;
|
|
7145
|
-
dtype x;
|
|
7146
|
-
|
|
7147
|
-
INIT_COUNTER(lp, n);
|
|
7148
|
-
INIT_PTR_IDX(lp, 0, p1, s1, idx1);
|
|
7149
|
-
INIT_PTR_IDX(lp, 1, p2, s2, idx2);
|
|
7150
|
-
|
|
7151
|
-
if (idx1) {
|
|
7152
|
-
if (idx2) {
|
|
7153
|
-
for (i = 0; i < n; i++) {
|
|
7154
|
-
GET_DATA_INDEX(p1, idx1, dtype, x);
|
|
7155
|
-
x = m_asin(x);
|
|
7156
|
-
SET_DATA_INDEX(p2, idx2, dtype, x);
|
|
7157
|
-
}
|
|
7158
|
-
} else {
|
|
7159
|
-
for (i = 0; i < n; i++) {
|
|
7160
|
-
GET_DATA_INDEX(p1, idx1, dtype, x);
|
|
7161
|
-
x = m_asin(x);
|
|
7162
|
-
SET_DATA_STRIDE(p2, s2, dtype, x);
|
|
7163
|
-
}
|
|
7164
|
-
}
|
|
7165
|
-
} else {
|
|
7166
|
-
if (idx2) {
|
|
7167
|
-
for (i = 0; i < n; i++) {
|
|
7168
|
-
GET_DATA_STRIDE(p1, s1, dtype, x);
|
|
7169
|
-
x = m_asin(x);
|
|
7170
|
-
SET_DATA_INDEX(p2, idx2, dtype, x);
|
|
7171
|
-
}
|
|
7172
|
-
} else {
|
|
7173
|
-
//
|
|
7174
|
-
if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype))) {
|
|
7175
|
-
if (s1 == sizeof(dtype) && s2 == sizeof(dtype)) {
|
|
7176
|
-
//
|
|
7177
|
-
for (; i < n; i++) {
|
|
7178
|
-
((dtype*)p2)[i] = m_asin(((dtype*)p1)[i]);
|
|
7179
|
-
}
|
|
7180
|
-
//
|
|
7181
|
-
return;
|
|
7182
|
-
}
|
|
7183
|
-
if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype))) {
|
|
7184
|
-
//
|
|
7185
|
-
for (i = 0; i < n; i++) {
|
|
7186
|
-
*(dtype*)p2 = m_asin(*(dtype*)p1);
|
|
7187
|
-
p1 += s1;
|
|
7188
|
-
p2 += s2;
|
|
7189
|
-
}
|
|
7190
|
-
return;
|
|
7191
|
-
//
|
|
7192
|
-
}
|
|
7193
|
-
}
|
|
7194
|
-
for (i = 0; i < n; i++) {
|
|
7195
|
-
GET_DATA_STRIDE(p1, s1, dtype, x);
|
|
7196
|
-
x = m_asin(x);
|
|
7197
|
-
SET_DATA_STRIDE(p2, s2, dtype, x);
|
|
7198
|
-
}
|
|
7199
|
-
//
|
|
7200
|
-
}
|
|
7201
|
-
}
|
|
7202
|
-
}
|
|
7203
|
-
|
|
7204
|
-
static VALUE sfloat_math_s_asin(VALUE mod, VALUE a1) {
|
|
7205
|
-
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
|
7206
|
-
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
|
7207
|
-
ndfunc_t ndf = { iter_sfloat_math_s_asin, FULL_LOOP, 1, 1, ain, aout };
|
|
7208
|
-
|
|
7209
|
-
return na_ndloop(&ndf, 1, a1);
|
|
7210
|
-
}
|
|
7211
|
-
|
|
7212
|
-
static void iter_sfloat_math_s_acos(na_loop_t* const lp) {
|
|
7213
|
-
size_t i = 0, n;
|
|
7214
|
-
char *p1, *p2;
|
|
7215
|
-
ssize_t s1, s2;
|
|
7216
|
-
size_t *idx1, *idx2;
|
|
7217
|
-
dtype x;
|
|
7218
|
-
|
|
7219
|
-
INIT_COUNTER(lp, n);
|
|
7220
|
-
INIT_PTR_IDX(lp, 0, p1, s1, idx1);
|
|
7221
|
-
INIT_PTR_IDX(lp, 1, p2, s2, idx2);
|
|
7222
|
-
|
|
7223
|
-
if (idx1) {
|
|
7224
|
-
if (idx2) {
|
|
7225
|
-
for (i = 0; i < n; i++) {
|
|
7226
|
-
GET_DATA_INDEX(p1, idx1, dtype, x);
|
|
7227
|
-
x = m_acos(x);
|
|
7228
|
-
SET_DATA_INDEX(p2, idx2, dtype, x);
|
|
7229
|
-
}
|
|
7230
|
-
} else {
|
|
7231
|
-
for (i = 0; i < n; i++) {
|
|
7232
|
-
GET_DATA_INDEX(p1, idx1, dtype, x);
|
|
7233
|
-
x = m_acos(x);
|
|
7234
|
-
SET_DATA_STRIDE(p2, s2, dtype, x);
|
|
7235
|
-
}
|
|
7236
|
-
}
|
|
7237
|
-
} else {
|
|
7238
|
-
if (idx2) {
|
|
7239
|
-
for (i = 0; i < n; i++) {
|
|
7240
|
-
GET_DATA_STRIDE(p1, s1, dtype, x);
|
|
7241
|
-
x = m_acos(x);
|
|
7242
|
-
SET_DATA_INDEX(p2, idx2, dtype, x);
|
|
7243
|
-
}
|
|
7244
|
-
} else {
|
|
7245
|
-
//
|
|
7246
|
-
if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype))) {
|
|
7247
|
-
if (s1 == sizeof(dtype) && s2 == sizeof(dtype)) {
|
|
7248
|
-
//
|
|
7249
|
-
for (; i < n; i++) {
|
|
7250
|
-
((dtype*)p2)[i] = m_acos(((dtype*)p1)[i]);
|
|
7251
|
-
}
|
|
7252
|
-
//
|
|
7253
|
-
return;
|
|
7254
|
-
}
|
|
7255
|
-
if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype))) {
|
|
7256
|
-
//
|
|
7257
|
-
for (i = 0; i < n; i++) {
|
|
7258
|
-
*(dtype*)p2 = m_acos(*(dtype*)p1);
|
|
7259
|
-
p1 += s1;
|
|
7260
|
-
p2 += s2;
|
|
7261
|
-
}
|
|
7262
|
-
return;
|
|
7263
|
-
//
|
|
7264
|
-
}
|
|
7265
|
-
}
|
|
7266
|
-
for (i = 0; i < n; i++) {
|
|
7267
|
-
GET_DATA_STRIDE(p1, s1, dtype, x);
|
|
7268
|
-
x = m_acos(x);
|
|
7269
|
-
SET_DATA_STRIDE(p2, s2, dtype, x);
|
|
7270
|
-
}
|
|
7271
|
-
//
|
|
7272
|
-
}
|
|
7273
|
-
}
|
|
7274
|
-
}
|
|
7275
|
-
|
|
7276
|
-
static VALUE sfloat_math_s_acos(VALUE mod, VALUE a1) {
|
|
7277
|
-
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
|
7278
|
-
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
|
7279
|
-
ndfunc_t ndf = { iter_sfloat_math_s_acos, FULL_LOOP, 1, 1, ain, aout };
|
|
7280
|
-
|
|
7281
|
-
return na_ndloop(&ndf, 1, a1);
|
|
7282
|
-
}
|
|
7283
|
-
|
|
7284
|
-
static void iter_sfloat_math_s_atan(na_loop_t* const lp) {
|
|
7285
|
-
size_t i = 0, n;
|
|
7286
|
-
char *p1, *p2;
|
|
7287
|
-
ssize_t s1, s2;
|
|
7288
|
-
size_t *idx1, *idx2;
|
|
7289
|
-
dtype x;
|
|
7290
|
-
|
|
7291
|
-
INIT_COUNTER(lp, n);
|
|
7292
|
-
INIT_PTR_IDX(lp, 0, p1, s1, idx1);
|
|
7293
|
-
INIT_PTR_IDX(lp, 1, p2, s2, idx2);
|
|
7294
|
-
|
|
7295
|
-
if (idx1) {
|
|
7296
|
-
if (idx2) {
|
|
7297
|
-
for (i = 0; i < n; i++) {
|
|
7298
|
-
GET_DATA_INDEX(p1, idx1, dtype, x);
|
|
7299
|
-
x = m_atan(x);
|
|
7300
|
-
SET_DATA_INDEX(p2, idx2, dtype, x);
|
|
7301
|
-
}
|
|
7302
|
-
} else {
|
|
7303
|
-
for (i = 0; i < n; i++) {
|
|
7304
|
-
GET_DATA_INDEX(p1, idx1, dtype, x);
|
|
7305
|
-
x = m_atan(x);
|
|
7306
|
-
SET_DATA_STRIDE(p2, s2, dtype, x);
|
|
7307
|
-
}
|
|
7308
|
-
}
|
|
7309
|
-
} else {
|
|
7310
|
-
if (idx2) {
|
|
7311
|
-
for (i = 0; i < n; i++) {
|
|
7312
|
-
GET_DATA_STRIDE(p1, s1, dtype, x);
|
|
7313
|
-
x = m_atan(x);
|
|
7314
|
-
SET_DATA_INDEX(p2, idx2, dtype, x);
|
|
7315
|
-
}
|
|
7316
|
-
} else {
|
|
7317
|
-
//
|
|
7318
|
-
if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype))) {
|
|
7319
|
-
if (s1 == sizeof(dtype) && s2 == sizeof(dtype)) {
|
|
7320
|
-
//
|
|
7321
|
-
for (; i < n; i++) {
|
|
7322
|
-
((dtype*)p2)[i] = m_atan(((dtype*)p1)[i]);
|
|
7323
|
-
}
|
|
7324
|
-
//
|
|
7325
|
-
return;
|
|
7326
|
-
}
|
|
7327
|
-
if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype))) {
|
|
7328
|
-
//
|
|
7329
|
-
for (i = 0; i < n; i++) {
|
|
7330
|
-
*(dtype*)p2 = m_atan(*(dtype*)p1);
|
|
7331
|
-
p1 += s1;
|
|
7332
|
-
p2 += s2;
|
|
7333
|
-
}
|
|
7334
|
-
return;
|
|
7335
|
-
//
|
|
7336
|
-
}
|
|
7337
|
-
}
|
|
7338
|
-
for (i = 0; i < n; i++) {
|
|
7339
|
-
GET_DATA_STRIDE(p1, s1, dtype, x);
|
|
7340
|
-
x = m_atan(x);
|
|
7341
|
-
SET_DATA_STRIDE(p2, s2, dtype, x);
|
|
7342
|
-
}
|
|
7343
|
-
//
|
|
7344
|
-
}
|
|
7345
|
-
}
|
|
7346
|
-
}
|
|
7347
|
-
|
|
7348
|
-
static VALUE sfloat_math_s_atan(VALUE mod, VALUE a1) {
|
|
7349
|
-
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
|
7350
|
-
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
|
7351
|
-
ndfunc_t ndf = { iter_sfloat_math_s_atan, FULL_LOOP, 1, 1, ain, aout };
|
|
7352
|
-
|
|
7353
|
-
return na_ndloop(&ndf, 1, a1);
|
|
7354
|
-
}
|
|
7355
|
-
|
|
7356
|
-
static void iter_sfloat_math_s_sinh(na_loop_t* const lp) {
|
|
7357
|
-
size_t i = 0, n;
|
|
7358
|
-
char *p1, *p2;
|
|
7359
|
-
ssize_t s1, s2;
|
|
7360
|
-
size_t *idx1, *idx2;
|
|
7361
|
-
dtype x;
|
|
7362
|
-
|
|
7363
|
-
INIT_COUNTER(lp, n);
|
|
7364
|
-
INIT_PTR_IDX(lp, 0, p1, s1, idx1);
|
|
7365
|
-
INIT_PTR_IDX(lp, 1, p2, s2, idx2);
|
|
7366
|
-
|
|
7367
|
-
if (idx1) {
|
|
7368
|
-
if (idx2) {
|
|
7369
|
-
for (i = 0; i < n; i++) {
|
|
7370
|
-
GET_DATA_INDEX(p1, idx1, dtype, x);
|
|
7371
|
-
x = m_sinh(x);
|
|
7372
|
-
SET_DATA_INDEX(p2, idx2, dtype, x);
|
|
7373
|
-
}
|
|
7374
|
-
} else {
|
|
7375
|
-
for (i = 0; i < n; i++) {
|
|
7376
|
-
GET_DATA_INDEX(p1, idx1, dtype, x);
|
|
7377
|
-
x = m_sinh(x);
|
|
7378
|
-
SET_DATA_STRIDE(p2, s2, dtype, x);
|
|
7379
|
-
}
|
|
7380
|
-
}
|
|
7381
|
-
} else {
|
|
7382
|
-
if (idx2) {
|
|
7383
|
-
for (i = 0; i < n; i++) {
|
|
7384
|
-
GET_DATA_STRIDE(p1, s1, dtype, x);
|
|
7385
|
-
x = m_sinh(x);
|
|
7386
|
-
SET_DATA_INDEX(p2, idx2, dtype, x);
|
|
7387
|
-
}
|
|
7388
|
-
} else {
|
|
7389
|
-
//
|
|
7390
|
-
if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype))) {
|
|
7391
|
-
if (s1 == sizeof(dtype) && s2 == sizeof(dtype)) {
|
|
7392
|
-
//
|
|
7393
|
-
for (; i < n; i++) {
|
|
7394
|
-
((dtype*)p2)[i] = m_sinh(((dtype*)p1)[i]);
|
|
7395
|
-
}
|
|
7396
|
-
//
|
|
7397
|
-
return;
|
|
7398
|
-
}
|
|
7399
|
-
if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype))) {
|
|
7400
|
-
//
|
|
7401
|
-
for (i = 0; i < n; i++) {
|
|
7402
|
-
*(dtype*)p2 = m_sinh(*(dtype*)p1);
|
|
7403
|
-
p1 += s1;
|
|
7404
|
-
p2 += s2;
|
|
7405
|
-
}
|
|
7406
|
-
return;
|
|
7407
|
-
//
|
|
7408
|
-
}
|
|
7409
|
-
}
|
|
7410
|
-
for (i = 0; i < n; i++) {
|
|
7411
|
-
GET_DATA_STRIDE(p1, s1, dtype, x);
|
|
7412
|
-
x = m_sinh(x);
|
|
7413
|
-
SET_DATA_STRIDE(p2, s2, dtype, x);
|
|
7414
|
-
}
|
|
7415
|
-
//
|
|
7416
|
-
}
|
|
7417
|
-
}
|
|
7418
|
-
}
|
|
7419
|
-
|
|
7420
|
-
static VALUE sfloat_math_s_sinh(VALUE mod, VALUE a1) {
|
|
7421
|
-
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
|
7422
|
-
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
|
7423
|
-
ndfunc_t ndf = { iter_sfloat_math_s_sinh, FULL_LOOP, 1, 1, ain, aout };
|
|
7424
|
-
|
|
7425
|
-
return na_ndloop(&ndf, 1, a1);
|
|
7426
|
-
}
|
|
7427
|
-
|
|
7428
|
-
static void iter_sfloat_math_s_cosh(na_loop_t* const lp) {
|
|
7429
|
-
size_t i = 0, n;
|
|
7430
|
-
char *p1, *p2;
|
|
7431
|
-
ssize_t s1, s2;
|
|
7432
|
-
size_t *idx1, *idx2;
|
|
7433
|
-
dtype x;
|
|
7434
|
-
|
|
7435
|
-
INIT_COUNTER(lp, n);
|
|
7436
|
-
INIT_PTR_IDX(lp, 0, p1, s1, idx1);
|
|
7437
|
-
INIT_PTR_IDX(lp, 1, p2, s2, idx2);
|
|
7438
|
-
|
|
7439
|
-
if (idx1) {
|
|
7440
|
-
if (idx2) {
|
|
7441
|
-
for (i = 0; i < n; i++) {
|
|
7442
|
-
GET_DATA_INDEX(p1, idx1, dtype, x);
|
|
7443
|
-
x = m_cosh(x);
|
|
7444
|
-
SET_DATA_INDEX(p2, idx2, dtype, x);
|
|
7445
|
-
}
|
|
7446
|
-
} else {
|
|
7447
|
-
for (i = 0; i < n; i++) {
|
|
7448
|
-
GET_DATA_INDEX(p1, idx1, dtype, x);
|
|
7449
|
-
x = m_cosh(x);
|
|
7450
|
-
SET_DATA_STRIDE(p2, s2, dtype, x);
|
|
7451
|
-
}
|
|
7452
|
-
}
|
|
7453
|
-
} else {
|
|
7454
|
-
if (idx2) {
|
|
7455
|
-
for (i = 0; i < n; i++) {
|
|
7456
|
-
GET_DATA_STRIDE(p1, s1, dtype, x);
|
|
7457
|
-
x = m_cosh(x);
|
|
7458
|
-
SET_DATA_INDEX(p2, idx2, dtype, x);
|
|
7459
|
-
}
|
|
7460
|
-
} else {
|
|
7461
|
-
//
|
|
7462
|
-
if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype))) {
|
|
7463
|
-
if (s1 == sizeof(dtype) && s2 == sizeof(dtype)) {
|
|
7464
|
-
//
|
|
7465
|
-
for (; i < n; i++) {
|
|
7466
|
-
((dtype*)p2)[i] = m_cosh(((dtype*)p1)[i]);
|
|
7467
|
-
}
|
|
7468
|
-
//
|
|
7469
|
-
return;
|
|
7470
|
-
}
|
|
7471
|
-
if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype))) {
|
|
7472
|
-
//
|
|
7473
|
-
for (i = 0; i < n; i++) {
|
|
7474
|
-
*(dtype*)p2 = m_cosh(*(dtype*)p1);
|
|
7475
|
-
p1 += s1;
|
|
7476
|
-
p2 += s2;
|
|
7477
|
-
}
|
|
7478
|
-
return;
|
|
7479
|
-
//
|
|
7480
|
-
}
|
|
7481
|
-
}
|
|
7482
|
-
for (i = 0; i < n; i++) {
|
|
7483
|
-
GET_DATA_STRIDE(p1, s1, dtype, x);
|
|
7484
|
-
x = m_cosh(x);
|
|
7485
|
-
SET_DATA_STRIDE(p2, s2, dtype, x);
|
|
7486
|
-
}
|
|
7487
|
-
//
|
|
7488
|
-
}
|
|
7489
|
-
}
|
|
7490
|
-
}
|
|
7491
|
-
|
|
7492
|
-
static VALUE sfloat_math_s_cosh(VALUE mod, VALUE a1) {
|
|
7493
|
-
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
|
7494
|
-
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
|
7495
|
-
ndfunc_t ndf = { iter_sfloat_math_s_cosh, FULL_LOOP, 1, 1, ain, aout };
|
|
7496
|
-
|
|
7497
|
-
return na_ndloop(&ndf, 1, a1);
|
|
7498
|
-
}
|
|
7499
|
-
|
|
7500
|
-
static void iter_sfloat_math_s_tanh(na_loop_t* const lp) {
|
|
7501
|
-
size_t i = 0, n;
|
|
7502
|
-
char *p1, *p2;
|
|
7503
|
-
ssize_t s1, s2;
|
|
7504
|
-
size_t *idx1, *idx2;
|
|
7505
|
-
dtype x;
|
|
7506
|
-
|
|
7507
|
-
INIT_COUNTER(lp, n);
|
|
7508
|
-
INIT_PTR_IDX(lp, 0, p1, s1, idx1);
|
|
7509
|
-
INIT_PTR_IDX(lp, 1, p2, s2, idx2);
|
|
7510
|
-
|
|
7511
|
-
if (idx1) {
|
|
7512
|
-
if (idx2) {
|
|
7513
|
-
for (i = 0; i < n; i++) {
|
|
7514
|
-
GET_DATA_INDEX(p1, idx1, dtype, x);
|
|
7515
|
-
x = m_tanh(x);
|
|
7516
|
-
SET_DATA_INDEX(p2, idx2, dtype, x);
|
|
7517
|
-
}
|
|
7518
|
-
} else {
|
|
7519
|
-
for (i = 0; i < n; i++) {
|
|
7520
|
-
GET_DATA_INDEX(p1, idx1, dtype, x);
|
|
7521
|
-
x = m_tanh(x);
|
|
7522
|
-
SET_DATA_STRIDE(p2, s2, dtype, x);
|
|
7523
|
-
}
|
|
7524
|
-
}
|
|
7525
|
-
} else {
|
|
7526
|
-
if (idx2) {
|
|
7527
|
-
for (i = 0; i < n; i++) {
|
|
7528
|
-
GET_DATA_STRIDE(p1, s1, dtype, x);
|
|
7529
|
-
x = m_tanh(x);
|
|
7530
|
-
SET_DATA_INDEX(p2, idx2, dtype, x);
|
|
7531
|
-
}
|
|
7532
|
-
} else {
|
|
7533
|
-
//
|
|
7534
|
-
if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype))) {
|
|
7535
|
-
if (s1 == sizeof(dtype) && s2 == sizeof(dtype)) {
|
|
7536
|
-
//
|
|
7537
|
-
for (; i < n; i++) {
|
|
7538
|
-
((dtype*)p2)[i] = m_tanh(((dtype*)p1)[i]);
|
|
7539
|
-
}
|
|
7540
|
-
//
|
|
7541
|
-
return;
|
|
7542
|
-
}
|
|
7543
|
-
if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype))) {
|
|
7544
|
-
//
|
|
7545
|
-
for (i = 0; i < n; i++) {
|
|
7546
|
-
*(dtype*)p2 = m_tanh(*(dtype*)p1);
|
|
7547
|
-
p1 += s1;
|
|
7548
|
-
p2 += s2;
|
|
7549
|
-
}
|
|
7550
|
-
return;
|
|
7551
|
-
//
|
|
7552
|
-
}
|
|
7553
|
-
}
|
|
7554
|
-
for (i = 0; i < n; i++) {
|
|
7555
|
-
GET_DATA_STRIDE(p1, s1, dtype, x);
|
|
7556
|
-
x = m_tanh(x);
|
|
7557
|
-
SET_DATA_STRIDE(p2, s2, dtype, x);
|
|
7558
|
-
}
|
|
7559
|
-
//
|
|
7560
|
-
}
|
|
7561
|
-
}
|
|
7562
|
-
}
|
|
7563
|
-
|
|
7564
|
-
static VALUE sfloat_math_s_tanh(VALUE mod, VALUE a1) {
|
|
7565
|
-
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
|
7566
|
-
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
|
7567
|
-
ndfunc_t ndf = { iter_sfloat_math_s_tanh, FULL_LOOP, 1, 1, ain, aout };
|
|
7568
|
-
|
|
7569
|
-
return na_ndloop(&ndf, 1, a1);
|
|
7570
|
-
}
|
|
7571
|
-
|
|
7572
|
-
static void iter_sfloat_math_s_asinh(na_loop_t* const lp) {
|
|
7573
|
-
size_t i = 0, n;
|
|
7574
|
-
char *p1, *p2;
|
|
7575
|
-
ssize_t s1, s2;
|
|
7576
|
-
size_t *idx1, *idx2;
|
|
7577
|
-
dtype x;
|
|
7578
|
-
|
|
7579
|
-
INIT_COUNTER(lp, n);
|
|
7580
|
-
INIT_PTR_IDX(lp, 0, p1, s1, idx1);
|
|
7581
|
-
INIT_PTR_IDX(lp, 1, p2, s2, idx2);
|
|
7582
|
-
|
|
7583
|
-
if (idx1) {
|
|
7584
|
-
if (idx2) {
|
|
7585
|
-
for (i = 0; i < n; i++) {
|
|
7586
|
-
GET_DATA_INDEX(p1, idx1, dtype, x);
|
|
7587
|
-
x = m_asinh(x);
|
|
7588
|
-
SET_DATA_INDEX(p2, idx2, dtype, x);
|
|
7589
|
-
}
|
|
7590
|
-
} else {
|
|
7591
|
-
for (i = 0; i < n; i++) {
|
|
7592
|
-
GET_DATA_INDEX(p1, idx1, dtype, x);
|
|
7593
|
-
x = m_asinh(x);
|
|
7594
|
-
SET_DATA_STRIDE(p2, s2, dtype, x);
|
|
7595
|
-
}
|
|
7596
|
-
}
|
|
7597
|
-
} else {
|
|
7598
|
-
if (idx2) {
|
|
7599
|
-
for (i = 0; i < n; i++) {
|
|
7600
|
-
GET_DATA_STRIDE(p1, s1, dtype, x);
|
|
7601
|
-
x = m_asinh(x);
|
|
7602
|
-
SET_DATA_INDEX(p2, idx2, dtype, x);
|
|
7603
|
-
}
|
|
7604
|
-
} else {
|
|
7605
|
-
//
|
|
7606
|
-
if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype))) {
|
|
7607
|
-
if (s1 == sizeof(dtype) && s2 == sizeof(dtype)) {
|
|
7608
|
-
//
|
|
7609
|
-
for (; i < n; i++) {
|
|
7610
|
-
((dtype*)p2)[i] = m_asinh(((dtype*)p1)[i]);
|
|
7611
|
-
}
|
|
7612
|
-
//
|
|
7613
|
-
return;
|
|
7614
|
-
}
|
|
7615
|
-
if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype))) {
|
|
7616
|
-
//
|
|
7617
|
-
for (i = 0; i < n; i++) {
|
|
7618
|
-
*(dtype*)p2 = m_asinh(*(dtype*)p1);
|
|
7619
|
-
p1 += s1;
|
|
7620
|
-
p2 += s2;
|
|
7621
|
-
}
|
|
7622
|
-
return;
|
|
7623
|
-
//
|
|
7624
|
-
}
|
|
7625
|
-
}
|
|
7626
|
-
for (i = 0; i < n; i++) {
|
|
7627
|
-
GET_DATA_STRIDE(p1, s1, dtype, x);
|
|
7628
|
-
x = m_asinh(x);
|
|
7629
|
-
SET_DATA_STRIDE(p2, s2, dtype, x);
|
|
7630
|
-
}
|
|
7631
|
-
//
|
|
7632
|
-
}
|
|
7633
|
-
}
|
|
7634
|
-
}
|
|
7635
|
-
|
|
7636
|
-
static VALUE sfloat_math_s_asinh(VALUE mod, VALUE a1) {
|
|
7637
|
-
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
|
7638
|
-
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
|
7639
|
-
ndfunc_t ndf = { iter_sfloat_math_s_asinh, FULL_LOOP, 1, 1, ain, aout };
|
|
7640
|
-
|
|
7641
|
-
return na_ndloop(&ndf, 1, a1);
|
|
7642
|
-
}
|
|
7643
|
-
|
|
7644
|
-
static void iter_sfloat_math_s_acosh(na_loop_t* const lp) {
|
|
7645
|
-
size_t i = 0, n;
|
|
7646
|
-
char *p1, *p2;
|
|
7647
|
-
ssize_t s1, s2;
|
|
7648
|
-
size_t *idx1, *idx2;
|
|
7649
|
-
dtype x;
|
|
7650
|
-
|
|
7651
|
-
INIT_COUNTER(lp, n);
|
|
7652
|
-
INIT_PTR_IDX(lp, 0, p1, s1, idx1);
|
|
7653
|
-
INIT_PTR_IDX(lp, 1, p2, s2, idx2);
|
|
7654
|
-
|
|
7655
|
-
if (idx1) {
|
|
7656
|
-
if (idx2) {
|
|
7657
|
-
for (i = 0; i < n; i++) {
|
|
7658
|
-
GET_DATA_INDEX(p1, idx1, dtype, x);
|
|
7659
|
-
x = m_acosh(x);
|
|
7660
|
-
SET_DATA_INDEX(p2, idx2, dtype, x);
|
|
7661
|
-
}
|
|
7662
|
-
} else {
|
|
7663
|
-
for (i = 0; i < n; i++) {
|
|
7664
|
-
GET_DATA_INDEX(p1, idx1, dtype, x);
|
|
7665
|
-
x = m_acosh(x);
|
|
7666
|
-
SET_DATA_STRIDE(p2, s2, dtype, x);
|
|
7667
|
-
}
|
|
7668
|
-
}
|
|
7669
|
-
} else {
|
|
7670
|
-
if (idx2) {
|
|
7671
|
-
for (i = 0; i < n; i++) {
|
|
7672
|
-
GET_DATA_STRIDE(p1, s1, dtype, x);
|
|
7673
|
-
x = m_acosh(x);
|
|
7674
|
-
SET_DATA_INDEX(p2, idx2, dtype, x);
|
|
7675
|
-
}
|
|
7676
|
-
} else {
|
|
7677
|
-
//
|
|
7678
|
-
if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype))) {
|
|
7679
|
-
if (s1 == sizeof(dtype) && s2 == sizeof(dtype)) {
|
|
7680
|
-
//
|
|
7681
|
-
for (; i < n; i++) {
|
|
7682
|
-
((dtype*)p2)[i] = m_acosh(((dtype*)p1)[i]);
|
|
7683
|
-
}
|
|
7684
|
-
//
|
|
7685
|
-
return;
|
|
7686
|
-
}
|
|
7687
|
-
if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype))) {
|
|
7688
|
-
//
|
|
7689
|
-
for (i = 0; i < n; i++) {
|
|
7690
|
-
*(dtype*)p2 = m_acosh(*(dtype*)p1);
|
|
7691
|
-
p1 += s1;
|
|
7692
|
-
p2 += s2;
|
|
7693
|
-
}
|
|
7694
|
-
return;
|
|
7695
|
-
//
|
|
7696
|
-
}
|
|
7697
|
-
}
|
|
7698
|
-
for (i = 0; i < n; i++) {
|
|
7699
|
-
GET_DATA_STRIDE(p1, s1, dtype, x);
|
|
7700
|
-
x = m_acosh(x);
|
|
7701
|
-
SET_DATA_STRIDE(p2, s2, dtype, x);
|
|
7702
|
-
}
|
|
7703
|
-
//
|
|
7704
|
-
}
|
|
7705
|
-
}
|
|
7706
|
-
}
|
|
7707
|
-
|
|
7708
|
-
static VALUE sfloat_math_s_acosh(VALUE mod, VALUE a1) {
|
|
7709
|
-
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
|
7710
|
-
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
|
7711
|
-
ndfunc_t ndf = { iter_sfloat_math_s_acosh, FULL_LOOP, 1, 1, ain, aout };
|
|
7712
|
-
|
|
7713
|
-
return na_ndloop(&ndf, 1, a1);
|
|
7714
|
-
}
|
|
7715
|
-
|
|
7716
|
-
static void iter_sfloat_math_s_atanh(na_loop_t* const lp) {
|
|
7717
|
-
size_t i = 0, n;
|
|
7718
|
-
char *p1, *p2;
|
|
7719
|
-
ssize_t s1, s2;
|
|
7720
|
-
size_t *idx1, *idx2;
|
|
7721
|
-
dtype x;
|
|
7722
|
-
|
|
7723
|
-
INIT_COUNTER(lp, n);
|
|
7724
|
-
INIT_PTR_IDX(lp, 0, p1, s1, idx1);
|
|
7725
|
-
INIT_PTR_IDX(lp, 1, p2, s2, idx2);
|
|
7726
|
-
|
|
7727
|
-
if (idx1) {
|
|
7728
|
-
if (idx2) {
|
|
7729
|
-
for (i = 0; i < n; i++) {
|
|
7730
|
-
GET_DATA_INDEX(p1, idx1, dtype, x);
|
|
7731
|
-
x = m_atanh(x);
|
|
7732
|
-
SET_DATA_INDEX(p2, idx2, dtype, x);
|
|
7733
|
-
}
|
|
7734
|
-
} else {
|
|
7735
|
-
for (i = 0; i < n; i++) {
|
|
7736
|
-
GET_DATA_INDEX(p1, idx1, dtype, x);
|
|
7737
|
-
x = m_atanh(x);
|
|
7738
|
-
SET_DATA_STRIDE(p2, s2, dtype, x);
|
|
7739
|
-
}
|
|
7740
|
-
}
|
|
7741
|
-
} else {
|
|
7742
|
-
if (idx2) {
|
|
7743
|
-
for (i = 0; i < n; i++) {
|
|
7744
|
-
GET_DATA_STRIDE(p1, s1, dtype, x);
|
|
7745
|
-
x = m_atanh(x);
|
|
7746
|
-
SET_DATA_INDEX(p2, idx2, dtype, x);
|
|
7747
|
-
}
|
|
7748
|
-
} else {
|
|
7749
|
-
//
|
|
7750
|
-
if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype))) {
|
|
7751
|
-
if (s1 == sizeof(dtype) && s2 == sizeof(dtype)) {
|
|
7752
|
-
//
|
|
7753
|
-
for (; i < n; i++) {
|
|
7754
|
-
((dtype*)p2)[i] = m_atanh(((dtype*)p1)[i]);
|
|
7755
|
-
}
|
|
7756
|
-
//
|
|
7757
|
-
return;
|
|
7758
|
-
}
|
|
7759
|
-
if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype))) {
|
|
7760
|
-
//
|
|
7761
|
-
for (i = 0; i < n; i++) {
|
|
7762
|
-
*(dtype*)p2 = m_atanh(*(dtype*)p1);
|
|
7763
|
-
p1 += s1;
|
|
7764
|
-
p2 += s2;
|
|
7765
|
-
}
|
|
7766
|
-
return;
|
|
7767
|
-
//
|
|
7768
|
-
}
|
|
7769
|
-
}
|
|
7770
|
-
for (i = 0; i < n; i++) {
|
|
7771
|
-
GET_DATA_STRIDE(p1, s1, dtype, x);
|
|
7772
|
-
x = m_atanh(x);
|
|
7773
|
-
SET_DATA_STRIDE(p2, s2, dtype, x);
|
|
7774
|
-
}
|
|
7775
|
-
//
|
|
7776
|
-
}
|
|
7777
|
-
}
|
|
7778
|
-
}
|
|
7779
|
-
|
|
7780
|
-
static VALUE sfloat_math_s_atanh(VALUE mod, VALUE a1) {
|
|
7781
|
-
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
|
7782
|
-
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
|
7783
|
-
ndfunc_t ndf = { iter_sfloat_math_s_atanh, FULL_LOOP, 1, 1, ain, aout };
|
|
7784
|
-
|
|
7785
|
-
return na_ndloop(&ndf, 1, a1);
|
|
7786
|
-
}
|
|
7787
|
-
|
|
7788
|
-
static void iter_sfloat_math_s_sinc(na_loop_t* const lp) {
|
|
7789
|
-
size_t i = 0, n;
|
|
7790
|
-
char *p1, *p2;
|
|
7791
|
-
ssize_t s1, s2;
|
|
7792
|
-
size_t *idx1, *idx2;
|
|
7793
|
-
dtype x;
|
|
7794
|
-
|
|
7795
|
-
INIT_COUNTER(lp, n);
|
|
7796
|
-
INIT_PTR_IDX(lp, 0, p1, s1, idx1);
|
|
7797
|
-
INIT_PTR_IDX(lp, 1, p2, s2, idx2);
|
|
7798
|
-
|
|
7799
|
-
if (idx1) {
|
|
7800
|
-
if (idx2) {
|
|
7801
|
-
for (i = 0; i < n; i++) {
|
|
7802
|
-
GET_DATA_INDEX(p1, idx1, dtype, x);
|
|
7803
|
-
x = m_sinc(x);
|
|
7804
|
-
SET_DATA_INDEX(p2, idx2, dtype, x);
|
|
7805
|
-
}
|
|
7806
|
-
} else {
|
|
7807
|
-
for (i = 0; i < n; i++) {
|
|
7808
|
-
GET_DATA_INDEX(p1, idx1, dtype, x);
|
|
7809
|
-
x = m_sinc(x);
|
|
7810
|
-
SET_DATA_STRIDE(p2, s2, dtype, x);
|
|
7811
|
-
}
|
|
7812
|
-
}
|
|
7813
|
-
} else {
|
|
7814
|
-
if (idx2) {
|
|
7815
|
-
for (i = 0; i < n; i++) {
|
|
7816
|
-
GET_DATA_STRIDE(p1, s1, dtype, x);
|
|
7817
|
-
x = m_sinc(x);
|
|
7818
|
-
SET_DATA_INDEX(p2, idx2, dtype, x);
|
|
7819
|
-
}
|
|
7820
|
-
} else {
|
|
7821
|
-
//
|
|
7822
|
-
if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype))) {
|
|
7823
|
-
if (s1 == sizeof(dtype) && s2 == sizeof(dtype)) {
|
|
7824
|
-
//
|
|
7825
|
-
for (; i < n; i++) {
|
|
7826
|
-
((dtype*)p2)[i] = m_sinc(((dtype*)p1)[i]);
|
|
7827
|
-
}
|
|
7828
|
-
//
|
|
7829
|
-
return;
|
|
7830
|
-
}
|
|
7831
|
-
if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype))) {
|
|
7832
|
-
//
|
|
7833
|
-
for (i = 0; i < n; i++) {
|
|
7834
|
-
*(dtype*)p2 = m_sinc(*(dtype*)p1);
|
|
7835
|
-
p1 += s1;
|
|
7836
|
-
p2 += s2;
|
|
7837
|
-
}
|
|
7838
|
-
return;
|
|
7839
|
-
//
|
|
7840
|
-
}
|
|
7841
|
-
}
|
|
7842
|
-
for (i = 0; i < n; i++) {
|
|
7843
|
-
GET_DATA_STRIDE(p1, s1, dtype, x);
|
|
7844
|
-
x = m_sinc(x);
|
|
7845
|
-
SET_DATA_STRIDE(p2, s2, dtype, x);
|
|
7846
|
-
}
|
|
7847
|
-
//
|
|
7848
|
-
}
|
|
7849
|
-
}
|
|
7850
|
-
}
|
|
7851
|
-
|
|
7852
|
-
static VALUE sfloat_math_s_sinc(VALUE mod, VALUE a1) {
|
|
7853
|
-
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
|
7854
|
-
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
|
7855
|
-
ndfunc_t ndf = { iter_sfloat_math_s_sinc, FULL_LOOP, 1, 1, ain, aout };
|
|
7856
|
-
|
|
7857
|
-
return na_ndloop(&ndf, 1, a1);
|
|
7858
|
-
}
|
|
7859
|
-
|
|
7860
|
-
static void iter_sfloat_math_s_atan2(na_loop_t* const lp) {
|
|
7861
|
-
size_t i;
|
|
7862
|
-
char *p1, *p2, *p3;
|
|
7863
|
-
ssize_t s1, s2, s3;
|
|
7864
|
-
dtype x, y;
|
|
7865
|
-
INIT_COUNTER(lp, i);
|
|
7866
|
-
INIT_PTR(lp, 0, p1, s1);
|
|
7867
|
-
INIT_PTR(lp, 1, p2, s2);
|
|
7868
|
-
INIT_PTR(lp, 2, p3, s3);
|
|
7869
|
-
for (; i--;) {
|
|
7870
|
-
GET_DATA_STRIDE(p1, s1, dtype, x);
|
|
7871
|
-
GET_DATA_STRIDE(p2, s2, dtype, y);
|
|
7872
|
-
x = m_atan2(x, y);
|
|
7873
|
-
SET_DATA_STRIDE(p3, s3, dtype, x);
|
|
7874
|
-
}
|
|
7875
|
-
}
|
|
7876
|
-
|
|
7877
|
-
static VALUE sfloat_math_s_atan2(VALUE mod, VALUE a1, VALUE a2) {
|
|
7878
|
-
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
|
|
7879
|
-
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
|
7880
|
-
ndfunc_t ndf = { iter_sfloat_math_s_atan2, STRIDE_LOOP, 2, 1, ain, aout };
|
|
7881
|
-
return na_ndloop(&ndf, 2, a1, a2);
|
|
7882
|
-
}
|
|
7883
|
-
|
|
7884
|
-
static void iter_sfloat_math_s_hypot(na_loop_t* const lp) {
|
|
7885
|
-
size_t i;
|
|
7886
|
-
char *p1, *p2, *p3;
|
|
7887
|
-
ssize_t s1, s2, s3;
|
|
7888
|
-
dtype x, y;
|
|
7889
|
-
INIT_COUNTER(lp, i);
|
|
7890
|
-
INIT_PTR(lp, 0, p1, s1);
|
|
7891
|
-
INIT_PTR(lp, 1, p2, s2);
|
|
7892
|
-
INIT_PTR(lp, 2, p3, s3);
|
|
7893
|
-
for (; i--;) {
|
|
7894
|
-
GET_DATA_STRIDE(p1, s1, dtype, x);
|
|
7895
|
-
GET_DATA_STRIDE(p2, s2, dtype, y);
|
|
7896
|
-
x = m_hypot(x, y);
|
|
7897
|
-
SET_DATA_STRIDE(p3, s3, dtype, x);
|
|
7898
|
-
}
|
|
7899
|
-
}
|
|
7900
|
-
|
|
7901
|
-
static VALUE sfloat_math_s_hypot(VALUE mod, VALUE a1, VALUE a2) {
|
|
7902
|
-
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
|
|
7903
|
-
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
|
7904
|
-
ndfunc_t ndf = { iter_sfloat_math_s_hypot, STRIDE_LOOP, 2, 1, ain, aout };
|
|
7905
|
-
return na_ndloop(&ndf, 2, a1, a2);
|
|
7906
|
-
}
|
|
7907
|
-
|
|
7908
|
-
static void iter_sfloat_math_s_erf(na_loop_t* const lp) {
|
|
7909
|
-
size_t i = 0, n;
|
|
7910
|
-
char *p1, *p2;
|
|
7911
|
-
ssize_t s1, s2;
|
|
7912
|
-
size_t *idx1, *idx2;
|
|
7913
|
-
dtype x;
|
|
7914
|
-
|
|
7915
|
-
INIT_COUNTER(lp, n);
|
|
7916
|
-
INIT_PTR_IDX(lp, 0, p1, s1, idx1);
|
|
7917
|
-
INIT_PTR_IDX(lp, 1, p2, s2, idx2);
|
|
7918
|
-
|
|
7919
|
-
if (idx1) {
|
|
7920
|
-
if (idx2) {
|
|
7921
|
-
for (i = 0; i < n; i++) {
|
|
7922
|
-
GET_DATA_INDEX(p1, idx1, dtype, x);
|
|
7923
|
-
x = m_erf(x);
|
|
7924
|
-
SET_DATA_INDEX(p2, idx2, dtype, x);
|
|
7925
|
-
}
|
|
7926
|
-
} else {
|
|
7927
|
-
for (i = 0; i < n; i++) {
|
|
7928
|
-
GET_DATA_INDEX(p1, idx1, dtype, x);
|
|
7929
|
-
x = m_erf(x);
|
|
7930
|
-
SET_DATA_STRIDE(p2, s2, dtype, x);
|
|
7931
|
-
}
|
|
7932
|
-
}
|
|
7933
|
-
} else {
|
|
7934
|
-
if (idx2) {
|
|
7935
|
-
for (i = 0; i < n; i++) {
|
|
7936
|
-
GET_DATA_STRIDE(p1, s1, dtype, x);
|
|
7937
|
-
x = m_erf(x);
|
|
7938
|
-
SET_DATA_INDEX(p2, idx2, dtype, x);
|
|
7939
|
-
}
|
|
7940
|
-
} else {
|
|
7941
|
-
//
|
|
7942
|
-
if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype))) {
|
|
7943
|
-
if (s1 == sizeof(dtype) && s2 == sizeof(dtype)) {
|
|
7944
|
-
//
|
|
7945
|
-
for (; i < n; i++) {
|
|
7946
|
-
((dtype*)p2)[i] = m_erf(((dtype*)p1)[i]);
|
|
7947
|
-
}
|
|
7948
|
-
//
|
|
7949
|
-
return;
|
|
7950
|
-
}
|
|
7951
|
-
if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype))) {
|
|
7952
|
-
//
|
|
7953
|
-
for (i = 0; i < n; i++) {
|
|
7954
|
-
*(dtype*)p2 = m_erf(*(dtype*)p1);
|
|
7955
|
-
p1 += s1;
|
|
7956
|
-
p2 += s2;
|
|
7957
|
-
}
|
|
7958
|
-
return;
|
|
7959
|
-
//
|
|
7960
|
-
}
|
|
7961
|
-
}
|
|
7962
|
-
for (i = 0; i < n; i++) {
|
|
7963
|
-
GET_DATA_STRIDE(p1, s1, dtype, x);
|
|
7964
|
-
x = m_erf(x);
|
|
7965
|
-
SET_DATA_STRIDE(p2, s2, dtype, x);
|
|
7966
|
-
}
|
|
7967
|
-
//
|
|
7968
|
-
}
|
|
7969
|
-
}
|
|
7970
|
-
}
|
|
7971
|
-
|
|
7972
|
-
static VALUE sfloat_math_s_erf(VALUE mod, VALUE a1) {
|
|
7973
|
-
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
|
7974
|
-
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
|
7975
|
-
ndfunc_t ndf = { iter_sfloat_math_s_erf, FULL_LOOP, 1, 1, ain, aout };
|
|
7976
|
-
|
|
7977
|
-
return na_ndloop(&ndf, 1, a1);
|
|
7978
|
-
}
|
|
7979
|
-
|
|
7980
|
-
static void iter_sfloat_math_s_erfc(na_loop_t* const lp) {
|
|
7981
|
-
size_t i = 0, n;
|
|
7982
|
-
char *p1, *p2;
|
|
7983
|
-
ssize_t s1, s2;
|
|
7984
|
-
size_t *idx1, *idx2;
|
|
7985
|
-
dtype x;
|
|
7986
|
-
|
|
7987
|
-
INIT_COUNTER(lp, n);
|
|
7988
|
-
INIT_PTR_IDX(lp, 0, p1, s1, idx1);
|
|
7989
|
-
INIT_PTR_IDX(lp, 1, p2, s2, idx2);
|
|
7990
|
-
|
|
7991
|
-
if (idx1) {
|
|
7992
|
-
if (idx2) {
|
|
7993
|
-
for (i = 0; i < n; i++) {
|
|
7994
|
-
GET_DATA_INDEX(p1, idx1, dtype, x);
|
|
7995
|
-
x = m_erfc(x);
|
|
7996
|
-
SET_DATA_INDEX(p2, idx2, dtype, x);
|
|
7997
|
-
}
|
|
7998
|
-
} else {
|
|
7999
|
-
for (i = 0; i < n; i++) {
|
|
8000
|
-
GET_DATA_INDEX(p1, idx1, dtype, x);
|
|
8001
|
-
x = m_erfc(x);
|
|
8002
|
-
SET_DATA_STRIDE(p2, s2, dtype, x);
|
|
8003
|
-
}
|
|
8004
|
-
}
|
|
8005
|
-
} else {
|
|
8006
|
-
if (idx2) {
|
|
8007
|
-
for (i = 0; i < n; i++) {
|
|
8008
|
-
GET_DATA_STRIDE(p1, s1, dtype, x);
|
|
8009
|
-
x = m_erfc(x);
|
|
8010
|
-
SET_DATA_INDEX(p2, idx2, dtype, x);
|
|
8011
|
-
}
|
|
8012
|
-
} else {
|
|
8013
|
-
//
|
|
8014
|
-
if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype))) {
|
|
8015
|
-
if (s1 == sizeof(dtype) && s2 == sizeof(dtype)) {
|
|
8016
|
-
//
|
|
8017
|
-
for (; i < n; i++) {
|
|
8018
|
-
((dtype*)p2)[i] = m_erfc(((dtype*)p1)[i]);
|
|
8019
|
-
}
|
|
8020
|
-
//
|
|
8021
|
-
return;
|
|
8022
|
-
}
|
|
8023
|
-
if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype))) {
|
|
8024
|
-
//
|
|
8025
|
-
for (i = 0; i < n; i++) {
|
|
8026
|
-
*(dtype*)p2 = m_erfc(*(dtype*)p1);
|
|
8027
|
-
p1 += s1;
|
|
8028
|
-
p2 += s2;
|
|
8029
|
-
}
|
|
8030
|
-
return;
|
|
8031
|
-
//
|
|
8032
|
-
}
|
|
8033
|
-
}
|
|
8034
|
-
for (i = 0; i < n; i++) {
|
|
8035
|
-
GET_DATA_STRIDE(p1, s1, dtype, x);
|
|
8036
|
-
x = m_erfc(x);
|
|
8037
|
-
SET_DATA_STRIDE(p2, s2, dtype, x);
|
|
8038
|
-
}
|
|
8039
|
-
//
|
|
8040
|
-
}
|
|
8041
|
-
}
|
|
8042
|
-
}
|
|
8043
|
-
|
|
8044
|
-
static VALUE sfloat_math_s_erfc(VALUE mod, VALUE a1) {
|
|
8045
|
-
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
|
8046
|
-
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
|
8047
|
-
ndfunc_t ndf = { iter_sfloat_math_s_erfc, FULL_LOOP, 1, 1, ain, aout };
|
|
8048
|
-
|
|
8049
|
-
return na_ndloop(&ndf, 1, a1);
|
|
8050
|
-
}
|
|
8051
|
-
|
|
8052
|
-
static void iter_sfloat_math_s_log1p(na_loop_t* const lp) {
|
|
8053
|
-
size_t i = 0, n;
|
|
8054
|
-
char *p1, *p2;
|
|
8055
|
-
ssize_t s1, s2;
|
|
8056
|
-
size_t *idx1, *idx2;
|
|
8057
|
-
dtype x;
|
|
8058
|
-
|
|
8059
|
-
INIT_COUNTER(lp, n);
|
|
8060
|
-
INIT_PTR_IDX(lp, 0, p1, s1, idx1);
|
|
8061
|
-
INIT_PTR_IDX(lp, 1, p2, s2, idx2);
|
|
8062
|
-
|
|
8063
|
-
if (idx1) {
|
|
8064
|
-
if (idx2) {
|
|
8065
|
-
for (i = 0; i < n; i++) {
|
|
8066
|
-
GET_DATA_INDEX(p1, idx1, dtype, x);
|
|
8067
|
-
x = m_log1p(x);
|
|
8068
|
-
SET_DATA_INDEX(p2, idx2, dtype, x);
|
|
8069
|
-
}
|
|
8070
|
-
} else {
|
|
8071
|
-
for (i = 0; i < n; i++) {
|
|
8072
|
-
GET_DATA_INDEX(p1, idx1, dtype, x);
|
|
8073
|
-
x = m_log1p(x);
|
|
8074
|
-
SET_DATA_STRIDE(p2, s2, dtype, x);
|
|
8075
|
-
}
|
|
8076
|
-
}
|
|
8077
|
-
} else {
|
|
8078
|
-
if (idx2) {
|
|
8079
|
-
for (i = 0; i < n; i++) {
|
|
8080
|
-
GET_DATA_STRIDE(p1, s1, dtype, x);
|
|
8081
|
-
x = m_log1p(x);
|
|
8082
|
-
SET_DATA_INDEX(p2, idx2, dtype, x);
|
|
8083
|
-
}
|
|
8084
|
-
} else {
|
|
8085
|
-
//
|
|
8086
|
-
if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype))) {
|
|
8087
|
-
if (s1 == sizeof(dtype) && s2 == sizeof(dtype)) {
|
|
8088
|
-
//
|
|
8089
|
-
for (; i < n; i++) {
|
|
8090
|
-
((dtype*)p2)[i] = m_log1p(((dtype*)p1)[i]);
|
|
8091
|
-
}
|
|
8092
|
-
//
|
|
8093
|
-
return;
|
|
8094
|
-
}
|
|
8095
|
-
if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype))) {
|
|
8096
|
-
//
|
|
8097
|
-
for (i = 0; i < n; i++) {
|
|
8098
|
-
*(dtype*)p2 = m_log1p(*(dtype*)p1);
|
|
8099
|
-
p1 += s1;
|
|
8100
|
-
p2 += s2;
|
|
8101
|
-
}
|
|
8102
|
-
return;
|
|
8103
|
-
//
|
|
8104
|
-
}
|
|
8105
|
-
}
|
|
8106
|
-
for (i = 0; i < n; i++) {
|
|
8107
|
-
GET_DATA_STRIDE(p1, s1, dtype, x);
|
|
8108
|
-
x = m_log1p(x);
|
|
8109
|
-
SET_DATA_STRIDE(p2, s2, dtype, x);
|
|
8110
|
-
}
|
|
8111
|
-
//
|
|
8112
|
-
}
|
|
8113
|
-
}
|
|
8114
|
-
}
|
|
8115
|
-
|
|
8116
|
-
static VALUE sfloat_math_s_log1p(VALUE mod, VALUE a1) {
|
|
8117
|
-
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
|
8118
|
-
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
|
8119
|
-
ndfunc_t ndf = { iter_sfloat_math_s_log1p, FULL_LOOP, 1, 1, ain, aout };
|
|
8120
|
-
|
|
8121
|
-
return na_ndloop(&ndf, 1, a1);
|
|
8122
|
-
}
|
|
8123
|
-
|
|
8124
|
-
static void iter_sfloat_math_s_expm1(na_loop_t* const lp) {
|
|
8125
|
-
size_t i = 0, n;
|
|
8126
|
-
char *p1, *p2;
|
|
8127
|
-
ssize_t s1, s2;
|
|
8128
|
-
size_t *idx1, *idx2;
|
|
8129
|
-
dtype x;
|
|
8130
|
-
|
|
8131
|
-
INIT_COUNTER(lp, n);
|
|
8132
|
-
INIT_PTR_IDX(lp, 0, p1, s1, idx1);
|
|
8133
|
-
INIT_PTR_IDX(lp, 1, p2, s2, idx2);
|
|
8134
|
-
|
|
8135
|
-
if (idx1) {
|
|
8136
|
-
if (idx2) {
|
|
8137
|
-
for (i = 0; i < n; i++) {
|
|
8138
|
-
GET_DATA_INDEX(p1, idx1, dtype, x);
|
|
8139
|
-
x = m_expm1(x);
|
|
8140
|
-
SET_DATA_INDEX(p2, idx2, dtype, x);
|
|
8141
|
-
}
|
|
8142
|
-
} else {
|
|
8143
|
-
for (i = 0; i < n; i++) {
|
|
8144
|
-
GET_DATA_INDEX(p1, idx1, dtype, x);
|
|
8145
|
-
x = m_expm1(x);
|
|
8146
|
-
SET_DATA_STRIDE(p2, s2, dtype, x);
|
|
8147
|
-
}
|
|
8148
|
-
}
|
|
8149
|
-
} else {
|
|
8150
|
-
if (idx2) {
|
|
8151
|
-
for (i = 0; i < n; i++) {
|
|
8152
|
-
GET_DATA_STRIDE(p1, s1, dtype, x);
|
|
8153
|
-
x = m_expm1(x);
|
|
8154
|
-
SET_DATA_INDEX(p2, idx2, dtype, x);
|
|
8155
|
-
}
|
|
8156
|
-
} else {
|
|
8157
|
-
//
|
|
8158
|
-
if (is_aligned(p1, sizeof(dtype)) && is_aligned(p2, sizeof(dtype))) {
|
|
8159
|
-
if (s1 == sizeof(dtype) && s2 == sizeof(dtype)) {
|
|
8160
|
-
//
|
|
8161
|
-
for (; i < n; i++) {
|
|
8162
|
-
((dtype*)p2)[i] = m_expm1(((dtype*)p1)[i]);
|
|
8163
|
-
}
|
|
8164
|
-
//
|
|
8165
|
-
return;
|
|
8166
|
-
}
|
|
8167
|
-
if (is_aligned_step(s1, sizeof(dtype)) && is_aligned_step(s2, sizeof(dtype))) {
|
|
8168
|
-
//
|
|
8169
|
-
for (i = 0; i < n; i++) {
|
|
8170
|
-
*(dtype*)p2 = m_expm1(*(dtype*)p1);
|
|
8171
|
-
p1 += s1;
|
|
8172
|
-
p2 += s2;
|
|
8173
|
-
}
|
|
8174
|
-
return;
|
|
8175
|
-
//
|
|
8176
|
-
}
|
|
8177
|
-
}
|
|
8178
|
-
for (i = 0; i < n; i++) {
|
|
8179
|
-
GET_DATA_STRIDE(p1, s1, dtype, x);
|
|
8180
|
-
x = m_expm1(x);
|
|
8181
|
-
SET_DATA_STRIDE(p2, s2, dtype, x);
|
|
8182
|
-
}
|
|
8183
|
-
//
|
|
8184
|
-
}
|
|
8185
|
-
}
|
|
8186
|
-
}
|
|
8187
|
-
|
|
8188
|
-
static VALUE sfloat_math_s_expm1(VALUE mod, VALUE a1) {
|
|
8189
|
-
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
|
8190
|
-
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
|
8191
|
-
ndfunc_t ndf = { iter_sfloat_math_s_expm1, FULL_LOOP, 1, 1, ain, aout };
|
|
8192
|
-
|
|
8193
|
-
return na_ndloop(&ndf, 1, a1);
|
|
8194
|
-
}
|
|
8195
|
-
|
|
8196
|
-
static void iter_sfloat_math_s_ldexp(na_loop_t* const lp) {
|
|
8197
|
-
size_t i;
|
|
8198
|
-
char *p1, *p2, *p3;
|
|
8199
|
-
ssize_t s1, s2, s3;
|
|
8200
|
-
dtype x, y;
|
|
8201
|
-
INIT_COUNTER(lp, i);
|
|
8202
|
-
INIT_PTR(lp, 0, p1, s1);
|
|
8203
|
-
INIT_PTR(lp, 1, p2, s2);
|
|
8204
|
-
INIT_PTR(lp, 2, p3, s3);
|
|
8205
|
-
for (; i--;) {
|
|
8206
|
-
GET_DATA_STRIDE(p1, s1, dtype, x);
|
|
8207
|
-
GET_DATA_STRIDE(p2, s2, dtype, y);
|
|
8208
|
-
x = m_ldexp(x, y);
|
|
8209
|
-
SET_DATA_STRIDE(p3, s3, dtype, x);
|
|
8210
|
-
}
|
|
8211
|
-
}
|
|
8212
|
-
|
|
8213
|
-
static VALUE sfloat_math_s_ldexp(VALUE mod, VALUE a1, VALUE a2) {
|
|
8214
|
-
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { cT, 0 } };
|
|
8215
|
-
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
|
8216
|
-
ndfunc_t ndf = { iter_sfloat_math_s_ldexp, STRIDE_LOOP, 2, 1, ain, aout };
|
|
8217
|
-
return na_ndloop(&ndf, 2, a1, a2);
|
|
8218
|
-
}
|
|
8219
|
-
|
|
8220
|
-
static void iter_sfloat_math_s_frexp(na_loop_t* const lp) {
|
|
8221
|
-
size_t i;
|
|
8222
|
-
char *p1, *p2, *p3;
|
|
8223
|
-
ssize_t s1, s2, s3;
|
|
8224
|
-
dtype x;
|
|
8225
|
-
int y;
|
|
8226
|
-
INIT_COUNTER(lp, i);
|
|
8227
|
-
INIT_PTR(lp, 0, p1, s1);
|
|
8228
|
-
INIT_PTR(lp, 1, p2, s2);
|
|
8229
|
-
INIT_PTR(lp, 2, p3, s3);
|
|
8230
|
-
for (; i--;) {
|
|
8231
|
-
GET_DATA_STRIDE(p1, s1, dtype, x);
|
|
8232
|
-
x = m_frexp(x, &y);
|
|
8233
|
-
SET_DATA_STRIDE(p2, s2, dtype, x);
|
|
8234
|
-
SET_DATA_STRIDE(p3, s3, int32_t, y);
|
|
8235
|
-
}
|
|
8236
|
-
}
|
|
8237
|
-
|
|
8238
|
-
static VALUE sfloat_math_s_frexp(VALUE mod, VALUE a1) {
|
|
8239
|
-
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
|
8240
|
-
ndfunc_arg_out_t aout[2] = { { cT, 0 }, { numo_cInt32, 0 } };
|
|
8241
|
-
ndfunc_t ndf = { iter_sfloat_math_s_frexp, STRIDE_LOOP, 1, 2, ain, aout };
|
|
8242
|
-
return na_ndloop(&ndf, 1, a1);
|
|
8243
|
-
}
|
|
8244
|
-
|
|
8245
6359
|
void Init_numo_sfloat(void) {
|
|
8246
6360
|
VALUE hCast, mNumo;
|
|
8247
6361
|
|