Skip to content

Avoid tiny numpy arrays in numba: create numba helper routines file #1680

Closed

Description

@Sevans711

Sub-issue of #1648 to track: should create a file like numba_math.py with helper routines acting on tuples.

As mentioned in the original issue, the idea is to put helper functions here, e.g. _numba_norm3(ux, uy, uz) which allows value = _numba_norm3(ux, uy, uz) instead of value = (ux**2 + uy**2 + uz**2)**0.5. These helper functions will be used throughout various regions of the code while addressing #1648.

Although, after looking into it a bit, I have learned that using fixed-length tuples such as u = (ux, uy, uz) is just as efficient as using individual components directly; the inefficiencies come into play if you ever create a list or numpy array. So, I believe helper functions working on tuples would be better, e.g. _numba_norm3(u) to handle value = (u[0]**2 + u[1]**2 + u[2]**2)**0.5.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

scalability

Type

No type

Fields

Priority

None yet

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions