numo-narray 0.9.1.1 → 0.9.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/numo/narray/extconf.rb +2 -1
- data/ext/numo/narray/gen/tmpl/format_to_a.c +1 -1
- data/ext/numo/narray/gen/tmpl_bit/format_to_a.c +1 -1
- data/ext/numo/narray/narray.c +0 -6
- data/ext/numo/narray/narray.def +28 -0
- data/ext/numo/narray/ndloop.c +11 -8
- data/ext/numo/narray/numo/narray.h +2 -2
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 21795de8941d7b8176772c41039e4d8a5b3ae03a51090f6ee2979f257de88d43
|
4
|
+
data.tar.gz: ff44506a3ce17bed9b927c23bf0c92395e1c1c54b8ccfcff9edc0aa6edb833c5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1be858a3b1ba7c5028dea3a034ecc4b70ff9e41711957b8989e58a517f911bf41849c84a0f64ec1beb993416b42675384e3e035179910b724692613f765b10cc
|
7
|
+
data.tar.gz: 7db10683049eab739ee97f3599112ea95566ed223d4e24b020cfe400011ae0d6ad862ed01080c50fe3dd3546c508286b70abd4f0c3a7fdec6a977655e08957ba
|
data/ext/numo/narray/extconf.rb
CHANGED
@@ -17,7 +17,8 @@ $INCFLAGS = "-Itypes #$INCFLAGS"
|
|
17
17
|
$INSTALLFILES = Dir.glob(%w[numo/*.h numo/types/*.h]).map{|x| [x,'$(archdir)'] }
|
18
18
|
$INSTALLFILES << ['numo/extconf.h','$(archdir)']
|
19
19
|
if /cygwin|mingw/ =~ RUBY_PLATFORM
|
20
|
-
$
|
20
|
+
$DLDFLAGS << " -Wl,--export-all,--out-implib=libnarray.a"
|
21
|
+
$INSTALLFILES << ['./libnarray.a', '$(archdir)']
|
21
22
|
end
|
22
23
|
|
23
24
|
srcs = %w(
|
@@ -37,7 +37,7 @@ static void
|
|
37
37
|
static VALUE
|
38
38
|
<%=c_func(-1)%>(int argc, VALUE *argv, VALUE self)
|
39
39
|
{
|
40
|
-
|
40
|
+
VALUE fmt=Qnil;
|
41
41
|
ndfunc_arg_in_t ain[3] = {{Qnil,0},{sym_loop_opt},{sym_option}};
|
42
42
|
ndfunc_arg_out_t aout[1] = {{rb_cArray,0}}; // dummy?
|
43
43
|
ndfunc_t ndf = { <%=c_iter%>, FULL_LOOP_NIP, 3, 1, ain, aout };
|
@@ -38,7 +38,7 @@ static void
|
|
38
38
|
static VALUE
|
39
39
|
<%=c_func(-1)%>(int argc, VALUE *argv, VALUE self)
|
40
40
|
{
|
41
|
-
|
41
|
+
VALUE fmt=Qnil;
|
42
42
|
ndfunc_arg_in_t ain[3] = {{Qnil,0},{sym_loop_opt},{sym_option}};
|
43
43
|
ndfunc_arg_out_t aout[1] = {{rb_cArray,0}}; // dummy?
|
44
44
|
ndfunc_t ndf = {<%=c_iter%>, FULL_LOOP_NIP, 3,1, ain,aout};
|
data/ext/numo/narray/narray.c
CHANGED
@@ -631,12 +631,6 @@ na_get_pointer_for_rw(VALUE self, int flag)
|
|
631
631
|
if ((flag & WRITE) && OBJ_FROZEN(obj)) {
|
632
632
|
rb_raise(rb_eRuntimeError, "cannot write to frozen NArray.");
|
633
633
|
}
|
634
|
-
|
635
|
-
if (flag & WRITE) {
|
636
|
-
if (OBJ_FROZEN(obj)) {
|
637
|
-
rb_raise(rb_eRuntimeError, "cannot write to frozen NArray.");
|
638
|
-
}
|
639
|
-
}
|
640
634
|
GetNArray(obj,na);
|
641
635
|
switch(NA_TYPE(na)) {
|
642
636
|
case NARRAY_DATA_T:
|
@@ -0,0 +1,28 @@
|
|
1
|
+
EXPORTS
|
2
|
+
Init_narray
|
3
|
+
nary_new
|
4
|
+
nary_view_new
|
5
|
+
nary_debug_info
|
6
|
+
nary_make_view
|
7
|
+
nary_element_stride
|
8
|
+
nary_dtype_element_stride
|
9
|
+
nary_get_pointer
|
10
|
+
nary_get_pointer_for_write
|
11
|
+
nary_get_pointer_for_read
|
12
|
+
nary_get_pointer_for_read_write
|
13
|
+
nary_get_offset
|
14
|
+
nary_copy_flags
|
15
|
+
nary_check_ladder
|
16
|
+
nary_check_contiguous
|
17
|
+
nary_flatten_dim
|
18
|
+
nary_flatten
|
19
|
+
nary_dup
|
20
|
+
nary_store
|
21
|
+
nary_reduce_dimension
|
22
|
+
nary_reduce_options
|
23
|
+
na_ndloop
|
24
|
+
na_ndloop2
|
25
|
+
na_ndloop3
|
26
|
+
na_ndloop4
|
27
|
+
nary_info_str
|
28
|
+
nary_test_reduce
|
data/ext/numo/narray/ndloop.c
CHANGED
@@ -510,7 +510,7 @@ static void
|
|
510
510
|
ndloop_set_stepidx(na_md_loop_t *lp, int j, VALUE vna, int *dim_map, int rwflag)
|
511
511
|
{
|
512
512
|
size_t n, s;
|
513
|
-
int i, k;
|
513
|
+
int i, k, nd;
|
514
514
|
stridx_t sdx;
|
515
515
|
narray_t *na;
|
516
516
|
|
@@ -528,6 +528,7 @@ ndloop_set_stepidx(na_md_loop_t *lp, int j, VALUE vna, int *dim_map, int rwflag)
|
|
528
528
|
rb_bug("invalid value for read-write flag");
|
529
529
|
}
|
530
530
|
GetNArray(vna,na);
|
531
|
+
nd = LARG(lp,j).ndim;
|
531
532
|
|
532
533
|
switch(NA_TYPE(na)) {
|
533
534
|
case NARRAY_DATA_T:
|
@@ -540,13 +541,14 @@ ndloop_set_stepidx(na_md_loop_t *lp, int j, VALUE vna, int *dim_map, int rwflag)
|
|
540
541
|
s = LARG(lp,j).elmsz;
|
541
542
|
for (k=na->ndim; k--;) {
|
542
543
|
n = na->shape[k];
|
543
|
-
if (n > 1) {
|
544
|
+
if (n > 1 || nd > 0) {
|
544
545
|
i = dim_map[k];
|
545
546
|
//printf("n=%d k=%d i=%d\n",n,k,i);
|
546
547
|
LITER(lp,i,j).step = s;
|
547
|
-
LITER(lp,i,j).idx = NULL;
|
548
|
+
//LITER(lp,i,j).idx = NULL;
|
548
549
|
}
|
549
550
|
s *= n;
|
551
|
+
nd--;
|
550
552
|
}
|
551
553
|
LITER(lp,0,j).pos = 0;
|
552
554
|
break;
|
@@ -555,20 +557,21 @@ ndloop_set_stepidx(na_md_loop_t *lp, int j, VALUE vna, int *dim_map, int rwflag)
|
|
555
557
|
for (k=0; k<na->ndim; k++) {
|
556
558
|
n = na->shape[k];
|
557
559
|
sdx = NA_VIEW_STRIDX(na)[k];
|
558
|
-
if (n > 1) {
|
560
|
+
if (n > 1 || nd > 0) {
|
559
561
|
i = dim_map[k];
|
560
562
|
if (SDX_IS_INDEX(sdx)) {
|
561
563
|
LITER(lp,i,j).step = 0;
|
562
564
|
LITER(lp,i,j).idx = SDX_GET_INDEX(sdx);
|
563
565
|
} else {
|
564
566
|
LITER(lp,i,j).step = SDX_GET_STRIDE(sdx);
|
565
|
-
LITER(lp,i,j).idx = NULL;
|
567
|
+
//LITER(lp,i,j).idx = NULL;
|
566
568
|
}
|
567
569
|
} else if (n==1) {
|
568
570
|
if (SDX_IS_INDEX(sdx)) {
|
569
571
|
LITER(lp,0,j).pos += SDX_GET_INDEX(sdx)[0];
|
570
572
|
}
|
571
573
|
}
|
574
|
+
nd--;
|
572
575
|
}
|
573
576
|
break;
|
574
577
|
default:
|
@@ -621,8 +624,8 @@ na->shape[i] == lp->n[ dim_map[i] ]
|
|
621
624
|
} else {
|
622
625
|
lp->xargs[j].flag = flag = NDL_READ;
|
623
626
|
}
|
624
|
-
ndloop_set_stepidx(lp, j, v, dim_map, flag);
|
625
627
|
LARG(lp,j).ndim = nf_dim;
|
628
|
+
ndloop_set_stepidx(lp, j, v, dim_map, flag);
|
626
629
|
if (nf_dim > 0) {
|
627
630
|
LARG(lp,j).shape = na->shape + (na->ndim - nf_dim);
|
628
631
|
}
|
@@ -787,8 +790,8 @@ ndloop_set_output_narray(ndfunc_t *nf, na_md_loop_t *lp, int k,
|
|
787
790
|
}
|
788
791
|
|
789
792
|
j = lp->nin + k;
|
790
|
-
ndloop_set_stepidx(lp, j, v, dim_map, flag);
|
791
793
|
LARG(lp,j).ndim = nd = nf->aout[k].dim;
|
794
|
+
ndloop_set_stepidx(lp, j, v, dim_map, flag);
|
792
795
|
if (nd > 0) {
|
793
796
|
LARG(lp,j).shape = nf->aout[k].shape;
|
794
797
|
}
|
@@ -981,7 +984,7 @@ ndfunc_set_bufcp(na_md_loop_t *lp, unsigned int loop_spec)
|
|
981
984
|
if (LARG(lp,j).shape) {
|
982
985
|
n = LARG(lp,j).shape[i];
|
983
986
|
} else {
|
984
|
-
printf("shape is NULL\n");
|
987
|
+
//printf("shape is NULL\n");
|
985
988
|
n = lp->user.n[i];
|
986
989
|
}
|
987
990
|
stride = sz * n;
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: numo-narray
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.1.
|
4
|
+
version: 0.9.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Masahiro TANAKA
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-03-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -209,6 +209,7 @@ files:
|
|
209
209
|
- ext/numo/narray/kwargs.c
|
210
210
|
- ext/numo/narray/math.c
|
211
211
|
- ext/numo/narray/narray.c
|
212
|
+
- ext/numo/narray/narray.def
|
212
213
|
- ext/numo/narray/ndloop.c
|
213
214
|
- ext/numo/narray/numo/compat.h
|
214
215
|
- ext/numo/narray/numo/intern.h
|