Jona
MModular
•Created by Jona on 12/19/2023 in #questions
Implementing a simple lookup matrix
I have a precomputed (=handwritten) simple matrix that I want to use in my code. I have currently written it as follows (without a type):
The envisioned example use of this would be something like this:
The original
conversion_matrices
becomes a ListLiteral
, which seems clearly unusable for this usecase given its lack of getitem implementation.
I believe using a StaticTuple
should probably work, but would require explicitly initializing the tuple for each nested tuple, explicitly listing the nested types repeatedly for every individual tuple. This is probably what I will fall back on if I find nothing else, but I wonder if there is a proper way to do this that doesn't lead to huge chunks of nested and repeated type definitions.
I don't have a lot of experience writing python code, so this might not even be a mojo specific question. In any case, I would be very thankful for a pointer in the right direction.7 replies