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 with ureg.wraps when different numpy shapes are used #2111

Open
samwaseda opened this issue Jan 4, 2025 · 0 comments
Open

Bug with ureg.wraps when different numpy shapes are used #2111

samwaseda opened this issue Jan 4, 2025 · 0 comments

Comments

@samwaseda
Copy link

This one works:

def f(C, x, P):
    return np.linalg.norm(P) / np.linalg.norm(C) / x**2

f(np.random.randn(2, 3, 4), np.random.randn(5, 6), np.random.randn(7, 8))

This one doesn't:

@ureg.wraps("=P/C/x**2", ("=C", "=x", "=P"))
def f(C, x, P):
    return np.linalg.norm(P) / np.linalg.norm(C) / x**2

f(np.random.randn(2, 3, 4) * ureg.gigapascal, np.random.randn(5, 6) * ureg.meter, np.random.randn(7, 8) * ureg.joule)

I already opened a PR to fix this problem

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 a pull request may close this issue.

1 participant