Support 'nuc' norm in dpnp.linalg.cond - #3084
Open
antonwolfy wants to merge 3 commits into
Open
antonwolfy wants to merge 3 commits into
antonwolfy wants to merge 3 commits into
Conversation
Add the nuclear norm ('nuc') to the set of norms accepted by
dpnp.linalg.cond. The condition number for 'nuc' is already computed
correctly through the inverse-based branch (norm(x, 'nuc') *
norm(inv(x), 'nuc')); this change documents it as a supported value of
p and adds test coverage.
Unlike NumPy, dpnp.linalg.inv raises LinAlgError on singular input, so
cond with 'nuc' raises on singular matrices consistently with the other
inverse-based norms (1, -1, inf, -inf, 'fro'); no special NaN handling
is required.
Update the docstring (parameter set, norm table, Notes, example), add
'nuc' to the TestCond norm list and to the cond sycl-queue/usm-type
propagation tests, and add a CHANGELOG entry.
antonwolfy
requested review from
ndgrigorian and
vlad-perevezentsev
as code owners
October 2, 2026 16:53
Contributor
|
View rendered docs @ https://intelpython.github.io/dpnp/pull/3084/index.html |
Collaborator
Contributor
|
Array API standard conformance tests for dpnp=0.21.0dev11=np2py314h8d9cdd5_17 ran successfully. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds the nuclear norm (
"nuc") to the set of norms accepted bydpnp.linalg.cond, aligning its supportedpvalues withdpnp.linalg.normand with NumPy.For
"nuc"the condition number is computed through the existing inverse-based branch asnorm(x, "nuc") * norm(inv(x), "nuc"), i.e. the product of the sums of the singular values ofxandinv(x). This path was already functional (dpnp.linalg.normsupports"nuc"for matrices), so no change to the computation itself is required — the result matches NumPy for non-singular, batched, complex, boolean, empty, and strided inputs.Consistent with the other inverse-based norms (
1,-1,inf,-inf,"fro"),dpnp.linalg.condraisesLinAlgErroron singular input whenp="nuc", becausedpnp.linalg.invraises on singular matrices rather than filling the result withinfthe way NumPy does.