Skip to content

Add broadcast_arrays - #3217

Merged
mrocklin merged 7 commits into
dask:masterfrom
jakirkham:add_broadcast_arrays
Feb 27, 2018
Merged

mrocklin merged 7 commits into
dask:masterfrom
jakirkham:add_broadcast_arrays

Conversation

@jakirkham

@jakirkham jakirkham commented Feb 27, 2018 •

Copy link
Copy Markdown
Member

Fixes #3209
Requires #3218 (for the no argument case)

Implements broadcast_arrays for Dask Arrays.

@jakirkham
jakirkham force-pushed the add_broadcast_arrays branch from aab9d9a to 9cf4097 Compare February 27, 2018 04:08
@jakirkham jakirkham changed the title WIP: Add broadcast_arrays Add broadcast_arrays Feb 27, 2018
@jakirkham
jakirkham force-pushed the add_broadcast_arrays branch 2 times, most recently from afa53eb to 3a78ec3 Compare February 27, 2018 04:37

@shoyer shoyer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good to me!

Comment thread dask/array/core.py Outdated

to_array = asarray
if subok:
to_array = asanyarray

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: I would prefer to write this with single assignment, to_array = asanyarray if subok else asarray

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Done.

Though sometimes coverage tools misreport line coverage on ternary expressions as they miss the branch.

@jakirkham
jakirkham force-pushed the add_broadcast_arrays branch from 3a78ec3 to d58368d Compare February 27, 2018 13:57
Implements `broadcast_arrays` for Dask Arrays. Builds off of all the
other `broadcast_*` functions already in `dask.array.core`.
Make `broadcast_arrays` available in the `dask.array` package.
Perform a simple test with `broadcast_arrays` that compares the results
from the NumPy implementation with the Dask Array implementation.
About to make it longer and it is already over the line length limit. So
go ahead and wrap it in advance.
Simplify the code in `meshgrid` a bit by making use of
`broadcast_arrays`, which does all the bookkeeping for broadcasting the
shape and chunks.
Include `broadcast_arrays` for auto-documenting in the `dask.array`
public API.
@jakirkham
jakirkham force-pushed the add_broadcast_arrays branch from d58368d to ac2a3ae Compare February 27, 2018 17:23
@jakirkham

Copy link
Copy Markdown
Member Author

Thanks for the reviews. Think this addresses all comments. Also added a test for the no argument case. Please let me know if there is anything else.

@mrocklin
mrocklin merged commit 7f69508 into dask:master Feb 27, 2018
@jakirkham
jakirkham deleted the add_broadcast_arrays branch February 27, 2018 18:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants