Skip to content
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

Add np.asfarray impl #5418

Merged
merged 14 commits into from Aug 27, 2020
Merged

Conversation

guilhermeleobas
Copy link
Collaborator

As title. I've updated types.float_ to be types.float64 instead of types.float32. On NumPy, at least on my machine, np.float_ is np.float64.

@guilhermeleobas guilhermeleobas changed the title Add asfarray impl Add np.asfarray impl Mar 25, 2020
@guilhermeleobas
Copy link
Collaborator Author

Ready for a round of reviews

@stuartarchibald
Copy link
Contributor

Thanks for the patch.

As title. I've updated types.float_ to be types.float64 instead of types.float32. On NumPy, at least on my machine, np.float_ is np.float64.

What does this mean?! I can't see related changes to the fundamental type in the patchset.

@stuartarchibald stuartarchibald added 4 - Waiting on author Waiting for author to respond to review and removed 3 - Ready for Review labels Apr 14, 2020
@guilhermeleobas
Copy link
Collaborator Author

Thanks for the patch.

As title. I've updated types.float_ to be types.float64 instead of types.float32. On NumPy, at least on my machine, np.float_ is np.float64.

What does this mean?! I can't see related changes to the fundamental type in the patchset.

I've undone those changes because it was breaking some tests.

@guilhermeleobas
Copy link
Collaborator Author

PR is ready for a review

@esc esc added 4 - Waiting on reviewer Waiting for reviewer to respond to author and removed 4 - Waiting on author Waiting for author to respond to review labels May 4, 2020
numba/np/arraymath.py Outdated Show resolved Hide resolved
numba/tests/test_np_functions.py Show resolved Hide resolved
@guilhermeleobas
Copy link
Collaborator Author

Thanks for the review @luk-f-a. I've fixed the code to support complex types.

@luk-f-a
Copy link
Contributor

luk-f-a commented May 20, 2020

@guilhermeleobas thanks for the changes, it looks good to me.

@guilhermeleobas
Copy link
Collaborator Author

cc @hameerabbasi

Copy link
Contributor

@hameerabbasi hameerabbasi left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks!

@guilhermeleobas
Copy link
Collaborator Author

Hi, @stuartarchibald

When you have some cycles to spare, can you take a look in this PR?

@esc esc requested a review from stuartarchibald July 22, 2020 15:49
Copy link
Contributor

@stuartarchibald stuartarchibald left a comment

Choose a reason for hiding this comment

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

Thanks for implementing this, I've given it an initial review, looks good, just one thing to resolve.

@@ -3899,6 +3899,19 @@ def impl(a, dtype=None):
return impl


@overload(np.asfarray)
def np_asfarray(a, dtype=types.float64):
Copy link
Contributor

Choose a reason for hiding this comment

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

think this ought to be dtype=np.float64?

Copy link
Contributor

Choose a reason for hiding this comment

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

and then something check that the thing passed in is actually a dtype or can be accepted and converted to one?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Is the check necessary? if dtype is not a subdtype of np.inexact, then, dtype will be assigned to types.float64.

Copy link
Contributor

Choose a reason for hiding this comment

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

ok, I think the check can be skipped as the as_dtype will pick up nonsense types.

@stuartarchibald stuartarchibald added 4 - Waiting on author Waiting for author to respond to review and removed 4 - Waiting on reviewer Waiting for reviewer to respond to author labels Aug 4, 2020
Copy link
Contributor

@stuartarchibald stuartarchibald left a comment

Choose a reason for hiding this comment

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

Thanks for the fixes, looks good!

@stuartarchibald stuartarchibald added 5 - Ready to merge Review and testing done, is ready to merge and removed 4 - Waiting on author Waiting for author to respond to review labels Aug 26, 2020
@stuartarchibald
Copy link
Contributor

Note: CI fail is #5973

@guilhermeleobas
Copy link
Collaborator Author

Thanks for the review @stuartarchibald

@stuartarchibald stuartarchibald merged commit 0db523e into numba:master Aug 27, 2020
@guilhermeleobas guilhermeleobas deleted the np_asfarray branch July 23, 2021 19:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
5 - Ready to merge Review and testing done, is ready to merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants