Class: CAIterator
- Inherits:
-
Object
- Object
- CAIterator
- Defined in:
- lib/carray/iterator.rb
Overview
CAIterator -- the form-only base of the iterator family. It carries no engine: each family member (CASlabIterator / CAWindowIterator / CABlockIterator / CACategoricalIterator / CAGroupIterator) implements its own fast engine. The base declares two things: the shared form accessors over the @ndim / @shape ivars, and the common reduction surface every member must implement (surface uniformity is the value: "this is an iterator, so it must answer these").
shape is canonical; dim is a legacy alias. A member exposes what it
actually holds (source / reference / labels) and adds its own methods
(min_index / max_index / map / correlate / convolve / sort_addr / ...);
those are NOT part of the common contract because some members legitimately
omit them (a window has no map, a group has no within-piece min_index).
The retired 2.0 generic dispatch (calculate / filter / evaluate over a
kernel_at_addr slot) is preserved at samples/caiterator/iterator.{rb,c}.
Direct Known Subclasses
CABlockIterator, CACategoricalIterator, CASlabIterator, CAWindowIterator
Instance Attribute Summary collapse
-
#ndim ⇒ Object
readonly
No
include Enumerable: the family surface is fully explicit per iterator, so Enumerable's reduction-like names (to_a / min / sum / count / ...) do not leak in and silently fold the pieces. -
#shape ⇒ Object
(also: #dim)
readonly
No
include Enumerable: the family surface is fully explicit per iterator, so Enumerable's reduction-like names (to_a / min / sum / count / ...) do not leak in and silently fold the pieces.
Instance Attribute Details
#ndim ⇒ Object (readonly)
No include Enumerable: the family surface is fully explicit per iterator,
so Enumerable's reduction-like names (to_a / min / sum / count / ...) do not
leak in and silently fold the pieces. A method outside the contract below
that a member does not define is a clean NoMethodError, not a wrong answer.
29 30 31 |
# File 'lib/carray/iterator.rb', line 29 def ndim @ndim end |
#shape ⇒ Object (readonly) Also known as: dim
No include Enumerable: the family surface is fully explicit per iterator,
so Enumerable's reduction-like names (to_a / min / sum / count / ...) do not
leak in and silently fold the pieces. A method outside the contract below
that a member does not define is a clean NoMethodError, not a wrong answer.
29 30 31 |
# File 'lib/carray/iterator.rb', line 29 def shape @shape end |