numo-narray 0.9.0.4 → 0.9.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +11 -8
- data/Rakefile +9 -0
- data/ext/numo/narray/array.c +178 -47
- data/ext/numo/narray/data.c +105 -97
- data/ext/numo/narray/depend.erb +6 -7
- data/ext/numo/narray/gen/cogen.rb +30 -7
- data/ext/numo/narray/gen/def/bit.rb +17 -14
- data/ext/numo/narray/gen/def/dcomplex.rb +19 -15
- data/ext/numo/narray/gen/def/dfloat.rb +17 -13
- data/ext/numo/narray/gen/def/int16.rb +16 -12
- data/ext/numo/narray/gen/def/int32.rb +16 -12
- data/ext/numo/narray/gen/def/int64.rb +16 -12
- data/ext/numo/narray/gen/def/int8.rb +16 -12
- data/ext/numo/narray/gen/def/robject.rb +18 -14
- data/ext/numo/narray/gen/def/scomplex.rb +19 -15
- data/ext/numo/narray/gen/def/sfloat.rb +17 -13
- data/ext/numo/narray/gen/def/uint16.rb +16 -12
- data/ext/numo/narray/gen/def/uint32.rb +16 -12
- data/ext/numo/narray/gen/def/uint64.rb +16 -12
- data/ext/numo/narray/gen/def/uint8.rb +16 -12
- data/ext/numo/narray/gen/erbpp2.rb +324 -0
- data/ext/numo/narray/gen/narray_def.rb +252 -0
- data/ext/numo/narray/gen/spec.rb +141 -71
- data/ext/numo/narray/gen/tmpl/accum.c +22 -9
- data/ext/numo/narray/gen/tmpl/accum_binary.c +29 -13
- data/ext/numo/narray/gen/tmpl/accum_index.c +38 -16
- data/ext/numo/narray/gen/tmpl/alloc_func.c +107 -0
- data/ext/numo/narray/gen/tmpl/allocate.c +1 -1
- data/ext/numo/narray/gen/tmpl/aref.c +1 -1
- data/ext/numo/narray/gen/tmpl/aset.c +4 -2
- data/ext/numo/narray/gen/tmpl/binary.c +4 -4
- data/ext/numo/narray/gen/tmpl/binary2.c +5 -5
- data/ext/numo/narray/gen/tmpl/binary_s.c +5 -5
- data/ext/numo/narray/gen/tmpl/bincount.c +4 -4
- data/ext/numo/narray/gen/tmpl/cast.c +9 -6
- data/ext/numo/narray/gen/tmpl/cast_array.c +4 -9
- data/ext/numo/narray/gen/tmpl/class.c +9 -0
- data/ext/numo/narray/gen/tmpl/clip.c +118 -0
- data/ext/numo/narray/gen/tmpl/coerce_cast.c +4 -2
- data/ext/numo/narray/gen/tmpl/cond_binary.c +5 -5
- data/ext/numo/narray/gen/tmpl/cond_unary.c +6 -6
- data/ext/numo/narray/gen/tmpl/cum.c +18 -9
- data/ext/numo/narray/gen/tmpl/each.c +2 -2
- data/ext/numo/narray/gen/tmpl/each_with_index.c +2 -2
- data/ext/numo/narray/gen/tmpl/extract.c +2 -2
- data/ext/numo/narray/gen/tmpl/extract_data.c +48 -0
- data/ext/numo/narray/gen/tmpl/eye.c +3 -3
- data/ext/numo/narray/gen/tmpl/fill.c +2 -2
- data/ext/numo/narray/gen/tmpl/format.c +5 -5
- data/ext/numo/narray/gen/tmpl/format_to_a.c +4 -4
- data/ext/numo/narray/gen/tmpl/frexp.c +37 -0
- data/ext/numo/narray/gen/tmpl/init_class.c +20 -0
- data/ext/numo/narray/gen/tmpl/init_module.c +12 -0
- data/ext/numo/narray/gen/tmpl/inspect.c +2 -2
- data/ext/numo/narray/gen/tmpl/lib.c +45 -0
- data/ext/numo/narray/gen/tmpl/logseq.c +1 -1
- data/ext/numo/narray/gen/tmpl/map_with_index.c +2 -2
- data/ext/numo/narray/gen/tmpl/median.c +31 -8
- data/ext/numo/narray/gen/tmpl/minmax.c +24 -24
- data/ext/numo/narray/gen/tmpl/module.c +9 -0
- data/ext/numo/narray/gen/tmpl/new_dim0.c +12 -0
- data/ext/numo/narray/gen/tmpl/poly.c +3 -3
- data/ext/numo/narray/gen/tmpl/pow.c +1 -1
- data/ext/numo/narray/gen/tmpl/powint.c +1 -1
- data/ext/numo/narray/gen/tmpl/qsort.c +10 -3
- data/ext/numo/narray/gen/tmpl/rand.c +1 -1
- data/ext/numo/narray/gen/tmpl/rand_norm.c +1 -1
- data/ext/numo/narray/gen/tmpl/seq.c +1 -1
- data/ext/numo/narray/gen/tmpl/set2.c +5 -5
- data/ext/numo/narray/gen/tmpl/sort.c +29 -14
- data/ext/numo/narray/gen/tmpl/sort_index.c +41 -20
- data/ext/numo/narray/gen/tmpl/store.c +11 -5
- data/ext/numo/narray/gen/tmpl/store_array.c +1 -1
- data/ext/numo/narray/gen/tmpl/store_bit.c +1 -1
- data/ext/numo/narray/gen/tmpl/store_from.c +1 -1
- data/ext/numo/narray/gen/tmpl/store_numeric.c +3 -16
- data/ext/numo/narray/gen/tmpl/to_a.c +2 -2
- data/ext/numo/narray/gen/tmpl/unary.c +7 -7
- data/ext/numo/narray/gen/tmpl/unary2.c +8 -8
- data/ext/numo/narray/gen/tmpl/unary_ret2.c +33 -0
- data/ext/numo/narray/gen/tmpl/unary_s.c +8 -8
- data/ext/numo/narray/gen/tmpl_bit/allocate.c +1 -5
- data/ext/numo/narray/gen/tmpl_bit/aref.c +1 -1
- data/ext/numo/narray/gen/tmpl_bit/aset.c +2 -2
- data/ext/numo/narray/gen/tmpl_bit/binary.c +8 -8
- data/ext/numo/narray/gen/tmpl_bit/bit_count.c +8 -8
- data/ext/numo/narray/gen/tmpl_bit/bit_reduce.c +6 -6
- data/ext/numo/narray/gen/tmpl_bit/each.c +2 -2
- data/ext/numo/narray/gen/tmpl_bit/each_with_index.c +2 -2
- data/ext/numo/narray/gen/tmpl_bit/extract.c +1 -1
- data/ext/numo/narray/gen/tmpl_bit/fill.c +2 -2
- data/ext/numo/narray/gen/tmpl_bit/format.c +5 -5
- data/ext/numo/narray/gen/tmpl_bit/format_to_a.c +2 -2
- data/ext/numo/narray/gen/tmpl_bit/inspect.c +2 -2
- data/ext/numo/narray/gen/tmpl_bit/mask.c +5 -5
- data/ext/numo/narray/gen/tmpl_bit/none_p.c +4 -4
- data/ext/numo/narray/gen/tmpl_bit/store_array.c +2 -2
- data/ext/numo/narray/gen/tmpl_bit/store_bit.c +1 -1
- data/ext/numo/narray/gen/tmpl_bit/store_from.c +1 -1
- data/ext/numo/narray/gen/tmpl_bit/to_a.c +2 -2
- data/ext/numo/narray/gen/tmpl_bit/unary.c +9 -9
- data/ext/numo/narray/gen/tmpl_bit/where.c +6 -6
- data/ext/numo/narray/gen/tmpl_bit/where2.c +8 -8
- data/ext/numo/narray/index.c +46 -30
- data/ext/numo/narray/math.c +12 -6
- data/ext/numo/narray/narray.c +242 -218
- data/ext/numo/narray/ndloop.c +17 -24
- data/ext/numo/narray/numo/intern.h +63 -67
- data/ext/numo/narray/numo/narray.h +38 -13
- data/ext/numo/narray/numo/ndloop.h +1 -1
- data/ext/numo/narray/numo/template.h +1 -1
- data/ext/numo/narray/numo/types/complex.h +8 -4
- data/ext/numo/narray/numo/types/complex_macro.h +118 -1
- data/ext/numo/narray/numo/types/float_macro.h +283 -6
- data/ext/numo/narray/numo/types/robj_macro.h +261 -9
- data/ext/numo/narray/numo/types/xint_macro.h +35 -0
- data/ext/numo/narray/struct.c +34 -15
- data/lib/erbpp.rb +5 -1
- data/lib/erbpp/line_number.rb +10 -3
- data/lib/erbpp/narray_def.rb +55 -25
- data/lib/numo/narray/extra.rb +638 -219
- data/numo-narray.gemspec +1 -0
- data/spec/narray_spec.rb +2 -2
- metadata +17 -14
- data/ext/numo/narray/gen/dtype.erb.c +0 -82
- data/ext/numo/narray/gen/tmpl/cast_numeric.c +0 -22
- data/ext/numo/narray/gen/tmpl/robj_allocate.c +0 -32
- data/ext/numo/narray/gen/tmpl_bit/cast.c +0 -37
- data/ext/numo/narray/gen/tmpl_bit/cast_array.c +0 -18
- data/ext/numo/narray/gen/tmpl_bit/cast_numeric.c +0 -22
- data/ext/numo/narray/gen/tmpl_bit/coerce_cast.c +0 -8
- data/ext/numo/narray/gen/tmpl_bit/map_with_index.c +0 -94
- data/ext/numo/narray/gen/tmpl_bit/store.c +0 -32
- data/ext/numo/narray/gen/tmpl_bit/store_numeric.c +0 -22
@@ -1,5 +1,6 @@
|
|
1
|
+
<% (is_float ? ["_ignan","_prnan"] : [""]).each do |j| %>
|
1
2
|
static void
|
2
|
-
<%=c_iter%>(na_loop_t *const lp)
|
3
|
+
<%=c_iter%><%=j%>(na_loop_t *const lp)
|
3
4
|
{
|
4
5
|
size_t n;
|
5
6
|
char *ptr;
|
@@ -7,30 +8,44 @@ static void
|
|
7
8
|
|
8
9
|
INIT_COUNTER(lp, n);
|
9
10
|
INIT_PTR(lp, 0, ptr, step);
|
10
|
-
<%=
|
11
|
+
<%=type_name%>_qsort<%=j%>(ptr, n, step);
|
11
12
|
}
|
13
|
+
<% end %>
|
12
14
|
|
13
15
|
/*
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
16
|
+
<%=name%> of self.
|
17
|
+
<% if is_float %>
|
18
|
+
@overload <%=name%>(axis:nil, nan:false)
|
19
|
+
@param [TrueClass] nan If true, propagete NaN. If false, ignore NaN.
|
20
|
+
<% else %>
|
21
|
+
@overload <%=name%>(axis:nil)
|
22
|
+
<% end %>
|
23
|
+
@param [Numeric,Array,Range] axis Affected dimensions.
|
24
|
+
@return [Numo::<%=class_name%>] returns result of <%=name%>.
|
25
|
+
@example
|
26
|
+
Numo::DFloat[3,4,1,2].sort => Numo::DFloat[1,2,3,4]
|
27
|
+
*/
|
22
28
|
static VALUE
|
23
|
-
<%=c_func%>(int argc, VALUE *argv, VALUE self)
|
29
|
+
<%=c_func(-1)%>(int argc, VALUE *argv, VALUE self)
|
24
30
|
{
|
31
|
+
int nan = 0;
|
25
32
|
VALUE reduce;
|
26
33
|
ndfunc_arg_in_t ain[2] = {{OVERWRITE,0},{sym_reduce,0}};
|
27
|
-
ndfunc_t ndf = {
|
34
|
+
ndfunc_t ndf = {0, STRIDE_LOOP|NDF_FLAT_REDUCE, 2,0, ain,0};
|
28
35
|
|
29
36
|
if (!TEST_INPLACE(self)) {
|
30
37
|
self = na_copy(self);
|
31
38
|
}
|
32
|
-
reduce = na_reduce_dimension(argc, argv, 1, &self); // v[0] = self
|
33
|
-
|
39
|
+
reduce = na_reduce_dimension(argc, argv, 1, &self, &nan); // v[0] = self
|
40
|
+
<% if is_float %>
|
41
|
+
if (nan) {
|
42
|
+
ndf.func = <%=c_iter%>_prnan;
|
43
|
+
} else {
|
44
|
+
ndf.func = <%=c_iter%>_ignan;
|
45
|
+
}
|
46
|
+
<% else %>
|
47
|
+
ndf.func = <%=c_iter%>;
|
48
|
+
<% end %>
|
34
49
|
na_ndloop(&ndf, 2, self, reduce);
|
35
50
|
return self;
|
36
51
|
}
|
@@ -1,8 +1,8 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
<% (is_float ? ["_ignan","_prnan"] : [""]).each do |j|
|
2
|
+
[64,32].each do |i| %>
|
3
3
|
#define idx_t int<%=i%>_t
|
4
4
|
static void
|
5
|
-
<%=
|
5
|
+
<%=type_name%>_index<%=i%>_qsort<%=j%>(na_loop_t *const lp)
|
6
6
|
{
|
7
7
|
size_t i, n, idx;
|
8
8
|
char *d_ptr, *i_ptr, *o_ptr;
|
@@ -23,7 +23,7 @@ static void
|
|
23
23
|
//printf("(%ld,%.3f)",i,*(double*)ptr[i]);
|
24
24
|
}
|
25
25
|
|
26
|
-
<%=
|
26
|
+
<%=type_name%>_index_qsort<%=j%>(ptr, n, sizeof(dtype*));
|
27
27
|
|
28
28
|
//d_ptr = lp->args[0].ptr;
|
29
29
|
//printf("(d_ptr=%lx)\n",(size_t)d_ptr);
|
@@ -37,20 +37,25 @@ static void
|
|
37
37
|
//printf("\n");
|
38
38
|
}
|
39
39
|
#undef idx_t
|
40
|
-
<% end %>
|
40
|
+
<% end;end %>
|
41
41
|
|
42
42
|
/*
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
43
|
+
<%=name%>. Returns an index array of sort result.
|
44
|
+
<% if is_float %>
|
45
|
+
@overload <%=name%>(axis:nil, nan:false)
|
46
|
+
@param [TrueClass] nan If true, propagete NaN. If false, ignore NaN.
|
47
|
+
<% else %>
|
48
|
+
@overload <%=name%>(axis:nil)
|
49
|
+
<% end %>
|
50
|
+
@param [Numeric,Array,Range] axis Affected dimensions.
|
51
|
+
@return [Integer,Numo::Int] returns result index of <%=name%>.
|
52
|
+
@example
|
53
|
+
Numo::NArray[3,4,1,2].sort_index => Numo::Int32[2,3,0,1]
|
54
|
+
*/
|
51
55
|
static VALUE
|
52
|
-
<%=c_func%>(int argc, VALUE *argv, VALUE self)
|
56
|
+
<%=c_func(-1)%>(int argc, VALUE *argv, VALUE self)
|
53
57
|
{
|
58
|
+
int nan = 0;
|
54
59
|
size_t size;
|
55
60
|
narray_t *na;
|
56
61
|
VALUE idx, tmp, reduce, res;
|
@@ -59,6 +64,8 @@ static VALUE
|
|
59
64
|
ndfunc_arg_out_t aout[1] = {{0,0,0}};
|
60
65
|
ndfunc_t ndf = {0, STRIDE_LOOP_NIP|NDF_FLAT_REDUCE|NDF_CUM, 3,1, ain,aout};
|
61
66
|
|
67
|
+
reduce = na_reduce_dimension(argc, argv, 1, &self, &nan); // v[0] = self
|
68
|
+
|
62
69
|
GetNArray(self,na);
|
63
70
|
if (na->ndim==0) {
|
64
71
|
return INT2FIX(0);
|
@@ -66,18 +73,32 @@ static VALUE
|
|
66
73
|
if (na->size > (~(u_int32_t)0)) {
|
67
74
|
ain[1].type =
|
68
75
|
aout[0].type = numo_cInt64;
|
69
|
-
idx =
|
70
|
-
|
76
|
+
idx = nary_new(numo_cInt64, na->ndim, na->shape);
|
77
|
+
<% if is_float %>
|
78
|
+
if (nan) {
|
79
|
+
ndf.func = <%=type_name%>_index64_qsort_prnan;
|
80
|
+
} else {
|
81
|
+
ndf.func = <%=type_name%>_index64_qsort_ignan;
|
82
|
+
}
|
83
|
+
<% else %>
|
84
|
+
ndf.func = <%=type_name%>_index64_qsort;
|
85
|
+
<% end %>
|
71
86
|
} else {
|
72
87
|
ain[1].type =
|
73
88
|
aout[0].type = numo_cInt32;
|
74
|
-
idx =
|
75
|
-
|
89
|
+
idx = nary_new(numo_cInt32, na->ndim, na->shape);
|
90
|
+
<% if is_float %>
|
91
|
+
if (nan) {
|
92
|
+
ndf.func = <%=type_name%>_index32_qsort_prnan;
|
93
|
+
} else {
|
94
|
+
ndf.func = <%=type_name%>_index32_qsort_ignan;
|
95
|
+
}
|
96
|
+
<% else %>
|
97
|
+
ndf.func = <%=type_name%>_index32_qsort;
|
98
|
+
<% end %>
|
76
99
|
}
|
77
100
|
rb_funcall(idx, rb_intern("seq"), 0);
|
78
101
|
|
79
|
-
reduce = na_reduce_dimension(argc, argv, 1, &self); // v[0] = self
|
80
|
-
|
81
102
|
size = na->size*sizeof(void*);
|
82
103
|
buf = rb_alloc_tmp_buffer(&tmp, size);
|
83
104
|
res = na_ndloop3(&ndf, buf, 3, self, idx, reduce);
|
@@ -1,3 +1,7 @@
|
|
1
|
+
<% children.each do |c|%>
|
2
|
+
<%= c.result %>
|
3
|
+
|
4
|
+
<% end %>
|
1
5
|
/*
|
2
6
|
Store elements to Numo::<%=class_name%> from other.
|
3
7
|
@overload store(other)
|
@@ -5,12 +9,14 @@
|
|
5
9
|
@return [Numo::<%=class_name%>] self
|
6
10
|
*/
|
7
11
|
static VALUE
|
8
|
-
<%=c_func%>(VALUE self, VALUE obj)
|
12
|
+
<%=c_func(1)%>(VALUE self, VALUE obj)
|
9
13
|
{
|
10
|
-
VALUE r;
|
14
|
+
VALUE r, klass;
|
15
|
+
|
16
|
+
klass = CLASS_OF(obj);
|
11
17
|
|
12
|
-
<%
|
13
|
-
if (<%=x.condition%>) {
|
18
|
+
<% definitions.each do |x| %>
|
19
|
+
if (<%=x.condition("klass")%>) {
|
14
20
|
<%=x.c_func%>(self,obj);
|
15
21
|
return self;
|
16
22
|
}
|
@@ -25,7 +31,7 @@ static VALUE
|
|
25
31
|
}
|
26
32
|
|
27
33
|
<% if is_object %>
|
28
|
-
|
34
|
+
robject_store_numeric(self,obj);
|
29
35
|
<% else %>
|
30
36
|
rb_raise(nary_eCastError, "unknown conversion from %s to %s",
|
31
37
|
rb_class2name(CLASS_OF(obj)),
|
@@ -1,22 +1,9 @@
|
|
1
1
|
static VALUE
|
2
|
-
|
3
|
-
{
|
4
|
-
VALUE v;
|
5
|
-
dtype *ptr;
|
6
|
-
|
7
|
-
v = rb_narray_new(cT, 0, NULL);
|
8
|
-
ptr = (dtype*)(char*)na_get_pointer_for_write(v);
|
9
|
-
*ptr = x;
|
10
|
-
na_release_lock(v);
|
11
|
-
return v;
|
12
|
-
}
|
13
|
-
|
14
|
-
static VALUE
|
15
|
-
<%=c_func%>(VALUE self, VALUE obj)
|
2
|
+
<%=c_func(:nodef)%>(VALUE self, VALUE obj)
|
16
3
|
{
|
17
4
|
dtype x;
|
18
5
|
x = m_num_to_data(obj);
|
19
|
-
obj =
|
20
|
-
<%=
|
6
|
+
obj = <%=type_name%>_new_dim0(x);
|
7
|
+
<%=parent.c_func%>(self,obj);
|
21
8
|
return self;
|
22
9
|
}
|
@@ -28,11 +28,11 @@ void
|
|
28
28
|
|
29
29
|
/*
|
30
30
|
Convert self to Array.
|
31
|
-
@overload <%=
|
31
|
+
@overload <%=name%>
|
32
32
|
@return [Array]
|
33
33
|
*/
|
34
34
|
static VALUE
|
35
|
-
<%=c_func%>(VALUE self)
|
35
|
+
<%=c_func(0)%>(VALUE self)
|
36
36
|
{
|
37
37
|
ndfunc_arg_in_t ain[3] = {{Qnil,0},{sym_loop_opt},{sym_option}};
|
38
38
|
ndfunc_arg_out_t aout[1] = {{rb_cArray,0}}; // dummy?
|
@@ -15,13 +15,13 @@ static void
|
|
15
15
|
if (idx2) {
|
16
16
|
for (; i--;) {
|
17
17
|
GET_DATA_INDEX(p1,idx1,dtype,x);
|
18
|
-
x = m_<%=
|
18
|
+
x = m_<%=name%>(x);
|
19
19
|
SET_DATA_INDEX(p2,idx2,dtype,x);
|
20
20
|
}
|
21
21
|
} else {
|
22
22
|
for (; i--;) {
|
23
23
|
GET_DATA_INDEX(p1,idx1,dtype,x);
|
24
|
-
x = m_<%=
|
24
|
+
x = m_<%=name%>(x);
|
25
25
|
SET_DATA_STRIDE(p2,s2,dtype,x);
|
26
26
|
}
|
27
27
|
}
|
@@ -29,13 +29,13 @@ static void
|
|
29
29
|
if (idx2) {
|
30
30
|
for (; i--;) {
|
31
31
|
GET_DATA_STRIDE(p1,s1,dtype,x);
|
32
|
-
x = m_<%=
|
32
|
+
x = m_<%=name%>(x);
|
33
33
|
SET_DATA_INDEX(p2,idx2,dtype,x);
|
34
34
|
}
|
35
35
|
} else {
|
36
36
|
for (; i--;) {
|
37
37
|
GET_DATA_STRIDE(p1,s1,dtype,x);
|
38
|
-
x = m_<%=
|
38
|
+
x = m_<%=name%>(x);
|
39
39
|
SET_DATA_STRIDE(p2,s2,dtype,x);
|
40
40
|
}
|
41
41
|
}
|
@@ -43,12 +43,12 @@ static void
|
|
43
43
|
}
|
44
44
|
|
45
45
|
/*
|
46
|
-
Unary <%=
|
46
|
+
Unary <%=name%>.
|
47
47
|
@overload <%=op_map%>
|
48
|
-
@return [Numo::<%=class_name%>] <%=
|
48
|
+
@return [Numo::<%=class_name%>] <%=name%> of self.
|
49
49
|
*/
|
50
50
|
static VALUE
|
51
|
-
<%=c_func%>(VALUE self)
|
51
|
+
<%=c_func(0)%>(VALUE self)
|
52
52
|
{
|
53
53
|
ndfunc_arg_in_t ain[1] = {{cT,0}};
|
54
54
|
ndfunc_arg_out_t aout[1] = {{cT,0}};
|
@@ -14,13 +14,13 @@ static void
|
|
14
14
|
if (idx2) {
|
15
15
|
for (; i--;) {
|
16
16
|
GET_DATA_INDEX(p1,idx1,dtype,x);
|
17
|
-
y = m_<%=
|
17
|
+
y = m_<%=name%>(x);
|
18
18
|
SET_DATA_INDEX(p2,idx2,<%=dtype%>,y);
|
19
19
|
}
|
20
20
|
} else {
|
21
21
|
for (; i--;) {
|
22
22
|
GET_DATA_INDEX(p1,idx1,dtype,x);
|
23
|
-
y = m_<%=
|
23
|
+
y = m_<%=name%>(x);
|
24
24
|
SET_DATA_STRIDE(p2,s2,<%=dtype%>,y);
|
25
25
|
}
|
26
26
|
}
|
@@ -28,13 +28,13 @@ static void
|
|
28
28
|
if (idx2) {
|
29
29
|
for (; i--;) {
|
30
30
|
GET_DATA_STRIDE(p1,s1,dtype,x);
|
31
|
-
y = m_<%=
|
31
|
+
y = m_<%=name%>(x);
|
32
32
|
SET_DATA_INDEX(p2,idx2,<%=dtype%>,y);
|
33
33
|
}
|
34
34
|
} else {
|
35
35
|
for (; i--;) {
|
36
36
|
GET_DATA_STRIDE(p1,s1,dtype,x);
|
37
|
-
y = m_<%=
|
37
|
+
y = m_<%=name%>(x);
|
38
38
|
SET_DATA_STRIDE(p2,s2,<%=dtype%>,y);
|
39
39
|
}
|
40
40
|
}
|
@@ -43,12 +43,12 @@ static void
|
|
43
43
|
|
44
44
|
|
45
45
|
/*
|
46
|
-
<%=
|
47
|
-
@overload <%=
|
48
|
-
@return [Numo::<%=real_class_name%>] <%=
|
46
|
+
<%=name%> of self.
|
47
|
+
@overload <%=name%>
|
48
|
+
@return [Numo::<%=real_class_name%>] <%=name%> of self.
|
49
49
|
*/
|
50
50
|
static VALUE
|
51
|
-
<%=c_func%>(VALUE self)
|
51
|
+
<%=c_func(0)%>(VALUE self)
|
52
52
|
{
|
53
53
|
ndfunc_arg_in_t ain[1] = {{cT,0}};
|
54
54
|
ndfunc_arg_out_t aout[1] = {{<%=tpclass%>,0}};
|
@@ -0,0 +1,33 @@
|
|
1
|
+
static void
|
2
|
+
<%=c_iter%>(na_loop_t *const lp)
|
3
|
+
{
|
4
|
+
size_t i;
|
5
|
+
char *p1, *p2, *p3;
|
6
|
+
ssize_t s1, s2, s3;
|
7
|
+
dtype x, y, z;
|
8
|
+
INIT_COUNTER(lp, i);
|
9
|
+
INIT_PTR(lp, 0, p1, s1);
|
10
|
+
INIT_PTR(lp, 1, p2, s2);
|
11
|
+
INIT_PTR(lp, 2, p3, s3);
|
12
|
+
for (; i--;) {
|
13
|
+
GET_DATA_STRIDE(p1,s1,dtype,x);
|
14
|
+
m_<%=name%>(x,y,z);
|
15
|
+
SET_DATA_STRIDE(p2,s2,dtype,y);
|
16
|
+
SET_DATA_STRIDE(p3,s3,dtype,z);
|
17
|
+
}
|
18
|
+
}
|
19
|
+
|
20
|
+
/*
|
21
|
+
<%=name%> of self.
|
22
|
+
@overload <%=name%>
|
23
|
+
@return [Numo::<%=real_class_name%>] <%=name%> of self.
|
24
|
+
*/
|
25
|
+
static VALUE
|
26
|
+
<%=c_func(0)%>(VALUE self)
|
27
|
+
{
|
28
|
+
ndfunc_arg_in_t ain[1] = {{cT,0}};
|
29
|
+
ndfunc_arg_out_t aout[2] = {{cT,0},{cT,0}};
|
30
|
+
ndfunc_t ndf = {<%=c_iter%>, STRIDE_LOOP, 1,2, ain,aout};
|
31
|
+
|
32
|
+
return na_ndloop(&ndf, 1, self);
|
33
|
+
}
|
@@ -13,13 +13,13 @@ static void
|
|
13
13
|
if (idx2) {
|
14
14
|
for (; i--;) {
|
15
15
|
GET_DATA_INDEX(p1,idx1,dtype,x);
|
16
|
-
x = m_<%=
|
16
|
+
x = m_<%=name%>(x);
|
17
17
|
SET_DATA_INDEX(p2,idx2,dtype,x);
|
18
18
|
}
|
19
19
|
} else {
|
20
20
|
for (; i--;) {
|
21
21
|
GET_DATA_INDEX(p1,idx1,dtype,x);
|
22
|
-
x = m_<%=
|
22
|
+
x = m_<%=name%>(x);
|
23
23
|
SET_DATA_STRIDE(p2,s2,dtype,x);
|
24
24
|
}
|
25
25
|
}
|
@@ -27,13 +27,13 @@ static void
|
|
27
27
|
if (idx2) {
|
28
28
|
for (; i--;) {
|
29
29
|
GET_DATA_STRIDE(p1,s1,dtype,x);
|
30
|
-
x = m_<%=
|
30
|
+
x = m_<%=name%>(x);
|
31
31
|
SET_DATA_INDEX(p2,idx2,dtype,x);
|
32
32
|
}
|
33
33
|
} else {
|
34
34
|
for (; i--;) {
|
35
35
|
GET_DATA_STRIDE(p1,s1,dtype,x);
|
36
|
-
x = m_<%=
|
36
|
+
x = m_<%=name%>(x);
|
37
37
|
SET_DATA_STRIDE(p2,s2,dtype,x);
|
38
38
|
}
|
39
39
|
}
|
@@ -41,13 +41,13 @@ static void
|
|
41
41
|
}
|
42
42
|
|
43
43
|
/*
|
44
|
-
Calculate <%=
|
45
|
-
@overload <%=
|
44
|
+
Calculate <%=name%>(x).
|
45
|
+
@overload <%=name%>(x)
|
46
46
|
@param [Numo::NArray,Numeric] x input value
|
47
|
-
@return [Numo::<%=class_name%>] result of <%=
|
47
|
+
@return [Numo::<%=class_name%>] result of <%=name%>(x).
|
48
48
|
*/
|
49
49
|
static VALUE
|
50
|
-
<%=c_func%>(VALUE mod, VALUE a1)
|
50
|
+
<%=c_func(1)%>(VALUE mod, VALUE a1)
|
51
51
|
{
|
52
52
|
ndfunc_arg_in_t ain[1] = {{cT,0}};
|
53
53
|
ndfunc_arg_out_t aout[1] = {{cT,0}};
|