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).
CoordLike
Trait for unified layout handling of compile-time and runtime indices.
Implemented traits
AnyType,
Copyable,
Defaultable,
Deinitable,
ImplicitlyCopyable,
Movable,
RegisterPassable,
TrivialRegisterPassable,
Writable
comptime members
DTYPE
comptime DTYPE = DType.int
The data type used by scalar-returning coordinate operations.
is_static_value
comptime is_static_value = False
True if the value is known at compile time.
is_tuple
comptime is_tuple = False
True if this is a tuple type (Coord), False for scalar values.
is_value
comptime is_value = not _Self.is_tuple.__bool__()
True if this is a scalar value, False for tuple types.
ParamListType
comptime ParamListType
The type list of element types for coordinates.
static_value
comptime static_value
The compile-time value if statically known, -1 otherwise.
Required methods
__len__
static def __len__() -> Int
Get the number of elements in this type.
Returns:
Int: The number of elements (1 for single values, >1 for tuples).
value
def value(self) -> Scalar[Self.DTYPE]
Get the scalar value of this coordinate.
Only valid for value types (not tuples).
Returns:
Scalar[_Self.DTYPE]: The scalar value.
tuple
def tuple(var self) -> Coord[Self.ParamListType]
Get this coordinate as a Coord tuple.
Only valid for tuple types.
Returns:
Coord[_Self.ParamListType]: The coordinate as a Coord tuple.
product
def product(self) -> Scalar[Self.DTYPE]
Calculate the product of all elements.
Returns:
Scalar[_Self.DTYPE]: The product of all elements.
sum
def sum(self) -> Scalar[Self.DTYPE]
Calculate the sum of all elements.
Returns:
Scalar[_Self.DTYPE]: The sum of all elements.