• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

IntelPython / dpnp / 38276469894
83%

Build:
DEFAULT BRANCH: master
Ran 12 Oct 2026 06:03PM UTC
Jobs 1
Files 271
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

12 Oct 2026 04:18PM UTC coverage: 78.667% (-0.002%) from 78.669%
38276469894

push

github

web-flow
Use computation dtype in dpnp.linalg.pinv for default tolerance and empty input (#3090)

This PR updates `dpnp.linalg.pinv` to take the data type for the default
tolerance and for the result of an empty input from the data type the
SVD is computed in. This aligns `dpnp.linalg.pinv` with NumPy 2.6
behavior.

### Default tolerance
When `rtol=None` (the default) and `rcond` is not given, the cutoff is
`max(M, N) * eps`. Previously `eps` was taken from
`dpnp.result_type(a.dtype, dpnp.default_float_type(a.device))`, which
gives `float64`:
- for `float32`/`complex64` input on devices with fp64 support;
- for integer input on devices without fp64 support, since `result_type`
called with dtypes only does not know the device.

In both cases the SVD runs in single precision, so the cutoff was about
10⁹ times too small. Singular values at the level of single-precision
rounding noise were therefore inverted instead of discarded. The
tolerance now uses `eps` of `_common_type(a)`, which also matches the
docstring (`max(M, N) * dpnp.finfo(a.dtype).eps`).

Note that `dpnp.linalg.pinv(a)` called without a tolerance now uses the
larger cutoff for `float32`/`complex64` input on devices with fp64
support.

### Empty input
The empty-input shortcut returned an array of the input data type. An
empty integer or boolean array therefore produced an integer/boolean
result, while a non-empty one produced a floating-point result. The
shortcut now returns the computation data type: `float64`, or `float32`
on devices without fp64 support.

```python
import dpnp as np

a = np.diag(np.array([1.0, 1e-9], dtype=np.float32))
np.linalg.pinv(a)  # was [[1, 0], [0, 1e9]], now [[1, 0], [0, 0]]

np.linalg.pinv(np.empty((0, 3), dtype=np.int64)).dtype  # was int64, now float64
```

1608 of 3000 branches covered (53.6%)

Branch coverage included in aggregate %.

3 of 3 new or added lines in 1 file covered. (100.0%)

1 existing line in 1 file now uncovered.

27914 of 34528 relevant lines covered (80.84%)

19627.69 hits per line

Coverage Regressions

Lines Coverage ∆ File
1
88.43
-0.26% dpnp/scipy/sparse/linalg/_iterative.py
Jobs
ID Job ID Ran Files Coverage
1 38276469894.1 12 Oct 2026 06:03PM UTC 271
78.67
GitHub Action Run
Source Files on build 38276469894
  • Tree
  • List 271
  • Changed 2
  • Source Changed 1
  • Coverage Changed 2
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Repo
  • Github Actions Build #38276469894
  • c3fdb6c7 on github
  • Prev Build on master (#38263142605)
  • Next Build on master (#38392766188)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc