IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /docs/manual/basics.md). For the complete Mojo documentation index, see llms.txt.
Skip to main content
Version: Nightly
For the complete Mojo documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /docs/manual/basics.md).

col_major_nested

def col_major_nested(var shape: Coord) -> Layout[shape.element_types, *?]

Creates a column-major layout from a nested shape Coord.

For a nested shape ((a, b), (c, d)) the result has nested strides ((1, a), (a*b, a*b*c)) — col-major over the flattened shape, re-nested.

Currently restricted to all-static (compile-time) leaf dimensions and one level of nesting. For flat shapes use col_major.

Args:

  • shape (Coord): The nested shape as a Coord whose top-level elements are themselves Coords.

Returns:

Layout[shape.element_types, *?]: A Layout with the matching nested column-major strides.