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

Extensive use of abs for complex tolerances #468

Open
weymouth opened this issue Mar 18, 2024 · 2 comments
Open

Extensive use of abs for complex tolerances #468

weymouth opened this issue Mar 18, 2024 · 2 comments

Comments

@weymouth
Copy link

weymouth commented Mar 18, 2024

I just profiled expintx(1,z::Complex) and found the majority of the time is spent checking the convergence using abs(stuff) < ϵ. Would there be a problem with simply squaring all of these and using abs2(stuff) < ϵ^2? This is much much faster, especially when stuff::Complex.

Since ϵ=10eps(T), I suppose that could lead to some issues. But I would much prefer to slightly reduce the tolerance than the current waste of compute.

I'm happy to do the PR if it's likely to get merged in.

@weymouth
Copy link
Author

Or we could just use fastabs. That should be harmless, right?

@weymouth weymouth changed the title Use of abs instead of abs2 for complex tolerances Extensive use of abs for complex tolerances Mar 19, 2024
@stevengj
Copy link
Member

stevengj commented Mar 19, 2024

Yes, fastabs should be fine here. Not sure how that compares to abs2, but with abs2 you also need to be careful of over/underflow.

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

No branches or pull requests

2 participants