def project_right_index

bendtorch-core@0.1.0.0 · src/shape/flat.bend:51

import bendtorch-core@0.1.0.0/src/shape/flat.bend as Flat
import Base
import bendtorch-core@0.1.0.0/src/shape/core.bend as Shape

51def project_right_index(+plan: Shape.BroadcastPlan, map: Shape.Index<Shape.extents(Shape.left_shape(plan)), Shape.extents(Shape.right_shape(plan)), Shape.extents(Shape.output_shape(plan))>, index: Shape.FlatIndex<Shape.output_shape(plan)>) -> Shape.FlatIndex<Shape.right_shape(plan)>:
52  match map index:
53    case Shape.Indexed{rows, exact} Shape.FIndex{+value, bound}:
54      Shape.FIndex{Shape.walk_right(rows, value), right_bound(plan, rows, exact, value, bound)}
55    case Shape.Unindexed{zero} Shape.FIndex{+value, bound}:
56      Empty.absurd(Shape.FlatIndex<Shape.right_shape(plan)>, hollow(Shape.output_shape(plan), value, zero, bound))

Uses (11)

Used by (7)