dask-array 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- dask_array-0.1.0/.gitignore +30 -0
- dask_array-0.1.0/LICENSE +29 -0
- dask_array-0.1.0/PKG-INFO +48 -0
- dask_array-0.1.0/README.md +18 -0
- dask_array-0.1.0/dask_array/__init__.py +228 -0
- dask_array-0.1.0/dask_array/_backends.py +76 -0
- dask_array-0.1.0/dask_array/_backends_array.py +99 -0
- dask_array-0.1.0/dask_array/_blockwise.py +1410 -0
- dask_array-0.1.0/dask_array/_broadcast.py +272 -0
- dask_array-0.1.0/dask_array/_chunk.py +445 -0
- dask_array-0.1.0/dask_array/_chunk_types.py +54 -0
- dask_array-0.1.0/dask_array/_collection.py +1644 -0
- dask_array-0.1.0/dask_array/_concatenate.py +331 -0
- dask_array-0.1.0/dask_array/_core_utils.py +1365 -0
- dask_array-0.1.0/dask_array/_dispatch.py +141 -0
- dask_array-0.1.0/dask_array/_einsum.py +277 -0
- dask_array-0.1.0/dask_array/_expr.py +544 -0
- dask_array-0.1.0/dask_array/_expr_flow.py +586 -0
- dask_array-0.1.0/dask_array/_gufunc.py +805 -0
- dask_array-0.1.0/dask_array/_histogram.py +617 -0
- dask_array-0.1.0/dask_array/_map_blocks.py +652 -0
- dask_array-0.1.0/dask_array/_new_collection.py +10 -0
- dask_array-0.1.0/dask_array/_numpy_compat.py +135 -0
- dask_array-0.1.0/dask_array/_overlap.py +1159 -0
- dask_array-0.1.0/dask_array/_rechunk.py +1050 -0
- dask_array-0.1.0/dask_array/_reshape.py +710 -0
- dask_array-0.1.0/dask_array/_routines.py +102 -0
- dask_array-0.1.0/dask_array/_shuffle.py +448 -0
- dask_array-0.1.0/dask_array/_stack.py +264 -0
- dask_array-0.1.0/dask_array/_svg.py +291 -0
- dask_array-0.1.0/dask_array/_templates.py +29 -0
- dask_array-0.1.0/dask_array/_test_utils.py +257 -0
- dask_array-0.1.0/dask_array/_ufunc.py +385 -0
- dask_array-0.1.0/dask_array/_utils.py +349 -0
- dask_array-0.1.0/dask_array/_visualize.py +223 -0
- dask_array-0.1.0/dask_array/_xarray.py +337 -0
- dask_array-0.1.0/dask_array/core/__init__.py +34 -0
- dask_array-0.1.0/dask_array/core/_blockwise_funcs.py +312 -0
- dask_array-0.1.0/dask_array/core/_conversion.py +422 -0
- dask_array-0.1.0/dask_array/core/_from_graph.py +97 -0
- dask_array-0.1.0/dask_array/creation/__init__.py +71 -0
- dask_array-0.1.0/dask_array/creation/_arange.py +121 -0
- dask_array-0.1.0/dask_array/creation/_diag.py +116 -0
- dask_array-0.1.0/dask_array/creation/_diagonal.py +241 -0
- dask_array-0.1.0/dask_array/creation/_eye.py +103 -0
- dask_array-0.1.0/dask_array/creation/_linspace.py +102 -0
- dask_array-0.1.0/dask_array/creation/_mesh.py +134 -0
- dask_array-0.1.0/dask_array/creation/_ones_zeros.py +454 -0
- dask_array-0.1.0/dask_array/creation/_pad.py +270 -0
- dask_array-0.1.0/dask_array/creation/_repeat.py +55 -0
- dask_array-0.1.0/dask_array/creation/_tile.py +36 -0
- dask_array-0.1.0/dask_array/creation/_tri.py +28 -0
- dask_array-0.1.0/dask_array/creation/_utils.py +296 -0
- dask_array-0.1.0/dask_array/fft.py +320 -0
- dask_array-0.1.0/dask_array/io/__init__.py +39 -0
- dask_array-0.1.0/dask_array/io/_base.py +10 -0
- dask_array-0.1.0/dask_array/io/_from_array.py +257 -0
- dask_array-0.1.0/dask_array/io/_from_delayed.py +95 -0
- dask_array-0.1.0/dask_array/io/_from_graph.py +54 -0
- dask_array-0.1.0/dask_array/io/_from_npy_stack.py +67 -0
- dask_array-0.1.0/dask_array/io/_store.py +336 -0
- dask_array-0.1.0/dask_array/io/_tiledb.py +159 -0
- dask_array-0.1.0/dask_array/io/_to_npy_stack.py +65 -0
- dask_array-0.1.0/dask_array/io/_zarr.py +449 -0
- dask_array-0.1.0/dask_array/linalg/__init__.py +39 -0
- dask_array-0.1.0/dask_array/linalg/_cholesky.py +234 -0
- dask_array-0.1.0/dask_array/linalg/_lu.py +300 -0
- dask_array-0.1.0/dask_array/linalg/_norm.py +94 -0
- dask_array-0.1.0/dask_array/linalg/_qr.py +601 -0
- dask_array-0.1.0/dask_array/linalg/_solve.py +349 -0
- dask_array-0.1.0/dask_array/linalg/_svd.py +394 -0
- dask_array-0.1.0/dask_array/linalg/_tensordot.py +334 -0
- dask_array-0.1.0/dask_array/linalg/_utils.py +74 -0
- dask_array-0.1.0/dask_array/manipulation/__init__.py +45 -0
- dask_array-0.1.0/dask_array/manipulation/_expand.py +321 -0
- dask_array-0.1.0/dask_array/manipulation/_flip.py +92 -0
- dask_array-0.1.0/dask_array/manipulation/_roll.py +78 -0
- dask_array-0.1.0/dask_array/manipulation/_transpose.py +309 -0
- dask_array-0.1.0/dask_array/random/__init__.py +125 -0
- dask_array-0.1.0/dask_array/random/_choice.py +181 -0
- dask_array-0.1.0/dask_array/random/_expr.py +256 -0
- dask_array-0.1.0/dask_array/random/_generator.py +441 -0
- dask_array-0.1.0/dask_array/random/_random_state.py +259 -0
- dask_array-0.1.0/dask_array/random/_utils.py +84 -0
- dask_array-0.1.0/dask_array/reductions/__init__.py +84 -0
- dask_array-0.1.0/dask_array/reductions/_arg_reduction.py +130 -0
- dask_array-0.1.0/dask_array/reductions/_common.py +1082 -0
- dask_array-0.1.0/dask_array/reductions/_cumulative.py +522 -0
- dask_array-0.1.0/dask_array/reductions/_percentile.py +261 -0
- dask_array-0.1.0/dask_array/reductions/_reduction.py +725 -0
- dask_array-0.1.0/dask_array/reductions/_trace.py +56 -0
- dask_array-0.1.0/dask_array/routines/__init__.py +133 -0
- dask_array-0.1.0/dask_array/routines/_apply.py +84 -0
- dask_array-0.1.0/dask_array/routines/_bincount.py +112 -0
- dask_array-0.1.0/dask_array/routines/_broadcast.py +111 -0
- dask_array-0.1.0/dask_array/routines/_coarsen.py +115 -0
- dask_array-0.1.0/dask_array/routines/_diff.py +79 -0
- dask_array-0.1.0/dask_array/routines/_gradient.py +158 -0
- dask_array-0.1.0/dask_array/routines/_indexing.py +65 -0
- dask_array-0.1.0/dask_array/routines/_insert_delete.py +132 -0
- dask_array-0.1.0/dask_array/routines/_misc.py +122 -0
- dask_array-0.1.0/dask_array/routines/_nonzero.py +72 -0
- dask_array-0.1.0/dask_array/routines/_search.py +123 -0
- dask_array-0.1.0/dask_array/routines/_select.py +113 -0
- dask_array-0.1.0/dask_array/routines/_statistics.py +171 -0
- dask_array-0.1.0/dask_array/routines/_topk.py +82 -0
- dask_array-0.1.0/dask_array/routines/_triangular.py +74 -0
- dask_array-0.1.0/dask_array/routines/_unique.py +232 -0
- dask_array-0.1.0/dask_array/routines/_where.py +62 -0
- dask_array-0.1.0/dask_array/slicing/__init__.py +67 -0
- dask_array-0.1.0/dask_array/slicing/_basic.py +550 -0
- dask_array-0.1.0/dask_array/slicing/_blocks.py +138 -0
- dask_array-0.1.0/dask_array/slicing/_bool_index.py +145 -0
- dask_array-0.1.0/dask_array/slicing/_setitem.py +329 -0
- dask_array-0.1.0/dask_array/slicing/_squeeze.py +101 -0
- dask_array-0.1.0/dask_array/slicing/_utils.py +1133 -0
- dask_array-0.1.0/dask_array/slicing/_vindex.py +282 -0
- dask_array-0.1.0/dask_array/stacking/__init__.py +15 -0
- dask_array-0.1.0/dask_array/stacking/_block.py +83 -0
- dask_array-0.1.0/dask_array/stacking/_simple.py +58 -0
- dask_array-0.1.0/dask_array/templates/array.html.j2 +48 -0
- dask_array-0.1.0/dask_array/tests/__init__.py +0 -0
- dask_array-0.1.0/dask_array/tests/conftest.py +22 -0
- dask_array-0.1.0/dask_array/tests/test_api.py +40 -0
- dask_array-0.1.0/dask_array/tests/test_binary_op_chunks.py +107 -0
- dask_array-0.1.0/dask_array/tests/test_coarse_slice_through_blockwise.py +362 -0
- dask_array-0.1.0/dask_array/tests/test_collection.py +799 -0
- dask_array-0.1.0/dask_array/tests/test_creation.py +1102 -0
- dask_array-0.1.0/dask_array/tests/test_expr_flow.py +143 -0
- dask_array-0.1.0/dask_array/tests/test_linalg.py +1130 -0
- dask_array-0.1.0/dask_array/tests/test_map_blocks_multi_output.py +104 -0
- dask_array-0.1.0/dask_array/tests/test_rechunk_pushdown.py +214 -0
- dask_array-0.1.0/dask_array/tests/test_reductions.py +1091 -0
- dask_array-0.1.0/dask_array/tests/test_routines.py +2853 -0
- dask_array-0.1.0/dask_array/tests/test_shuffle_chunks.py +67 -0
- dask_array-0.1.0/dask_array/tests/test_slice_pushdown.py +968 -0
- dask_array-0.1.0/dask_array/tests/test_slice_through_blockwise.py +678 -0
- dask_array-0.1.0/dask_array/tests/test_slice_through_overlap.py +366 -0
- dask_array-0.1.0/dask_array/tests/test_slice_through_reshape.py +272 -0
- dask_array-0.1.0/dask_array/tests/test_slicing.py +839 -0
- dask_array-0.1.0/dask_array/tests/test_transpose_slice_pushdown.py +208 -0
- dask_array-0.1.0/dask_array/tests/test_visualize.py +94 -0
- dask_array-0.1.0/dask_array/tests/test_xarray.py +193 -0
- dask_array-0.1.0/pyproject.toml +99 -0
- dask_array-0.1.0/uv.lock +1426 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*.egg-info/
|
|
5
|
+
dist/
|
|
6
|
+
build/
|
|
7
|
+
|
|
8
|
+
# Virtual environments
|
|
9
|
+
.venv/
|
|
10
|
+
venv/
|
|
11
|
+
|
|
12
|
+
# uv
|
|
13
|
+
.uv-cache/
|
|
14
|
+
|
|
15
|
+
# Testing
|
|
16
|
+
.pytest_cache/
|
|
17
|
+
.coverage
|
|
18
|
+
htmlcov/
|
|
19
|
+
|
|
20
|
+
# IDE
|
|
21
|
+
.idea/
|
|
22
|
+
.vscode/
|
|
23
|
+
*.swp
|
|
24
|
+
|
|
25
|
+
# Jupyter
|
|
26
|
+
*.ipynb
|
|
27
|
+
.ipynb_checkpoints/
|
|
28
|
+
|
|
29
|
+
# OS
|
|
30
|
+
.DS_Store
|
dask_array-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
BSD 3-Clause License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2014, Anaconda, Inc., Coiled Computing Inc., Matthew Rocklin, and contributors
|
|
4
|
+
All rights reserved.
|
|
5
|
+
|
|
6
|
+
Redistribution and use in source and binary forms, with or without
|
|
7
|
+
modification, are permitted provided that the following conditions are met:
|
|
8
|
+
|
|
9
|
+
* Redistributions of source code must retain the above copyright notice, this
|
|
10
|
+
list of conditions and the following disclaimer.
|
|
11
|
+
|
|
12
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
|
13
|
+
this list of conditions and the following disclaimer in the documentation
|
|
14
|
+
and/or other materials provided with the distribution.
|
|
15
|
+
|
|
16
|
+
* Neither the name of the copyright holder nor the names of its
|
|
17
|
+
contributors may be used to endorse or promote products derived from
|
|
18
|
+
this software without specific prior written permission.
|
|
19
|
+
|
|
20
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
21
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
22
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
23
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
24
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
25
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
26
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
27
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
28
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
29
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: dask-array
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Parallel arrays with task graphs
|
|
5
|
+
Project-URL: Homepage, https://github.com/mrocklin/dask-array
|
|
6
|
+
Project-URL: Source, https://github.com/mrocklin/dask-array
|
|
7
|
+
Project-URL: Issues, https://github.com/mrocklin/dask-array/issues
|
|
8
|
+
License-Expression: BSD-3-Clause
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Requires-Python: >=3.10
|
|
11
|
+
Requires-Dist: dask>=2024.1.0
|
|
12
|
+
Requires-Dist: jinja2>=3.1.6
|
|
13
|
+
Requires-Dist: numpy!=2.4.0,>=2.0.0
|
|
14
|
+
Requires-Dist: rich
|
|
15
|
+
Requires-Dist: toolz>=0.8.2
|
|
16
|
+
Provides-Extra: complete
|
|
17
|
+
Requires-Dist: h5py; extra == 'complete'
|
|
18
|
+
Requires-Dist: scipy; extra == 'complete'
|
|
19
|
+
Requires-Dist: tiledb; extra == 'complete'
|
|
20
|
+
Requires-Dist: zarr>=2.0; extra == 'complete'
|
|
21
|
+
Provides-Extra: sparse
|
|
22
|
+
Requires-Dist: numba>=0.60; (python_version < '3.13') and extra == 'sparse'
|
|
23
|
+
Requires-Dist: sparse; (python_version < '3.13') and extra == 'sparse'
|
|
24
|
+
Provides-Extra: test
|
|
25
|
+
Requires-Dist: pytest; extra == 'test'
|
|
26
|
+
Requires-Dist: pytest-cov; extra == 'test'
|
|
27
|
+
Requires-Dist: pytest-xdist; extra == 'test'
|
|
28
|
+
Requires-Dist: xarray; extra == 'test'
|
|
29
|
+
Description-Content-Type: text/markdown
|
|
30
|
+
|
|
31
|
+
# dask-array
|
|
32
|
+
|
|
33
|
+
Expression-based dask array implementation.
|
|
34
|
+
|
|
35
|
+
## Installation
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
pip install dask-array
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Usage
|
|
42
|
+
|
|
43
|
+
```python
|
|
44
|
+
import dask_array as da
|
|
45
|
+
|
|
46
|
+
x = da.ones((1000, 1000), chunks=(100, 100))
|
|
47
|
+
result = x.sum().compute()
|
|
48
|
+
```
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# dask-array
|
|
2
|
+
|
|
3
|
+
Expression-based dask array implementation.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install dask-array
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```python
|
|
14
|
+
import dask_array as da
|
|
15
|
+
|
|
16
|
+
x = da.ones((1000, 1000), chunks=(100, 100))
|
|
17
|
+
result = x.sum().compute()
|
|
18
|
+
```
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import numpy as np
|
|
4
|
+
|
|
5
|
+
import dask_array._backends
|
|
6
|
+
from dask_array import _chunk as chunk
|
|
7
|
+
from dask_array._core_utils import PerformanceWarning
|
|
8
|
+
from dask.base import compute
|
|
9
|
+
from dask_array._chunk_types import register_chunk_type
|
|
10
|
+
|
|
11
|
+
from dask_array import fft, random
|
|
12
|
+
from dask_array._collection import (
|
|
13
|
+
Array,
|
|
14
|
+
array,
|
|
15
|
+
asanyarray,
|
|
16
|
+
asarray,
|
|
17
|
+
atleast_1d,
|
|
18
|
+
atleast_2d,
|
|
19
|
+
atleast_3d,
|
|
20
|
+
block,
|
|
21
|
+
blockwise,
|
|
22
|
+
broadcast_to,
|
|
23
|
+
concatenate,
|
|
24
|
+
dstack,
|
|
25
|
+
elemwise,
|
|
26
|
+
expand_dims,
|
|
27
|
+
flip,
|
|
28
|
+
fliplr,
|
|
29
|
+
flipud,
|
|
30
|
+
from_array,
|
|
31
|
+
hstack,
|
|
32
|
+
moveaxis,
|
|
33
|
+
ravel,
|
|
34
|
+
rechunk,
|
|
35
|
+
reshape,
|
|
36
|
+
reshape_blockwise,
|
|
37
|
+
roll,
|
|
38
|
+
rollaxis,
|
|
39
|
+
rot90,
|
|
40
|
+
squeeze,
|
|
41
|
+
stack,
|
|
42
|
+
swapaxes,
|
|
43
|
+
transpose,
|
|
44
|
+
vstack,
|
|
45
|
+
)
|
|
46
|
+
from dask_array._einsum import einsum
|
|
47
|
+
from dask_array._gufunc import *
|
|
48
|
+
from dask_array._histogram import histogram, histogram2d, histogramdd
|
|
49
|
+
from dask_array._map_blocks import map_blocks
|
|
50
|
+
from dask_array._overlap import map_overlap, overlap, trim_overlap
|
|
51
|
+
from dask_array._routines import (
|
|
52
|
+
aligned_coarsen_chunks,
|
|
53
|
+
allclose,
|
|
54
|
+
append,
|
|
55
|
+
apply_along_axis,
|
|
56
|
+
apply_over_axes,
|
|
57
|
+
argtopk,
|
|
58
|
+
argwhere,
|
|
59
|
+
around,
|
|
60
|
+
average,
|
|
61
|
+
bincount,
|
|
62
|
+
broadcast_arrays,
|
|
63
|
+
choose,
|
|
64
|
+
coarsen,
|
|
65
|
+
compress,
|
|
66
|
+
corrcoef,
|
|
67
|
+
count_nonzero,
|
|
68
|
+
cov,
|
|
69
|
+
delete,
|
|
70
|
+
digitize,
|
|
71
|
+
ediff1d,
|
|
72
|
+
extract,
|
|
73
|
+
flatnonzero,
|
|
74
|
+
gradient,
|
|
75
|
+
insert,
|
|
76
|
+
isclose,
|
|
77
|
+
iscomplexobj,
|
|
78
|
+
isin,
|
|
79
|
+
isnull,
|
|
80
|
+
ndim,
|
|
81
|
+
nonzero,
|
|
82
|
+
notnull,
|
|
83
|
+
outer,
|
|
84
|
+
piecewise,
|
|
85
|
+
ptp,
|
|
86
|
+
ravel_multi_index,
|
|
87
|
+
result_type,
|
|
88
|
+
round,
|
|
89
|
+
searchsorted,
|
|
90
|
+
select,
|
|
91
|
+
shape,
|
|
92
|
+
take,
|
|
93
|
+
topk,
|
|
94
|
+
tril,
|
|
95
|
+
tril_indices,
|
|
96
|
+
tril_indices_from,
|
|
97
|
+
triu,
|
|
98
|
+
triu_indices,
|
|
99
|
+
triu_indices_from,
|
|
100
|
+
unify_chunks,
|
|
101
|
+
union1d,
|
|
102
|
+
unique,
|
|
103
|
+
unravel_index,
|
|
104
|
+
)
|
|
105
|
+
from dask_array._shuffle import shuffle
|
|
106
|
+
from dask_array._ufunc import *
|
|
107
|
+
from dask_array.creation import (
|
|
108
|
+
arange,
|
|
109
|
+
diag,
|
|
110
|
+
diagonal,
|
|
111
|
+
empty,
|
|
112
|
+
empty_like,
|
|
113
|
+
eye,
|
|
114
|
+
fromfunction,
|
|
115
|
+
full,
|
|
116
|
+
full_like,
|
|
117
|
+
indices,
|
|
118
|
+
linspace,
|
|
119
|
+
meshgrid,
|
|
120
|
+
ones,
|
|
121
|
+
ones_like,
|
|
122
|
+
pad,
|
|
123
|
+
repeat,
|
|
124
|
+
tile,
|
|
125
|
+
tri,
|
|
126
|
+
zeros,
|
|
127
|
+
zeros_like,
|
|
128
|
+
)
|
|
129
|
+
from dask_array.io import (
|
|
130
|
+
from_delayed,
|
|
131
|
+
from_npy_stack,
|
|
132
|
+
from_tiledb,
|
|
133
|
+
from_zarr,
|
|
134
|
+
store,
|
|
135
|
+
to_hdf5,
|
|
136
|
+
to_npy_stack,
|
|
137
|
+
to_tiledb,
|
|
138
|
+
to_zarr,
|
|
139
|
+
)
|
|
140
|
+
from dask_array.linalg import dot, matmul, tensordot, vdot
|
|
141
|
+
from dask_array.reductions import (
|
|
142
|
+
_tree_reduce,
|
|
143
|
+
all,
|
|
144
|
+
any,
|
|
145
|
+
arg_reduction,
|
|
146
|
+
argmax,
|
|
147
|
+
argmin,
|
|
148
|
+
cumprod,
|
|
149
|
+
cumreduction,
|
|
150
|
+
cumsum,
|
|
151
|
+
max,
|
|
152
|
+
mean,
|
|
153
|
+
median,
|
|
154
|
+
min,
|
|
155
|
+
moment,
|
|
156
|
+
nanargmax,
|
|
157
|
+
nanargmin,
|
|
158
|
+
nancumprod,
|
|
159
|
+
nancumsum,
|
|
160
|
+
nanmax,
|
|
161
|
+
nanmean,
|
|
162
|
+
nanmedian,
|
|
163
|
+
nanmin,
|
|
164
|
+
nanpercentile,
|
|
165
|
+
nanprod,
|
|
166
|
+
nanquantile,
|
|
167
|
+
nanstd,
|
|
168
|
+
nansum,
|
|
169
|
+
nanvar,
|
|
170
|
+
percentile,
|
|
171
|
+
prod,
|
|
172
|
+
quantile,
|
|
173
|
+
reduction,
|
|
174
|
+
std,
|
|
175
|
+
sum,
|
|
176
|
+
trace,
|
|
177
|
+
var,
|
|
178
|
+
)
|
|
179
|
+
from dask_array.routines._diff import diff
|
|
180
|
+
from dask_array.routines._where import where
|
|
181
|
+
from dask_array._expr_flow import expr_flow
|
|
182
|
+
from dask_array._visualize import expr_table
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
def optimize(dsk, keys=None, **kwargs):
|
|
186
|
+
"""Optimize a dask-array collection.
|
|
187
|
+
|
|
188
|
+
Low-level graphs are returned unchanged because this package optimizes
|
|
189
|
+
through Array expressions before graph materialization.
|
|
190
|
+
"""
|
|
191
|
+
if isinstance(dsk, Array):
|
|
192
|
+
result = dsk.optimize()
|
|
193
|
+
if keys is not None:
|
|
194
|
+
return result.__dask_graph__()
|
|
195
|
+
return result
|
|
196
|
+
return dsk
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
newaxis = None
|
|
200
|
+
nan = np.nan
|
|
201
|
+
inf = np.inf
|
|
202
|
+
e = np.e
|
|
203
|
+
pi = np.pi
|
|
204
|
+
euler_gamma = np.euler_gamma
|
|
205
|
+
|
|
206
|
+
bool = np.bool
|
|
207
|
+
int8 = np.int8
|
|
208
|
+
int16 = np.int16
|
|
209
|
+
int32 = np.int32
|
|
210
|
+
int64 = np.int64
|
|
211
|
+
uint8 = np.uint8
|
|
212
|
+
uint16 = np.uint16
|
|
213
|
+
uint32 = np.uint32
|
|
214
|
+
uint64 = np.uint64
|
|
215
|
+
float32 = np.float32
|
|
216
|
+
float64 = np.float64
|
|
217
|
+
complex64 = np.complex64
|
|
218
|
+
complex128 = np.complex128
|
|
219
|
+
|
|
220
|
+
# Ensure our xarray ChunkManager replaces the built-in DaskManager
|
|
221
|
+
# regardless of entry point enumeration order. See _xarray.py for details.
|
|
222
|
+
try:
|
|
223
|
+
from dask_array._xarray import _ensure_registered
|
|
224
|
+
|
|
225
|
+
_ensure_registered()
|
|
226
|
+
del _ensure_registered
|
|
227
|
+
except ImportError:
|
|
228
|
+
pass
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import numpy as np
|
|
4
|
+
|
|
5
|
+
from dask._dispatch import get_collection_type
|
|
6
|
+
|
|
7
|
+
try:
|
|
8
|
+
import sparse
|
|
9
|
+
|
|
10
|
+
sparse_installed = True
|
|
11
|
+
except ImportError:
|
|
12
|
+
sparse_installed = False
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
try:
|
|
16
|
+
import scipy.sparse as sp
|
|
17
|
+
|
|
18
|
+
scipy_installed = True
|
|
19
|
+
except ImportError:
|
|
20
|
+
scipy_installed = False
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def create_array_collection(expr):
|
|
24
|
+
"""Create an Array collection from an expression."""
|
|
25
|
+
from dask_array._collection import Array
|
|
26
|
+
from dask_array._expr import ArrayExpr
|
|
27
|
+
|
|
28
|
+
if isinstance(expr, ArrayExpr):
|
|
29
|
+
return Array(expr)
|
|
30
|
+
|
|
31
|
+
# For non-ArrayExpr (e.g., from dask-dataframe), wrap in adapter
|
|
32
|
+
# This is a fallback - most cases should be ArrayExpr
|
|
33
|
+
raise TypeError(f"Expected ArrayExpr, got {type(expr)}")
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
@get_collection_type.register(np.ndarray)
|
|
37
|
+
def get_collection_type_array(_):
|
|
38
|
+
return create_array_collection
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
if sparse_installed:
|
|
42
|
+
|
|
43
|
+
@get_collection_type.register(sparse.COO)
|
|
44
|
+
def get_collection_type_sparse(_):
|
|
45
|
+
return create_array_collection
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
if scipy_installed:
|
|
49
|
+
|
|
50
|
+
@get_collection_type.register(sp.csr_matrix)
|
|
51
|
+
def get_collection_type_scipy(_):
|
|
52
|
+
return create_array_collection
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
if scipy_installed and hasattr(sp, "sparray"):
|
|
56
|
+
|
|
57
|
+
@get_collection_type.register(sp.csr_array)
|
|
58
|
+
def get_collection_type_scipy_array(_):
|
|
59
|
+
return create_array_collection
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
@get_collection_type.register(object)
|
|
63
|
+
def get_collection_type_object(_):
|
|
64
|
+
return create_scalar_collection
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def create_scalar_collection(expr):
|
|
68
|
+
from dask_array._expr import ArrayExpr
|
|
69
|
+
|
|
70
|
+
if isinstance(expr, ArrayExpr):
|
|
71
|
+
from dask_array._collection import Array
|
|
72
|
+
|
|
73
|
+
return Array(expr)
|
|
74
|
+
|
|
75
|
+
# For other expressions, try to return something sensible
|
|
76
|
+
raise TypeError(f"Cannot create collection from {type(expr)}")
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"""Array creation dispatch for backend-specific array creation.
|
|
2
|
+
|
|
3
|
+
This module provides `array_creation_dispatch` which is used by random modules
|
|
4
|
+
and creation functions to dispatch to backend-specific implementations.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
import numpy as np
|
|
10
|
+
|
|
11
|
+
from dask.backends import CreationDispatch, DaskBackendEntrypoint
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class ArrayBackendEntrypoint(DaskBackendEntrypoint):
|
|
15
|
+
"""Dask-Array version of ``DaskBackendEntrypoint``
|
|
16
|
+
|
|
17
|
+
See Also
|
|
18
|
+
--------
|
|
19
|
+
NumpyBackendEntrypoint
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
@property
|
|
23
|
+
def RandomState(self):
|
|
24
|
+
"""Return the backend-specific RandomState class
|
|
25
|
+
|
|
26
|
+
For example, the 'numpy' backend simply returns
|
|
27
|
+
``numpy.random.RandomState``.
|
|
28
|
+
"""
|
|
29
|
+
raise NotImplementedError
|
|
30
|
+
|
|
31
|
+
@property
|
|
32
|
+
def default_bit_generator(self):
|
|
33
|
+
"""Return the default BitGenerator type"""
|
|
34
|
+
raise NotImplementedError
|
|
35
|
+
|
|
36
|
+
@staticmethod
|
|
37
|
+
def ones(shape, *, dtype=None, meta=None, **kwargs):
|
|
38
|
+
"""Create an array of ones
|
|
39
|
+
|
|
40
|
+
Returns a new array having a specified shape and filled
|
|
41
|
+
with ones.
|
|
42
|
+
"""
|
|
43
|
+
raise NotImplementedError
|
|
44
|
+
|
|
45
|
+
@staticmethod
|
|
46
|
+
def zeros(shape, *, dtype=None, meta=None, **kwargs):
|
|
47
|
+
"""Create an array of zeros
|
|
48
|
+
|
|
49
|
+
Returns a new array having a specified shape and filled
|
|
50
|
+
with zeros.
|
|
51
|
+
"""
|
|
52
|
+
raise NotImplementedError
|
|
53
|
+
|
|
54
|
+
@staticmethod
|
|
55
|
+
def empty(shape, *, dtype=None, meta=None, **kwargs):
|
|
56
|
+
"""Create an empty array
|
|
57
|
+
|
|
58
|
+
Returns an uninitialized array having a specified shape.
|
|
59
|
+
"""
|
|
60
|
+
raise NotImplementedError
|
|
61
|
+
|
|
62
|
+
@staticmethod
|
|
63
|
+
def full(shape, fill_value, *, dtype=None, meta=None, **kwargs):
|
|
64
|
+
"""Create a uniformly filled array
|
|
65
|
+
|
|
66
|
+
Returns a new array having a specified shape and filled
|
|
67
|
+
with fill_value.
|
|
68
|
+
"""
|
|
69
|
+
raise NotImplementedError
|
|
70
|
+
|
|
71
|
+
@staticmethod
|
|
72
|
+
def arange(start, /, stop=None, step=1, *, dtype=None, meta=None, **kwargs):
|
|
73
|
+
"""Create an ascending or descending array
|
|
74
|
+
|
|
75
|
+
Returns evenly spaced values within the half-open interval
|
|
76
|
+
``[start, stop)`` as a one-dimensional array.
|
|
77
|
+
"""
|
|
78
|
+
raise NotImplementedError
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
class NumpyBackendEntrypoint(ArrayBackendEntrypoint):
|
|
82
|
+
@property
|
|
83
|
+
def RandomState(self):
|
|
84
|
+
return np.random.RandomState
|
|
85
|
+
|
|
86
|
+
@property
|
|
87
|
+
def default_bit_generator(self):
|
|
88
|
+
return np.random.PCG64
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
array_creation_dispatch = CreationDispatch(
|
|
92
|
+
module_name="array",
|
|
93
|
+
default="numpy",
|
|
94
|
+
entrypoint_class=ArrayBackendEntrypoint,
|
|
95
|
+
name="array_creation_dispatch",
|
|
96
|
+
)
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
array_creation_dispatch.register_backend("numpy", NumpyBackendEntrypoint())
|