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

Use an Enum for space types #524

Open
jrmaddison opened this issue Mar 6, 2024 · 1 comment
Open

Use an Enum for space types #524

jrmaddison opened this issue Mar 6, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@jrmaddison
Copy link
Collaborator

jrmaddison commented Mar 6, 2024

class SpaceType(Enum):
    PRIMAL = 1.0 + 1.0j
    CONJUGATE = 1.0 - 1.0j
    DUAL = -1.0 - 1.0j
    ANTIDUAL = -1.0 + 1.0j

(or a normalized version, i.e. the fourth roots of -1) has a nice structure, so that space types can be mapped

SpaceType(space_type.value.conjugate())  # -> conjugate
SpaceType(-space_type.value)  # -> dual
SpaceType(-space_type.value.conjugate())  # -> antidual

Also take the opportunity to rename 'conjugate dual' to 'antidual'. 'Antidual' has slightly less symmetry, but 'conjugate' still seems preferable to 'antiprimal'.

@jrmaddison
Copy link
Collaborator Author

Update will need to be backwards compatible, meaning that string space type arguments (including "conjugate_dual") will need to be handled correctly.

@jrmaddison jrmaddison added the enhancement New feature or request label Jul 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant