Skip to content

1D np.linalg.norm not preserving input dtype? #10364

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
kmaehashi opened this issue Jan 11, 2018 · 2 comments · Fixed by #10390
Closed

1D np.linalg.norm not preserving input dtype? #10364

kmaehashi opened this issue Jan 11, 2018 · 2 comments · Fixed by #10390
Assignees
Labels

Comments

@kmaehashi
Copy link
Member

I saw the v1.14.0 release note saying:

1D np.linalg.norm preserves float input types, even for arbitrary orders

However, when I try the code on the release note, it does not behave as it says.

>>> import numpy as np
>>> np.__version__
'1.14.0'
>>> f32 = np.float32([1, 2])
>>> np.linalg.norm(f32, 2.0).dtype
dtype('float32')
>>> np.linalg.norm(f32, 2.0001).dtype
dtype('float64')  # it should be float32 on numpy 1.14?
@charris charris added this to the 1.14.1 release milestone Jan 11, 2018
@eric-wieser
Copy link
Member

eric-wieser commented Jan 11, 2018

My fault in #9522 (351fe97). I think it does preserve longdouble types now, but I wasn't able to test that.

Maybe simplest to revert that part of the release note?

@eric-wieser
Copy link
Member

eric-wieser commented Jan 11, 2018

Culprit is the 1.0 on this line upcasting: 351fe97#diff-6858bbac5c5c59bdddf245c69d6a547cR2206

Replacing it with 1 or np.reciprocal should solve the problem.

@eric-wieser eric-wieser self-assigned this Jan 11, 2018
eric-wieser added a commit to eric-wieser/numpy that referenced this issue Jan 12, 2018
…r speed

Fixes numpygh-10364, partly by adjusting the promise in the release notes
@charris charris removed this from the 1.14.1 release milestone Jan 27, 2018
hanjohn pushed a commit to hanjohn/numpy that referenced this issue Feb 15, 2018
…r speed

Fixes numpygh-10364, partly by adjusting the promise in the release notes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants