Skip to content

Fix linalg.norm with ord=numpy.inf#10655

Closed
the-master-guy wants to merge 1 commit intonumpy:masterfrom
the-master-guy:3763
Closed

Fix linalg.norm with ord=numpy.inf#10655
the-master-guy wants to merge 1 commit intonumpy:masterfrom
the-master-guy:3763

Conversation

@the-master-guy
Copy link

Fixed the error where linalg.norm with ord=numpy.inf does not work for empty array, with the solution specified inte the comments, namely creating a case that checks for such a possibility and returns the norm to be 0 as is should be for empty arrays.

@eric-wieser
Copy link
Member

with the solution specified inte the comments,

Which comments?

x = asarray(x)

if x.size == 0:
return 0
Copy link
Member

Choose a reason for hiding this comment

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

This check is too early - it allows np.linalg.norm([], axis="I have no idea what I'm doing"), which should clearly error

Copy link
Member

@eric-wieser eric-wieser left a comment

Choose a reason for hiding this comment

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

Needs tests too

@eric-wieser
Copy link
Member

Duplicate of #10688

@eric-wieser eric-wieser marked this as a duplicate of #10688 Mar 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants