-
Notifications
You must be signed in to change notification settings - Fork 10
Open
Description
from https://bitbucket.org/apdavison/lazyarray/issues/1/support-creating-lazy-arrays-from-scipy
Examples:
>>> row = np.array([0, 2, 2, 0, 1, 2])
>>> col = np.array([0, 0, 1, 2, 2, 2])
>>> data = np.array([1, 2, 3, 4, 5, 6])
>>> sparr = csc_matrix((data, (row, col)), shape=(3, 3))
>>> sparr.toarray()
array([[1, 0, 4],
[0, 0, 5],
[2, 3, 6]])
>>> larr = larray(sparr)
>>> larr.shape
(3, 3)
>>> larr.dtype
dtype('int64')
>>> larr.evaluate()
array([[1, 0, 4],
[0, 0, 5],
[2, 3, 6]])
>>> larr.evaluate(empty_val=np.nan)
array([[1, nan, 4],
[nan, nan, 5],
[2, 3, 6]])
>>> larr[2, :]
array([2, 3, 6])
>>> larr.base_value
<3x3 sparse matrix of type '<class 'numpy.int64'>'
with 6 stored elements in Compressed Sparse Column format>Metadata
Metadata
Assignees
Labels
No labels