Clarify dpnp.linalg.cond() behavior with singular matrices#2460
Clarify dpnp.linalg.cond() behavior with singular matrices#2460vlad-perevezentsev merged 9 commits intomasterfrom
dpnp.linalg.cond() behavior with singular matrices#2460Conversation
|
View rendered docs @ https://intelpython.github.io/dpnp/index.html |
|
Array API standard conformance tests for dpnp=0.18.0dev4=py312h852cfe9_11 ran successfully. |
| # It returns `inf`, `0`, or large/small finite values | ||
| # depending on the norm and the matrix content. | ||
| # DPNP raises LinAlgError for 1, -1, inf, -inf, and 'fro' | ||
| # due to use of gesv in the 2D case. |
There was a problem hiding this comment.
Are you planning to add a test for > 2D case?
There was a problem hiding this comment.
No, numpy behavior with singular matrices varies depending on the norm value and the matrix content so it is better not to rely on it in tests. This test was added to cover case nan to inf conversion to improve code coverage
There was a problem hiding this comment.
What is about testing only that the exception raised?
There was a problem hiding this comment.
In the next PR I am going to remove synchronization with host and device while converting nan to inf which will cause changes in this test so I will add test for ND there
antonwolfy
left a comment
There was a problem hiding this comment.
Thank you @vlad-perevezentsev
This PR suggests clarifying the behavior and updating `dpnp.linalg.cond()` tests for singular matrices. It adds `Notes` section to the docs explaining the difference with NumPy when handling singular input and updates tests to avoid crashes while testing 01bf544
This PR suggests clarifying the behavior and updating
dpnp.linalg.cond()tests for singular matrices.It adds
Notessection to the docs explaining the difference with NumPy when handling singular input and updates tests to avoid crashes while testing