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

Document elementwise functions for DOK arrays #451

Merged
merged 4 commits into from
Mar 23, 2021

Conversation

DragaDoncila
Copy link
Contributor

@hameerabbasi I've updated the docs to include elementwise operations for DOK arrays.

At this point I'm not sure whether you want to keep the DOK documentation in Construct Sparse Arrays, or whether you'd like to pull it out as its own section, but please let me know if that's the case, and whether you want more detail on the elementwise operations e.g. more detail on comparisons, etc. As it is, I tried to follow the convention already used for the COO arrays.

Copy link
Collaborator

@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.

It'd be nice to note all standard ufuncs and operators are now supported on DOK minus reduce.

@codecov
Copy link

codecov bot commented Mar 22, 2021

Codecov Report

Merging #451 (acede9d) into master (1b7f424) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master     #451   +/-   ##
=======================================
  Coverage   95.15%   95.15%           
=======================================
  Files          20       20           
  Lines        2975     2975           
=======================================
  Hits         2831     2831           
  Misses        144      144           

y = sparse.random((10, 10), 0.5, format="dok")
sparse.elemwise(np.add, x, y)

:obj:`DOK` arrays also support standard `__ufunc__` operations and operators, including comparison operators,
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think __ufunc__ is a thing.

y = np.random.random((10, 10))
x == y

:obj:`DOK` arrays are returned from elemwise functions and standard `__ufunc__` operations if and only if all
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I changed it to just say universal... I'm not sure if there's a better technical term to refer to it by

@hameerabbasi
Copy link
Collaborator

I think the technical term would be operators and ufuncs, without the double-underscore.

@DragaDoncila
Copy link
Contributor Author

@hameerabbasi I've made that change. Is there anything else you'd like documented?

@hameerabbasi hameerabbasi merged commit 325445c into pydata:master Mar 23, 2021
@hameerabbasi
Copy link
Collaborator

Thanks, @DragaDoncila!

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.

2 participants