numo-narray-alt 0.9.5 → 0.9.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +3 -0
- data/README.md +13 -0
- data/ext/numo/narray/SFMT-params19937.h +12 -12
- data/ext/numo/narray/array.c +26 -2
- data/ext/numo/narray/data.c +70 -72
- data/ext/numo/narray/extconf.rb +0 -1
- data/ext/numo/narray/index.c +2 -2
- data/ext/numo/narray/kwargs.c +6 -6
- data/ext/numo/narray/math.c +10 -4
- data/ext/numo/narray/narray.c +80 -52
- data/ext/numo/narray/numo/narray.h +20 -20
- data/ext/numo/narray/numo/ndloop.h +1 -1
- data/ext/numo/narray/numo/template.h +80 -80
- data/ext/numo/narray/numo/types/bit.h +76 -0
- data/ext/numo/narray/numo/types/complex.h +2 -2
- data/ext/numo/narray/numo/types/complex_macro.h +27 -26
- data/ext/numo/narray/numo/types/float_macro.h +18 -17
- data/ext/numo/narray/numo/types/real_accum.h +22 -22
- data/ext/numo/narray/numo/types/robj_macro.h +15 -14
- data/ext/numo/narray/numo/types/xint_macro.h +50 -8
- data/ext/numo/narray/rand.c +7 -0
- data/ext/numo/narray/src/mh/mean.h +102 -0
- data/ext/numo/narray/src/mh/rms.h +102 -0
- data/ext/numo/narray/src/mh/stddev.h +103 -0
- data/ext/numo/narray/src/mh/var.h +102 -0
- data/ext/numo/narray/src/t_bit.c +121 -71
- data/ext/numo/narray/src/t_dcomplex.c +248 -387
- data/ext/numo/narray/src/t_dfloat.c +922 -1068
- data/ext/numo/narray/src/t_int16.c +282 -231
- data/ext/numo/narray/src/t_int32.c +282 -231
- data/ext/numo/narray/src/t_int64.c +281 -230
- data/ext/numo/narray/src/t_int8.c +282 -231
- data/ext/numo/narray/src/t_robject.c +278 -405
- data/ext/numo/narray/src/t_scomplex.c +246 -406
- data/ext/numo/narray/src/t_sfloat.c +916 -1058
- data/ext/numo/narray/src/t_uint16.c +282 -231
- data/ext/numo/narray/src/t_uint32.c +282 -231
- data/ext/numo/narray/src/t_uint64.c +282 -231
- data/ext/numo/narray/src/t_uint8.c +282 -231
- data/ext/numo/narray/struct.c +12 -7
- data/lib/numo/narray/extra.rb +8 -5
- metadata +6 -3
- data/ext/numo/narray/src/t_mean.c +0 -105
@@ -32,14 +32,21 @@ static ID id_to_a;
|
|
32
32
|
|
33
33
|
#include <numo/types/scomplex.h>
|
34
34
|
|
35
|
-
VALUE cT;
|
36
|
-
extern VALUE cRT;
|
37
|
-
|
38
35
|
/*
|
39
36
|
class definition: Numo::SComplex
|
40
37
|
*/
|
41
|
-
|
42
38
|
VALUE cT;
|
39
|
+
extern VALUE cRT;
|
40
|
+
|
41
|
+
#include "mh/mean.h"
|
42
|
+
#include "mh/var.h"
|
43
|
+
#include "mh/stddev.h"
|
44
|
+
#include "mh/rms.h"
|
45
|
+
|
46
|
+
DEF_NARRAY_FLT_MEAN_METHOD_FUNC(scomplex, scomplex, numo_cSComplex, numo_cSComplex)
|
47
|
+
DEF_NARRAY_FLT_VAR_METHOD_FUNC(scomplex, float, numo_cSComplex, numo_cSFloat)
|
48
|
+
DEF_NARRAY_FLT_STDDEV_METHOD_FUNC(scomplex, float, numo_cSComplex, numo_cSFloat)
|
49
|
+
DEF_NARRAY_FLT_RMS_METHOD_FUNC(scomplex, float, numo_cSComplex, numo_cSFloat)
|
43
50
|
|
44
51
|
static VALUE scomplex_store(VALUE, VALUE);
|
45
52
|
|
@@ -147,9 +154,9 @@ static VALUE scomplex_allocate(VALUE self) {
|
|
147
154
|
/*
|
148
155
|
Extract an element only if self is a dimensionless NArray.
|
149
156
|
@overload extract
|
150
|
-
|
151
|
-
|
152
|
-
|
157
|
+
@return [Numeric,Numo::NArray]
|
158
|
+
--- Extract element value as Ruby Object if self is a dimensionless NArray,
|
159
|
+
otherwise returns self.
|
153
160
|
*/
|
154
161
|
static VALUE scomplex_extract(VALUE self) {
|
155
162
|
volatile VALUE v;
|
@@ -989,8 +996,8 @@ static VALUE scomplex_store_array(VALUE self, VALUE rary) {
|
|
989
996
|
/*
|
990
997
|
Store elements to Numo::SComplex from other.
|
991
998
|
@overload store(other)
|
992
|
-
|
993
|
-
|
999
|
+
@param [Object] other
|
1000
|
+
@return [Numo::SComplex] self
|
994
1001
|
*/
|
995
1002
|
static VALUE scomplex_store(VALUE self, VALUE obj) {
|
996
1003
|
VALUE r, klass;
|
@@ -1228,9 +1235,9 @@ static VALUE scomplex_cast_array(VALUE rary) {
|
|
1228
1235
|
Cast object to Numo::SComplex.
|
1229
1236
|
@overload [](elements)
|
1230
1237
|
@overload cast(array)
|
1231
|
-
|
1232
|
-
|
1233
|
-
|
1238
|
+
@param [Numeric,Array] elements
|
1239
|
+
@param [Array] array
|
1240
|
+
@return [Numo::SComplex]
|
1234
1241
|
*/
|
1235
1242
|
static VALUE scomplex_s_cast(VALUE type, VALUE obj) {
|
1236
1243
|
VALUE v;
|
@@ -1270,11 +1277,11 @@ static VALUE scomplex_s_cast(VALUE type, VALUE obj) {
|
|
1270
1277
|
/*
|
1271
1278
|
Multi-dimensional element reference.
|
1272
1279
|
@overload [](dim0,...,dimL)
|
1273
|
-
|
1274
|
-
|
1275
|
-
|
1276
|
-
|
1277
|
-
|
1280
|
+
@param [Numeric,Range,Array,Numo::Int32,Numo::Int64,Numo::Bit,TrueClass,FalseClass,Symbol]
|
1281
|
+
dim0,...,dimL multi-dimensional indices.
|
1282
|
+
@return [Numeric,Numo::SComplex] an element or NArray view.
|
1283
|
+
@see Numo::NArray#[]
|
1284
|
+
@see #[]=
|
1278
1285
|
*/
|
1279
1286
|
static VALUE scomplex_aref(int argc, VALUE* argv, VALUE self) {
|
1280
1287
|
int nd;
|
@@ -1293,10 +1300,10 @@ static VALUE scomplex_aref(int argc, VALUE* argv, VALUE self) {
|
|
1293
1300
|
/*
|
1294
1301
|
Multi-dimensional element assignment.
|
1295
1302
|
@overload []=(dim0,...,dimL,val)
|
1296
|
-
|
1297
|
-
|
1298
|
-
|
1299
|
-
|
1303
|
+
@param [Numeric,Range,Array,Numo::Int32,Numo::Int64,Numo::Bit,TrueClass,FalseClass,Symbol]
|
1304
|
+
dim0,...,dimL multi-dimensional indices.
|
1305
|
+
@param [Numeric,Numo::NArray,Array] val Value(s) to be set to self.
|
1306
|
+
@return [Numeric,Numo::NArray,Array] returns `val` (last argument).
|
1300
1307
|
@see Numo::NArray#[]=
|
1301
1308
|
@see #[]
|
1302
1309
|
*/
|
@@ -1327,7 +1334,7 @@ static VALUE scomplex_aset(int argc, VALUE* argv, VALUE self) {
|
|
1327
1334
|
/*
|
1328
1335
|
return NArray with cast to the type of self.
|
1329
1336
|
@overload coerce_cast(type)
|
1330
|
-
|
1337
|
+
@return [nil]
|
1331
1338
|
*/
|
1332
1339
|
static VALUE scomplex_coerce_cast(VALUE self, VALUE type) {
|
1333
1340
|
return Qnil;
|
@@ -1362,7 +1369,7 @@ static void iter_scomplex_to_a(na_loop_t* const lp) {
|
|
1362
1369
|
/*
|
1363
1370
|
Convert self to Array.
|
1364
1371
|
@overload to_a
|
1365
|
-
|
1372
|
+
@return [Array]
|
1366
1373
|
*/
|
1367
1374
|
static VALUE scomplex_to_a(VALUE self) {
|
1368
1375
|
ndfunc_arg_in_t ain[3] = { { Qnil, 0 }, { sym_loop_opt }, { sym_option } };
|
@@ -1395,8 +1402,8 @@ static void iter_scomplex_fill(na_loop_t* const lp) {
|
|
1395
1402
|
/*
|
1396
1403
|
Fill elements with other.
|
1397
1404
|
@overload fill other
|
1398
|
-
|
1399
|
-
|
1405
|
+
@param [Numeric] other
|
1406
|
+
@return [Numo::SComplex] self.
|
1400
1407
|
*/
|
1401
1408
|
static VALUE scomplex_fill(VALUE self, VALUE val) {
|
1402
1409
|
ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { sym_option } };
|
@@ -1449,8 +1456,8 @@ static void iter_scomplex_format(na_loop_t* const lp) {
|
|
1449
1456
|
/*
|
1450
1457
|
Format elements into strings.
|
1451
1458
|
@overload format format
|
1452
|
-
|
1453
|
-
|
1459
|
+
@param [String] format
|
1460
|
+
@return [Numo::RObject] array of formatted strings.
|
1454
1461
|
*/
|
1455
1462
|
static VALUE scomplex_format(int argc, VALUE* argv, VALUE self) {
|
1456
1463
|
VALUE fmt = Qnil;
|
@@ -1496,8 +1503,8 @@ static void iter_scomplex_format_to_a(na_loop_t* const lp) {
|
|
1496
1503
|
/*
|
1497
1504
|
Format elements into strings.
|
1498
1505
|
@overload format_to_a format
|
1499
|
-
|
1500
|
-
|
1506
|
+
@param [String] format
|
1507
|
+
@return [Array] array of formatted strings.
|
1501
1508
|
*/
|
1502
1509
|
static VALUE scomplex_format_to_a(int argc, VALUE* argv, VALUE self) {
|
1503
1510
|
VALUE fmt = Qnil;
|
@@ -1516,7 +1523,7 @@ static VALUE iter_scomplex_inspect(char* ptr, size_t pos, VALUE fmt) {
|
|
1516
1523
|
/*
|
1517
1524
|
Returns a string containing a human-readable representation of NArray.
|
1518
1525
|
@overload inspect
|
1519
|
-
|
1526
|
+
@return [String]
|
1520
1527
|
*/
|
1521
1528
|
static VALUE scomplex_inspect(VALUE ary) {
|
1522
1529
|
return na_ndloop_inspect(ary, iter_scomplex_inspect, Qnil);
|
@@ -1550,9 +1557,9 @@ static void iter_scomplex_each(na_loop_t* const lp) {
|
|
1550
1557
|
Calls the given block once for each element in self,
|
1551
1558
|
passing that element as a parameter.
|
1552
1559
|
@overload each
|
1553
|
-
|
1554
|
-
|
1555
|
-
|
1560
|
+
@return [Numo::NArray] self
|
1561
|
+
For a block `{|x| ... }`,
|
1562
|
+
@yieldparam [Numeric] x an element of NArray.
|
1556
1563
|
@see #each_with_index
|
1557
1564
|
@see #map
|
1558
1565
|
*/
|
@@ -1629,7 +1636,7 @@ static void iter_scomplex_map(na_loop_t* const lp) {
|
|
1629
1636
|
/*
|
1630
1637
|
Unary map.
|
1631
1638
|
@overload map
|
1632
|
-
|
1639
|
+
@return [Numo::SComplex] map of self.
|
1633
1640
|
*/
|
1634
1641
|
static VALUE scomplex_map(VALUE self) {
|
1635
1642
|
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
@@ -1688,10 +1695,10 @@ static void iter_scomplex_each_with_index(na_loop_t* const lp) {
|
|
1688
1695
|
Invokes the given block once for each element of self,
|
1689
1696
|
passing that element and indices along each axis as parameters.
|
1690
1697
|
@overload each_with_index
|
1691
|
-
|
1692
|
-
|
1693
|
-
|
1694
|
-
|
1698
|
+
For a block `{|x,i,j,...| ... }`,
|
1699
|
+
@yieldparam [Numeric] x an element
|
1700
|
+
@yieldparam [Integer] i,j,... multitimensional indices
|
1701
|
+
@return [Numo::NArray] self
|
1695
1702
|
@see #each
|
1696
1703
|
@see #map_with_index
|
1697
1704
|
*/
|
@@ -1779,10 +1786,10 @@ static void iter_scomplex_map_with_index(na_loop_t* const lp) {
|
|
1779
1786
|
Creates a new NArray containing the values returned by the block.
|
1780
1787
|
Inplace option is allowed, i.e., `nary.inplace.map` overwrites `nary`.
|
1781
1788
|
@overload map_with_index
|
1782
|
-
|
1783
|
-
|
1784
|
-
|
1785
|
-
|
1789
|
+
For a block `{|x,i,j,...| ... }`,
|
1790
|
+
@yieldparam [Numeric] x an element
|
1791
|
+
@yieldparam [Integer] i,j,... multitimensional indices
|
1792
|
+
@return [Numo::NArray] mapped array
|
1786
1793
|
@see #map
|
1787
1794
|
@see #each_with_index
|
1788
1795
|
*/
|
@@ -1838,7 +1845,7 @@ static void iter_scomplex_abs(na_loop_t* const lp) {
|
|
1838
1845
|
/*
|
1839
1846
|
abs of self.
|
1840
1847
|
@overload abs
|
1841
|
-
|
1848
|
+
@return [Numo::SFloat] abs of self.
|
1842
1849
|
*/
|
1843
1850
|
static VALUE scomplex_abs(VALUE self) {
|
1844
1851
|
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
@@ -1848,7 +1855,7 @@ static VALUE scomplex_abs(VALUE self) {
|
|
1848
1855
|
return na_ndloop(&ndf, 1, self);
|
1849
1856
|
}
|
1850
1857
|
|
1851
|
-
#define check_intdivzero(y)
|
1858
|
+
#define check_intdivzero(y) \
|
1852
1859
|
{}
|
1853
1860
|
|
1854
1861
|
static void iter_scomplex_add(na_loop_t* const lp) {
|
@@ -1950,8 +1957,8 @@ static VALUE scomplex_add_self(VALUE self, VALUE other) {
|
|
1950
1957
|
/*
|
1951
1958
|
Binary add.
|
1952
1959
|
@overload + other
|
1953
|
-
|
1954
|
-
|
1960
|
+
@param [Numo::NArray,Numeric] other
|
1961
|
+
@return [Numo::NArray] self + other
|
1955
1962
|
*/
|
1956
1963
|
static VALUE scomplex_add(VALUE self, VALUE other) {
|
1957
1964
|
|
@@ -1966,7 +1973,7 @@ static VALUE scomplex_add(VALUE self, VALUE other) {
|
|
1966
1973
|
}
|
1967
1974
|
}
|
1968
1975
|
|
1969
|
-
#define check_intdivzero(y)
|
1976
|
+
#define check_intdivzero(y) \
|
1970
1977
|
{}
|
1971
1978
|
|
1972
1979
|
static void iter_scomplex_sub(na_loop_t* const lp) {
|
@@ -2068,8 +2075,8 @@ static VALUE scomplex_sub_self(VALUE self, VALUE other) {
|
|
2068
2075
|
/*
|
2069
2076
|
Binary sub.
|
2070
2077
|
@overload - other
|
2071
|
-
|
2072
|
-
|
2078
|
+
@param [Numo::NArray,Numeric] other
|
2079
|
+
@return [Numo::NArray] self - other
|
2073
2080
|
*/
|
2074
2081
|
static VALUE scomplex_sub(VALUE self, VALUE other) {
|
2075
2082
|
|
@@ -2084,7 +2091,7 @@ static VALUE scomplex_sub(VALUE self, VALUE other) {
|
|
2084
2091
|
}
|
2085
2092
|
}
|
2086
2093
|
|
2087
|
-
#define check_intdivzero(y)
|
2094
|
+
#define check_intdivzero(y) \
|
2088
2095
|
{}
|
2089
2096
|
|
2090
2097
|
static void iter_scomplex_mul(na_loop_t* const lp) {
|
@@ -2186,8 +2193,8 @@ static VALUE scomplex_mul_self(VALUE self, VALUE other) {
|
|
2186
2193
|
/*
|
2187
2194
|
Binary mul.
|
2188
2195
|
@overload * other
|
2189
|
-
|
2190
|
-
|
2196
|
+
@param [Numo::NArray,Numeric] other
|
2197
|
+
@return [Numo::NArray] self * other
|
2191
2198
|
*/
|
2192
2199
|
static VALUE scomplex_mul(VALUE self, VALUE other) {
|
2193
2200
|
|
@@ -2202,7 +2209,7 @@ static VALUE scomplex_mul(VALUE self, VALUE other) {
|
|
2202
2209
|
}
|
2203
2210
|
}
|
2204
2211
|
|
2205
|
-
#define check_intdivzero(y)
|
2212
|
+
#define check_intdivzero(y) \
|
2206
2213
|
{}
|
2207
2214
|
|
2208
2215
|
static void iter_scomplex_div(na_loop_t* const lp) {
|
@@ -2304,8 +2311,8 @@ static VALUE scomplex_div_self(VALUE self, VALUE other) {
|
|
2304
2311
|
/*
|
2305
2312
|
Binary div.
|
2306
2313
|
@overload / other
|
2307
|
-
|
2308
|
-
|
2314
|
+
@param [Numo::NArray,Numeric] other
|
2315
|
+
@return [Numo::NArray] self / other
|
2309
2316
|
*/
|
2310
2317
|
static VALUE scomplex_div(VALUE self, VALUE other) {
|
2311
2318
|
|
@@ -2373,8 +2380,8 @@ static VALUE scomplex_pow_self(VALUE self, VALUE other) {
|
|
2373
2380
|
/*
|
2374
2381
|
Binary power.
|
2375
2382
|
@overload ** other
|
2376
|
-
|
2377
|
-
|
2383
|
+
@param [Numo::NArray,Numeric] other
|
2384
|
+
@return [Numo::NArray] self to the other-th power.
|
2378
2385
|
*/
|
2379
2386
|
static VALUE scomplex_pow(VALUE self, VALUE other) {
|
2380
2387
|
|
@@ -2453,7 +2460,7 @@ static void iter_scomplex_minus(na_loop_t* const lp) {
|
|
2453
2460
|
/*
|
2454
2461
|
Unary minus.
|
2455
2462
|
@overload -@
|
2456
|
-
|
2463
|
+
@return [Numo::SComplex] minus of self.
|
2457
2464
|
*/
|
2458
2465
|
static VALUE scomplex_minus(VALUE self) {
|
2459
2466
|
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
@@ -2528,7 +2535,7 @@ static void iter_scomplex_reciprocal(na_loop_t* const lp) {
|
|
2528
2535
|
/*
|
2529
2536
|
Unary reciprocal.
|
2530
2537
|
@overload reciprocal
|
2531
|
-
|
2538
|
+
@return [Numo::SComplex] reciprocal of self.
|
2532
2539
|
*/
|
2533
2540
|
static VALUE scomplex_reciprocal(VALUE self) {
|
2534
2541
|
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
@@ -2603,7 +2610,7 @@ static void iter_scomplex_sign(na_loop_t* const lp) {
|
|
2603
2610
|
/*
|
2604
2611
|
Unary sign.
|
2605
2612
|
@overload sign
|
2606
|
-
|
2613
|
+
@return [Numo::SComplex] sign of self.
|
2607
2614
|
*/
|
2608
2615
|
static VALUE scomplex_sign(VALUE self) {
|
2609
2616
|
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
@@ -2678,7 +2685,7 @@ static void iter_scomplex_square(na_loop_t* const lp) {
|
|
2678
2685
|
/*
|
2679
2686
|
Unary square.
|
2680
2687
|
@overload square
|
2681
|
-
|
2688
|
+
@return [Numo::SComplex] square of self.
|
2682
2689
|
*/
|
2683
2690
|
static VALUE scomplex_square(VALUE self) {
|
2684
2691
|
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
@@ -2753,7 +2760,7 @@ static void iter_scomplex_conj(na_loop_t* const lp) {
|
|
2753
2760
|
/*
|
2754
2761
|
Unary conj.
|
2755
2762
|
@overload conj
|
2756
|
-
|
2763
|
+
@return [Numo::SComplex] conj of self.
|
2757
2764
|
*/
|
2758
2765
|
static VALUE scomplex_conj(VALUE self) {
|
2759
2766
|
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
@@ -2828,7 +2835,7 @@ static void iter_scomplex_im(na_loop_t* const lp) {
|
|
2828
2835
|
/*
|
2829
2836
|
Unary im.
|
2830
2837
|
@overload im
|
2831
|
-
|
2838
|
+
@return [Numo::SComplex] im of self.
|
2832
2839
|
*/
|
2833
2840
|
static VALUE scomplex_im(VALUE self) {
|
2834
2841
|
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
@@ -2882,7 +2889,7 @@ static void iter_scomplex_real(na_loop_t* const lp) {
|
|
2882
2889
|
/*
|
2883
2890
|
real of self.
|
2884
2891
|
@overload real
|
2885
|
-
|
2892
|
+
@return [Numo::SFloat] real of self.
|
2886
2893
|
*/
|
2887
2894
|
static VALUE scomplex_real(VALUE self) {
|
2888
2895
|
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
@@ -2936,7 +2943,7 @@ static void iter_scomplex_imag(na_loop_t* const lp) {
|
|
2936
2943
|
/*
|
2937
2944
|
imag of self.
|
2938
2945
|
@overload imag
|
2939
|
-
|
2946
|
+
@return [Numo::SFloat] imag of self.
|
2940
2947
|
*/
|
2941
2948
|
static VALUE scomplex_imag(VALUE self) {
|
2942
2949
|
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
@@ -2990,7 +2997,7 @@ static void iter_scomplex_arg(na_loop_t* const lp) {
|
|
2990
2997
|
/*
|
2991
2998
|
arg of self.
|
2992
2999
|
@overload arg
|
2993
|
-
|
3000
|
+
@return [Numo::SFloat] arg of self.
|
2994
3001
|
*/
|
2995
3002
|
static VALUE scomplex_arg(VALUE self) {
|
2996
3003
|
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
@@ -3138,8 +3145,8 @@ static VALUE scomplex_eq_self(VALUE self, VALUE other) {
|
|
3138
3145
|
/*
|
3139
3146
|
Comparison eq other.
|
3140
3147
|
@overload eq other
|
3141
|
-
|
3142
|
-
|
3148
|
+
@param [Numo::NArray,Numeric] other
|
3149
|
+
@return [Numo::Bit] result of self eq other.
|
3143
3150
|
*/
|
3144
3151
|
static VALUE scomplex_eq(VALUE self, VALUE other) {
|
3145
3152
|
|
@@ -3185,8 +3192,8 @@ static VALUE scomplex_ne_self(VALUE self, VALUE other) {
|
|
3185
3192
|
/*
|
3186
3193
|
Comparison ne other.
|
3187
3194
|
@overload ne other
|
3188
|
-
|
3189
|
-
|
3195
|
+
@param [Numo::NArray,Numeric] other
|
3196
|
+
@return [Numo::Bit] result of self ne other.
|
3190
3197
|
*/
|
3191
3198
|
static VALUE scomplex_ne(VALUE self, VALUE other) {
|
3192
3199
|
|
@@ -3232,8 +3239,8 @@ static VALUE scomplex_nearly_eq_self(VALUE self, VALUE other) {
|
|
3232
3239
|
/*
|
3233
3240
|
Comparison nearly_eq other.
|
3234
3241
|
@overload nearly_eq other
|
3235
|
-
|
3236
|
-
|
3242
|
+
@param [Numo::NArray,Numeric] other
|
3243
|
+
@return [Numo::Bit] result of self nearly_eq other.
|
3237
3244
|
*/
|
3238
3245
|
static VALUE scomplex_nearly_eq(VALUE self, VALUE other) {
|
3239
3246
|
|
@@ -3312,7 +3319,7 @@ static void iter_scomplex_floor(na_loop_t* const lp) {
|
|
3312
3319
|
/*
|
3313
3320
|
Unary floor.
|
3314
3321
|
@overload floor
|
3315
|
-
|
3322
|
+
@return [Numo::SComplex] floor of self.
|
3316
3323
|
*/
|
3317
3324
|
static VALUE scomplex_floor(VALUE self) {
|
3318
3325
|
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
@@ -3387,7 +3394,7 @@ static void iter_scomplex_round(na_loop_t* const lp) {
|
|
3387
3394
|
/*
|
3388
3395
|
Unary round.
|
3389
3396
|
@overload round
|
3390
|
-
|
3397
|
+
@return [Numo::SComplex] round of self.
|
3391
3398
|
*/
|
3392
3399
|
static VALUE scomplex_round(VALUE self) {
|
3393
3400
|
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
@@ -3462,7 +3469,7 @@ static void iter_scomplex_ceil(na_loop_t* const lp) {
|
|
3462
3469
|
/*
|
3463
3470
|
Unary ceil.
|
3464
3471
|
@overload ceil
|
3465
|
-
|
3472
|
+
@return [Numo::SComplex] ceil of self.
|
3466
3473
|
*/
|
3467
3474
|
static VALUE scomplex_ceil(VALUE self) {
|
3468
3475
|
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
@@ -3537,7 +3544,7 @@ static void iter_scomplex_trunc(na_loop_t* const lp) {
|
|
3537
3544
|
/*
|
3538
3545
|
Unary trunc.
|
3539
3546
|
@overload trunc
|
3540
|
-
|
3547
|
+
@return [Numo::SComplex] trunc of self.
|
3541
3548
|
*/
|
3542
3549
|
static VALUE scomplex_trunc(VALUE self) {
|
3543
3550
|
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
@@ -3612,7 +3619,7 @@ static void iter_scomplex_rint(na_loop_t* const lp) {
|
|
3612
3619
|
/*
|
3613
3620
|
Unary rint.
|
3614
3621
|
@overload rint
|
3615
|
-
|
3622
|
+
@return [Numo::SComplex] rint of self.
|
3616
3623
|
*/
|
3617
3624
|
static VALUE scomplex_rint(VALUE self) {
|
3618
3625
|
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
@@ -3622,7 +3629,7 @@ static VALUE scomplex_rint(VALUE self) {
|
|
3622
3629
|
return na_ndloop(&ndf, 1, self);
|
3623
3630
|
}
|
3624
3631
|
|
3625
|
-
#define check_intdivzero(y)
|
3632
|
+
#define check_intdivzero(y) \
|
3626
3633
|
{}
|
3627
3634
|
|
3628
3635
|
static void iter_scomplex_copysign(na_loop_t* const lp) {
|
@@ -3724,8 +3731,8 @@ static VALUE scomplex_copysign_self(VALUE self, VALUE other) {
|
|
3724
3731
|
/*
|
3725
3732
|
Binary copysign.
|
3726
3733
|
@overload copysign other
|
3727
|
-
|
3728
|
-
|
3734
|
+
@param [Numo::NArray,Numeric] other
|
3735
|
+
@return [Numo::NArray] self copysign other
|
3729
3736
|
*/
|
3730
3737
|
static VALUE scomplex_copysign(VALUE self, VALUE other) {
|
3731
3738
|
|
@@ -3772,7 +3779,7 @@ static void iter_scomplex_isnan(na_loop_t* const lp) {
|
|
3772
3779
|
/*
|
3773
3780
|
Condition of isnan.
|
3774
3781
|
@overload isnan
|
3775
|
-
|
3782
|
+
@return [Numo::Bit] Condition of isnan.
|
3776
3783
|
*/
|
3777
3784
|
static VALUE scomplex_isnan(VALUE self) {
|
3778
3785
|
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
@@ -3814,7 +3821,7 @@ static void iter_scomplex_isinf(na_loop_t* const lp) {
|
|
3814
3821
|
/*
|
3815
3822
|
Condition of isinf.
|
3816
3823
|
@overload isinf
|
3817
|
-
|
3824
|
+
@return [Numo::Bit] Condition of isinf.
|
3818
3825
|
*/
|
3819
3826
|
static VALUE scomplex_isinf(VALUE self) {
|
3820
3827
|
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
@@ -3856,7 +3863,7 @@ static void iter_scomplex_isposinf(na_loop_t* const lp) {
|
|
3856
3863
|
/*
|
3857
3864
|
Condition of isposinf.
|
3858
3865
|
@overload isposinf
|
3859
|
-
|
3866
|
+
@return [Numo::Bit] Condition of isposinf.
|
3860
3867
|
*/
|
3861
3868
|
static VALUE scomplex_isposinf(VALUE self) {
|
3862
3869
|
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
@@ -3898,7 +3905,7 @@ static void iter_scomplex_isneginf(na_loop_t* const lp) {
|
|
3898
3905
|
/*
|
3899
3906
|
Condition of isneginf.
|
3900
3907
|
@overload isneginf
|
3901
|
-
|
3908
|
+
@return [Numo::Bit] Condition of isneginf.
|
3902
3909
|
*/
|
3903
3910
|
static VALUE scomplex_isneginf(VALUE self) {
|
3904
3911
|
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
@@ -3940,7 +3947,7 @@ static void iter_scomplex_isfinite(na_loop_t* const lp) {
|
|
3940
3947
|
/*
|
3941
3948
|
Condition of isfinite.
|
3942
3949
|
@overload isfinite
|
3943
|
-
|
3950
|
+
@return [Numo::Bit] Condition of isfinite.
|
3944
3951
|
*/
|
3945
3952
|
static VALUE scomplex_isfinite(VALUE self) {
|
3946
3953
|
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
@@ -3976,12 +3983,12 @@ static void iter_scomplex_sum_nan(na_loop_t* const lp) {
|
|
3976
3983
|
/*
|
3977
3984
|
sum of self.
|
3978
3985
|
@overload sum(axis:nil, keepdims:false, nan:false)
|
3979
|
-
|
3980
|
-
|
3981
|
-
|
3982
|
-
|
3983
|
-
|
3984
|
-
|
3986
|
+
@param [TrueClass] nan If true, apply NaN-aware algorithm (avoid NaN for sum/mean etc, or,
|
3987
|
+
return NaN for min/max etc).
|
3988
|
+
@param [Numeric,Array,Range] axis Performs sum along the axis.
|
3989
|
+
@param [TrueClass] keepdims If true, the reduced axes are left in the result array as
|
3990
|
+
dimensions with size one.
|
3991
|
+
@return [Numo::SComplex] returns result of sum.
|
3985
3992
|
*/
|
3986
3993
|
static VALUE scomplex_sum(int argc, VALUE* argv, VALUE self) {
|
3987
3994
|
VALUE v, reduce;
|
@@ -4022,12 +4029,12 @@ static void iter_scomplex_prod_nan(na_loop_t* const lp) {
|
|
4022
4029
|
/*
|
4023
4030
|
prod of self.
|
4024
4031
|
@overload prod(axis:nil, keepdims:false, nan:false)
|
4025
|
-
|
4026
|
-
|
4027
|
-
|
4028
|
-
|
4029
|
-
|
4030
|
-
|
4032
|
+
@param [TrueClass] nan If true, apply NaN-aware algorithm (avoid NaN for sum/mean etc, or,
|
4033
|
+
return NaN for min/max etc).
|
4034
|
+
@param [Numeric,Array,Range] axis Performs prod along the axis.
|
4035
|
+
@param [TrueClass] keepdims If true, the reduced axes are left in the result array as
|
4036
|
+
dimensions with size one.
|
4037
|
+
@return [Numo::SComplex] returns result of prod.
|
4031
4038
|
*/
|
4032
4039
|
static VALUE scomplex_prod(int argc, VALUE* argv, VALUE self) {
|
4033
4040
|
VALUE v, reduce;
|
@@ -4042,190 +4049,6 @@ static VALUE scomplex_prod(int argc, VALUE* argv, VALUE self) {
|
|
4042
4049
|
return scomplex_extract(v);
|
4043
4050
|
}
|
4044
4051
|
|
4045
|
-
static void iter_scomplex_mean(na_loop_t* const lp) {
|
4046
|
-
size_t n;
|
4047
|
-
char *p1, *p2;
|
4048
|
-
ssize_t s1;
|
4049
|
-
|
4050
|
-
INIT_COUNTER(lp, n);
|
4051
|
-
INIT_PTR(lp, 0, p1, s1);
|
4052
|
-
p2 = lp->args[1].ptr + lp->args[1].iter[0].pos;
|
4053
|
-
|
4054
|
-
*(dtype*)p2 = f_mean(n, p1, s1);
|
4055
|
-
}
|
4056
|
-
static void iter_scomplex_mean_nan(na_loop_t* const lp) {
|
4057
|
-
size_t n;
|
4058
|
-
char *p1, *p2;
|
4059
|
-
ssize_t s1;
|
4060
|
-
|
4061
|
-
INIT_COUNTER(lp, n);
|
4062
|
-
INIT_PTR(lp, 0, p1, s1);
|
4063
|
-
p2 = lp->args[1].ptr + lp->args[1].iter[0].pos;
|
4064
|
-
|
4065
|
-
*(dtype*)p2 = f_mean_nan(n, p1, s1);
|
4066
|
-
}
|
4067
|
-
|
4068
|
-
/*
|
4069
|
-
mean of self.
|
4070
|
-
@overload mean(axis:nil, keepdims:false, nan:false)
|
4071
|
-
@param [TrueClass] nan If true, apply NaN-aware algorithm (avoid NaN for sum/mean etc, or,
|
4072
|
-
return NaN for min/max etc).
|
4073
|
-
@param [Numeric,Array,Range] axis Performs mean along the axis.
|
4074
|
-
@param [TrueClass] keepdims If true, the reduced axes are left in the result array as
|
4075
|
-
dimensions with size one.
|
4076
|
-
@return [Numo::SComplex] returns result of mean.
|
4077
|
-
*/
|
4078
|
-
static VALUE scomplex_mean(int argc, VALUE* argv, VALUE self) {
|
4079
|
-
VALUE v, reduce;
|
4080
|
-
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { sym_reduce, 0 } };
|
4081
|
-
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
4082
|
-
ndfunc_t ndf = { iter_scomplex_mean, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout };
|
4083
|
-
|
4084
|
-
reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, iter_scomplex_mean_nan);
|
4085
|
-
|
4086
|
-
v = na_ndloop(&ndf, 2, self, reduce);
|
4087
|
-
|
4088
|
-
return scomplex_extract(v);
|
4089
|
-
}
|
4090
|
-
|
4091
|
-
static void iter_scomplex_stddev(na_loop_t* const lp) {
|
4092
|
-
size_t n;
|
4093
|
-
char *p1, *p2;
|
4094
|
-
ssize_t s1;
|
4095
|
-
|
4096
|
-
INIT_COUNTER(lp, n);
|
4097
|
-
INIT_PTR(lp, 0, p1, s1);
|
4098
|
-
p2 = lp->args[1].ptr + lp->args[1].iter[0].pos;
|
4099
|
-
|
4100
|
-
*(rtype*)p2 = f_stddev(n, p1, s1);
|
4101
|
-
}
|
4102
|
-
static void iter_scomplex_stddev_nan(na_loop_t* const lp) {
|
4103
|
-
size_t n;
|
4104
|
-
char *p1, *p2;
|
4105
|
-
ssize_t s1;
|
4106
|
-
|
4107
|
-
INIT_COUNTER(lp, n);
|
4108
|
-
INIT_PTR(lp, 0, p1, s1);
|
4109
|
-
p2 = lp->args[1].ptr + lp->args[1].iter[0].pos;
|
4110
|
-
|
4111
|
-
*(rtype*)p2 = f_stddev_nan(n, p1, s1);
|
4112
|
-
}
|
4113
|
-
|
4114
|
-
/*
|
4115
|
-
stddev of self.
|
4116
|
-
@overload stddev(axis:nil, keepdims:false, nan:false)
|
4117
|
-
@param [TrueClass] nan If true, apply NaN-aware algorithm (avoid NaN for sum/mean etc, or,
|
4118
|
-
return NaN for min/max etc).
|
4119
|
-
@param [Numeric,Array,Range] axis Performs stddev along the axis.
|
4120
|
-
@param [TrueClass] keepdims If true, the reduced axes are left in the result array as
|
4121
|
-
dimensions with size one.
|
4122
|
-
@return [Numo::SComplex] returns result of stddev.
|
4123
|
-
*/
|
4124
|
-
static VALUE scomplex_stddev(int argc, VALUE* argv, VALUE self) {
|
4125
|
-
VALUE v, reduce;
|
4126
|
-
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { sym_reduce, 0 } };
|
4127
|
-
ndfunc_arg_out_t aout[1] = { { cRT, 0 } };
|
4128
|
-
ndfunc_t ndf = { iter_scomplex_stddev, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout };
|
4129
|
-
|
4130
|
-
reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, iter_scomplex_stddev_nan);
|
4131
|
-
|
4132
|
-
v = na_ndloop(&ndf, 2, self, reduce);
|
4133
|
-
|
4134
|
-
return rb_funcall(v, rb_intern("extract"), 0);
|
4135
|
-
}
|
4136
|
-
|
4137
|
-
static void iter_scomplex_var(na_loop_t* const lp) {
|
4138
|
-
size_t n;
|
4139
|
-
char *p1, *p2;
|
4140
|
-
ssize_t s1;
|
4141
|
-
|
4142
|
-
INIT_COUNTER(lp, n);
|
4143
|
-
INIT_PTR(lp, 0, p1, s1);
|
4144
|
-
p2 = lp->args[1].ptr + lp->args[1].iter[0].pos;
|
4145
|
-
|
4146
|
-
*(rtype*)p2 = f_var(n, p1, s1);
|
4147
|
-
}
|
4148
|
-
static void iter_scomplex_var_nan(na_loop_t* const lp) {
|
4149
|
-
size_t n;
|
4150
|
-
char *p1, *p2;
|
4151
|
-
ssize_t s1;
|
4152
|
-
|
4153
|
-
INIT_COUNTER(lp, n);
|
4154
|
-
INIT_PTR(lp, 0, p1, s1);
|
4155
|
-
p2 = lp->args[1].ptr + lp->args[1].iter[0].pos;
|
4156
|
-
|
4157
|
-
*(rtype*)p2 = f_var_nan(n, p1, s1);
|
4158
|
-
}
|
4159
|
-
|
4160
|
-
/*
|
4161
|
-
var of self.
|
4162
|
-
@overload var(axis:nil, keepdims:false, nan:false)
|
4163
|
-
@param [TrueClass] nan If true, apply NaN-aware algorithm (avoid NaN for sum/mean etc, or,
|
4164
|
-
return NaN for min/max etc).
|
4165
|
-
@param [Numeric,Array,Range] axis Performs var along the axis.
|
4166
|
-
@param [TrueClass] keepdims If true, the reduced axes are left in the result array as
|
4167
|
-
dimensions with size one.
|
4168
|
-
@return [Numo::SComplex] returns result of var.
|
4169
|
-
*/
|
4170
|
-
static VALUE scomplex_var(int argc, VALUE* argv, VALUE self) {
|
4171
|
-
VALUE v, reduce;
|
4172
|
-
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { sym_reduce, 0 } };
|
4173
|
-
ndfunc_arg_out_t aout[1] = { { cRT, 0 } };
|
4174
|
-
ndfunc_t ndf = { iter_scomplex_var, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout };
|
4175
|
-
|
4176
|
-
reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, iter_scomplex_var_nan);
|
4177
|
-
|
4178
|
-
v = na_ndloop(&ndf, 2, self, reduce);
|
4179
|
-
|
4180
|
-
return rb_funcall(v, rb_intern("extract"), 0);
|
4181
|
-
}
|
4182
|
-
|
4183
|
-
static void iter_scomplex_rms(na_loop_t* const lp) {
|
4184
|
-
size_t n;
|
4185
|
-
char *p1, *p2;
|
4186
|
-
ssize_t s1;
|
4187
|
-
|
4188
|
-
INIT_COUNTER(lp, n);
|
4189
|
-
INIT_PTR(lp, 0, p1, s1);
|
4190
|
-
p2 = lp->args[1].ptr + lp->args[1].iter[0].pos;
|
4191
|
-
|
4192
|
-
*(rtype*)p2 = f_rms(n, p1, s1);
|
4193
|
-
}
|
4194
|
-
static void iter_scomplex_rms_nan(na_loop_t* const lp) {
|
4195
|
-
size_t n;
|
4196
|
-
char *p1, *p2;
|
4197
|
-
ssize_t s1;
|
4198
|
-
|
4199
|
-
INIT_COUNTER(lp, n);
|
4200
|
-
INIT_PTR(lp, 0, p1, s1);
|
4201
|
-
p2 = lp->args[1].ptr + lp->args[1].iter[0].pos;
|
4202
|
-
|
4203
|
-
*(rtype*)p2 = f_rms_nan(n, p1, s1);
|
4204
|
-
}
|
4205
|
-
|
4206
|
-
/*
|
4207
|
-
rms of self.
|
4208
|
-
@overload rms(axis:nil, keepdims:false, nan:false)
|
4209
|
-
@param [TrueClass] nan If true, apply NaN-aware algorithm (avoid NaN for sum/mean etc, or,
|
4210
|
-
return NaN for min/max etc).
|
4211
|
-
@param [Numeric,Array,Range] axis Performs rms along the axis.
|
4212
|
-
@param [TrueClass] keepdims If true, the reduced axes are left in the result array as
|
4213
|
-
dimensions with size one.
|
4214
|
-
@return [Numo::SComplex] returns result of rms.
|
4215
|
-
*/
|
4216
|
-
static VALUE scomplex_rms(int argc, VALUE* argv, VALUE self) {
|
4217
|
-
VALUE v, reduce;
|
4218
|
-
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { sym_reduce, 0 } };
|
4219
|
-
ndfunc_arg_out_t aout[1] = { { cRT, 0 } };
|
4220
|
-
ndfunc_t ndf = { iter_scomplex_rms, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout };
|
4221
|
-
|
4222
|
-
reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, iter_scomplex_rms_nan);
|
4223
|
-
|
4224
|
-
v = na_ndloop(&ndf, 2, self, reduce);
|
4225
|
-
|
4226
|
-
return rb_funcall(v, rb_intern("extract"), 0);
|
4227
|
-
}
|
4228
|
-
|
4229
4052
|
static void iter_scomplex_cumsum(na_loop_t* const lp) {
|
4230
4053
|
size_t i;
|
4231
4054
|
char *p1, *p2;
|
@@ -4266,9 +4089,9 @@ static void iter_scomplex_cumsum_nan(na_loop_t* const lp) {
|
|
4266
4089
|
/*
|
4267
4090
|
cumsum of self.
|
4268
4091
|
@overload cumsum(axis:nil, nan:false)
|
4269
|
-
|
4270
|
-
|
4271
|
-
|
4092
|
+
@param [Numeric,Array,Range] axis Performs cumsum along the axis.
|
4093
|
+
@param [TrueClass] nan If true, apply NaN-aware algorithm (avoid NaN if exists).
|
4094
|
+
@return [Numo::SComplex] cumsum of self.
|
4272
4095
|
*/
|
4273
4096
|
static VALUE scomplex_cumsum(int argc, VALUE* argv, VALUE self) {
|
4274
4097
|
VALUE reduce;
|
@@ -4323,9 +4146,9 @@ static void iter_scomplex_cumprod_nan(na_loop_t* const lp) {
|
|
4323
4146
|
/*
|
4324
4147
|
cumprod of self.
|
4325
4148
|
@overload cumprod(axis:nil, nan:false)
|
4326
|
-
|
4327
|
-
|
4328
|
-
|
4149
|
+
@param [Numeric,Array,Range] axis Performs cumprod along the axis.
|
4150
|
+
@param [TrueClass] nan If true, apply NaN-aware algorithm (avoid NaN if exists).
|
4151
|
+
@return [Numo::SComplex] cumprod of self.
|
4329
4152
|
*/
|
4330
4153
|
static VALUE scomplex_cumprod(int argc, VALUE* argv, VALUE self) {
|
4331
4154
|
VALUE reduce;
|
@@ -4435,12 +4258,12 @@ static VALUE scomplex_mulsum_self(int argc, VALUE* argv, VALUE self) {
|
|
4435
4258
|
Binary mulsum.
|
4436
4259
|
|
4437
4260
|
@overload mulsum(other, axis:nil, keepdims:false, nan:false)
|
4438
|
-
|
4439
|
-
|
4440
|
-
|
4441
|
-
|
4442
|
-
|
4443
|
-
|
4261
|
+
@param [Numo::NArray,Numeric] other
|
4262
|
+
@param [Numeric,Array,Range] axis Performs mulsum along the axis.
|
4263
|
+
@param [TrueClass] keepdims (keyword) If true, the reduced axes are left in the result array
|
4264
|
+
as dimensions with size one.
|
4265
|
+
@param [TrueClass] nan (keyword) If true, apply NaN-aware algorithm (avoid NaN if exists).
|
4266
|
+
@return [Numo::NArray] mulsum of self and other.
|
4444
4267
|
*/
|
4445
4268
|
static VALUE scomplex_mulsum(int argc, VALUE* argv, VALUE self) {
|
4446
4269
|
//
|
@@ -4509,9 +4332,9 @@ static void iter_scomplex_seq(na_loop_t* const lp) {
|
|
4509
4332
|
beg+i*step
|
4510
4333
|
where i is 1-dimensional index.
|
4511
4334
|
@overload seq([beg,[step]])
|
4512
|
-
|
4513
|
-
|
4514
|
-
|
4335
|
+
@param [Numeric] beg beginning of sequence. (default=0)
|
4336
|
+
@param [Numeric] step step of sequence. (default=1)
|
4337
|
+
@return [Numo::SComplex] self.
|
4515
4338
|
@example
|
4516
4339
|
Numo::DFloat.new(6).seq(1,-0.2)
|
4517
4340
|
# => Numo::DFloat#shape=[6]
|
@@ -4521,7 +4344,7 @@ static void iter_scomplex_seq(na_loop_t* const lp) {
|
|
4521
4344
|
# => Numo::DComplex#shape=[6]
|
4522
4345
|
# [1+0i, 0.8+0.2i, 0.6+0.4i, 0.4+0.6i, 0.2+0.8i, 0+1i]
|
4523
4346
|
*/
|
4524
|
-
static VALUE scomplex_seq(int argc, VALUE*
|
4347
|
+
static VALUE scomplex_seq(int argc, VALUE* argv, VALUE self) {
|
4525
4348
|
seq_opt_t* g;
|
4526
4349
|
VALUE vbeg = Qnil, vstep = Qnil;
|
4527
4350
|
ndfunc_arg_in_t ain[1] = { { OVERWRITE, 0 } };
|
@@ -4531,7 +4354,7 @@ static VALUE scomplex_seq(int argc, VALUE* args, VALUE self) {
|
|
4531
4354
|
g->beg = m_zero;
|
4532
4355
|
g->step = m_one;
|
4533
4356
|
g->count = 0;
|
4534
|
-
rb_scan_args(argc,
|
4357
|
+
rb_scan_args(argc, argv, "02", &vbeg, &vstep);
|
4535
4358
|
if (vbeg != Qnil) {
|
4536
4359
|
g->beg = m_num_to_data(vbeg);
|
4537
4360
|
}
|
@@ -4590,10 +4413,10 @@ static void iter_scomplex_logseq(na_loop_t* const lp) {
|
|
4590
4413
|
Applicable classes: DFloat, SFloat, DComplex, SCopmplex.
|
4591
4414
|
|
4592
4415
|
@overload logseq(beg,step,[base])
|
4593
|
-
|
4594
|
-
|
4595
|
-
|
4596
|
-
|
4416
|
+
@param [Numeric] beg The beginning of sequence.
|
4417
|
+
@param [Numeric] step The step of sequence.
|
4418
|
+
@param [Numeric] base The base of log space. (default=10)
|
4419
|
+
@return [Numo::SComplex] self.
|
4597
4420
|
|
4598
4421
|
@example
|
4599
4422
|
Numo::DFloat.new(5).logseq(4,-1,2)
|
@@ -4604,14 +4427,14 @@ static void iter_scomplex_logseq(na_loop_t* const lp) {
|
|
4604
4427
|
# => Numo::DComplex#shape=[5]
|
4605
4428
|
# [1+7.26156e-310i, 0.5+0.866025i, -0.5+0.866025i, -1+1.22465e-16i, ...]
|
4606
4429
|
*/
|
4607
|
-
static VALUE scomplex_logseq(int argc, VALUE*
|
4430
|
+
static VALUE scomplex_logseq(int argc, VALUE* argv, VALUE self) {
|
4608
4431
|
logseq_opt_t* g;
|
4609
4432
|
VALUE vbeg, vstep, vbase;
|
4610
4433
|
ndfunc_arg_in_t ain[1] = { { OVERWRITE, 0 } };
|
4611
4434
|
ndfunc_t ndf = { iter_scomplex_logseq, FULL_LOOP, 1, 0, ain, 0 };
|
4612
4435
|
|
4613
4436
|
g = ALLOCA_N(logseq_opt_t, 1);
|
4614
|
-
rb_scan_args(argc,
|
4437
|
+
rb_scan_args(argc, argv, "21", &vbeg, &vstep, &vbase);
|
4615
4438
|
g->beg = m_num_to_data(vbeg);
|
4616
4439
|
g->step = m_num_to_data(vstep);
|
4617
4440
|
if (vbase == Qnil) {
|
@@ -4655,11 +4478,11 @@ static void iter_scomplex_eye(na_loop_t* const lp) {
|
|
4655
4478
|
/*
|
4656
4479
|
Eye: Set a value to diagonal components, set 0 to non-diagonal components.
|
4657
4480
|
@overload eye([element,offset])
|
4658
|
-
|
4659
|
-
|
4660
|
-
|
4661
|
-
|
4662
|
-
|
4481
|
+
@param [Numeric] element Diagonal element to be stored. Default is 1.
|
4482
|
+
@param [Integer] offset Diagonal offset from the main diagonal. The
|
4483
|
+
default is 0. k>0 for diagonals above the main diagonal, and k<0
|
4484
|
+
for diagonals below the main diagonal.
|
4485
|
+
@return [Numo::SComplex] eye of self.
|
4663
4486
|
*/
|
4664
4487
|
static VALUE scomplex_eye(int argc, VALUE* argv, VALUE self) {
|
4665
4488
|
ndfunc_arg_in_t ain[1] = { { OVERWRITE, 2 } };
|
@@ -4756,10 +4579,10 @@ static void iter_scomplex_rand(na_loop_t* const lp) {
|
|
4756
4579
|
/*
|
4757
4580
|
Generate uniformly distributed random numbers on self narray.
|
4758
4581
|
@overload rand([[low],high])
|
4759
|
-
|
4760
|
-
|
4761
|
-
|
4762
|
-
|
4582
|
+
@param [Numeric] low lower inclusive boundary of random numbers. (default=0)
|
4583
|
+
@param [Numeric] high upper exclusive boundary of random numbers. (default=1 or 1+1i for
|
4584
|
+
complex types)
|
4585
|
+
@return [Numo::SComplex] self.
|
4763
4586
|
@example
|
4764
4587
|
Numo::DFloat.new(6).rand
|
4765
4588
|
# => Numo::DFloat#shape=[6]
|
@@ -4773,14 +4596,14 @@ static void iter_scomplex_rand(na_loop_t* const lp) {
|
|
4773
4596
|
# => Numo::Int32#shape=[6]
|
4774
4597
|
# [4, 3, 3, 2, 4, 2]
|
4775
4598
|
*/
|
4776
|
-
static VALUE scomplex_rand(int argc, VALUE*
|
4599
|
+
static VALUE scomplex_rand(int argc, VALUE* argv, VALUE self) {
|
4777
4600
|
rand_opt_t g;
|
4778
4601
|
VALUE v1 = Qnil, v2 = Qnil;
|
4779
4602
|
dtype high;
|
4780
4603
|
ndfunc_arg_in_t ain[1] = { { OVERWRITE, 0 } };
|
4781
4604
|
ndfunc_t ndf = { iter_scomplex_rand, FULL_LOOP, 1, 0, ain, 0 };
|
4782
4605
|
|
4783
|
-
rb_scan_args(argc,
|
4606
|
+
rb_scan_args(argc, argv, "02", &v1, &v2);
|
4784
4607
|
if (v2 == Qnil) {
|
4785
4608
|
g.low = m_zero;
|
4786
4609
|
if (v1 == Qnil) {
|
@@ -4845,41 +4668,20 @@ static void iter_scomplex_rand_norm(na_loop_t* const lp) {
|
|
4845
4668
|
/*
|
4846
4669
|
Generates random numbers from the normal distribution on self narray
|
4847
4670
|
using Box-Muller Transformation.
|
4671
|
+
|
4848
4672
|
@overload rand_norm([mu,[sigma]])
|
4849
|
-
|
4850
|
-
|
4851
|
-
|
4852
|
-
@example
|
4853
|
-
Numo::DFloat.new(5,5).rand_norm
|
4854
|
-
# => Numo::DFloat#shape=[5,5]
|
4855
|
-
# [[-0.581255, -0.168354, 0.586895, -0.595142, -0.802802],
|
4856
|
-
# [-0.326106, 0.282922, 1.68427, 0.918499, -0.0485384],
|
4857
|
-
# [-0.464453, -0.992194, 0.413794, -0.60717, -0.699695],
|
4858
|
-
# [-1.64168, 0.48676, -0.875871, -1.43275, 0.812172],
|
4859
|
-
# [-0.209975, -0.103612, -0.878617, -1.42495, 1.0968]]
|
4860
|
-
|
4861
|
-
Numo::DFloat.new(5,5).rand_norm(10,0.1)
|
4862
|
-
# => Numo::DFloat#shape=[5,5]
|
4863
|
-
# [[9.9019, 9.90339, 10.0826, 9.98384, 9.72861],
|
4864
|
-
# [9.81507, 10.0272, 9.91445, 10.0568, 9.88923],
|
4865
|
-
# [10.0234, 9.97874, 9.96011, 9.9006, 9.99964],
|
4866
|
-
# [10.0186, 9.94598, 9.92236, 9.99811, 9.97003],
|
4867
|
-
# [9.79266, 9.95044, 9.95212, 9.93692, 10.2027]]
|
4868
|
-
|
4869
|
-
Numo::DComplex.new(3,3).rand_norm(5+5i)
|
4870
|
-
# => Numo::DComplex#shape=[3,3]
|
4871
|
-
# [[5.84303+4.40052i, 4.00984+6.08982i, 5.10979+5.13215i],
|
4872
|
-
# [4.26477+3.99655i, 4.90052+5.00763i, 4.46607+2.3444i],
|
4873
|
-
# [4.5528+7.11003i, 5.62117+6.69094i, 5.05443+5.35133i]]
|
4673
|
+
@param [Numeric] mu mean of normal distribution. (default=0)
|
4674
|
+
@param [Numeric] sigma standard deviation of normal distribution. (default=1)
|
4675
|
+
@return [Numo::SComplex] self.
|
4874
4676
|
*/
|
4875
|
-
static VALUE scomplex_rand_norm(int argc, VALUE*
|
4677
|
+
static VALUE scomplex_rand_norm(int argc, VALUE* argv, VALUE self) {
|
4876
4678
|
int n;
|
4877
4679
|
randn_opt_t g;
|
4878
4680
|
VALUE v1 = Qnil, v2 = Qnil;
|
4879
4681
|
ndfunc_arg_in_t ain[1] = { { OVERWRITE, 0 } };
|
4880
4682
|
ndfunc_t ndf = { iter_scomplex_rand_norm, FULL_LOOP, 1, 0, ain, 0 };
|
4881
4683
|
|
4882
|
-
n = rb_scan_args(argc,
|
4684
|
+
n = rb_scan_args(argc, argv, "02", &v1, &v2);
|
4883
4685
|
if (n == 0) {
|
4884
4686
|
g.mu = m_zero;
|
4885
4687
|
} else {
|
@@ -4914,8 +4716,8 @@ static void iter_scomplex_poly(na_loop_t* const lp) {
|
|
4914
4716
|
Calculate polynomial.
|
4915
4717
|
`x.poly(a0,a1,a2,...,an) = a0 + a1*x + a2*x**2 + ... + an*x**n`
|
4916
4718
|
@overload poly a0, a1, ..., an
|
4917
|
-
|
4918
|
-
|
4719
|
+
@param [Numo::NArray,Numeric] a0,a1,...,an
|
4720
|
+
@return [Numo::SComplex]
|
4919
4721
|
*/
|
4920
4722
|
static VALUE scomplex_poly(VALUE self, VALUE args) {
|
4921
4723
|
int argc, i;
|
@@ -4940,10 +4742,6 @@ static VALUE scomplex_poly(VALUE self, VALUE args) {
|
|
4940
4742
|
return scomplex_extract(v);
|
4941
4743
|
}
|
4942
4744
|
|
4943
|
-
/*
|
4944
|
-
module definition: Numo::SComplex::NMath
|
4945
|
-
*/
|
4946
|
-
|
4947
4745
|
VALUE mTM;
|
4948
4746
|
|
4949
4747
|
static void iter_scomplex_math_s_sqrt(na_loop_t* const lp) {
|
@@ -5013,8 +4811,8 @@ static void iter_scomplex_math_s_sqrt(na_loop_t* const lp) {
|
|
5013
4811
|
/*
|
5014
4812
|
Calculate sqrt(x).
|
5015
4813
|
@overload sqrt(x)
|
5016
|
-
|
5017
|
-
|
4814
|
+
@param [Numo::NArray,Numeric] x input value
|
4815
|
+
@return [Numo::SComplex] result of sqrt(x).
|
5018
4816
|
*/
|
5019
4817
|
static VALUE scomplex_math_s_sqrt(VALUE mod, VALUE a1) {
|
5020
4818
|
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
@@ -5091,8 +4889,8 @@ static void iter_scomplex_math_s_cbrt(na_loop_t* const lp) {
|
|
5091
4889
|
/*
|
5092
4890
|
Calculate cbrt(x).
|
5093
4891
|
@overload cbrt(x)
|
5094
|
-
|
5095
|
-
|
4892
|
+
@param [Numo::NArray,Numeric] x input value
|
4893
|
+
@return [Numo::SComplex] result of cbrt(x).
|
5096
4894
|
*/
|
5097
4895
|
static VALUE scomplex_math_s_cbrt(VALUE mod, VALUE a1) {
|
5098
4896
|
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
@@ -5169,8 +4967,8 @@ static void iter_scomplex_math_s_log(na_loop_t* const lp) {
|
|
5169
4967
|
/*
|
5170
4968
|
Calculate log(x).
|
5171
4969
|
@overload log(x)
|
5172
|
-
|
5173
|
-
|
4970
|
+
@param [Numo::NArray,Numeric] x input value
|
4971
|
+
@return [Numo::SComplex] result of log(x).
|
5174
4972
|
*/
|
5175
4973
|
static VALUE scomplex_math_s_log(VALUE mod, VALUE a1) {
|
5176
4974
|
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
@@ -5247,8 +5045,8 @@ static void iter_scomplex_math_s_log2(na_loop_t* const lp) {
|
|
5247
5045
|
/*
|
5248
5046
|
Calculate log2(x).
|
5249
5047
|
@overload log2(x)
|
5250
|
-
|
5251
|
-
|
5048
|
+
@param [Numo::NArray,Numeric] x input value
|
5049
|
+
@return [Numo::SComplex] result of log2(x).
|
5252
5050
|
*/
|
5253
5051
|
static VALUE scomplex_math_s_log2(VALUE mod, VALUE a1) {
|
5254
5052
|
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
@@ -5325,8 +5123,8 @@ static void iter_scomplex_math_s_log10(na_loop_t* const lp) {
|
|
5325
5123
|
/*
|
5326
5124
|
Calculate log10(x).
|
5327
5125
|
@overload log10(x)
|
5328
|
-
|
5329
|
-
|
5126
|
+
@param [Numo::NArray,Numeric] x input value
|
5127
|
+
@return [Numo::SComplex] result of log10(x).
|
5330
5128
|
*/
|
5331
5129
|
static VALUE scomplex_math_s_log10(VALUE mod, VALUE a1) {
|
5332
5130
|
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
@@ -5403,8 +5201,8 @@ static void iter_scomplex_math_s_exp(na_loop_t* const lp) {
|
|
5403
5201
|
/*
|
5404
5202
|
Calculate exp(x).
|
5405
5203
|
@overload exp(x)
|
5406
|
-
|
5407
|
-
|
5204
|
+
@param [Numo::NArray,Numeric] x input value
|
5205
|
+
@return [Numo::SComplex] result of exp(x).
|
5408
5206
|
*/
|
5409
5207
|
static VALUE scomplex_math_s_exp(VALUE mod, VALUE a1) {
|
5410
5208
|
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
@@ -5481,8 +5279,8 @@ static void iter_scomplex_math_s_exp2(na_loop_t* const lp) {
|
|
5481
5279
|
/*
|
5482
5280
|
Calculate exp2(x).
|
5483
5281
|
@overload exp2(x)
|
5484
|
-
|
5485
|
-
|
5282
|
+
@param [Numo::NArray,Numeric] x input value
|
5283
|
+
@return [Numo::SComplex] result of exp2(x).
|
5486
5284
|
*/
|
5487
5285
|
static VALUE scomplex_math_s_exp2(VALUE mod, VALUE a1) {
|
5488
5286
|
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
@@ -5559,8 +5357,8 @@ static void iter_scomplex_math_s_exp10(na_loop_t* const lp) {
|
|
5559
5357
|
/*
|
5560
5358
|
Calculate exp10(x).
|
5561
5359
|
@overload exp10(x)
|
5562
|
-
|
5563
|
-
|
5360
|
+
@param [Numo::NArray,Numeric] x input value
|
5361
|
+
@return [Numo::SComplex] result of exp10(x).
|
5564
5362
|
*/
|
5565
5363
|
static VALUE scomplex_math_s_exp10(VALUE mod, VALUE a1) {
|
5566
5364
|
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
@@ -5637,8 +5435,8 @@ static void iter_scomplex_math_s_sin(na_loop_t* const lp) {
|
|
5637
5435
|
/*
|
5638
5436
|
Calculate sin(x).
|
5639
5437
|
@overload sin(x)
|
5640
|
-
|
5641
|
-
|
5438
|
+
@param [Numo::NArray,Numeric] x input value
|
5439
|
+
@return [Numo::SComplex] result of sin(x).
|
5642
5440
|
*/
|
5643
5441
|
static VALUE scomplex_math_s_sin(VALUE mod, VALUE a1) {
|
5644
5442
|
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
@@ -5715,8 +5513,8 @@ static void iter_scomplex_math_s_cos(na_loop_t* const lp) {
|
|
5715
5513
|
/*
|
5716
5514
|
Calculate cos(x).
|
5717
5515
|
@overload cos(x)
|
5718
|
-
|
5719
|
-
|
5516
|
+
@param [Numo::NArray,Numeric] x input value
|
5517
|
+
@return [Numo::SComplex] result of cos(x).
|
5720
5518
|
*/
|
5721
5519
|
static VALUE scomplex_math_s_cos(VALUE mod, VALUE a1) {
|
5722
5520
|
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
@@ -5793,8 +5591,8 @@ static void iter_scomplex_math_s_tan(na_loop_t* const lp) {
|
|
5793
5591
|
/*
|
5794
5592
|
Calculate tan(x).
|
5795
5593
|
@overload tan(x)
|
5796
|
-
|
5797
|
-
|
5594
|
+
@param [Numo::NArray,Numeric] x input value
|
5595
|
+
@return [Numo::SComplex] result of tan(x).
|
5798
5596
|
*/
|
5799
5597
|
static VALUE scomplex_math_s_tan(VALUE mod, VALUE a1) {
|
5800
5598
|
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
@@ -5871,8 +5669,8 @@ static void iter_scomplex_math_s_asin(na_loop_t* const lp) {
|
|
5871
5669
|
/*
|
5872
5670
|
Calculate asin(x).
|
5873
5671
|
@overload asin(x)
|
5874
|
-
|
5875
|
-
|
5672
|
+
@param [Numo::NArray,Numeric] x input value
|
5673
|
+
@return [Numo::SComplex] result of asin(x).
|
5876
5674
|
*/
|
5877
5675
|
static VALUE scomplex_math_s_asin(VALUE mod, VALUE a1) {
|
5878
5676
|
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
@@ -5949,8 +5747,8 @@ static void iter_scomplex_math_s_acos(na_loop_t* const lp) {
|
|
5949
5747
|
/*
|
5950
5748
|
Calculate acos(x).
|
5951
5749
|
@overload acos(x)
|
5952
|
-
|
5953
|
-
|
5750
|
+
@param [Numo::NArray,Numeric] x input value
|
5751
|
+
@return [Numo::SComplex] result of acos(x).
|
5954
5752
|
*/
|
5955
5753
|
static VALUE scomplex_math_s_acos(VALUE mod, VALUE a1) {
|
5956
5754
|
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
@@ -6027,8 +5825,8 @@ static void iter_scomplex_math_s_atan(na_loop_t* const lp) {
|
|
6027
5825
|
/*
|
6028
5826
|
Calculate atan(x).
|
6029
5827
|
@overload atan(x)
|
6030
|
-
|
6031
|
-
|
5828
|
+
@param [Numo::NArray,Numeric] x input value
|
5829
|
+
@return [Numo::SComplex] result of atan(x).
|
6032
5830
|
*/
|
6033
5831
|
static VALUE scomplex_math_s_atan(VALUE mod, VALUE a1) {
|
6034
5832
|
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
@@ -6105,8 +5903,8 @@ static void iter_scomplex_math_s_sinh(na_loop_t* const lp) {
|
|
6105
5903
|
/*
|
6106
5904
|
Calculate sinh(x).
|
6107
5905
|
@overload sinh(x)
|
6108
|
-
|
6109
|
-
|
5906
|
+
@param [Numo::NArray,Numeric] x input value
|
5907
|
+
@return [Numo::SComplex] result of sinh(x).
|
6110
5908
|
*/
|
6111
5909
|
static VALUE scomplex_math_s_sinh(VALUE mod, VALUE a1) {
|
6112
5910
|
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
@@ -6183,8 +5981,8 @@ static void iter_scomplex_math_s_cosh(na_loop_t* const lp) {
|
|
6183
5981
|
/*
|
6184
5982
|
Calculate cosh(x).
|
6185
5983
|
@overload cosh(x)
|
6186
|
-
|
6187
|
-
|
5984
|
+
@param [Numo::NArray,Numeric] x input value
|
5985
|
+
@return [Numo::SComplex] result of cosh(x).
|
6188
5986
|
*/
|
6189
5987
|
static VALUE scomplex_math_s_cosh(VALUE mod, VALUE a1) {
|
6190
5988
|
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
@@ -6261,8 +6059,8 @@ static void iter_scomplex_math_s_tanh(na_loop_t* const lp) {
|
|
6261
6059
|
/*
|
6262
6060
|
Calculate tanh(x).
|
6263
6061
|
@overload tanh(x)
|
6264
|
-
|
6265
|
-
|
6062
|
+
@param [Numo::NArray,Numeric] x input value
|
6063
|
+
@return [Numo::SComplex] result of tanh(x).
|
6266
6064
|
*/
|
6267
6065
|
static VALUE scomplex_math_s_tanh(VALUE mod, VALUE a1) {
|
6268
6066
|
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
@@ -6339,8 +6137,8 @@ static void iter_scomplex_math_s_asinh(na_loop_t* const lp) {
|
|
6339
6137
|
/*
|
6340
6138
|
Calculate asinh(x).
|
6341
6139
|
@overload asinh(x)
|
6342
|
-
|
6343
|
-
|
6140
|
+
@param [Numo::NArray,Numeric] x input value
|
6141
|
+
@return [Numo::SComplex] result of asinh(x).
|
6344
6142
|
*/
|
6345
6143
|
static VALUE scomplex_math_s_asinh(VALUE mod, VALUE a1) {
|
6346
6144
|
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
@@ -6417,8 +6215,8 @@ static void iter_scomplex_math_s_acosh(na_loop_t* const lp) {
|
|
6417
6215
|
/*
|
6418
6216
|
Calculate acosh(x).
|
6419
6217
|
@overload acosh(x)
|
6420
|
-
|
6421
|
-
|
6218
|
+
@param [Numo::NArray,Numeric] x input value
|
6219
|
+
@return [Numo::SComplex] result of acosh(x).
|
6422
6220
|
*/
|
6423
6221
|
static VALUE scomplex_math_s_acosh(VALUE mod, VALUE a1) {
|
6424
6222
|
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
@@ -6495,8 +6293,8 @@ static void iter_scomplex_math_s_atanh(na_loop_t* const lp) {
|
|
6495
6293
|
/*
|
6496
6294
|
Calculate atanh(x).
|
6497
6295
|
@overload atanh(x)
|
6498
|
-
|
6499
|
-
|
6296
|
+
@param [Numo::NArray,Numeric] x input value
|
6297
|
+
@return [Numo::SComplex] result of atanh(x).
|
6500
6298
|
*/
|
6501
6299
|
static VALUE scomplex_math_s_atanh(VALUE mod, VALUE a1) {
|
6502
6300
|
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
@@ -6573,8 +6371,8 @@ static void iter_scomplex_math_s_sinc(na_loop_t* const lp) {
|
|
6573
6371
|
/*
|
6574
6372
|
Calculate sinc(x).
|
6575
6373
|
@overload sinc(x)
|
6576
|
-
|
6577
|
-
|
6374
|
+
@param [Numo::NArray,Numeric] x input value
|
6375
|
+
@return [Numo::SComplex] result of sinc(x).
|
6578
6376
|
*/
|
6579
6377
|
static VALUE scomplex_math_s_sinc(VALUE mod, VALUE a1) {
|
6580
6378
|
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
@@ -6600,16 +6398,18 @@ void Init_numo_scomplex(void) {
|
|
6600
6398
|
id_real = rb_intern("real");
|
6601
6399
|
id_to_a = rb_intern("to_a");
|
6602
6400
|
|
6603
|
-
|
6604
|
-
|
6605
|
-
|
6606
|
-
|
6401
|
+
/**
|
6402
|
+
* Document-class: Numo::SComplex
|
6403
|
+
*
|
6404
|
+
* Single precision floating point (32bit) complex number N-dimensional array class.
|
6405
|
+
*/
|
6607
6406
|
cT = rb_define_class_under(mNumo, "SComplex", cNArray);
|
6608
6407
|
|
6609
6408
|
// alias of SComplex
|
6610
6409
|
rb_define_const(mNumo, "Complex32", numo_cSComplex);
|
6611
6410
|
|
6612
6411
|
hCast = rb_hash_new();
|
6412
|
+
/* Upcasting rules of SComplex. */
|
6613
6413
|
rb_define_const(cT, "UPCAST", hCast);
|
6614
6414
|
rb_hash_aset(hCast, rb_cArray, cT);
|
6615
6415
|
|
@@ -6636,17 +6436,17 @@ void Init_numo_scomplex(void) {
|
|
6636
6436
|
rb_hash_aset(hCast, numo_cUInt8, numo_cSComplex);
|
6637
6437
|
rb_obj_freeze(hCast);
|
6638
6438
|
|
6639
|
-
|
6439
|
+
/* Element size of SComplex in bits. */
|
6640
6440
|
rb_define_const(cT, "ELEMENT_BIT_SIZE", INT2FIX(sizeof(dtype) * 8));
|
6641
|
-
|
6441
|
+
/* Element size of SComplex in bytes. */
|
6642
6442
|
rb_define_const(cT, "ELEMENT_BYTE_SIZE", INT2FIX(sizeof(dtype)));
|
6643
|
-
|
6443
|
+
/* Stride size of contiguous SComplex array. */
|
6644
6444
|
rb_define_const(cT, "CONTIGUOUS_STRIDE", INT2FIX(sizeof(dtype)));
|
6645
|
-
|
6445
|
+
/* Machine epsilon of SComplex */
|
6646
6446
|
rb_define_const(cT, "EPSILON", M_EPSILON);
|
6647
|
-
|
6447
|
+
/* The largest representable value of SComplex */
|
6648
6448
|
rb_define_const(cT, "MAX", M_MAX);
|
6649
|
-
|
6449
|
+
/* The smallest representable value of SComplex */
|
6650
6450
|
rb_define_const(cT, "MIN", M_MIN);
|
6651
6451
|
rb_define_alloc_func(cT, scomplex_s_alloc_func);
|
6652
6452
|
rb_define_method(cT, "allocate", scomplex_allocate, 0);
|
@@ -6706,9 +6506,49 @@ void Init_numo_scomplex(void) {
|
|
6706
6506
|
rb_define_method(cT, "isfinite", scomplex_isfinite, 0);
|
6707
6507
|
rb_define_method(cT, "sum", scomplex_sum, -1);
|
6708
6508
|
rb_define_method(cT, "prod", scomplex_prod, -1);
|
6509
|
+
/**
|
6510
|
+
* mean of self.
|
6511
|
+
* @overload mean(axis: nil, keepdims: false, nan: false)
|
6512
|
+
* @param axis [Numeric, Array, Range] Performs mean along the axis.
|
6513
|
+
* @param keepdims [Boolean] If true, the reduced axes are left in the result array as
|
6514
|
+
* dimensions with size one.
|
6515
|
+
* @param nan [Boolean] If true, apply NaN-aware algorithm
|
6516
|
+
* (avoid NaN for sum/mean etc, or return NaN for min/max etc).
|
6517
|
+
* @return [Numo::SComplex] returns result of mean.
|
6518
|
+
*/
|
6709
6519
|
rb_define_method(cT, "mean", scomplex_mean, -1);
|
6710
|
-
|
6520
|
+
/**
|
6521
|
+
* var of self.
|
6522
|
+
* @overload var(axis: nil, keepdims: false, nan: false)
|
6523
|
+
* @param axis [Numeric,Array,Range] Performs var along the axis.
|
6524
|
+
* @param keepdims [TrueClass] If true, the reduced axes are left in the result array as
|
6525
|
+
* dimensions with size one.
|
6526
|
+
* @param nan [TrueClass] If true, apply NaN-aware algorithm
|
6527
|
+
* (avoid NaN for sum/mean etc, or, return NaN for min/max etc).
|
6528
|
+
* @return [Numo::SFloat] returns result of var.
|
6529
|
+
*/
|
6711
6530
|
rb_define_method(cT, "var", scomplex_var, -1);
|
6531
|
+
/**
|
6532
|
+
* stddev of self.
|
6533
|
+
* @overload stddev(axis: nil, keepdims: false, nan: false)
|
6534
|
+
* @param axis [Numeric, Array, Range] Performs stddev along the axis.
|
6535
|
+
* @param keepdims [Boolean] If true, the reduced axes are left in the result array as
|
6536
|
+
* dimensions with size one.
|
6537
|
+
* @param nan [Bollean] If true, apply NaN-aware algorithm
|
6538
|
+
* (avoid NaN for sum/mean etc, or, return NaN for min/max etc).
|
6539
|
+
* @return [Numo::SFloat] returns result of stddev.
|
6540
|
+
*/
|
6541
|
+
rb_define_method(cT, "stddev", scomplex_stddev, -1);
|
6542
|
+
/**
|
6543
|
+
* rms of self.
|
6544
|
+
* @overload rms(axis: nil, keepdims: false, nan: false)
|
6545
|
+
* @param axis [Numeric, Array, Range] Performs rms along the axis.
|
6546
|
+
* @param keepdims [Boolean] If true, the reduced axes are left in the result array as
|
6547
|
+
* dimensions with size one.
|
6548
|
+
* @param nan [Boolean] If true, apply NaN-aware algorithm
|
6549
|
+
* (avoid NaN for sum/mean etc, or, return NaN for min/max etc).
|
6550
|
+
* @return [Numo::SFloat] returns result of rms.
|
6551
|
+
*/
|
6712
6552
|
rb_define_method(cT, "rms", scomplex_rms, -1);
|
6713
6553
|
rb_define_method(cT, "cumsum", scomplex_cumsum, -1);
|
6714
6554
|
rb_define_method(cT, "cumprod", scomplex_cumprod, -1);
|
@@ -6722,11 +6562,11 @@ void Init_numo_scomplex(void) {
|
|
6722
6562
|
rb_define_method(cT, "poly", scomplex_poly, -2);
|
6723
6563
|
rb_define_singleton_method(cT, "[]", scomplex_s_cast, -2);
|
6724
6564
|
|
6725
|
-
|
6726
|
-
|
6727
|
-
|
6728
|
-
|
6729
|
-
|
6565
|
+
/**
|
6566
|
+
* Document-module: Numo::SComplex::Math
|
6567
|
+
*
|
6568
|
+
* This module contains mathematical functions for Numo::SComplex.
|
6569
|
+
*/
|
6730
6570
|
mTM = rb_define_module_under(cT, "Math");
|
6731
6571
|
|
6732
6572
|
rb_define_module_function(mTM, "sqrt", scomplex_math_s_sqrt, 1);
|