carray 1.3.5 → 1.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSES +22 -0
- data/README.md +18 -21
- data/Rakefile +31 -0
- data/carray.gemspec +13 -26
- data/{ca_iter_block.c → ext/ca_iter_block.c} +13 -13
- data/{ca_iter_dimension.c → ext/ca_iter_dimension.c} +16 -16
- data/{ca_iter_window.c → ext/ca_iter_window.c} +10 -10
- data/{ca_obj_array.c → ext/ca_obj_array.c} +60 -55
- data/{ca_obj_bitarray.c → ext/ca_obj_bitarray.c} +12 -12
- data/{ca_obj_bitfield.c → ext/ca_obj_bitfield.c} +7 -7
- data/{ca_obj_block.c → ext/ca_obj_block.c} +42 -42
- data/{ca_obj_fake.c → ext/ca_obj_fake.c} +7 -7
- data/{ca_obj_farray.c → ext/ca_obj_farray.c} +18 -18
- data/{ca_obj_field.c → ext/ca_obj_field.c} +15 -15
- data/{ca_obj_grid.c → ext/ca_obj_grid.c} +27 -27
- data/{ca_obj_mapping.c → ext/ca_obj_mapping.c} +9 -9
- data/{ca_obj_object.c → ext/ca_obj_object.c} +37 -37
- data/{ca_obj_reduce.c → ext/ca_obj_reduce.c} +1 -1
- data/{ca_obj_refer.c → ext/ca_obj_refer.c} +33 -33
- data/{ca_obj_repeat.c → ext/ca_obj_repeat.c} +43 -43
- data/{ca_obj_select.c → ext/ca_obj_select.c} +2 -2
- data/{ca_obj_shift.c → ext/ca_obj_shift.c} +23 -23
- data/{ca_obj_transpose.c → ext/ca_obj_transpose.c} +23 -23
- data/{ca_obj_unbound_repeat.c → ext/ca_obj_unbound_repeat.c} +55 -55
- data/{ca_obj_window.c → ext/ca_obj_window.c} +26 -26
- data/{carray.h → ext/carray.h} +77 -51
- data/{carray_access.c → ext/carray_access.c} +133 -91
- data/{carray_attribute.c → ext/carray_attribute.c} +12 -12
- data/{carray_call_cfunc.c → ext/carray_call_cfunc.c} +0 -0
- data/{carray_cast.c → ext/carray_cast.c} +6 -6
- data/{carray_cast_func.rb → ext/carray_cast_func.rb} +0 -0
- data/{carray_class.c → ext/carray_class.c} +0 -0
- data/{carray_conversion.c → ext/carray_conversion.c} +11 -13
- data/{carray_copy.c → ext/carray_copy.c} +19 -19
- data/{carray_core.c → ext/carray_core.c} +2 -2
- data/ext/carray_data_type.c +66 -0
- data/{carray_element.c → ext/carray_element.c} +9 -9
- data/{carray_generate.c → ext/carray_generate.c} +67 -1
- data/{carray_iterator.c → ext/carray_iterator.c} +40 -38
- data/{carray_loop.c → ext/carray_loop.c} +24 -24
- data/{carray_mask.c → ext/carray_mask.c} +17 -6
- data/{carray_math.rb → ext/carray_math.rb} +25 -25
- data/ext/{mathfunc/carray_mathfunc.c → carray_mathfunc.c} +0 -0
- data/{carray_numeric.c → ext/carray_numeric.c} +1 -1
- data/{carray_operator.c → ext/carray_operator.c} +32 -9
- data/{carray_order.c → ext/carray_order.c} +2 -153
- data/{carray_sort_addr.c → ext/carray_sort_addr.c} +0 -0
- data/{carray_stat.c → ext/carray_stat.c} +5 -5
- data/{carray_stat_proc.rb → ext/carray_stat_proc.rb} +23 -23
- data/{carray_test.c → ext/carray_test.c} +22 -21
- data/{carray_undef.c → ext/carray_undef.c} +0 -0
- data/{carray_utils.c → ext/carray_utils.c} +0 -0
- data/{extconf.rb → ext/extconf.rb} +0 -5
- data/{mkmath.rb → ext/mkmath.rb} +12 -2
- data/{ruby_carray.c → ext/ruby_carray.c} +9 -2
- data/{ruby_ccomplex.c → ext/ruby_ccomplex.c} +0 -0
- data/{ruby_float_func.c → ext/ruby_float_func.c} +0 -0
- data/{version.h → ext/version.h} +5 -5
- data/{version.rb → ext/version.rb} +0 -0
- data/lib/carray.rb +49 -7
- data/lib/carray/{base/autoload.rb → autoload.rb} +48 -6
- data/lib/carray/autoload/autoload_base.rb +1 -5
- data/lib/carray/autoload/autoload_gem_cairo.rb +9 -0
- data/lib/carray/autoload/autoload_gem_ffi.rb +9 -0
- data/lib/carray/autoload/autoload_gem_gnuplot.rb +2 -0
- data/lib/carray/autoload/autoload_gem_io_csv.rb +14 -0
- data/lib/carray/autoload/autoload_gem_io_pg.rb +6 -0
- data/lib/carray/autoload/autoload_gem_io_sqlite3.rb +12 -0
- data/lib/carray/autoload/autoload_gem_narray.rb +10 -0
- data/lib/carray/autoload/autoload_gem_numo_narray.rb +15 -0
- data/lib/carray/autoload/autoload_gem_opencv.rb +16 -0
- data/lib/carray/autoload/autoload_gem_random.rb +8 -0
- data/lib/carray/autoload/autoload_gem_rmagick.rb +23 -0
- data/lib/carray/autoload/{autoload_graphics_zimg.rb → autoload_gem_zimg.rb} +0 -0
- data/lib/carray/basic.rb +193 -0
- data/lib/carray/compose.rb +291 -0
- data/lib/carray/construct.rb +445 -0
- data/lib/carray/convert.rb +115 -0
- data/lib/carray/{base/inspect.rb → inspect.rb} +6 -6
- data/lib/carray/io/imagemagick.rb +1 -1
- data/lib/carray/{base/iterator.rb → iterator.rb} +3 -3
- data/lib/carray/mask.rb +91 -0
- data/lib/carray/{base/math.rb → math.rb} +17 -47
- data/lib/carray/math/histogram.rb +7 -7
- data/lib/carray/mkmf.rb +8 -0
- data/lib/carray/object/ca_obj_pack.rb +8 -8
- data/lib/carray/obsolete.rb +272 -0
- data/lib/carray/ordering.rb +157 -0
- data/lib/carray/{base/serialize.rb → serialize.rb} +28 -53
- data/lib/carray/string.rb +190 -0
- data/lib/carray/{base/struct.rb → struct.rb} +20 -20
- data/lib/carray/{io/table.rb → table.rb} +1 -9
- data/lib/carray/testing.rb +56 -0
- data/lib/carray/time.rb +78 -0
- data/lib/carray/transform.rb +100 -0
- data/misc/Methods.ja.md +182 -0
- data/{NOTE → misc/NOTE} +0 -0
- data/test/test_ALL.rb +0 -2
- data/test/test_order.rb +7 -7
- data/test/test_ref_store.rb +13 -13
- data/test/test_stat.rb +7 -15
- data/{devel → utils}/guess_shape.rb +0 -0
- data/utils/{diff_method.rb → monkey_patch_methods.rb} +17 -7
- metadata +100 -254
- data/COPYING +0 -56
- data/GPL +0 -340
- data/Gemfile +0 -8
- data/Gemfile.lock +0 -33
- data/LEGAL +0 -50
- data/TODO +0 -5
- data/carray_random.c +0 -531
- data/ext/calculus/carray_calculus.c +0 -931
- data/ext/calculus/carray_interp.c +0 -358
- data/ext/calculus/extconf.rb +0 -12
- data/ext/calculus/lib/autoload/autoload_math_calculus.rb +0 -2
- data/ext/calculus/lib/math/calculus.rb +0 -119
- data/ext/calculus/lib/math/interp/adapter_interp1d.rb +0 -31
- data/ext/fortio/extconf.rb +0 -3
- data/ext/fortio/lib/carray/autoload/autoload_fortran_format.rb +0 -5
- data/ext/fortio/lib/carray/io/fortran_format.rb +0 -43
- data/ext/fortio/lib/fortio.rb +0 -3
- data/ext/fortio/lib/fortio/fortran_format.rb +0 -605
- data/ext/fortio/lib/fortio/fortran_format.tab.rb +0 -536
- data/ext/fortio/lib/fortio/fortran_format.y +0 -215
- data/ext/fortio/lib/fortio/fortran_namelist.rb +0 -151
- data/ext/fortio/lib/fortio/fortran_namelist.tab.rb +0 -470
- data/ext/fortio/lib/fortio/fortran_namelist.y +0 -213
- data/ext/fortio/lib/fortio/fortran_sequential.rb +0 -345
- data/ext/fortio/ruby_fortio.c +0 -182
- data/ext/fortio/test/test_H.rb +0 -5
- data/ext/fortio/test/test_T.rb +0 -7
- data/ext/fortio/test/test_fortran_format.rb +0 -86
- data/ext/fortio/test/test_namelist.rb +0 -25
- data/ext/fortio/test/test_namelist_write.rb +0 -10
- data/ext/fortio/test/test_sequential.rb +0 -13
- data/ext/fortio/test/test_sequential2.rb +0 -13
- data/ext/fortio/work/test.rb +0 -10
- data/ext/fortio/work/test_e.rb +0 -19
- data/ext/fortio/work/test_ep.rb +0 -10
- data/ext/fortio/work/test_parse.rb +0 -12
- data/ext/imagemap/carray_imagemap.c +0 -495
- data/ext/imagemap/doc/call_graph.dot +0 -28
- data/ext/imagemap/draw.c +0 -567
- data/ext/imagemap/extconf.rb +0 -13
- data/ext/imagemap/lib/autoload/autoload_graphics_imagemap.rb +0 -1
- data/ext/imagemap/lib/graphics/imagemap.rb +0 -273
- data/ext/imagemap/lib/image_map.rb +0 -4
- data/ext/imagemap/test/swath_index.rb +0 -83
- data/ext/imagemap/test/swath_warp.rb +0 -99
- data/ext/imagemap/test/test.rb +0 -23
- data/ext/imagemap/test/test_image.rb +0 -42
- data/ext/imagemap/test/test_line.rb +0 -14
- data/ext/imagemap/test/test_rotate.rb +0 -17
- data/ext/imagemap/test/test_triangle.rb +0 -20
- data/ext/imagemap/test/test_warp.rb +0 -26
- data/ext/mathfunc/extconf.rb +0 -18
- data/ext/mathfunc/lib/autoload/autoload_math_mathfunc.rb +0 -1
- data/ext/mathfunc/lib/math/mathfunc.rb +0 -15
- data/ext/mathfunc/test/test_hypot.rb +0 -5
- data/ext/mathfunc/test/test_j0.rb +0 -22
- data/ext/mathfunc/test/test_jn.rb +0 -8
- data/ext/mathfunc/test/test_sph.rb +0 -9
- data/ext/narray/README +0 -22
- data/ext/narray/ca_wrap_narray.c +0 -500
- data/ext/narray/carray_narray.c +0 -21
- data/ext/narray/extconf.rb +0 -57
- data/ext/narray/lib/autoload/autoload_math_narray.rb +0 -1
- data/ext/narray/lib/autoload/autoload_math_narray_miss.rb +0 -11
- data/ext/narray/lib/math/narray.rb +0 -17
- data/ext/narray/lib/math/narray_miss.rb +0 -45
- data/lib/carray/autoload/autoload_graphics_gnuplot.rb +0 -2
- data/lib/carray/autoload/autoload_io_csv.rb +0 -14
- data/lib/carray/autoload/autoload_io_pg.rb +0 -6
- data/lib/carray/autoload/autoload_io_sqlite3.rb +0 -12
- data/lib/carray/autoload/autoload_io_table.rb +0 -1
- data/lib/carray/autoload/autoload_math_interp.rb +0 -4
- data/lib/carray/base/basic.rb +0 -1090
- data/lib/carray/base/obsolete.rb +0 -131
- data/lib/carray/graphics/gnuplot.rb +0 -2131
- data/lib/carray/graphics/zimg.rb +0 -296
- data/lib/carray/io/csv.rb +0 -572
- data/lib/carray/io/pg.rb +0 -101
- data/lib/carray/io/sqlite3.rb +0 -215
- data/lib/carray/math/interp.rb +0 -57
- data/lib/carray/math/interp/adapter_gsl_spline.rb +0 -47
- data/mt19937ar.c +0 -182
- data/mt19937ar.h +0 -86
- data/rdoc_main.rb +0 -27
- data/rdoc_math.rb +0 -5
- data/rdoc_stat.rb +0 -31
- data/test/test_narray.rb +0 -64
- data/test/test_random.rb +0 -15
- data/utils/create_rdoc.sh +0 -9
- data/utils/make_tgz.sh +0 -3
@@ -1383,7 +1383,7 @@ ca_stat_nd_contig_loop (CArray *ca, CArray *co, ca_size_t mc,
|
|
1383
1383
|
void *p;
|
1384
1384
|
boolean8_t *m;
|
1385
1385
|
ca_size_t i, n;
|
1386
|
-
if ( level == co->
|
1386
|
+
if ( level == co->ndim ) {
|
1387
1387
|
CAStatIterator it;
|
1388
1388
|
n = ca->elements/co->elements;
|
1389
1389
|
idx[level] = 0;
|
@@ -1421,8 +1421,8 @@ rb_ca_stat_nd_contig (VALUE self, VALUE vaxis, VALUE rmc, VALUE vfval,
|
|
1421
1421
|
ca_type_name[ca->data_type]);
|
1422
1422
|
}
|
1423
1423
|
|
1424
|
-
ndim = ca->
|
1425
|
-
if ( ndim <= 0 || ndim > ca->
|
1424
|
+
ndim = ca->ndim - RARRAY_LEN(vaxis);
|
1425
|
+
if ( ndim <= 0 || ndim > ca->ndim ) {
|
1426
1426
|
rb_raise(rb_eRuntimeError, "invalid dimension specified");
|
1427
1427
|
}
|
1428
1428
|
|
@@ -1449,7 +1449,7 @@ rb_ca_stat_nd_contig (VALUE self, VALUE vaxis, VALUE rmc, VALUE vfval,
|
|
1449
1449
|
char *op;
|
1450
1450
|
boolean8_t *om;
|
1451
1451
|
int8_t i;
|
1452
|
-
for (i=0; i<ca->
|
1452
|
+
for (i=0; i<ca->ndim; i++) {
|
1453
1453
|
idx[i] = 0;
|
1454
1454
|
}
|
1455
1455
|
ca_attach_n(2, ca, co);
|
@@ -1474,7 +1474,7 @@ ca_stat_get_offset_loop (CArray *ca, ca_size_t *dm,
|
|
1474
1474
|
CArray *offset)
|
1475
1475
|
{
|
1476
1476
|
ca_size_t i;
|
1477
|
-
if ( level == ca->
|
1477
|
+
if ( level == ca->ndim - 1 ) {
|
1478
1478
|
if ( dm[level] == 0 ) {
|
1479
1479
|
idx[level] = 0;
|
1480
1480
|
*(ca_size_t *)ca_ptr_at_index(offset, idx1) = ca_index2addr(ca, idx);
|
@@ -1513,13 +1513,13 @@ rb_ca_stat_nd_discrete (VALUE self, VALUE vaxis, VALUE rmc, VALUE vfval,
|
|
1513
1513
|
ca_size_t loop_dim[CA_RANK_MAX];
|
1514
1514
|
ca_size_t dm[CA_RANK_MAX], dn[CA_RANK_MAX];
|
1515
1515
|
CArray *ca, *co, *first, *offset;
|
1516
|
-
ca_size_t
|
1516
|
+
ca_size_t out_ndim, loop_ndim;
|
1517
1517
|
ca_size_t mc;
|
1518
1518
|
ca_size_t i, k;
|
1519
1519
|
|
1520
1520
|
Data_Get_Struct(self, CArray, ca);
|
1521
1521
|
|
1522
|
-
for (i=0; i<ca->
|
1522
|
+
for (i=0; i<ca->ndim; i++) {
|
1523
1523
|
dm[i] = 0;
|
1524
1524
|
dn[i] = 1;
|
1525
1525
|
}
|
@@ -1530,26 +1530,26 @@ rb_ca_stat_nd_discrete (VALUE self, VALUE vaxis, VALUE rmc, VALUE vfval,
|
|
1530
1530
|
dn[k] = 0;
|
1531
1531
|
}
|
1532
1532
|
|
1533
|
-
|
1534
|
-
|
1535
|
-
for (i=0; i<ca->
|
1533
|
+
out_ndim = 0;
|
1534
|
+
loop_ndim = 0;
|
1535
|
+
for (i=0; i<ca->ndim; i++) {
|
1536
1536
|
if ( dm[i] ) {
|
1537
|
-
loop_dim[
|
1538
|
-
|
1537
|
+
loop_dim[loop_ndim] = ca->dim[i];
|
1538
|
+
loop_ndim += 1;
|
1539
1539
|
}
|
1540
1540
|
else {
|
1541
|
-
out_dim[
|
1542
|
-
|
1541
|
+
out_dim[out_ndim] = ca->dim[i];
|
1542
|
+
out_ndim += 1;
|
1543
1543
|
}
|
1544
1544
|
}
|
1545
1545
|
|
1546
|
-
out = rb_carray_new(data_type,
|
1546
|
+
out = rb_carray_new(data_type, out_ndim, out_dim, 0, NULL);
|
1547
1547
|
Data_Get_Struct(out, CArray, co);
|
1548
1548
|
|
1549
|
-
first = carray_new(CA_SIZE,
|
1549
|
+
first = carray_new(CA_SIZE, out_ndim, out_dim, 0, NULL);
|
1550
1550
|
first->ptr = realloc(first->ptr, first->bytes*(first->elements+1));
|
1551
1551
|
|
1552
|
-
offset = carray_new(CA_SIZE,
|
1552
|
+
offset = carray_new(CA_SIZE, loop_ndim, loop_dim, 0, NULL);
|
1553
1553
|
offset->ptr = realloc(offset->ptr, offset->bytes*(offset->elements+1));
|
1554
1554
|
|
1555
1555
|
ca_stat_get_offset_loop(ca, dn, 0, idx, 0, idx1, first);
|
@@ -1673,14 +1673,14 @@ rb_ca_stat_general (int argc, VALUE *argv, VALUE self,
|
|
1673
1673
|
|
1674
1674
|
for (i=0; i<RARRAY_LEN(vaxis); i++) {
|
1675
1675
|
k = NUM2SIZE(rb_ary_entry(vaxis, RARRAY_LEN(vaxis)-1-i));
|
1676
|
-
CA_CHECK_INDEX(k, ca->
|
1677
|
-
if ( k != ca->
|
1676
|
+
CA_CHECK_INDEX(k, ca->ndim);
|
1677
|
+
if ( k != ca->ndim-1-i ) {
|
1678
1678
|
is_contig = 0;
|
1679
1679
|
}
|
1680
1680
|
}
|
1681
1681
|
|
1682
1682
|
if ( is_contig ) {
|
1683
|
-
if ( RARRAY_LEN(vaxis) == ca->
|
1683
|
+
if ( RARRAY_LEN(vaxis) == ca->ndim ) {
|
1684
1684
|
return rb_ca_stat_1d(self, rmc, vfval, ca_proc);
|
1685
1685
|
}
|
1686
1686
|
else {
|
@@ -1841,7 +1841,7 @@ ca_dimstat_type2_loop (CArray *ca, CArray *co, ca_size_t mc,
|
|
1841
1841
|
void *p;
|
1842
1842
|
boolean8_t *m;
|
1843
1843
|
ca_size_t i, n;
|
1844
|
-
if ( level == co->
|
1844
|
+
if ( level == co->ndim ) {
|
1845
1845
|
CAStatIterator it;
|
1846
1846
|
n = ca->elements/co->elements;
|
1847
1847
|
idx[level] = 0;
|
@@ -1871,7 +1871,7 @@ ca_dimstat_type2 (CArray *ca, CArray *co, ca_size_t mc, ca_stat_proc_t *ca_proc)
|
|
1871
1871
|
char *op;
|
1872
1872
|
boolean8_t *om;
|
1873
1873
|
int8_t i;
|
1874
|
-
for (i=0; i<ca->
|
1874
|
+
for (i=0; i<ca->ndim; i++) {
|
1875
1875
|
idx[i] = 0;
|
1876
1876
|
}
|
1877
1877
|
ca_attach_n(2, ca, co);
|
@@ -1904,7 +1904,7 @@ rb_ca_dimstat_type2 (int argc, VALUE *argv, VALUE self,
|
|
1904
1904
|
}
|
1905
1905
|
|
1906
1906
|
ndim = NUM2SIZE(rndim);
|
1907
|
-
if ( ndim <= 0 || ndim > ca->
|
1907
|
+
if ( ndim <= 0 || ndim > ca->ndim ) {
|
1908
1908
|
rb_raise(rb_eRuntimeError, "invalid dimension specified");
|
1909
1909
|
}
|
1910
1910
|
|
@@ -34,26 +34,26 @@ ca_check_type (void *ap, int8_t data_type)
|
|
34
34
|
}
|
35
35
|
|
36
36
|
void
|
37
|
-
|
37
|
+
ca_check_ndim (void *ap, int ndim)
|
38
38
|
{
|
39
39
|
CArray *ca = (CArray *) ap;
|
40
40
|
if ( ! ca_is_scalar(ca) ) {
|
41
|
-
if ( ca->
|
42
|
-
rb_raise(rb_eRuntimeError, "
|
41
|
+
if ( ca->ndim != ndim ) {
|
42
|
+
rb_raise(rb_eRuntimeError, "ndim mismatch");
|
43
43
|
}
|
44
44
|
}
|
45
45
|
}
|
46
46
|
|
47
47
|
void
|
48
|
-
ca_check_shape (void *ap, int
|
48
|
+
ca_check_shape (void *ap, int ndim, ca_size_t *dim)
|
49
49
|
{
|
50
50
|
CArray *ca = (CArray *) ap;
|
51
51
|
int i;
|
52
52
|
if ( ! ca_is_scalar(ca) ) {
|
53
|
-
if ( ca->
|
53
|
+
if ( ca->ndim != ndim ) {
|
54
54
|
rb_raise(rb_eRuntimeError, "shape mismatch");
|
55
55
|
}
|
56
|
-
for (i=0; i<
|
56
|
+
for (i=0; i<ndim; i++) {
|
57
57
|
if ( ca->dim[i] != dim[i] ) {
|
58
58
|
rb_raise(rb_eRuntimeError, "shape mismatch");
|
59
59
|
}
|
@@ -72,12 +72,12 @@ ca_check_same_data_type (void *ap1, void *ap2)
|
|
72
72
|
}
|
73
73
|
|
74
74
|
void
|
75
|
-
|
75
|
+
ca_check_same_ndim (void *ap1, void *ap2)
|
76
76
|
{
|
77
77
|
CArray *ca1 = (CArray *) ap1;
|
78
78
|
CArray *ca2 = (CArray *) ap2;
|
79
|
-
if ( ca1->
|
80
|
-
rb_raise(rb_eRuntimeError, "
|
79
|
+
if ( ca1->ndim != ca2->ndim ) {
|
80
|
+
rb_raise(rb_eRuntimeError, "ndim mismatch");
|
81
81
|
}
|
82
82
|
}
|
83
83
|
|
@@ -98,10 +98,10 @@ ca_check_same_shape (void *ap1, void *ap2)
|
|
98
98
|
CArray *ca2 = (CArray *) ap2;
|
99
99
|
int i;
|
100
100
|
if ( ( ! ca_is_scalar(ca1) ) && ( ! ca_is_scalar(ca2) ) ) {
|
101
|
-
if ( ca1->
|
101
|
+
if ( ca1->ndim != ca2->ndim ) {
|
102
102
|
rb_raise(rb_eRuntimeError, "shape mismatch");
|
103
103
|
}
|
104
|
-
for (i=0; i<ca1->
|
104
|
+
for (i=0; i<ca1->ndim; i++) {
|
105
105
|
if ( ca1->dim[i] != ca2->dim[i] ) {
|
106
106
|
rb_raise(rb_eRuntimeError, "shape mismatch");
|
107
107
|
}
|
@@ -114,7 +114,7 @@ ca_check_index (void *ap, ca_size_t *idx)
|
|
114
114
|
{
|
115
115
|
CArray *ca = (CArray *) ap;
|
116
116
|
int i;
|
117
|
-
for (i=0; i<ca->
|
117
|
+
for (i=0; i<ca->ndim; i++) {
|
118
118
|
if ( idx[i] < 0 || idx[i] >= ca->dim[i] ) {
|
119
119
|
rb_raise(rb_eRuntimeError, "invalid index");
|
120
120
|
}
|
@@ -140,11 +140,11 @@ ca_has_same_shape (void *ap1, void *ap2)
|
|
140
140
|
if ( ca_is_scalar(ca1) || ca_is_scalar(ca2) ) {
|
141
141
|
return 1;
|
142
142
|
}
|
143
|
-
else if ( ca1->
|
143
|
+
else if ( ca1->ndim != ca2->ndim ) {
|
144
144
|
return 0;
|
145
145
|
}
|
146
146
|
else {
|
147
|
-
for (i=0; i<ca1->
|
147
|
+
for (i=0; i<ca1->ndim; i++) {
|
148
148
|
if ( ca1->dim[i] != ca2->dim[i] ) {
|
149
149
|
return 0;
|
150
150
|
}
|
@@ -158,7 +158,7 @@ ca_is_valid_index (void *ap, ca_size_t *idx)
|
|
158
158
|
{
|
159
159
|
CArray *ca = (CArray *) ap;
|
160
160
|
int8_t i;
|
161
|
-
for (i=0; i<ca->
|
161
|
+
for (i=0; i<ca->ndim; i++) {
|
162
162
|
if ( idx[i] < 0 || idx[i] >= ca->dim[i] ) {
|
163
163
|
return 0;
|
164
164
|
}
|
@@ -236,11 +236,11 @@ rb_ca_is_valid_index (int argc, VALUE *argv, VALUE self)
|
|
236
236
|
|
237
237
|
Data_Get_Struct(self, CArray, ca);
|
238
238
|
|
239
|
-
if ( argc != ca->
|
239
|
+
if ( argc != ca->ndim ) {
|
240
240
|
rb_raise(rb_eArgError,
|
241
|
-
"invalid # of arguments (%i for %i)", argc, ca->
|
241
|
+
"invalid # of arguments (%i for %i)", argc, ca->ndim);
|
242
242
|
}
|
243
|
-
for (i=0; i<ca->
|
243
|
+
for (i=0; i<ca->ndim; i++) {
|
244
244
|
idx = NUM2SIZE(argv[i]);
|
245
245
|
if ( idx < 0 ) {
|
246
246
|
idx += ca->dim[i];
|
@@ -381,7 +381,7 @@ ca_equal (void *ap, void *bp)
|
|
381
381
|
return 0;
|
382
382
|
}
|
383
383
|
|
384
|
-
if ( ca->
|
384
|
+
if ( ca->ndim != cb->ndim ) { /* ndim comparison */
|
385
385
|
return 0;
|
386
386
|
}
|
387
387
|
|
@@ -389,7 +389,7 @@ ca_equal (void *ap, void *bp)
|
|
389
389
|
return 0;
|
390
390
|
}
|
391
391
|
|
392
|
-
for (i=0; i<ca->
|
392
|
+
for (i=0; i<ca->ndim; i++) {
|
393
393
|
if ( ca->dim[i] != cb->dim[i] ) { /* dimensional shape comparison */
|
394
394
|
return 0;
|
395
395
|
}
|
@@ -571,9 +571,11 @@ rb_ca_modify (VALUE self)
|
|
571
571
|
if ( OBJ_FROZEN(self) ) {
|
572
572
|
rb_error_frozen("CArray object");
|
573
573
|
}
|
574
|
+
/*
|
574
575
|
if ( ( ! OBJ_TAINTED(self) ) && rb_safe_level() >= 4 ) {
|
575
576
|
rb_raise(rb_eSecurityError, "Insecure: can't modify carray");
|
576
577
|
}
|
578
|
+
*/
|
577
579
|
}
|
578
580
|
|
579
581
|
VALUE
|
@@ -585,7 +587,6 @@ rb_ca_freeze (VALUE self)
|
|
585
587
|
return rb_obj_freeze(self);
|
586
588
|
}
|
587
589
|
|
588
|
-
|
589
590
|
void
|
590
591
|
Init_carray_test ()
|
591
592
|
{
|
File without changes
|
File without changes
|
@@ -189,11 +189,6 @@ if ( not File.exist?("carray_stat_proc.c") ) or
|
|
189
189
|
system("ruby carray_stat_proc.rb > carray_stat_proc.c")
|
190
190
|
end
|
191
191
|
|
192
|
-
puts "creating rdoc_ext.rb"
|
193
|
-
system %{
|
194
|
-
ruby utils/extract_rdoc.rb > rdoc_ext.rb
|
195
|
-
}
|
196
|
-
|
197
192
|
# --- create Makefile
|
198
193
|
|
199
194
|
create_makefile("carray_ext")
|
data/{mkmath.rb → ext/mkmath.rb}
RENAMED
@@ -289,7 +289,12 @@ ca_binop_#{name}_#{type} (ca_size_t n, boolean8_t *m, char *ptr1, ca_size_t i1,
|
|
289
289
|
io.puts
|
290
290
|
io.print %{
|
291
291
|
static VALUE rb_ca_#{name} (VALUE self, VALUE other)
|
292
|
-
{
|
292
|
+
{
|
293
|
+
if ( ! rb_ca_test_castable(other) ) {
|
294
|
+
return rb_ca_binop_pass_to_other(self, other, rb_intern("#{op}"));
|
295
|
+
}
|
296
|
+
return rb_ca_call_binop(self, other, ca_binop_#{name});
|
297
|
+
}
|
293
298
|
static VALUE rb_ca_#{name}_bang (VALUE self, VALUE other)
|
294
299
|
{ return rb_ca_call_binop_bang(self, other, ca_binop_#{name}); }
|
295
300
|
}
|
@@ -529,7 +534,12 @@ ca_bincmp_#{name}_#{type} (ca_size_t n, boolean8_t *m,
|
|
529
534
|
io.puts
|
530
535
|
io.print %{
|
531
536
|
static VALUE rb_ca_#{name} (VALUE self, VALUE other)
|
532
|
-
{
|
537
|
+
{
|
538
|
+
if ( ! rb_ca_test_castable(other) ) {
|
539
|
+
return rb_ca_binop_pass_to_other(self, other, rb_intern("#{op}"));
|
540
|
+
}
|
541
|
+
return rb_ca_call_bincmp(self, other, ca_bincmp_#{name});
|
542
|
+
}
|
533
543
|
}
|
534
544
|
DEFINITIONS << io.string
|
535
545
|
if op
|
@@ -24,6 +24,7 @@ void Init_numeric_float_function ();
|
|
24
24
|
void Init_carray_core ();
|
25
25
|
void Init_carray_undef ();
|
26
26
|
void Init_carray_class ();
|
27
|
+
void Init_carray_data_type ();
|
27
28
|
void Init_carray_test ();
|
28
29
|
void Init_carray_attribute ();
|
29
30
|
void Init_carray_loop ();
|
@@ -34,7 +35,6 @@ void Init_carray_iterator ();
|
|
34
35
|
void Init_carray_operator ();
|
35
36
|
void Init_carray_numeric ();
|
36
37
|
void Init_carray_math ();
|
37
|
-
void Init_carray_random ();
|
38
38
|
void Init_carray_utils ();
|
39
39
|
void Init_carray_order ();
|
40
40
|
void Init_carray_sort_addr ();
|
@@ -70,6 +70,9 @@ void Init_ca_iter_dimension ();
|
|
70
70
|
void Init_ca_iter_block ();
|
71
71
|
void Init_ca_iter_window ();
|
72
72
|
|
73
|
+
void Init_carray_mathfunc ();
|
74
|
+
|
75
|
+
|
73
76
|
void
|
74
77
|
Init_carray_ext ()
|
75
78
|
{
|
@@ -193,6 +196,7 @@ Init_carray_ext ()
|
|
193
196
|
Init_numeric_float_function();
|
194
197
|
|
195
198
|
Init_carray_class();
|
199
|
+
Init_carray_data_type();
|
196
200
|
Init_carray_test();
|
197
201
|
Init_carray_attribute();
|
198
202
|
Init_carray_undef();
|
@@ -203,7 +207,6 @@ Init_carray_ext ()
|
|
203
207
|
Init_carray_operator();
|
204
208
|
Init_carray_math(); /* order of math, numeric should not be changed */
|
205
209
|
Init_carray_numeric(); /* order of math, numeric should not be changed */
|
206
|
-
Init_carray_random();
|
207
210
|
Init_carray_order();
|
208
211
|
Init_carray_sort_addr();
|
209
212
|
Init_carray_stat();
|
@@ -240,5 +243,9 @@ Init_carray_ext ()
|
|
240
243
|
Init_ca_iter_dimension();
|
241
244
|
Init_ca_iter_block();
|
242
245
|
Init_ca_iter_window();
|
246
|
+
|
247
|
+
Init_carray_mathfunc();
|
248
|
+
|
249
|
+
|
243
250
|
}
|
244
251
|
|
File without changes
|
File without changes
|
data/{version.h → ext/version.h}
RENAMED
@@ -10,9 +10,9 @@
|
|
10
10
|
|
11
11
|
---------------------------------------------------------------------------- */
|
12
12
|
|
13
|
-
#define CA_VERSION "1.
|
14
|
-
#define CA_VERSION_CODE
|
13
|
+
#define CA_VERSION "1.5.1"
|
14
|
+
#define CA_VERSION_CODE 151
|
15
15
|
#define CA_VERSION_MAJOR 1
|
16
|
-
#define CA_VERSION_MINOR
|
17
|
-
#define CA_VERSION_TEENY
|
18
|
-
#define CA_VERSION_DATE "
|
16
|
+
#define CA_VERSION_MINOR 5
|
17
|
+
#define CA_VERSION_TEENY 1
|
18
|
+
#define CA_VERSION_DATE "2020/07/01"
|
File without changes
|
data/lib/carray.rb
CHANGED
@@ -14,15 +14,57 @@ major = RbConfig::CONFIG['MAJOR'].to_i
|
|
14
14
|
minor = RbConfig::CONFIG['MINOR'].to_i
|
15
15
|
teeny = RbConfig::CONFIG['TEENY'].to_i
|
16
16
|
ruby_version_code = major * 100 + minor * 10 + teeny
|
17
|
+
|
17
18
|
if ruby_version_code < 190
|
18
19
|
require 'complex'
|
19
20
|
end
|
20
21
|
|
22
|
+
# main
|
23
|
+
|
21
24
|
require 'carray_ext'
|
22
|
-
|
23
|
-
require 'carray/
|
24
|
-
require 'carray/
|
25
|
-
require 'carray/
|
26
|
-
require 'carray/
|
27
|
-
require 'carray/
|
28
|
-
require 'carray/
|
25
|
+
|
26
|
+
require 'carray/inspect'
|
27
|
+
require 'carray/basic'
|
28
|
+
require 'carray/construct'
|
29
|
+
require 'carray/mask'
|
30
|
+
require 'carray/compose'
|
31
|
+
require 'carray/transform'
|
32
|
+
require 'carray/convert'
|
33
|
+
require 'carray/testing'
|
34
|
+
require 'carray/ordering'
|
35
|
+
|
36
|
+
require 'carray/math'
|
37
|
+
require 'carray/iterator'
|
38
|
+
require 'carray/struct'
|
39
|
+
require 'carray/table'
|
40
|
+
require 'carray/string'
|
41
|
+
|
42
|
+
# obsolete methods
|
43
|
+
|
44
|
+
require 'carray/obsolete'
|
45
|
+
|
46
|
+
# autoload
|
47
|
+
|
48
|
+
unless $CARRAY_NO_AUTOLOAD
|
49
|
+
require 'carray/autoload'
|
50
|
+
require 'carray/autoload/autoload_base'
|
51
|
+
require 'carray/autoload/autoload_io_imagemagick'
|
52
|
+
require 'carray/autoload/autoload_math_histogram'
|
53
|
+
require 'carray/autoload/autoload_math_recurrence'
|
54
|
+
require 'carray/autoload/autoload_object_iterator'
|
55
|
+
require 'carray/autoload/autoload_object_link'
|
56
|
+
require 'carray/autoload/autoload_object_pack'
|
57
|
+
|
58
|
+
require 'carray/autoload/autoload_gem_random'
|
59
|
+
require 'carray/autoload/autoload_gem_gnuplot'
|
60
|
+
require 'carray/autoload/autoload_gem_narray'
|
61
|
+
require 'carray/autoload/autoload_gem_numo_narray'
|
62
|
+
require 'carray/autoload/autoload_gem_io_csv'
|
63
|
+
require 'carray/autoload/autoload_gem_io_sqlite3'
|
64
|
+
require 'carray/autoload/autoload_gem_rmagick'
|
65
|
+
require 'carray/autoload/autoload_gem_cairo'
|
66
|
+
require 'carray/autoload/autoload_gem_opencv'
|
67
|
+
require 'carray/autoload/autoload_gem_ffi'
|
68
|
+
|
69
|
+
undef autoload_method
|
70
|
+
end
|