Skip to content

Commit 894e7f1

Browse files
Improve handling of large values by inverse hyperbolic and trigonometric functions (#2928)
The `dpnp.tensor.acosh` function was returning incorrect results (infinity) for complex numbers with large negative real parts (see #2924, #2896). The issue was caused by the threshold used `1/epsilon` to decide when to switch from acos in SYCL's experimental complex extension (`exprm_ns::acos()`) to a log-based formula. The SYCL `exprm_ns::acos()` returns incorrect results for large negative real parts, due to used formula `z + sqrt(z² - 1)`, which leads to `log(0) = -infinity`. The PR proposes to change the threshold from `1/epsilon` to `sqrt(1/epsilon)/2` for all inverse trig/hyperbolic functions. This is the precision loss point where `sqrt(z² ± 1)` calculations become unstable. Also the PR reduces code duplication by creating shared `casinh()`, `casin()`, `catanh()`, `catan()` functions in new `complex_math.hpp` header. 9154e64
1 parent 70e7f67 commit 894e7f1

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

reference/comparison.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1040,7 +1040,7 @@
10401040
<h1>Comparison Table NumPy/ DPNP/ CuPy<a class="headerlink" href="#comparison-table-numpy-dpnp-cupy" title="Link to this heading">¶</a></h1>
10411041
<p>Here is a list of NumPy and CuPy APIs and its corresponding DPNP implementations.</p>
10421042
<p><code class="docutils literal notranslate"><span class="pre">-</span></code> in DPNP column means that DPNP implementation is not provided yet.</p>
1043-
<p><strong>NumPy(v2.5.0) / DPNP(v0.21.0dev2+8.g8588c5abe1b) / CuPy(v14.1.1) APIs</strong></p>
1043+
<p><strong>NumPy(v2.5.0) / DPNP(v0.21.0dev2+9.g9154e642b41) / CuPy(v14.1.1) APIs</strong></p>
10441044
<section id="summary">
10451045
<h2>Summary<a class="headerlink" href="#summary" title="Link to this heading">¶</a></h2>
10461046
<div class="table-wrapper docutils container">

searchindex.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)