Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change transforms.py to represent "scalars" as zero-D arrays #55

Open
CrepeGoat opened this issue Jul 19, 2021 · 0 comments
Open

change transforms.py to represent "scalars" as zero-D arrays #55

CrepeGoat opened this issue Jul 19, 2021 · 0 comments
Labels
development Related to the development process enhancement New feature or request

Comments

@CrepeGoat
Copy link
Contributor

originally discussed in #44 (comment).

The transforms.py code requires if-else logic to specially handle inputs & internal variables, depending on whether they're numpy arrays or scalar values. This special-case logic could, in most cases, be removed by representing "scalars" as zero-dimensional arrays, which would remove excess complexity from the system.

One example of special-case logic occurs on this line here:

            if scalar:
                out = self.function(values)
            else:
                out[:] = self.function(values)

By representing the scalars as 0D-arrays, ^this could be generically refactored to v this:

            out[...] = self.function(values)

Implementing this change will likely break a handful of other dependent pieces of code, since 0D-arrays don't exactly behave the same as true scalars in all situations; this should be investigated in more detail.

@StokesMIDE StokesMIDE added development Related to the development process enhancement New feature or request labels Sep 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
development Related to the development process enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants