Module reshape

Source
Expand description

Reshaping transformations for multidimensional slices and shapes. Dimensional reshaping of slices and shapes.

This module defines utilities for transforming a Slice or Shape by factoring large extents into smaller ones under a given limit. The result is a reshaped view with increased dimensionality and preserved memory layout.

This is useful for hierarchical routing, structured fanout, and other multidimensional layout transformations.

For Shapes, reshaping also expands dimension labels using a label/N naming convention, preserving the semantics of the original shape in the reshaped reshape_with_limit.

See [reshape_with_limit] and [reshape_shape] for entry points.

Modules§

prelude
For convenient slice.reshape_with_limit(), shape.reshape() syntax, use reshape::prelude::*.

Structs§

Limit
A shaping constraint that bounds the maximum extent allowed in any reshaped dimension.
ReshapedShape
A reshaped version of a Shape, with factored dimensions and updated labels.

Traits§

ReshapeShapeExt
Extension trait for reshaping Shapes by factoring large dimensions.
ReshapeSliceExt
A trait for types that can be reshaped into a higher-dimensional view by factoring large extents into smaller ones.

Functions§

expand_labels
Expands factored dimension labels into one label per subdimension.
reshape_shape
Reshapes a labeled Shape by factoring large extents into smaller ones, producing a new shape with expanded dimensionality and updated labels.
reshape_with_limit
Reshapes a slice by factoring each dimension into smaller extents under the given limit.
to_original_coord
Constructs a function that maps coordinates from the reshaped slice back to equivalent coordinates in the original slice, preserving their flat (linear) position.
to_reshaped_coord
Constructs a function that maps coordinates from the original slice to equivalent coordinates in the reshaped slice, preserving their flat (linear) position.

Type Aliases§

Coord
Coordinate vector used throughout reshape logic. Semantically represents a point in multidimensional space.