Skip to content

Modifications to enable sparse xarrays #261

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

Merged
merged 2 commits into from
Jul 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion sparse/coo/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
eye, full, full_like, zeros, zeros_like, ones, ones_like,
kron, argwhere, isposinf, isneginf)

from numpy.core._multiarray_umath import result_type
Copy link
Member

Choose a reason for hiding this comment

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

Beware, this is likely to break in a future NumPy release — this isn’t a public API


__all__ = ['COO', 'as_coo', 'elemwise', 'tensordot', 'dot', 'matmul', 'concatenate', 'stack', 'triu', 'tril', 'where', 'nansum', 'nanmean',
'nanprod', 'nanmin', 'nanmax', 'nanreduce', 'roll', 'eye', 'full', 'full_like', 'zeros', 'zeros_like', 'ones', 'ones_like', 'kron', 'argwhere',
'isposinf', 'isneginf']
'isposinf', 'isneginf', 'result_type']
4 changes: 2 additions & 2 deletions sparse/coo/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -2066,7 +2066,7 @@ def clip(self, min=None, max=None, out=None):
return self.__array_ufunc__(np.clip, '__call__', self, a_min=min,
a_max=max, out=out)

def astype(self, dtype):
def astype(self, dtype, copy=True):
"""
Copy of the array, cast to a specified type.

Expand All @@ -2077,7 +2077,7 @@ def astype(self, dtype):
:obj:`COO.elemwise`: Apply an arbitrary element-wise function to one or two
arguments.
"""
return self.__array_ufunc__(np.ndarray.astype, '__call__', self, dtype=dtype)
return self.__array_ufunc__(np.ndarray.astype, '__call__', self, dtype=dtype, copy=copy)

def maybe_densify(self, max_size=1000, min_density=0.25):
"""
Expand Down