frozen numeric arrays, dataclasses, numba

Viewed 436

I am trying to improve quality of an existing scientific code by declaring classes as dataclasses, declaring them as frozen=True as much as possible. One of the intents is to use numba's JIT for acceleration at a few places.

The code is currently using tuples for storing small constant numeric arrays (think of constant 3d coordinate), but tuples don't declare their size, can't be easily consumed by numba and don't support basic arithmetics. Numpy arrays, on the other hand, are dynamically-sized and modifiable, not lending themselves to frozen dataclasses easily.

I am looking for suitable class for fixed-size frozen numeric array which supports basic arithmetics and could be used with numba's JIT (with nopython=True) without further conversions. Any tips?

0 Answers
Related