loki.transformations.array_indexing.vector_notation
Utilities to manipulate vector notation in array expressions.
Functions
|
Make dimensions of arrays explicit within |
|
Remove colon notation from array dimensions within |
|
Resolve vector notation for a given dimension only. |
|
Resolve implicit vector notation by inserting explicit loops |
Classes
|
A mapper that replaces fully qualified |
|
A mapper that derives the fully qualified iteration dimension for unbounded |
|
A |
- remove_explicit_array_dimensions(routine, calls_only=False)
Remove colon notation from array dimensions within
Subroutineroutine. E.g., convert two-dimensional arrayarr2d(:,:)toarr2dorarr3d(:,:,:)toarr3d, but NOT e.g.,arr(1,:,:).- Parameters:
routine (
Subroutine) – The subroutine to checkcalls_only (bool) – Whether to remove colon notation from array dimensions only from arrays within (inline) calls or all arrays (default: False)
- add_explicit_array_dimensions(routine)
Make dimensions of arrays explicit within
Subroutineroutine. E.g., convert two-dimensional arrayarr2dtoarr2d(:,:)orarr3dtoarr3d(:,:,:).- Parameters:
routine (
Subroutine) – The subroutine to check
- resolve_vector_notation(routine)
Resolve implicit vector notation by inserting explicit loops
- resolve_vector_dimension(routine, dimension, derive_qualified_ranges=False)
Resolve vector notation for a given dimension only. The dimension is defined by a loop variable and the bounds of the given range.
Unliked the related
resolve_vector_notation()utility, this will only resolve the defined dimension according toboundsandloop_variable.- Parameters:
routine (
Subroutine) – The subroutine in which to resolve vector notation usage.dimension (
Dimension) – Dimension object that defines the dimension to resolvederive_qualified_ranges (bool) – Flag to enable the derivation of (all) range bounds from shape information.
- class ResolveVectorNotationTransformer(*args, loop_map=None, scope=None, derive_qualified_ranges=True, map_unknown_ranges=True, **kwargs)
Bases:
TransformerA
Transformerthat resolves implicit vector notation by inserting explicit loops.- Parameters:
loop_map (dict of tuple to
Variable) – A dict mapping the tuple(lower, upper, step)to a known variable symbol to use as loop index.scope (
SubroutineorModule) – The scope in which to create new loop index variablesderive_qualified_ranges (bool) – Derive explicit bounds for all unqualified index ranges (
:) before resolving them with loops.map_unknown_ranges (bool) – Flag to indicate whether unknown, but fully qualified range indices are to be remapped to loops.
- visit_Assignment(stmt, **kwargs)
- visit_MaskedStatement(masked, **kwargs)