Skip to content

Change numerical behavior of complex::acosh for certain edge cases - #1272

Closed
miscco wants to merge 1 commit into
NVIDIA:mainfrom
miscco:fix_acosh_pytorch
Closed

miscco wants to merge 1 commit into
NVIDIA:mainfrom
miscco:fix_acosh_pytorch

Conversation

@miscco

@miscco miscco commented Jan 11, 2024

Copy link
Copy Markdown
Contributor

We want to preserve behavior from thrust::complex, which also happens to be consistent with the behavior of libstdc++

The change is that we are now using Kahans formula to calculate acosh. This greatly simplifies the implementation too which is nice

See https://se.mathworks.com/company/newsletters/articles/trigonometry-is-a-complex-subject.html

Fixes nvbug4445377

@miscco miscco added nvbug Has an associated internal NVIDIA NVBug. libcu++ For all items related to libcu++ breaking Breaking change backport branch/2.3.x labels Jan 11, 2024
@miscco
miscco requested review from a team as code owners January 11, 2024 14:15
@miscco
miscco requested a review from ericniebler January 11, 2024 14:15
@miscco
miscco force-pushed the fix_acosh_pytorch branch from cbbf92e to df86d3d Compare January 11, 2024 20:36
@miscco
miscco force-pushed the fix_acosh_pytorch branch from df86d3d to f0e32be Compare January 15, 2024 13:46
} else if (cuda::std::isinf(neg_asinh.imag())) {
assert(cuda::std::isinf(asinh_neg.imag()));
} else {
assert(cuda::std::abs((neg_asinh.real()-asinh_neg.real())) < 1.e-3);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This here is icky but we do have issues with precision in this case

We want to preserve behavior from thrust::complex, which also happens to be consistent with the behavior of libstdc++

The change is that we are now using Kahans formula to calculate acosh. This greatly simplifies the implementation too which is nice

See https://se.mathworks.com/company/newsletters/articles/trigonometry-is-a-complex-subject.html

Fixes nvbug4445377
@miscco

miscco commented Mar 18, 2024

Copy link
Copy Markdown
Contributor Author

We decided to revert our complex changes and do a comprehensive rework once we are ready to bring it back in

@miscco miscco closed this Mar 18, 2024
@miscco
miscco deleted the fix_acosh_pytorch branch May 12, 2026 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking Breaking change libcu++ For all items related to libcu++ nvbug Has an associated internal NVIDIA NVBug.

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

2 participants