Class: CAStack
- Inherits:
-
Object
- Object
- CAStack
- Extended by:
- AutoloadMethodExtension
- Defined in:
- lib/carray/stack.rb,
lib/carray/autoload_carray.rb
Overview
CAStack.new(list, axis: 0) is implemented in C (ext/ca_obj_stack.c rb_ca_stack_s_new): it overrides Class#new to inspect Face homogeneity and (when applicable) re-wrap the raw CAStack via ca_face_lift. The Ruby class only adds the #append instance method below.
Instance Method Summary collapse
-
#append(*others) ⇒ CAStack
Flat-append
othersinto self's parents, preserving the receiver's k_axis.
Instance Method Details
#append(*others) ⇒ CAStack
Flat-append others into self's parents, preserving the receiver's
k_axis. Returns a new CAStack with the combined parents list.
Distinct from CArray#stack(other) which always treats self as a
single parent of a new K-stack -- here, the existing K-stack is
extended in place.
Example: s = CArray.stack([a, b], axis: 1) # 2-parent stack, k_axis=1 s.append(c, d) # 4-parent stack, k_axis=1
287 288 289 290 |
# File 'lib/carray/stack.rb', line 287 def append (*others) raise ArgumentError, "append: at least one parent required" if others.empty? CArray.stack(self.parents + others, axis: self.k_axis) end |