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

Bug fix for complex division of numpy.complex #342

Merged
merged 6 commits into from
Feb 5, 2025

Conversation

KarsKnook
Copy link
Contributor

No description provided.

@pbrubeck pbrubeck force-pushed the knook/fix/complex-division branch from 54f2931 to f769103 Compare February 3, 2025 10:00
@jorgensd
Copy link
Member

jorgensd commented Feb 4, 2025

Could you add a regression test for this bug?

@pbrubeck
Copy link
Contributor

pbrubeck commented Feb 4, 2025

I think it is hard to add a pure UFL test for this bug, as it would be caused by UFL subclasses that can carry data, such as a Firedrake Constant. As far as I understand, the only objects that can carry data are ComplexValue, but they immediatly cast the data to a complex.

@jorgensd
Copy link
Member

jorgensd commented Feb 4, 2025

I think it is hard to add a pure UFL test for this bug, as it would be caused by UFL subclasses that can carry data, such as a Firedrake Constant. As far as I understand, the only objects that can carry data are ComplexValue, but they immediatly cast the data to a complex.

Could you refer to a test in firedrake that exposed this but then and is fixed with the branch?

@pbrubeck
Copy link
Contributor

pbrubeck commented Feb 4, 2025

@jorgensd
Copy link
Member

jorgensd commented Feb 4, 2025

@pbrubeck wouldn't this be resolved in firedrake if firedrake.Constant would inherit from ScalarValue rather than ConstantValue (https://github.com/firedrakeproject/firedrake/blob/ecac12bc9763f0e37e62bf5e32d5bff17d6067cd/firedrake/constant.py#L42) as that would then hit: https://github.com/FEniCS/ufl/blob/main/ufl/algebra.py#L225-L231 instead?
Or am I missing some motivation here?
Edit:
Ignoring this potential simplification/change in firedrake, I've made a native test with a PR into this branch at: firedrakeproject#59

@pbrubeck
Copy link
Contributor

pbrubeck commented Feb 4, 2025

A firedrake.Constant is a rather complicated object, I defer to @connorjward. From the discussion in firedrakeproject/firedrake#2376 I think this PR should go through regardless.

@jorgensd jorgensd added this pull request to the merge queue Feb 5, 2025
Merged via the queue into FEniCS:main with commit 1ab30c2 Feb 5, 2025
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants