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,32 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
Store elements to Numo::<%=class_name%> from other.
|
3
|
-
@overload store(other)
|
4
|
-
@param [Object] other
|
5
|
-
@return [Numo::<%=class_name%>] self
|
6
|
-
*/
|
7
|
-
static VALUE
|
8
|
-
<%=c_func%>(VALUE self, VALUE obj)
|
9
|
-
{
|
10
|
-
|
11
|
-
VALUE r;
|
12
|
-
|
13
|
-
<% Store.definitions.each do |x| %>
|
14
|
-
if (<%=x.condition%>) {
|
15
|
-
<%=x.c_func%>(self,obj);
|
16
|
-
return self;
|
17
|
-
}
|
18
|
-
<% end %>
|
19
|
-
|
20
|
-
if (IsNArray(obj)) {
|
21
|
-
r = rb_funcall(obj, rb_intern("coerce_cast"), 1, cT);
|
22
|
-
if (CLASS_OF(r)==cT) {
|
23
|
-
<%=c_func%>(self,r);
|
24
|
-
return self;
|
25
|
-
}
|
26
|
-
}
|
27
|
-
|
28
|
-
rb_raise(nary_eCastError, "unknown conversion from %s to %s",
|
29
|
-
rb_class2name(CLASS_OF(obj)),
|
30
|
-
rb_class2name(CLASS_OF(self)));
|
31
|
-
return self;
|
32
|
-
}
|
@@ -1,22 +0,0 @@
|
|
1
|
-
static VALUE
|
2
|
-
numo_<%=tp%>_new_dim0(dtype x)
|
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)
|
16
|
-
{
|
17
|
-
dtype x;
|
18
|
-
x = m_num_to_data(obj);
|
19
|
-
obj = numo_<%=tp%>_new_dim0(x);
|
20
|
-
<%=find_tmpl("store").c_func%>(self,obj);
|
21
|
-
return self;
|
22
|
-
}
|