ext/numo/narray/gen/tmpl_bit/aref.c in numo-narray-0.9.1.4 vs ext/numo/narray/gen/tmpl_bit/aref.c in numo-narray-0.9.1.5

- old
+ new

@@ -1,41 +1,33 @@ /* - Array element referenece or slice view. + Multi-dimensional element reference. @overload [](dim0,...,dimL) - @param [Numeric,Range,etc] dim0,...,dimL Multi-dimensional Index. - @return [Numeric,NArray::<%=class_name%>] Element object or NArray view. + @param [Numeric,Range,Array,Numo::Int32,Numo::Int64,Numo::Bit,TrueClass,FalseClass,Symbol] dim0,...,dimL multi-dimensional indices. + @return [Numeric,Numo::Bit] an element or NArray view. + @see Numo::NArray#[] + @see #[]= - --- Returns the element at +dim0+, +dim1+, ... are Numeric indices - for each dimension, or returns a NArray View as a sliced subarray if - +dim0+, +dim1+, ... includes other than Numeric index, e.g., Range - or Array or true. - @example - a = Numo::DFloat.new(4,5).seq - => Numo::DFloat#shape=[4,5] - [[0, 1, 2, 3, 4], - [5, 6, 7, 8, 9], - [10, 11, 12, 13, 14], - [15, 16, 17, 18, 19]] + a = Numo::Int32.new(3,4).seq + # => Numo::Int32#shape=[3,4] + # [[0, 1, 2, 3], + # [4, 5, 6, 7], + # [8, 9, 10, 11]] - a[1,1] - => 6.0 + b = (a%2).eq(0) + # => Numo::Bit#shape=[3,4] + # [[1, 0, 1, 0], + # [1, 0, 1, 0], + # [1, 0, 1, 0]] - a[1..3,1] - => Numo::DFloat#shape=[3] - [6, 11, 16] + b[true,(0..-1)%2] + # => Numo::Bit(view)#shape=[3,2] + # [[1, 1], + # [1, 1], + # [1, 1]] - a[1,[1,3,4]] - => Numo::DFloat#shape=[3] - [6, 8, 9] - - a[true,2].fill(99) - a - => Numo::DFloat#shape=[4,5] - [[0, 1, 99, 3, 4], - [5, 6, 99, 8, 9], - [10, 11, 99, 13, 14], - [15, 16, 99, 18, 19]] + b[1,1] + # => 0 */ static VALUE <%=c_func(-1)%>(int argc, VALUE *argv, VALUE self) { int nd;