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/dcomplex.h>
|
34
34
|
|
35
|
-
VALUE cT;
|
36
|
-
extern VALUE cRT;
|
37
|
-
|
38
35
|
/*
|
39
36
|
class definition: Numo::DComplex
|
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(dcomplex, dcomplex, numo_cDComplex, numo_cDComplex)
|
47
|
+
DEF_NARRAY_FLT_VAR_METHOD_FUNC(dcomplex, double, numo_cDComplex, numo_cDFloat)
|
48
|
+
DEF_NARRAY_FLT_STDDEV_METHOD_FUNC(dcomplex, double, numo_cDComplex, numo_cDFloat)
|
49
|
+
DEF_NARRAY_FLT_RMS_METHOD_FUNC(dcomplex, double, numo_cDComplex, numo_cDFloat)
|
43
50
|
|
44
51
|
static VALUE dcomplex_store(VALUE, VALUE);
|
45
52
|
|
@@ -147,8 +154,8 @@ static VALUE dcomplex_allocate(VALUE self) {
|
|
147
154
|
/*
|
148
155
|
Extract an element only if self is a dimensionless NArray.
|
149
156
|
@overload extract
|
150
|
-
|
151
|
-
|
157
|
+
@return [Numeric,Numo::NArray]
|
158
|
+
--- Extract element value as Ruby Object if self is a dimensionless NArray,
|
152
159
|
otherwise returns self.
|
153
160
|
*/
|
154
161
|
static VALUE dcomplex_extract(VALUE self) {
|
@@ -989,8 +996,8 @@ static VALUE dcomplex_store_array(VALUE self, VALUE rary) {
|
|
989
996
|
/*
|
990
997
|
Store elements to Numo::DComplex from other.
|
991
998
|
@overload store(other)
|
992
|
-
|
993
|
-
|
999
|
+
@param [Object] other
|
1000
|
+
@return [Numo::DComplex] self
|
994
1001
|
*/
|
995
1002
|
static VALUE dcomplex_store(VALUE self, VALUE obj) {
|
996
1003
|
VALUE r, klass;
|
@@ -1228,9 +1235,9 @@ static VALUE dcomplex_cast_array(VALUE rary) {
|
|
1228
1235
|
Cast object to Numo::DComplex.
|
1229
1236
|
@overload [](elements)
|
1230
1237
|
@overload cast(array)
|
1231
|
-
|
1232
|
-
|
1233
|
-
|
1238
|
+
@param [Numeric,Array] elements
|
1239
|
+
@param [Array] array
|
1240
|
+
@return [Numo::DComplex]
|
1234
1241
|
*/
|
1235
1242
|
static VALUE dcomplex_s_cast(VALUE type, VALUE obj) {
|
1236
1243
|
VALUE v;
|
@@ -1270,9 +1277,9 @@ static VALUE dcomplex_s_cast(VALUE type, VALUE obj) {
|
|
1270
1277
|
/*
|
1271
1278
|
Multi-dimensional element reference.
|
1272
1279
|
@overload [](dim0,...,dimL)
|
1273
|
-
|
1274
|
-
|
1275
|
-
|
1280
|
+
@param [Numeric,Range,Array,Numo::Int32,Numo::Int64,Numo::Bit,TrueClass,FalseClass,Symbol]
|
1281
|
+
dim0,...,dimL multi-dimensional indices.
|
1282
|
+
@return [Numeric,Numo::DComplex] an element or NArray view.
|
1276
1283
|
@see Numo::NArray#[]
|
1277
1284
|
@see #[]=
|
1278
1285
|
*/
|
@@ -1293,10 +1300,10 @@ static VALUE dcomplex_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 dcomplex_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 dcomplex_coerce_cast(VALUE self, VALUE type) {
|
1333
1340
|
return Qnil;
|
@@ -1362,7 +1369,7 @@ static void iter_dcomplex_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 dcomplex_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_dcomplex_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::DComplex] self.
|
1400
1407
|
*/
|
1401
1408
|
static VALUE dcomplex_fill(VALUE self, VALUE val) {
|
1402
1409
|
ndfunc_arg_in_t ain[2] = { { OVERWRITE, 0 }, { sym_option } };
|
@@ -1449,8 +1456,8 @@ static void iter_dcomplex_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 dcomplex_format(int argc, VALUE* argv, VALUE self) {
|
1456
1463
|
VALUE fmt = Qnil;
|
@@ -1496,8 +1503,8 @@ static void iter_dcomplex_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 dcomplex_format_to_a(int argc, VALUE* argv, VALUE self) {
|
1503
1510
|
VALUE fmt = Qnil;
|
@@ -1516,7 +1523,7 @@ static VALUE iter_dcomplex_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 dcomplex_inspect(VALUE ary) {
|
1522
1529
|
return na_ndloop_inspect(ary, iter_dcomplex_inspect, Qnil);
|
@@ -1550,9 +1557,9 @@ static void iter_dcomplex_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_dcomplex_map(na_loop_t* const lp) {
|
|
1629
1636
|
/*
|
1630
1637
|
Unary map.
|
1631
1638
|
@overload map
|
1632
|
-
|
1639
|
+
@return [Numo::DComplex] map of self.
|
1633
1640
|
*/
|
1634
1641
|
static VALUE dcomplex_map(VALUE self) {
|
1635
1642
|
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
@@ -1688,10 +1695,10 @@ static void iter_dcomplex_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_dcomplex_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_dcomplex_abs(na_loop_t* const lp) {
|
|
1838
1845
|
/*
|
1839
1846
|
abs of self.
|
1840
1847
|
@overload abs
|
1841
|
-
|
1848
|
+
@return [Numo::DFloat] abs of self.
|
1842
1849
|
*/
|
1843
1850
|
static VALUE dcomplex_abs(VALUE self) {
|
1844
1851
|
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
@@ -1848,7 +1855,7 @@ static VALUE dcomplex_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_dcomplex_add(na_loop_t* const lp) {
|
@@ -1950,8 +1957,8 @@ static VALUE dcomplex_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 dcomplex_add(VALUE self, VALUE other) {
|
1957
1964
|
|
@@ -1966,7 +1973,7 @@ static VALUE dcomplex_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_dcomplex_sub(na_loop_t* const lp) {
|
@@ -2068,8 +2075,8 @@ static VALUE dcomplex_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 dcomplex_sub(VALUE self, VALUE other) {
|
2075
2082
|
|
@@ -2084,7 +2091,7 @@ static VALUE dcomplex_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_dcomplex_mul(na_loop_t* const lp) {
|
@@ -2186,8 +2193,8 @@ static VALUE dcomplex_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 dcomplex_mul(VALUE self, VALUE other) {
|
2193
2200
|
|
@@ -2202,7 +2209,7 @@ static VALUE dcomplex_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_dcomplex_div(na_loop_t* const lp) {
|
@@ -2304,8 +2311,8 @@ static VALUE dcomplex_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 dcomplex_div(VALUE self, VALUE other) {
|
2311
2318
|
|
@@ -2373,8 +2380,8 @@ static VALUE dcomplex_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 dcomplex_pow(VALUE self, VALUE other) {
|
2380
2387
|
|
@@ -2453,7 +2460,7 @@ static void iter_dcomplex_minus(na_loop_t* const lp) {
|
|
2453
2460
|
/*
|
2454
2461
|
Unary minus.
|
2455
2462
|
@overload -@
|
2456
|
-
|
2463
|
+
@return [Numo::DComplex] minus of self.
|
2457
2464
|
*/
|
2458
2465
|
static VALUE dcomplex_minus(VALUE self) {
|
2459
2466
|
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
@@ -2528,7 +2535,7 @@ static void iter_dcomplex_reciprocal(na_loop_t* const lp) {
|
|
2528
2535
|
/*
|
2529
2536
|
Unary reciprocal.
|
2530
2537
|
@overload reciprocal
|
2531
|
-
|
2538
|
+
@return [Numo::DComplex] reciprocal of self.
|
2532
2539
|
*/
|
2533
2540
|
static VALUE dcomplex_reciprocal(VALUE self) {
|
2534
2541
|
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
@@ -2603,7 +2610,7 @@ static void iter_dcomplex_sign(na_loop_t* const lp) {
|
|
2603
2610
|
/*
|
2604
2611
|
Unary sign.
|
2605
2612
|
@overload sign
|
2606
|
-
|
2613
|
+
@return [Numo::DComplex] sign of self.
|
2607
2614
|
*/
|
2608
2615
|
static VALUE dcomplex_sign(VALUE self) {
|
2609
2616
|
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
@@ -2678,7 +2685,7 @@ static void iter_dcomplex_square(na_loop_t* const lp) {
|
|
2678
2685
|
/*
|
2679
2686
|
Unary square.
|
2680
2687
|
@overload square
|
2681
|
-
|
2688
|
+
@return [Numo::DComplex] square of self.
|
2682
2689
|
*/
|
2683
2690
|
static VALUE dcomplex_square(VALUE self) {
|
2684
2691
|
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
@@ -2753,7 +2760,7 @@ static void iter_dcomplex_conj(na_loop_t* const lp) {
|
|
2753
2760
|
/*
|
2754
2761
|
Unary conj.
|
2755
2762
|
@overload conj
|
2756
|
-
|
2763
|
+
@return [Numo::DComplex] conj of self.
|
2757
2764
|
*/
|
2758
2765
|
static VALUE dcomplex_conj(VALUE self) {
|
2759
2766
|
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
@@ -2828,7 +2835,7 @@ static void iter_dcomplex_im(na_loop_t* const lp) {
|
|
2828
2835
|
/*
|
2829
2836
|
Unary im.
|
2830
2837
|
@overload im
|
2831
|
-
|
2838
|
+
@return [Numo::DComplex] im of self.
|
2832
2839
|
*/
|
2833
2840
|
static VALUE dcomplex_im(VALUE self) {
|
2834
2841
|
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
@@ -2882,7 +2889,7 @@ static void iter_dcomplex_real(na_loop_t* const lp) {
|
|
2882
2889
|
/*
|
2883
2890
|
real of self.
|
2884
2891
|
@overload real
|
2885
|
-
|
2892
|
+
@return [Numo::DFloat] real of self.
|
2886
2893
|
*/
|
2887
2894
|
static VALUE dcomplex_real(VALUE self) {
|
2888
2895
|
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
@@ -2936,7 +2943,7 @@ static void iter_dcomplex_imag(na_loop_t* const lp) {
|
|
2936
2943
|
/*
|
2937
2944
|
imag of self.
|
2938
2945
|
@overload imag
|
2939
|
-
|
2946
|
+
@return [Numo::DFloat] imag of self.
|
2940
2947
|
*/
|
2941
2948
|
static VALUE dcomplex_imag(VALUE self) {
|
2942
2949
|
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
@@ -2990,7 +2997,7 @@ static void iter_dcomplex_arg(na_loop_t* const lp) {
|
|
2990
2997
|
/*
|
2991
2998
|
arg of self.
|
2992
2999
|
@overload arg
|
2993
|
-
|
3000
|
+
@return [Numo::DFloat] arg of self.
|
2994
3001
|
*/
|
2995
3002
|
static VALUE dcomplex_arg(VALUE self) {
|
2996
3003
|
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
@@ -3138,8 +3145,8 @@ static VALUE dcomplex_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 dcomplex_eq(VALUE self, VALUE other) {
|
3145
3152
|
|
@@ -3185,8 +3192,8 @@ static VALUE dcomplex_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 dcomplex_ne(VALUE self, VALUE other) {
|
3192
3199
|
|
@@ -3232,8 +3239,8 @@ static VALUE dcomplex_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 dcomplex_nearly_eq(VALUE self, VALUE other) {
|
3239
3246
|
|
@@ -3312,7 +3319,7 @@ static void iter_dcomplex_floor(na_loop_t* const lp) {
|
|
3312
3319
|
/*
|
3313
3320
|
Unary floor.
|
3314
3321
|
@overload floor
|
3315
|
-
|
3322
|
+
@return [Numo::DComplex] floor of self.
|
3316
3323
|
*/
|
3317
3324
|
static VALUE dcomplex_floor(VALUE self) {
|
3318
3325
|
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
@@ -3387,7 +3394,7 @@ static void iter_dcomplex_round(na_loop_t* const lp) {
|
|
3387
3394
|
/*
|
3388
3395
|
Unary round.
|
3389
3396
|
@overload round
|
3390
|
-
|
3397
|
+
@return [Numo::DComplex] round of self.
|
3391
3398
|
*/
|
3392
3399
|
static VALUE dcomplex_round(VALUE self) {
|
3393
3400
|
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
@@ -3462,7 +3469,7 @@ static void iter_dcomplex_ceil(na_loop_t* const lp) {
|
|
3462
3469
|
/*
|
3463
3470
|
Unary ceil.
|
3464
3471
|
@overload ceil
|
3465
|
-
|
3472
|
+
@return [Numo::DComplex] ceil of self.
|
3466
3473
|
*/
|
3467
3474
|
static VALUE dcomplex_ceil(VALUE self) {
|
3468
3475
|
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
@@ -3537,7 +3544,7 @@ static void iter_dcomplex_trunc(na_loop_t* const lp) {
|
|
3537
3544
|
/*
|
3538
3545
|
Unary trunc.
|
3539
3546
|
@overload trunc
|
3540
|
-
|
3547
|
+
@return [Numo::DComplex] trunc of self.
|
3541
3548
|
*/
|
3542
3549
|
static VALUE dcomplex_trunc(VALUE self) {
|
3543
3550
|
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
@@ -3612,7 +3619,7 @@ static void iter_dcomplex_rint(na_loop_t* const lp) {
|
|
3612
3619
|
/*
|
3613
3620
|
Unary rint.
|
3614
3621
|
@overload rint
|
3615
|
-
|
3622
|
+
@return [Numo::DComplex] rint of self.
|
3616
3623
|
*/
|
3617
3624
|
static VALUE dcomplex_rint(VALUE self) {
|
3618
3625
|
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
@@ -3622,7 +3629,7 @@ static VALUE dcomplex_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_dcomplex_copysign(na_loop_t* const lp) {
|
@@ -3724,8 +3731,8 @@ static VALUE dcomplex_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 dcomplex_copysign(VALUE self, VALUE other) {
|
3731
3738
|
|
@@ -3772,7 +3779,7 @@ static void iter_dcomplex_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 dcomplex_isnan(VALUE self) {
|
3778
3785
|
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
@@ -3814,7 +3821,7 @@ static void iter_dcomplex_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 dcomplex_isinf(VALUE self) {
|
3820
3827
|
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
@@ -3856,7 +3863,7 @@ static void iter_dcomplex_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 dcomplex_isposinf(VALUE self) {
|
3862
3869
|
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
@@ -3898,7 +3905,7 @@ static void iter_dcomplex_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 dcomplex_isneginf(VALUE self) {
|
3904
3911
|
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
@@ -3940,7 +3947,7 @@ static void iter_dcomplex_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 dcomplex_isfinite(VALUE self) {
|
3946
3953
|
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
@@ -3976,12 +3983,12 @@ static void iter_dcomplex_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::DComplex] returns result of sum.
|
3985
3992
|
*/
|
3986
3993
|
static VALUE dcomplex_sum(int argc, VALUE* argv, VALUE self) {
|
3987
3994
|
VALUE v, reduce;
|
@@ -4022,12 +4029,12 @@ static void iter_dcomplex_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::DComplex] returns result of prod.
|
4031
4038
|
*/
|
4032
4039
|
static VALUE dcomplex_prod(int argc, VALUE* argv, VALUE self) {
|
4033
4040
|
VALUE v, reduce;
|
@@ -4068,12 +4075,12 @@ static void iter_dcomplex_kahan_sum_nan(na_loop_t* const lp) {
|
|
4068
4075
|
/*
|
4069
4076
|
kahan_sum of self.
|
4070
4077
|
@overload kahan_sum(axis:nil, keepdims:false, nan:false)
|
4071
|
-
|
4072
|
-
|
4073
|
-
|
4074
|
-
|
4075
|
-
|
4076
|
-
|
4078
|
+
@param [TrueClass] nan If true, apply NaN-aware algorithm (avoid NaN for sum/mean etc, or,
|
4079
|
+
return NaN for min/max etc).
|
4080
|
+
@param [Numeric,Array,Range] axis Performs kahan_sum along the axis.
|
4081
|
+
@param [TrueClass] keepdims If true, the reduced axes are left in the result array as
|
4082
|
+
dimensions with size one.
|
4083
|
+
@return [Numo::DComplex] returns result of kahan_sum.
|
4077
4084
|
*/
|
4078
4085
|
static VALUE dcomplex_kahan_sum(int argc, VALUE* argv, VALUE self) {
|
4079
4086
|
VALUE v, reduce;
|
@@ -4090,190 +4097,6 @@ static VALUE dcomplex_kahan_sum(int argc, VALUE* argv, VALUE self) {
|
|
4090
4097
|
return dcomplex_extract(v);
|
4091
4098
|
}
|
4092
4099
|
|
4093
|
-
static void iter_dcomplex_mean(na_loop_t* const lp) {
|
4094
|
-
size_t n;
|
4095
|
-
char *p1, *p2;
|
4096
|
-
ssize_t s1;
|
4097
|
-
|
4098
|
-
INIT_COUNTER(lp, n);
|
4099
|
-
INIT_PTR(lp, 0, p1, s1);
|
4100
|
-
p2 = lp->args[1].ptr + lp->args[1].iter[0].pos;
|
4101
|
-
|
4102
|
-
*(dtype*)p2 = f_mean(n, p1, s1);
|
4103
|
-
}
|
4104
|
-
static void iter_dcomplex_mean_nan(na_loop_t* const lp) {
|
4105
|
-
size_t n;
|
4106
|
-
char *p1, *p2;
|
4107
|
-
ssize_t s1;
|
4108
|
-
|
4109
|
-
INIT_COUNTER(lp, n);
|
4110
|
-
INIT_PTR(lp, 0, p1, s1);
|
4111
|
-
p2 = lp->args[1].ptr + lp->args[1].iter[0].pos;
|
4112
|
-
|
4113
|
-
*(dtype*)p2 = f_mean_nan(n, p1, s1);
|
4114
|
-
}
|
4115
|
-
|
4116
|
-
/*
|
4117
|
-
mean of self.
|
4118
|
-
@overload mean(axis:nil, keepdims:false, nan:false)
|
4119
|
-
@param [TrueClass] nan If true, apply NaN-aware algorithm (avoid NaN for sum/mean etc, or,
|
4120
|
-
return NaN for min/max etc).
|
4121
|
-
@param [Numeric,Array,Range] axis Performs mean along the axis.
|
4122
|
-
@param [TrueClass] keepdims If true, the reduced axes are left in the result array as
|
4123
|
-
dimensions with size one.
|
4124
|
-
@return [Numo::DComplex] returns result of mean.
|
4125
|
-
*/
|
4126
|
-
static VALUE dcomplex_mean(int argc, VALUE* argv, VALUE self) {
|
4127
|
-
VALUE v, reduce;
|
4128
|
-
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { sym_reduce, 0 } };
|
4129
|
-
ndfunc_arg_out_t aout[1] = { { cT, 0 } };
|
4130
|
-
ndfunc_t ndf = { iter_dcomplex_mean, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout };
|
4131
|
-
|
4132
|
-
reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, iter_dcomplex_mean_nan);
|
4133
|
-
|
4134
|
-
v = na_ndloop(&ndf, 2, self, reduce);
|
4135
|
-
|
4136
|
-
return dcomplex_extract(v);
|
4137
|
-
}
|
4138
|
-
|
4139
|
-
static void iter_dcomplex_stddev(na_loop_t* const lp) {
|
4140
|
-
size_t n;
|
4141
|
-
char *p1, *p2;
|
4142
|
-
ssize_t s1;
|
4143
|
-
|
4144
|
-
INIT_COUNTER(lp, n);
|
4145
|
-
INIT_PTR(lp, 0, p1, s1);
|
4146
|
-
p2 = lp->args[1].ptr + lp->args[1].iter[0].pos;
|
4147
|
-
|
4148
|
-
*(rtype*)p2 = f_stddev(n, p1, s1);
|
4149
|
-
}
|
4150
|
-
static void iter_dcomplex_stddev_nan(na_loop_t* const lp) {
|
4151
|
-
size_t n;
|
4152
|
-
char *p1, *p2;
|
4153
|
-
ssize_t s1;
|
4154
|
-
|
4155
|
-
INIT_COUNTER(lp, n);
|
4156
|
-
INIT_PTR(lp, 0, p1, s1);
|
4157
|
-
p2 = lp->args[1].ptr + lp->args[1].iter[0].pos;
|
4158
|
-
|
4159
|
-
*(rtype*)p2 = f_stddev_nan(n, p1, s1);
|
4160
|
-
}
|
4161
|
-
|
4162
|
-
/*
|
4163
|
-
stddev of self.
|
4164
|
-
@overload stddev(axis:nil, keepdims:false, nan:false)
|
4165
|
-
@param [TrueClass] nan If true, apply NaN-aware algorithm (avoid NaN for sum/mean etc, or,
|
4166
|
-
return NaN for min/max etc).
|
4167
|
-
@param [Numeric,Array,Range] axis Performs stddev along the axis.
|
4168
|
-
@param [TrueClass] keepdims If true, the reduced axes are left in the result array as
|
4169
|
-
dimensions with size one.
|
4170
|
-
@return [Numo::DComplex] returns result of stddev.
|
4171
|
-
*/
|
4172
|
-
static VALUE dcomplex_stddev(int argc, VALUE* argv, VALUE self) {
|
4173
|
-
VALUE v, reduce;
|
4174
|
-
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { sym_reduce, 0 } };
|
4175
|
-
ndfunc_arg_out_t aout[1] = { { cRT, 0 } };
|
4176
|
-
ndfunc_t ndf = { iter_dcomplex_stddev, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout };
|
4177
|
-
|
4178
|
-
reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, iter_dcomplex_stddev_nan);
|
4179
|
-
|
4180
|
-
v = na_ndloop(&ndf, 2, self, reduce);
|
4181
|
-
|
4182
|
-
return rb_funcall(v, rb_intern("extract"), 0);
|
4183
|
-
}
|
4184
|
-
|
4185
|
-
static void iter_dcomplex_var(na_loop_t* const lp) {
|
4186
|
-
size_t n;
|
4187
|
-
char *p1, *p2;
|
4188
|
-
ssize_t s1;
|
4189
|
-
|
4190
|
-
INIT_COUNTER(lp, n);
|
4191
|
-
INIT_PTR(lp, 0, p1, s1);
|
4192
|
-
p2 = lp->args[1].ptr + lp->args[1].iter[0].pos;
|
4193
|
-
|
4194
|
-
*(rtype*)p2 = f_var(n, p1, s1);
|
4195
|
-
}
|
4196
|
-
static void iter_dcomplex_var_nan(na_loop_t* const lp) {
|
4197
|
-
size_t n;
|
4198
|
-
char *p1, *p2;
|
4199
|
-
ssize_t s1;
|
4200
|
-
|
4201
|
-
INIT_COUNTER(lp, n);
|
4202
|
-
INIT_PTR(lp, 0, p1, s1);
|
4203
|
-
p2 = lp->args[1].ptr + lp->args[1].iter[0].pos;
|
4204
|
-
|
4205
|
-
*(rtype*)p2 = f_var_nan(n, p1, s1);
|
4206
|
-
}
|
4207
|
-
|
4208
|
-
/*
|
4209
|
-
var of self.
|
4210
|
-
@overload var(axis:nil, keepdims:false, nan:false)
|
4211
|
-
@param [TrueClass] nan If true, apply NaN-aware algorithm (avoid NaN for sum/mean etc, or,
|
4212
|
-
return NaN for min/max etc).
|
4213
|
-
@param [Numeric,Array,Range] axis Performs var along the axis.
|
4214
|
-
@param [TrueClass] keepdims If true, the reduced axes are left in the result array as
|
4215
|
-
dimensions with size one.
|
4216
|
-
@return [Numo::DComplex] returns result of var.
|
4217
|
-
*/
|
4218
|
-
static VALUE dcomplex_var(int argc, VALUE* argv, VALUE self) {
|
4219
|
-
VALUE v, reduce;
|
4220
|
-
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { sym_reduce, 0 } };
|
4221
|
-
ndfunc_arg_out_t aout[1] = { { cRT, 0 } };
|
4222
|
-
ndfunc_t ndf = { iter_dcomplex_var, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout };
|
4223
|
-
|
4224
|
-
reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, iter_dcomplex_var_nan);
|
4225
|
-
|
4226
|
-
v = na_ndloop(&ndf, 2, self, reduce);
|
4227
|
-
|
4228
|
-
return rb_funcall(v, rb_intern("extract"), 0);
|
4229
|
-
}
|
4230
|
-
|
4231
|
-
static void iter_dcomplex_rms(na_loop_t* const lp) {
|
4232
|
-
size_t n;
|
4233
|
-
char *p1, *p2;
|
4234
|
-
ssize_t s1;
|
4235
|
-
|
4236
|
-
INIT_COUNTER(lp, n);
|
4237
|
-
INIT_PTR(lp, 0, p1, s1);
|
4238
|
-
p2 = lp->args[1].ptr + lp->args[1].iter[0].pos;
|
4239
|
-
|
4240
|
-
*(rtype*)p2 = f_rms(n, p1, s1);
|
4241
|
-
}
|
4242
|
-
static void iter_dcomplex_rms_nan(na_loop_t* const lp) {
|
4243
|
-
size_t n;
|
4244
|
-
char *p1, *p2;
|
4245
|
-
ssize_t s1;
|
4246
|
-
|
4247
|
-
INIT_COUNTER(lp, n);
|
4248
|
-
INIT_PTR(lp, 0, p1, s1);
|
4249
|
-
p2 = lp->args[1].ptr + lp->args[1].iter[0].pos;
|
4250
|
-
|
4251
|
-
*(rtype*)p2 = f_rms_nan(n, p1, s1);
|
4252
|
-
}
|
4253
|
-
|
4254
|
-
/*
|
4255
|
-
rms of self.
|
4256
|
-
@overload rms(axis:nil, keepdims:false, nan:false)
|
4257
|
-
@param [TrueClass] nan If true, apply NaN-aware algorithm (avoid NaN for sum/mean etc, or,
|
4258
|
-
return NaN for min/max etc).
|
4259
|
-
@param [Numeric,Array,Range] axis Performs rms along the axis.
|
4260
|
-
@param [TrueClass] keepdims If true, the reduced axes are left in the result array as
|
4261
|
-
dimensions with size one.
|
4262
|
-
@return [Numo::DComplex] returns result of rms.
|
4263
|
-
*/
|
4264
|
-
static VALUE dcomplex_rms(int argc, VALUE* argv, VALUE self) {
|
4265
|
-
VALUE v, reduce;
|
4266
|
-
ndfunc_arg_in_t ain[2] = { { cT, 0 }, { sym_reduce, 0 } };
|
4267
|
-
ndfunc_arg_out_t aout[1] = { { cRT, 0 } };
|
4268
|
-
ndfunc_t ndf = { iter_dcomplex_rms, STRIDE_LOOP_NIP | NDF_FLAT_REDUCE, 2, 1, ain, aout };
|
4269
|
-
|
4270
|
-
reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, iter_dcomplex_rms_nan);
|
4271
|
-
|
4272
|
-
v = na_ndloop(&ndf, 2, self, reduce);
|
4273
|
-
|
4274
|
-
return rb_funcall(v, rb_intern("extract"), 0);
|
4275
|
-
}
|
4276
|
-
|
4277
4100
|
static void iter_dcomplex_cumsum(na_loop_t* const lp) {
|
4278
4101
|
size_t i;
|
4279
4102
|
char *p1, *p2;
|
@@ -4314,9 +4137,9 @@ static void iter_dcomplex_cumsum_nan(na_loop_t* const lp) {
|
|
4314
4137
|
/*
|
4315
4138
|
cumsum of self.
|
4316
4139
|
@overload cumsum(axis:nil, nan:false)
|
4317
|
-
|
4318
|
-
|
4319
|
-
|
4140
|
+
@param [Numeric,Array,Range] axis Performs cumsum along the axis.
|
4141
|
+
@param [TrueClass] nan If true, apply NaN-aware algorithm (avoid NaN if exists).
|
4142
|
+
@return [Numo::DComplex] cumsum of self.
|
4320
4143
|
*/
|
4321
4144
|
static VALUE dcomplex_cumsum(int argc, VALUE* argv, VALUE self) {
|
4322
4145
|
VALUE reduce;
|
@@ -4371,9 +4194,9 @@ static void iter_dcomplex_cumprod_nan(na_loop_t* const lp) {
|
|
4371
4194
|
/*
|
4372
4195
|
cumprod of self.
|
4373
4196
|
@overload cumprod(axis:nil, nan:false)
|
4374
|
-
|
4375
|
-
|
4376
|
-
|
4197
|
+
@param [Numeric,Array,Range] axis Performs cumprod along the axis.
|
4198
|
+
@param [TrueClass] nan If true, apply NaN-aware algorithm (avoid NaN if exists).
|
4199
|
+
@return [Numo::DComplex] cumprod of self.
|
4377
4200
|
*/
|
4378
4201
|
static VALUE dcomplex_cumprod(int argc, VALUE* argv, VALUE self) {
|
4379
4202
|
VALUE reduce;
|
@@ -4483,12 +4306,12 @@ static VALUE dcomplex_mulsum_self(int argc, VALUE* argv, VALUE self) {
|
|
4483
4306
|
Binary mulsum.
|
4484
4307
|
|
4485
4308
|
@overload mulsum(other, axis:nil, keepdims:false, nan:false)
|
4486
|
-
|
4487
|
-
|
4488
|
-
|
4489
|
-
|
4490
|
-
|
4491
|
-
|
4309
|
+
@param [Numo::NArray,Numeric] other
|
4310
|
+
@param [Numeric,Array,Range] axis Performs mulsum along the axis.
|
4311
|
+
@param [TrueClass] keepdims (keyword) If true, the reduced axes are left in the result array
|
4312
|
+
as dimensions with size one.
|
4313
|
+
@param [TrueClass] nan (keyword) If true, apply NaN-aware algorithm (avoid NaN if exists).
|
4314
|
+
@return [Numo::NArray] mulsum of self and other.
|
4492
4315
|
*/
|
4493
4316
|
static VALUE dcomplex_mulsum(int argc, VALUE* argv, VALUE self) {
|
4494
4317
|
//
|
@@ -4557,9 +4380,9 @@ static void iter_dcomplex_seq(na_loop_t* const lp) {
|
|
4557
4380
|
beg+i*step
|
4558
4381
|
where i is 1-dimensional index.
|
4559
4382
|
@overload seq([beg,[step]])
|
4560
|
-
|
4561
|
-
|
4562
|
-
|
4383
|
+
@param [Numeric] beg beginning of sequence. (default=0)
|
4384
|
+
@param [Numeric] step step of sequence. (default=1)
|
4385
|
+
@return [Numo::DComplex] self.
|
4563
4386
|
@example
|
4564
4387
|
Numo::DFloat.new(6).seq(1,-0.2)
|
4565
4388
|
# => Numo::DFloat#shape=[6]
|
@@ -4569,7 +4392,7 @@ static void iter_dcomplex_seq(na_loop_t* const lp) {
|
|
4569
4392
|
# => Numo::DComplex#shape=[6]
|
4570
4393
|
# [1+0i, 0.8+0.2i, 0.6+0.4i, 0.4+0.6i, 0.2+0.8i, 0+1i]
|
4571
4394
|
*/
|
4572
|
-
static VALUE dcomplex_seq(int argc, VALUE*
|
4395
|
+
static VALUE dcomplex_seq(int argc, VALUE* argv, VALUE self) {
|
4573
4396
|
seq_opt_t* g;
|
4574
4397
|
VALUE vbeg = Qnil, vstep = Qnil;
|
4575
4398
|
ndfunc_arg_in_t ain[1] = { { OVERWRITE, 0 } };
|
@@ -4579,7 +4402,7 @@ static VALUE dcomplex_seq(int argc, VALUE* args, VALUE self) {
|
|
4579
4402
|
g->beg = m_zero;
|
4580
4403
|
g->step = m_one;
|
4581
4404
|
g->count = 0;
|
4582
|
-
rb_scan_args(argc,
|
4405
|
+
rb_scan_args(argc, argv, "02", &vbeg, &vstep);
|
4583
4406
|
if (vbeg != Qnil) {
|
4584
4407
|
g->beg = m_num_to_data(vbeg);
|
4585
4408
|
}
|
@@ -4638,10 +4461,10 @@ static void iter_dcomplex_logseq(na_loop_t* const lp) {
|
|
4638
4461
|
Applicable classes: DFloat, SFloat, DComplex, SCopmplex.
|
4639
4462
|
|
4640
4463
|
@overload logseq(beg,step,[base])
|
4641
|
-
|
4642
|
-
|
4643
|
-
|
4644
|
-
|
4464
|
+
@param [Numeric] beg The beginning of sequence.
|
4465
|
+
@param [Numeric] step The step of sequence.
|
4466
|
+
@param [Numeric] base The base of log space. (default=10)
|
4467
|
+
@return [Numo::DComplex] self.
|
4645
4468
|
|
4646
4469
|
@example
|
4647
4470
|
Numo::DFloat.new(5).logseq(4,-1,2)
|
@@ -4652,14 +4475,14 @@ static void iter_dcomplex_logseq(na_loop_t* const lp) {
|
|
4652
4475
|
# => Numo::DComplex#shape=[5]
|
4653
4476
|
# [1+7.26156e-310i, 0.5+0.866025i, -0.5+0.866025i, -1+1.22465e-16i, ...]
|
4654
4477
|
*/
|
4655
|
-
static VALUE dcomplex_logseq(int argc, VALUE*
|
4478
|
+
static VALUE dcomplex_logseq(int argc, VALUE* argv, VALUE self) {
|
4656
4479
|
logseq_opt_t* g;
|
4657
4480
|
VALUE vbeg, vstep, vbase;
|
4658
4481
|
ndfunc_arg_in_t ain[1] = { { OVERWRITE, 0 } };
|
4659
4482
|
ndfunc_t ndf = { iter_dcomplex_logseq, FULL_LOOP, 1, 0, ain, 0 };
|
4660
4483
|
|
4661
4484
|
g = ALLOCA_N(logseq_opt_t, 1);
|
4662
|
-
rb_scan_args(argc,
|
4485
|
+
rb_scan_args(argc, argv, "21", &vbeg, &vstep, &vbase);
|
4663
4486
|
g->beg = m_num_to_data(vbeg);
|
4664
4487
|
g->step = m_num_to_data(vstep);
|
4665
4488
|
if (vbase == Qnil) {
|
@@ -4703,11 +4526,11 @@ static void iter_dcomplex_eye(na_loop_t* const lp) {
|
|
4703
4526
|
/*
|
4704
4527
|
Eye: Set a value to diagonal components, set 0 to non-diagonal components.
|
4705
4528
|
@overload eye([element,offset])
|
4706
|
-
|
4707
|
-
|
4708
|
-
|
4709
|
-
|
4710
|
-
|
4529
|
+
@param [Numeric] element Diagonal element to be stored. Default is 1.
|
4530
|
+
@param [Integer] offset Diagonal offset from the main diagonal. The
|
4531
|
+
default is 0. k>0 for diagonals above the main diagonal, and k<0
|
4532
|
+
for diagonals below the main diagonal.
|
4533
|
+
@return [Numo::DComplex] eye of self.
|
4711
4534
|
*/
|
4712
4535
|
static VALUE dcomplex_eye(int argc, VALUE* argv, VALUE self) {
|
4713
4536
|
ndfunc_arg_in_t ain[1] = { { OVERWRITE, 2 } };
|
@@ -4804,10 +4627,10 @@ static void iter_dcomplex_rand(na_loop_t* const lp) {
|
|
4804
4627
|
/*
|
4805
4628
|
Generate uniformly distributed random numbers on self narray.
|
4806
4629
|
@overload rand([[low],high])
|
4807
|
-
|
4808
|
-
|
4809
|
-
|
4810
|
-
|
4630
|
+
@param [Numeric] low lower inclusive boundary of random numbers. (default=0)
|
4631
|
+
@param [Numeric] high upper exclusive boundary of random numbers. (default=1 or 1+1i for
|
4632
|
+
complex types)
|
4633
|
+
@return [Numo::DComplex] self.
|
4811
4634
|
@example
|
4812
4635
|
Numo::DFloat.new(6).rand
|
4813
4636
|
# => Numo::DFloat#shape=[6]
|
@@ -4821,14 +4644,14 @@ static void iter_dcomplex_rand(na_loop_t* const lp) {
|
|
4821
4644
|
# => Numo::Int32#shape=[6]
|
4822
4645
|
# [4, 3, 3, 2, 4, 2]
|
4823
4646
|
*/
|
4824
|
-
static VALUE dcomplex_rand(int argc, VALUE*
|
4647
|
+
static VALUE dcomplex_rand(int argc, VALUE* argv, VALUE self) {
|
4825
4648
|
rand_opt_t g;
|
4826
4649
|
VALUE v1 = Qnil, v2 = Qnil;
|
4827
4650
|
dtype high;
|
4828
4651
|
ndfunc_arg_in_t ain[1] = { { OVERWRITE, 0 } };
|
4829
4652
|
ndfunc_t ndf = { iter_dcomplex_rand, FULL_LOOP, 1, 0, ain, 0 };
|
4830
4653
|
|
4831
|
-
rb_scan_args(argc,
|
4654
|
+
rb_scan_args(argc, argv, "02", &v1, &v2);
|
4832
4655
|
if (v2 == Qnil) {
|
4833
4656
|
g.low = m_zero;
|
4834
4657
|
if (v1 == Qnil) {
|
@@ -4894,9 +4717,9 @@ static void iter_dcomplex_rand_norm(na_loop_t* const lp) {
|
|
4894
4717
|
Generates random numbers from the normal distribution on self narray
|
4895
4718
|
using Box-Muller Transformation.
|
4896
4719
|
@overload rand_norm([mu,[sigma]])
|
4897
|
-
|
4898
|
-
|
4899
|
-
|
4720
|
+
@param [Numeric] mu mean of normal distribution. (default=0)
|
4721
|
+
@param [Numeric] sigma standard deviation of normal distribution. (default=1)
|
4722
|
+
@return [Numo::DComplex] self.
|
4900
4723
|
@example
|
4901
4724
|
Numo::DFloat.new(5,5).rand_norm
|
4902
4725
|
# => Numo::DFloat#shape=[5,5]
|
@@ -4920,14 +4743,14 @@ static void iter_dcomplex_rand_norm(na_loop_t* const lp) {
|
|
4920
4743
|
# [4.26477+3.99655i, 4.90052+5.00763i, 4.46607+2.3444i],
|
4921
4744
|
# [4.5528+7.11003i, 5.62117+6.69094i, 5.05443+5.35133i]]
|
4922
4745
|
*/
|
4923
|
-
static VALUE dcomplex_rand_norm(int argc, VALUE*
|
4746
|
+
static VALUE dcomplex_rand_norm(int argc, VALUE* argv, VALUE self) {
|
4924
4747
|
int n;
|
4925
4748
|
randn_opt_t g;
|
4926
4749
|
VALUE v1 = Qnil, v2 = Qnil;
|
4927
4750
|
ndfunc_arg_in_t ain[1] = { { OVERWRITE, 0 } };
|
4928
4751
|
ndfunc_t ndf = { iter_dcomplex_rand_norm, FULL_LOOP, 1, 0, ain, 0 };
|
4929
4752
|
|
4930
|
-
n = rb_scan_args(argc,
|
4753
|
+
n = rb_scan_args(argc, argv, "02", &v1, &v2);
|
4931
4754
|
if (n == 0) {
|
4932
4755
|
g.mu = m_zero;
|
4933
4756
|
} else {
|
@@ -4962,8 +4785,8 @@ static void iter_dcomplex_poly(na_loop_t* const lp) {
|
|
4962
4785
|
Calculate polynomial.
|
4963
4786
|
`x.poly(a0,a1,a2,...,an) = a0 + a1*x + a2*x**2 + ... + an*x**n`
|
4964
4787
|
@overload poly a0, a1, ..., an
|
4965
|
-
|
4966
|
-
|
4788
|
+
@param [Numo::NArray,Numeric] a0,a1,...,an
|
4789
|
+
@return [Numo::DComplex]
|
4967
4790
|
*/
|
4968
4791
|
static VALUE dcomplex_poly(VALUE self, VALUE args) {
|
4969
4792
|
int argc, i;
|
@@ -4988,10 +4811,6 @@ static VALUE dcomplex_poly(VALUE self, VALUE args) {
|
|
4988
4811
|
return dcomplex_extract(v);
|
4989
4812
|
}
|
4990
4813
|
|
4991
|
-
/*
|
4992
|
-
module definition: Numo::DComplex::NMath
|
4993
|
-
*/
|
4994
|
-
|
4995
4814
|
VALUE mTM;
|
4996
4815
|
|
4997
4816
|
static void iter_dcomplex_math_s_sqrt(na_loop_t* const lp) {
|
@@ -5061,8 +4880,8 @@ static void iter_dcomplex_math_s_sqrt(na_loop_t* const lp) {
|
|
5061
4880
|
/*
|
5062
4881
|
Calculate sqrt(x).
|
5063
4882
|
@overload sqrt(x)
|
5064
|
-
|
5065
|
-
|
4883
|
+
@param [Numo::NArray,Numeric] x input value
|
4884
|
+
@return [Numo::DComplex] result of sqrt(x).
|
5066
4885
|
*/
|
5067
4886
|
static VALUE dcomplex_math_s_sqrt(VALUE mod, VALUE a1) {
|
5068
4887
|
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
@@ -5139,8 +4958,8 @@ static void iter_dcomplex_math_s_cbrt(na_loop_t* const lp) {
|
|
5139
4958
|
/*
|
5140
4959
|
Calculate cbrt(x).
|
5141
4960
|
@overload cbrt(x)
|
5142
|
-
|
5143
|
-
|
4961
|
+
@param [Numo::NArray,Numeric] x input value
|
4962
|
+
@return [Numo::DComplex] result of cbrt(x).
|
5144
4963
|
*/
|
5145
4964
|
static VALUE dcomplex_math_s_cbrt(VALUE mod, VALUE a1) {
|
5146
4965
|
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
@@ -5217,8 +5036,8 @@ static void iter_dcomplex_math_s_log(na_loop_t* const lp) {
|
|
5217
5036
|
/*
|
5218
5037
|
Calculate log(x).
|
5219
5038
|
@overload log(x)
|
5220
|
-
|
5221
|
-
|
5039
|
+
@param [Numo::NArray,Numeric] x input value
|
5040
|
+
@return [Numo::DComplex] result of log(x).
|
5222
5041
|
*/
|
5223
5042
|
static VALUE dcomplex_math_s_log(VALUE mod, VALUE a1) {
|
5224
5043
|
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
@@ -5295,8 +5114,8 @@ static void iter_dcomplex_math_s_log2(na_loop_t* const lp) {
|
|
5295
5114
|
/*
|
5296
5115
|
Calculate log2(x).
|
5297
5116
|
@overload log2(x)
|
5298
|
-
|
5299
|
-
|
5117
|
+
@param [Numo::NArray,Numeric] x input value
|
5118
|
+
@return [Numo::DComplex] result of log2(x).
|
5300
5119
|
*/
|
5301
5120
|
static VALUE dcomplex_math_s_log2(VALUE mod, VALUE a1) {
|
5302
5121
|
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
@@ -5373,8 +5192,8 @@ static void iter_dcomplex_math_s_log10(na_loop_t* const lp) {
|
|
5373
5192
|
/*
|
5374
5193
|
Calculate log10(x).
|
5375
5194
|
@overload log10(x)
|
5376
|
-
|
5377
|
-
|
5195
|
+
@param [Numo::NArray,Numeric] x input value
|
5196
|
+
@return [Numo::DComplex] result of log10(x).
|
5378
5197
|
*/
|
5379
5198
|
static VALUE dcomplex_math_s_log10(VALUE mod, VALUE a1) {
|
5380
5199
|
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
@@ -5451,8 +5270,8 @@ static void iter_dcomplex_math_s_exp(na_loop_t* const lp) {
|
|
5451
5270
|
/*
|
5452
5271
|
Calculate exp(x).
|
5453
5272
|
@overload exp(x)
|
5454
|
-
|
5455
|
-
|
5273
|
+
@param [Numo::NArray,Numeric] x input value
|
5274
|
+
@return [Numo::DComplex] result of exp(x).
|
5456
5275
|
*/
|
5457
5276
|
static VALUE dcomplex_math_s_exp(VALUE mod, VALUE a1) {
|
5458
5277
|
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
@@ -5529,8 +5348,8 @@ static void iter_dcomplex_math_s_exp2(na_loop_t* const lp) {
|
|
5529
5348
|
/*
|
5530
5349
|
Calculate exp2(x).
|
5531
5350
|
@overload exp2(x)
|
5532
|
-
|
5533
|
-
|
5351
|
+
@param [Numo::NArray,Numeric] x input value
|
5352
|
+
@return [Numo::DComplex] result of exp2(x).
|
5534
5353
|
*/
|
5535
5354
|
static VALUE dcomplex_math_s_exp2(VALUE mod, VALUE a1) {
|
5536
5355
|
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
@@ -5607,8 +5426,8 @@ static void iter_dcomplex_math_s_exp10(na_loop_t* const lp) {
|
|
5607
5426
|
/*
|
5608
5427
|
Calculate exp10(x).
|
5609
5428
|
@overload exp10(x)
|
5610
|
-
|
5611
|
-
|
5429
|
+
@param [Numo::NArray,Numeric] x input value
|
5430
|
+
@return [Numo::DComplex] result of exp10(x).
|
5612
5431
|
*/
|
5613
5432
|
static VALUE dcomplex_math_s_exp10(VALUE mod, VALUE a1) {
|
5614
5433
|
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
@@ -5685,8 +5504,8 @@ static void iter_dcomplex_math_s_sin(na_loop_t* const lp) {
|
|
5685
5504
|
/*
|
5686
5505
|
Calculate sin(x).
|
5687
5506
|
@overload sin(x)
|
5688
|
-
|
5689
|
-
|
5507
|
+
@param [Numo::NArray,Numeric] x input value
|
5508
|
+
@return [Numo::DComplex] result of sin(x).
|
5690
5509
|
*/
|
5691
5510
|
static VALUE dcomplex_math_s_sin(VALUE mod, VALUE a1) {
|
5692
5511
|
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
@@ -5763,8 +5582,8 @@ static void iter_dcomplex_math_s_cos(na_loop_t* const lp) {
|
|
5763
5582
|
/*
|
5764
5583
|
Calculate cos(x).
|
5765
5584
|
@overload cos(x)
|
5766
|
-
|
5767
|
-
|
5585
|
+
@param [Numo::NArray,Numeric] x input value
|
5586
|
+
@return [Numo::DComplex] result of cos(x).
|
5768
5587
|
*/
|
5769
5588
|
static VALUE dcomplex_math_s_cos(VALUE mod, VALUE a1) {
|
5770
5589
|
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
@@ -5841,8 +5660,8 @@ static void iter_dcomplex_math_s_tan(na_loop_t* const lp) {
|
|
5841
5660
|
/*
|
5842
5661
|
Calculate tan(x).
|
5843
5662
|
@overload tan(x)
|
5844
|
-
|
5845
|
-
|
5663
|
+
@param [Numo::NArray,Numeric] x input value
|
5664
|
+
@return [Numo::DComplex] result of tan(x).
|
5846
5665
|
*/
|
5847
5666
|
static VALUE dcomplex_math_s_tan(VALUE mod, VALUE a1) {
|
5848
5667
|
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
@@ -5919,8 +5738,8 @@ static void iter_dcomplex_math_s_asin(na_loop_t* const lp) {
|
|
5919
5738
|
/*
|
5920
5739
|
Calculate asin(x).
|
5921
5740
|
@overload asin(x)
|
5922
|
-
|
5923
|
-
|
5741
|
+
@param [Numo::NArray,Numeric] x input value
|
5742
|
+
@return [Numo::DComplex] result of asin(x).
|
5924
5743
|
*/
|
5925
5744
|
static VALUE dcomplex_math_s_asin(VALUE mod, VALUE a1) {
|
5926
5745
|
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
@@ -5997,8 +5816,8 @@ static void iter_dcomplex_math_s_acos(na_loop_t* const lp) {
|
|
5997
5816
|
/*
|
5998
5817
|
Calculate acos(x).
|
5999
5818
|
@overload acos(x)
|
6000
|
-
|
6001
|
-
|
5819
|
+
@param [Numo::NArray,Numeric] x input value
|
5820
|
+
@return [Numo::DComplex] result of acos(x).
|
6002
5821
|
*/
|
6003
5822
|
static VALUE dcomplex_math_s_acos(VALUE mod, VALUE a1) {
|
6004
5823
|
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
@@ -6075,8 +5894,8 @@ static void iter_dcomplex_math_s_atan(na_loop_t* const lp) {
|
|
6075
5894
|
/*
|
6076
5895
|
Calculate atan(x).
|
6077
5896
|
@overload atan(x)
|
6078
|
-
|
6079
|
-
|
5897
|
+
@param [Numo::NArray,Numeric] x input value
|
5898
|
+
@return [Numo::DComplex] result of atan(x).
|
6080
5899
|
*/
|
6081
5900
|
static VALUE dcomplex_math_s_atan(VALUE mod, VALUE a1) {
|
6082
5901
|
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
@@ -6153,8 +5972,8 @@ static void iter_dcomplex_math_s_sinh(na_loop_t* const lp) {
|
|
6153
5972
|
/*
|
6154
5973
|
Calculate sinh(x).
|
6155
5974
|
@overload sinh(x)
|
6156
|
-
|
6157
|
-
|
5975
|
+
@param [Numo::NArray,Numeric] x input value
|
5976
|
+
@return [Numo::DComplex] result of sinh(x).
|
6158
5977
|
*/
|
6159
5978
|
static VALUE dcomplex_math_s_sinh(VALUE mod, VALUE a1) {
|
6160
5979
|
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
@@ -6231,8 +6050,8 @@ static void iter_dcomplex_math_s_cosh(na_loop_t* const lp) {
|
|
6231
6050
|
/*
|
6232
6051
|
Calculate cosh(x).
|
6233
6052
|
@overload cosh(x)
|
6234
|
-
|
6235
|
-
|
6053
|
+
@param [Numo::NArray,Numeric] x input value
|
6054
|
+
@return [Numo::DComplex] result of cosh(x).
|
6236
6055
|
*/
|
6237
6056
|
static VALUE dcomplex_math_s_cosh(VALUE mod, VALUE a1) {
|
6238
6057
|
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
@@ -6309,8 +6128,8 @@ static void iter_dcomplex_math_s_tanh(na_loop_t* const lp) {
|
|
6309
6128
|
/*
|
6310
6129
|
Calculate tanh(x).
|
6311
6130
|
@overload tanh(x)
|
6312
|
-
|
6313
|
-
|
6131
|
+
@param [Numo::NArray,Numeric] x input value
|
6132
|
+
@return [Numo::DComplex] result of tanh(x).
|
6314
6133
|
*/
|
6315
6134
|
static VALUE dcomplex_math_s_tanh(VALUE mod, VALUE a1) {
|
6316
6135
|
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
@@ -6387,8 +6206,8 @@ static void iter_dcomplex_math_s_asinh(na_loop_t* const lp) {
|
|
6387
6206
|
/*
|
6388
6207
|
Calculate asinh(x).
|
6389
6208
|
@overload asinh(x)
|
6390
|
-
|
6391
|
-
|
6209
|
+
@param [Numo::NArray,Numeric] x input value
|
6210
|
+
@return [Numo::DComplex] result of asinh(x).
|
6392
6211
|
*/
|
6393
6212
|
static VALUE dcomplex_math_s_asinh(VALUE mod, VALUE a1) {
|
6394
6213
|
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
@@ -6465,8 +6284,8 @@ static void iter_dcomplex_math_s_acosh(na_loop_t* const lp) {
|
|
6465
6284
|
/*
|
6466
6285
|
Calculate acosh(x).
|
6467
6286
|
@overload acosh(x)
|
6468
|
-
|
6469
|
-
|
6287
|
+
@param [Numo::NArray,Numeric] x input value
|
6288
|
+
@return [Numo::DComplex] result of acosh(x).
|
6470
6289
|
*/
|
6471
6290
|
static VALUE dcomplex_math_s_acosh(VALUE mod, VALUE a1) {
|
6472
6291
|
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
@@ -6543,8 +6362,8 @@ static void iter_dcomplex_math_s_atanh(na_loop_t* const lp) {
|
|
6543
6362
|
/*
|
6544
6363
|
Calculate atanh(x).
|
6545
6364
|
@overload atanh(x)
|
6546
|
-
|
6547
|
-
|
6365
|
+
@param [Numo::NArray,Numeric] x input value
|
6366
|
+
@return [Numo::DComplex] result of atanh(x).
|
6548
6367
|
*/
|
6549
6368
|
static VALUE dcomplex_math_s_atanh(VALUE mod, VALUE a1) {
|
6550
6369
|
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
@@ -6621,8 +6440,8 @@ static void iter_dcomplex_math_s_sinc(na_loop_t* const lp) {
|
|
6621
6440
|
/*
|
6622
6441
|
Calculate sinc(x).
|
6623
6442
|
@overload sinc(x)
|
6624
|
-
|
6625
|
-
|
6443
|
+
@param [Numo::NArray,Numeric] x input value
|
6444
|
+
@return [Numo::DComplex] result of sinc(x).
|
6626
6445
|
*/
|
6627
6446
|
static VALUE dcomplex_math_s_sinc(VALUE mod, VALUE a1) {
|
6628
6447
|
ndfunc_arg_in_t ain[1] = { { cT, 0 } };
|
@@ -6648,16 +6467,18 @@ void Init_numo_dcomplex(void) {
|
|
6648
6467
|
id_real = rb_intern("real");
|
6649
6468
|
id_to_a = rb_intern("to_a");
|
6650
6469
|
|
6651
|
-
|
6652
|
-
|
6653
|
-
|
6654
|
-
|
6470
|
+
/**
|
6471
|
+
* Document-class: Numo::DComplex
|
6472
|
+
*
|
6473
|
+
* Double precision floating point complex number N-dimensional array class.
|
6474
|
+
*/
|
6655
6475
|
cT = rb_define_class_under(mNumo, "DComplex", cNArray);
|
6656
6476
|
|
6657
6477
|
// alias of DComplex
|
6658
6478
|
rb_define_const(mNumo, "Complex64", numo_cDComplex);
|
6659
6479
|
|
6660
6480
|
hCast = rb_hash_new();
|
6481
|
+
/* Upcasting rules of DComplex. */
|
6661
6482
|
rb_define_const(cT, "UPCAST", hCast);
|
6662
6483
|
rb_hash_aset(hCast, rb_cArray, cT);
|
6663
6484
|
|
@@ -6684,17 +6505,17 @@ void Init_numo_dcomplex(void) {
|
|
6684
6505
|
rb_hash_aset(hCast, numo_cUInt8, numo_cDComplex);
|
6685
6506
|
rb_obj_freeze(hCast);
|
6686
6507
|
|
6687
|
-
|
6508
|
+
/* Element size of DComplex in bits. */
|
6688
6509
|
rb_define_const(cT, "ELEMENT_BIT_SIZE", INT2FIX(sizeof(dtype) * 8));
|
6689
|
-
|
6510
|
+
/* Element size of DComplex in bytes. */
|
6690
6511
|
rb_define_const(cT, "ELEMENT_BYTE_SIZE", INT2FIX(sizeof(dtype)));
|
6691
|
-
|
6512
|
+
/* Stride size of contiguous DComplex array. */
|
6692
6513
|
rb_define_const(cT, "CONTIGUOUS_STRIDE", INT2FIX(sizeof(dtype)));
|
6693
|
-
|
6514
|
+
/* Machine epsilon of DComplex. */
|
6694
6515
|
rb_define_const(cT, "EPSILON", M_EPSILON);
|
6695
|
-
|
6516
|
+
/* The largest representable value of DComplex. */
|
6696
6517
|
rb_define_const(cT, "MAX", M_MAX);
|
6697
|
-
|
6518
|
+
/* The smallest representable value of DComplex. */
|
6698
6519
|
rb_define_const(cT, "MIN", M_MIN);
|
6699
6520
|
rb_define_alloc_func(cT, dcomplex_s_alloc_func);
|
6700
6521
|
rb_define_method(cT, "allocate", dcomplex_allocate, 0);
|
@@ -6755,9 +6576,49 @@ void Init_numo_dcomplex(void) {
|
|
6755
6576
|
rb_define_method(cT, "sum", dcomplex_sum, -1);
|
6756
6577
|
rb_define_method(cT, "prod", dcomplex_prod, -1);
|
6757
6578
|
rb_define_method(cT, "kahan_sum", dcomplex_kahan_sum, -1);
|
6579
|
+
/**
|
6580
|
+
* mean of self.
|
6581
|
+
* @overload mean(axis: nil, keepdims: false, nan: false)
|
6582
|
+
* @param axis [Numeric, Array, Range] Performs mean along the axis.
|
6583
|
+
* @param keepdims [Boolean] If true, the reduced axes are left in the result array as
|
6584
|
+
* dimensions with size one.
|
6585
|
+
* @param nan [Boolean] If true, apply NaN-aware algorithm
|
6586
|
+
* (avoid NaN for sum/mean etc, or return NaN for min/max etc).
|
6587
|
+
* @return [Numo::DComplex] returns result of mean.
|
6588
|
+
*/
|
6758
6589
|
rb_define_method(cT, "mean", dcomplex_mean, -1);
|
6759
|
-
|
6590
|
+
/**
|
6591
|
+
* var of self.
|
6592
|
+
* @overload var(axis: nil, keepdims: false, nan: false)
|
6593
|
+
* @param axis [Numeric, Array, Range] Performs var along the axis.
|
6594
|
+
* @param keepdims [Boolean] If true, the reduced axes are left in the result array as
|
6595
|
+
* dimensions with size one.
|
6596
|
+
* @param nan [Boolean] If true, apply NaN-aware algorithm
|
6597
|
+
* (avoid NaN for sum/mean etc, or, return NaN for min/max etc).
|
6598
|
+
* @return [Numo::DFloat] returns result of var.
|
6599
|
+
*/
|
6760
6600
|
rb_define_method(cT, "var", dcomplex_var, -1);
|
6601
|
+
/**
|
6602
|
+
* stddev of self.
|
6603
|
+
* @overload stddev(axis: nil, keepdims: false, nan: false)
|
6604
|
+
* @param axis [Numeric, Array, Range] Performs stddev along the axis.
|
6605
|
+
* @param keepdims [Boolean] If true, the reduced axes are left in the result array as
|
6606
|
+
* dimensions with size one.
|
6607
|
+
* @param nan [Boolean] If true, apply NaN-aware algorithm
|
6608
|
+
* (avoid NaN for sum/mean etc, or, return NaN for min/max etc).
|
6609
|
+
* @return [Numo::DFloat] returns result of stddev.
|
6610
|
+
*/
|
6611
|
+
rb_define_method(cT, "stddev", dcomplex_stddev, -1);
|
6612
|
+
/**
|
6613
|
+
* rms of self.
|
6614
|
+
* @overload rms(axis: nil, keepdims: false, nan: false)
|
6615
|
+
* @param axis [Numeric, Array, Range] Performs rms along the axis.
|
6616
|
+
* @param keepdims [Boolean] If true, the reduced axes are left in the result array as
|
6617
|
+
* dimensions with size one.
|
6618
|
+
* @param nan [Boolean] If true, apply NaN-aware algorithm
|
6619
|
+
* (avoid NaN for sum/mean etc, or, return NaN for min/max etc).
|
6620
|
+
* @return [Numo::DFloat] returns result of rms.
|
6621
|
+
*/
|
6761
6622
|
rb_define_method(cT, "rms", dcomplex_rms, -1);
|
6762
6623
|
rb_define_method(cT, "cumsum", dcomplex_cumsum, -1);
|
6763
6624
|
rb_define_method(cT, "cumprod", dcomplex_cumprod, -1);
|
@@ -6771,11 +6632,11 @@ void Init_numo_dcomplex(void) {
|
|
6771
6632
|
rb_define_method(cT, "poly", dcomplex_poly, -2);
|
6772
6633
|
rb_define_singleton_method(cT, "[]", dcomplex_s_cast, -2);
|
6773
6634
|
|
6774
|
-
|
6775
|
-
|
6776
|
-
|
6777
|
-
|
6778
|
-
|
6635
|
+
/**
|
6636
|
+
* Document-module: Numo::DComplex::Math
|
6637
|
+
*
|
6638
|
+
* This module contains mathematical functions for Numo::DComplex.
|
6639
|
+
*/
|
6779
6640
|
mTM = rb_define_module_under(cT, "Math");
|
6780
6641
|
|
6781
6642
|
rb_define_module_function(mTM, "sqrt", dcomplex_math_s_sqrt, 1);
|