python-graphblas 2023.12.0__tar.gz → 2024.2.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.
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/PKG-INFO +7 -7
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/agg/__init__.py +2 -1
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/binary/numpy.py +1 -0
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/core/automethods.py +1 -5
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/core/dtypes.py +1 -2
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/core/expr.py +4 -4
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/core/infix.py +0 -2
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/core/matrix.py +43 -103
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/core/operator/base.py +2 -1
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/core/operator/binary.py +2 -0
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/core/operator/indexunary.py +2 -0
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/core/operator/monoid.py +2 -0
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/core/operator/select.py +2 -0
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/core/operator/semiring.py +2 -0
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/core/operator/unary.py +2 -0
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/core/operator/utils.py +1 -0
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/core/scalar.py +11 -0
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/core/ss/binary.py +1 -0
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/core/ss/descriptor.py +1 -0
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/core/ss/indexunary.py +1 -0
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/core/ss/matrix.py +53 -60
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/core/ss/select.py +1 -0
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/core/ss/unary.py +1 -0
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/core/ss/vector.py +28 -28
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/core/utils.py +3 -1
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/core/vector.py +29 -70
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/io/__init__.py +0 -1
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/io/_awkward.py +1 -0
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/io/_matrixmarket.py +2 -0
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/io/_networkx.py +2 -0
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/io/_scipy.py +1 -0
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/io/_sparse.py +1 -0
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/monoid/numpy.py +1 -0
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/select/__init__.py +4 -11
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/semiring/numpy.py +1 -0
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/ss/_core.py +2 -4
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/tests/conftest.py +10 -6
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/tests/test_descriptor.py +1 -2
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/tests/test_dtype.py +1 -1
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/tests/test_infix.py +1 -1
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/tests/test_io.py +0 -11
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/tests/test_matrix.py +0 -11
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/tests/test_op.py +0 -2
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/tests/test_vector.py +0 -9
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/unary/numpy.py +1 -0
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/viz.py +2 -0
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/pyproject.toml +18 -12
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/python_graphblas.egg-info/PKG-INFO +7 -7
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/python_graphblas.egg-info/SOURCES.txt +0 -2
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/python_graphblas.egg-info/requires.txt +5 -5
- python-graphblas-2023.12.0/graphblas/core/agg.py +0 -17
- python-graphblas-2023.12.0/graphblas/io/_numpy.py +0 -104
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/LICENSE +0 -0
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/MANIFEST.in +0 -0
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/README.md +0 -0
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/conftest.py +0 -0
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/__init__.py +0 -0
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/agg/ss.py +0 -0
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/binary/__init__.py +0 -0
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/binary/ss.py +0 -0
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/core/__init__.py +0 -0
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/core/base.py +0 -0
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/core/descriptor.py +0 -0
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/core/formatting.py +0 -0
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/core/infixmethods.py +0 -0
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/core/mask.py +0 -0
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/core/operator/__init__.py +0 -0
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/core/operator/agg.py +0 -0
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/core/recorder.py +0 -0
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/core/slice.py +0 -0
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/core/ss/__init__.py +0 -0
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/core/ss/config.py +0 -0
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/core/ss/context.py +0 -0
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/core/ss/dtypes.py +0 -0
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/core/ss/prefix_scan.py +0 -0
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/dtypes/__init__.py +0 -0
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/dtypes/ss.py +0 -0
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/exceptions.py +0 -0
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/graphblas.yaml +0 -0
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/indexunary/__init__.py +0 -0
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/indexunary/ss.py +0 -0
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/monoid/__init__.py +0 -0
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/monoid/ss.py +0 -0
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/op/__init__.py +0 -0
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/op/numpy.py +0 -0
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/op/ss.py +0 -0
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/select/ss.py +0 -0
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/semiring/__init__.py +0 -0
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/semiring/ss.py +0 -0
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/ss/__init__.py +0 -0
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/tests/__init__.py +0 -0
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/tests/pickle1-vanilla.pkl +0 -0
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/tests/pickle1.pkl +0 -0
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/tests/pickle2-vanilla.pkl +0 -0
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/tests/pickle2.pkl +0 -0
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/tests/pickle3-vanilla.pkl +0 -0
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/tests/pickle3.pkl +0 -0
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/tests/test_auto_init.py +0 -0
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/tests/test_core.py +0 -0
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/tests/test_external_init.py +0 -0
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/tests/test_formatting.py +0 -0
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/tests/test_mask.py +0 -0
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/tests/test_numpyops.py +0 -0
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/tests/test_operator_types.py +0 -0
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/tests/test_pickle.py +0 -0
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/tests/test_prefix_scan.py +0 -0
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/tests/test_recorder.py +0 -0
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/tests/test_resolving.py +0 -0
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/tests/test_scalar.py +0 -0
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/tests/test_ss_utils.py +0 -0
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/tests/test_ssjit.py +0 -0
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/unary/__init__.py +0 -0
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/unary/ss.py +0 -0
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/python_graphblas.egg-info/dependency_links.txt +0 -0
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/python_graphblas.egg-info/top_level.txt +0 -0
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/setup.cfg +0 -0
- {python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/setup.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: python-graphblas
|
|
3
|
-
Version:
|
|
3
|
+
Version: 2024.2.0
|
|
4
4
|
Summary: Python library for GraphBLAS: high-performance sparse linear algebra for scalable graph analytics
|
|
5
5
|
Author: Jim Kitchen, Python-graphblas contributors
|
|
6
6
|
Author-email: Erik Welch <erik.n.welch@gmail.com>
|
|
@@ -234,11 +234,11 @@ Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
|
234
234
|
Requires-Python: >=3.9
|
|
235
235
|
Description-Content-Type: text/markdown
|
|
236
236
|
License-File: LICENSE
|
|
237
|
-
Requires-Dist: numpy>=1.
|
|
237
|
+
Requires-Dist: numpy>=1.22
|
|
238
238
|
Requires-Dist: donfig>=0.6
|
|
239
239
|
Requires-Dist: pyyaml>=5.4
|
|
240
240
|
Requires-Dist: suitesparse-graphblas<9,>=7.4.0.0
|
|
241
|
-
Requires-Dist: numba>=0.55; python_version < "3.
|
|
241
|
+
Requires-Dist: numba>=0.55; python_version < "3.13"
|
|
242
242
|
Provides-Extra: suitesparse
|
|
243
243
|
Requires-Dist: suitesparse-graphblas<9,>=7.4.0.0; extra == "suitesparse"
|
|
244
244
|
Provides-Extra: networkx
|
|
@@ -255,9 +255,9 @@ Provides-Extra: repr
|
|
|
255
255
|
Requires-Dist: python-graphblas[pandas]; extra == "repr"
|
|
256
256
|
Provides-Extra: io
|
|
257
257
|
Requires-Dist: python-graphblas[networkx,scipy]; extra == "io"
|
|
258
|
-
Requires-Dist: python-graphblas[numba]; python_version < "3.
|
|
258
|
+
Requires-Dist: python-graphblas[numba]; python_version < "3.13" and extra == "io"
|
|
259
259
|
Requires-Dist: awkward>=1.9; extra == "io"
|
|
260
|
-
Requires-Dist: sparse>=0.13; python_version < "3.
|
|
260
|
+
Requires-Dist: sparse>=0.13; python_version < "3.13" and extra == "io"
|
|
261
261
|
Requires-Dist: fast-matrix-market>=1.4.5; extra == "io"
|
|
262
262
|
Provides-Extra: viz
|
|
263
263
|
Requires-Dist: python-graphblas[networkx,scipy]; extra == "viz"
|
|
@@ -273,10 +273,10 @@ Requires-Dist: pytest>=6.2; extra == "test"
|
|
|
273
273
|
Requires-Dist: tomli>=1; extra == "test"
|
|
274
274
|
Provides-Extra: default
|
|
275
275
|
Requires-Dist: python-graphblas[pandas,scipy,suitesparse]; extra == "default"
|
|
276
|
-
Requires-Dist: python-graphblas[numba]; python_version < "3.
|
|
276
|
+
Requires-Dist: python-graphblas[numba]; python_version < "3.13" and extra == "default"
|
|
277
277
|
Provides-Extra: all
|
|
278
278
|
Requires-Dist: python-graphblas[default,io,test,viz]; extra == "all"
|
|
279
|
-
Requires-Dist: python-graphblas[datashade]; python_version < "3.
|
|
279
|
+
Requires-Dist: python-graphblas[datashade]; python_version < "3.13" and extra == "all"
|
|
280
280
|
|
|
281
281
|

|
|
282
282
|
|
|
@@ -73,7 +73,8 @@ Custom recipes (specific to SuiteSparse:GraphBLAS):
|
|
|
73
73
|
# - bxnor monoid: even bits
|
|
74
74
|
# - bnor monoid: odd bits
|
|
75
75
|
"""
|
|
76
|
-
|
|
76
|
+
|
|
77
|
+
# All items are dynamically added by classes in core/operator/agg.py
|
|
77
78
|
# This module acts as a container of Aggregator instances
|
|
78
79
|
_deprecated = {}
|
|
79
80
|
|
|
@@ -7,6 +7,7 @@ To automatically create the functions, run:
|
|
|
7
7
|
$ python -m graphblas.core.automethods
|
|
8
8
|
|
|
9
9
|
"""
|
|
10
|
+
|
|
10
11
|
from .. import config
|
|
11
12
|
|
|
12
13
|
|
|
@@ -281,10 +282,6 @@ def to_edgelist(self):
|
|
|
281
282
|
return self._get_value("to_edgelist")
|
|
282
283
|
|
|
283
284
|
|
|
284
|
-
def to_values(self):
|
|
285
|
-
return self._get_value("to_values")
|
|
286
|
-
|
|
287
|
-
|
|
288
285
|
def value(self):
|
|
289
286
|
return self._get_value("value")
|
|
290
287
|
|
|
@@ -398,7 +395,6 @@ def _main():
|
|
|
398
395
|
"ss",
|
|
399
396
|
"to_coo",
|
|
400
397
|
"to_dense",
|
|
401
|
-
"to_values",
|
|
402
398
|
}
|
|
403
399
|
vector = {
|
|
404
400
|
"_as_matrix",
|
|
@@ -375,8 +375,7 @@ def lookup_dtype(key, value=None):
|
|
|
375
375
|
|
|
376
376
|
|
|
377
377
|
def unify(type1, type2, *, is_left_scalar=False, is_right_scalar=False):
|
|
378
|
-
"""
|
|
379
|
-
Returns a type that can hold both type1 and type2.
|
|
378
|
+
"""Returns a type that can hold both type1 and type2.
|
|
380
379
|
|
|
381
380
|
For example:
|
|
382
381
|
unify(INT32, INT64) -> INT64
|
|
@@ -147,13 +147,13 @@ class IndexerResolver:
|
|
|
147
147
|
return self.indices[0]._py_index()
|
|
148
148
|
|
|
149
149
|
def parse_indices(self, indices, shape):
|
|
150
|
-
"""
|
|
151
|
-
Returns
|
|
150
|
+
"""Returns
|
|
152
151
|
-------
|
|
153
152
|
[(rows, rowsize), (cols, colsize)] for Matrix
|
|
154
153
|
[(idx, idx_size)] for Vector
|
|
155
154
|
|
|
156
155
|
Within each tuple, if the index is of type int, the size will be None
|
|
156
|
+
|
|
157
157
|
"""
|
|
158
158
|
if len(shape) == 1:
|
|
159
159
|
if type(indices) is tuple:
|
|
@@ -312,8 +312,8 @@ class AmbiguousAssignOrExtract:
|
|
|
312
312
|
Updater(self.parent, opts=opts)._setitem(self.resolved_indexes, expr, is_submask=False)
|
|
313
313
|
|
|
314
314
|
def new(self, dtype=None, *, mask=None, input_mask=None, name=None, **opts):
|
|
315
|
-
"""
|
|
316
|
-
|
|
315
|
+
"""Force extraction of the indexes into a new object.
|
|
316
|
+
|
|
317
317
|
dtype and mask are the only controllable parameters.
|
|
318
318
|
"""
|
|
319
319
|
if input_mask is not None:
|
|
@@ -236,7 +236,6 @@ class VectorInfixExpr(InfixExprBase):
|
|
|
236
236
|
to_coo = wrapdoc(Vector.to_coo)(property(automethods.to_coo))
|
|
237
237
|
to_dense = wrapdoc(Vector.to_dense)(property(automethods.to_dense))
|
|
238
238
|
to_dict = wrapdoc(Vector.to_dict)(property(automethods.to_dict))
|
|
239
|
-
to_values = wrapdoc(Vector.to_values)(property(automethods.to_values))
|
|
240
239
|
vxm = wrapdoc(Vector.vxm)(property(automethods.vxm))
|
|
241
240
|
wait = wrapdoc(Vector.wait)(property(automethods.wait))
|
|
242
241
|
# These raise exceptions
|
|
@@ -396,7 +395,6 @@ class MatrixInfixExpr(InfixExprBase):
|
|
|
396
395
|
to_dense = wrapdoc(Matrix.to_dense)(property(automethods.to_dense))
|
|
397
396
|
to_dicts = wrapdoc(Matrix.to_dicts)(property(automethods.to_dicts))
|
|
398
397
|
to_edgelist = wrapdoc(Matrix.to_edgelist)(property(automethods.to_edgelist))
|
|
399
|
-
to_values = wrapdoc(Matrix.to_values)(property(automethods.to_values))
|
|
400
398
|
wait = wrapdoc(Matrix.wait)(property(automethods.wait))
|
|
401
399
|
# These raise exceptions
|
|
402
400
|
__array__ = Matrix.__array__
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import itertools
|
|
2
|
-
import warnings
|
|
3
2
|
from collections.abc import Sequence
|
|
4
3
|
|
|
5
4
|
import numpy as np
|
|
@@ -178,6 +177,7 @@ class Matrix(BaseType):
|
|
|
178
177
|
Number of columns.
|
|
179
178
|
name : str, optional
|
|
180
179
|
Name to give the Matrix. This will be displayed in the ``__repr__``.
|
|
180
|
+
|
|
181
181
|
"""
|
|
182
182
|
|
|
183
183
|
__slots__ = "_nrows", "_ncols", "_parent", "ss"
|
|
@@ -297,6 +297,7 @@ class Matrix(BaseType):
|
|
|
297
297
|
Examples
|
|
298
298
|
--------
|
|
299
299
|
>>> del M[1, 5]
|
|
300
|
+
|
|
300
301
|
"""
|
|
301
302
|
del Updater(self, opts=opts)[keys]
|
|
302
303
|
|
|
@@ -311,6 +312,7 @@ class Matrix(BaseType):
|
|
|
311
312
|
.. code-block:: python
|
|
312
313
|
|
|
313
314
|
subM = M[[1, 3, 5], :].new()
|
|
315
|
+
|
|
314
316
|
"""
|
|
315
317
|
resolved_indexes = IndexerResolver(self, keys)
|
|
316
318
|
shape = resolved_indexes.shape
|
|
@@ -332,6 +334,7 @@ class Matrix(BaseType):
|
|
|
332
334
|
.. code-block:: python
|
|
333
335
|
|
|
334
336
|
M[0, 0:3] = 17
|
|
337
|
+
|
|
335
338
|
"""
|
|
336
339
|
Updater(self, opts=opts)[keys] = expr
|
|
337
340
|
|
|
@@ -343,6 +346,7 @@ class Matrix(BaseType):
|
|
|
343
346
|
.. code-block:: python
|
|
344
347
|
|
|
345
348
|
(10, 15) in M
|
|
349
|
+
|
|
346
350
|
"""
|
|
347
351
|
extractor = self[index]
|
|
348
352
|
if not extractor._is_scalar:
|
|
@@ -382,6 +386,7 @@ class Matrix(BaseType):
|
|
|
382
386
|
See Also
|
|
383
387
|
--------
|
|
384
388
|
:meth:`isclose` : For equality check of floating point dtypes
|
|
389
|
+
|
|
385
390
|
"""
|
|
386
391
|
other = self._expect_type(
|
|
387
392
|
other, (Matrix, TransposedMatrix), within="isequal", argname="other"
|
|
@@ -428,6 +433,7 @@ class Matrix(BaseType):
|
|
|
428
433
|
-------
|
|
429
434
|
bool
|
|
430
435
|
Whether all values of the Matrix are close to the values in ``other``.
|
|
436
|
+
|
|
431
437
|
"""
|
|
432
438
|
other = self._expect_type(
|
|
433
439
|
other, (Matrix, TransposedMatrix), within="isclose", argname="other"
|
|
@@ -515,42 +521,6 @@ class Matrix(BaseType):
|
|
|
515
521
|
self._nrows = nrows.value
|
|
516
522
|
self._ncols = ncols.value
|
|
517
523
|
|
|
518
|
-
def to_values(self, dtype=None, *, rows=True, columns=True, values=True, sort=True):
|
|
519
|
-
"""Extract the indices and values as a 3-tuple of numpy arrays
|
|
520
|
-
corresponding to the COO format of the Matrix.
|
|
521
|
-
|
|
522
|
-
.. deprecated:: 2022.11.0
|
|
523
|
-
``Matrix.to_values`` will be removed in a future release.
|
|
524
|
-
Use ``Matrix.to_coo`` instead. Will be removed in version 2023.9.0 or later
|
|
525
|
-
|
|
526
|
-
Parameters
|
|
527
|
-
----------
|
|
528
|
-
dtype :
|
|
529
|
-
Requested dtype for the output values array.
|
|
530
|
-
rows : bool, default=True
|
|
531
|
-
Whether to return rows; will return ``None`` for rows if ``False``
|
|
532
|
-
columns : bool, default=True
|
|
533
|
-
Whether to return columns; will return ``None`` for columns if ``False``
|
|
534
|
-
values : bool, default=True
|
|
535
|
-
Whether to return values; will return ``None`` for values if ``False``
|
|
536
|
-
sort : bool, default=True
|
|
537
|
-
Whether to require sorted indices.
|
|
538
|
-
If internally stored rowwise, the sorting will be first by rows, then by column.
|
|
539
|
-
If internally stored columnwise, the sorting will be first by column, then by row.
|
|
540
|
-
|
|
541
|
-
Returns
|
|
542
|
-
-------
|
|
543
|
-
np.ndarray[dtype=uint64] : Rows
|
|
544
|
-
np.ndarray[dtype=uint64] : Columns
|
|
545
|
-
np.ndarray : Values
|
|
546
|
-
"""
|
|
547
|
-
warnings.warn(
|
|
548
|
-
"`Matrix.to_values(...)` is deprecated; please use `Matrix.to_coo(...)` instead.",
|
|
549
|
-
DeprecationWarning,
|
|
550
|
-
stacklevel=2,
|
|
551
|
-
)
|
|
552
|
-
return self.to_coo(dtype, rows=rows, columns=columns, values=values, sort=sort)
|
|
553
|
-
|
|
554
524
|
def to_coo(self, dtype=None, *, rows=True, columns=True, values=True, sort=True):
|
|
555
525
|
"""Extract the indices and values as a 3-tuple of numpy arrays
|
|
556
526
|
corresponding to the COO format of the Matrix.
|
|
@@ -581,6 +551,7 @@ class Matrix(BaseType):
|
|
|
581
551
|
np.ndarray[dtype=uint64] : Rows
|
|
582
552
|
np.ndarray[dtype=uint64] : Columns
|
|
583
553
|
np.ndarray : Values
|
|
554
|
+
|
|
584
555
|
"""
|
|
585
556
|
if sort and backend == "suitesparse":
|
|
586
557
|
self.wait() # sort in SS
|
|
@@ -647,6 +618,7 @@ class Matrix(BaseType):
|
|
|
647
618
|
-------
|
|
648
619
|
np.ndarray[dtype=uint64] : Edgelist
|
|
649
620
|
np.ndarray : Values
|
|
621
|
+
|
|
650
622
|
"""
|
|
651
623
|
rows, columns, values = self.to_coo(dtype, values=values, sort=sort)
|
|
652
624
|
return (np.column_stack([rows, columns]), values)
|
|
@@ -727,6 +699,7 @@ class Matrix(BaseType):
|
|
|
727
699
|
Returns
|
|
728
700
|
-------
|
|
729
701
|
Matrix
|
|
702
|
+
|
|
730
703
|
"""
|
|
731
704
|
if dtype is not None or mask is not None or clear:
|
|
732
705
|
if dtype is None:
|
|
@@ -758,6 +731,7 @@ class Matrix(BaseType):
|
|
|
758
731
|
Returns
|
|
759
732
|
-------
|
|
760
733
|
:class:`~graphblas.Vector`
|
|
734
|
+
|
|
761
735
|
"""
|
|
762
736
|
if backend == "suitesparse":
|
|
763
737
|
from ..ss._core import diag
|
|
@@ -801,6 +775,7 @@ class Matrix(BaseType):
|
|
|
801
775
|
Use wait to force completion of the Matrix.
|
|
802
776
|
|
|
803
777
|
Has no effect in `blocking mode <../user_guide/init.html#graphblas-modes>`__.
|
|
778
|
+
|
|
804
779
|
"""
|
|
805
780
|
how = how.lower()
|
|
806
781
|
if how == "materialize":
|
|
@@ -827,6 +802,7 @@ class Matrix(BaseType):
|
|
|
827
802
|
Returns
|
|
828
803
|
-------
|
|
829
804
|
Python scalar
|
|
805
|
+
|
|
830
806
|
"""
|
|
831
807
|
expr = self[row, col]
|
|
832
808
|
if expr._is_scalar:
|
|
@@ -837,61 +813,6 @@ class Matrix(BaseType):
|
|
|
837
813
|
"Indices should get a single element, which will be extracted as a Python scalar."
|
|
838
814
|
)
|
|
839
815
|
|
|
840
|
-
@classmethod
|
|
841
|
-
def from_values(
|
|
842
|
-
cls,
|
|
843
|
-
rows,
|
|
844
|
-
columns,
|
|
845
|
-
values,
|
|
846
|
-
dtype=None,
|
|
847
|
-
*,
|
|
848
|
-
nrows=None,
|
|
849
|
-
ncols=None,
|
|
850
|
-
dup_op=None,
|
|
851
|
-
name=None,
|
|
852
|
-
):
|
|
853
|
-
"""Create a new Matrix from row and column indices and values.
|
|
854
|
-
|
|
855
|
-
.. deprecated:: 2022.11.0
|
|
856
|
-
``Matrix.from_values`` will be removed in a future release.
|
|
857
|
-
Use ``Matrix.from_coo`` instead. Will be removed in version 2023.9.0 or later
|
|
858
|
-
|
|
859
|
-
Parameters
|
|
860
|
-
----------
|
|
861
|
-
rows : list or np.ndarray
|
|
862
|
-
Row indices.
|
|
863
|
-
columns : list or np.ndarray
|
|
864
|
-
Column indices.
|
|
865
|
-
values : list or np.ndarray or scalar
|
|
866
|
-
List of values. If a scalar is provided, all values will be set to this single value.
|
|
867
|
-
dtype :
|
|
868
|
-
Data type of the Matrix. If not provided, the values will be inspected
|
|
869
|
-
to choose an appropriate dtype.
|
|
870
|
-
nrows : int, optional
|
|
871
|
-
Number of rows in the Matrix. If not provided, ``nrows`` is computed
|
|
872
|
-
from the maximum row index found in ``rows``.
|
|
873
|
-
ncols : int, optional
|
|
874
|
-
Number of columns in the Matrix. If not provided, ``ncols`` is computed
|
|
875
|
-
from the maximum column index found in ``columns``.
|
|
876
|
-
dup_op : :class:`~graphblas.core.operator.BinaryOp`, optional
|
|
877
|
-
Function used to combine values if duplicate indices are found.
|
|
878
|
-
Leaving ``dup_op=None`` will raise an error if duplicates are found.
|
|
879
|
-
name : str, optional
|
|
880
|
-
Name to give the Matrix.
|
|
881
|
-
|
|
882
|
-
Returns
|
|
883
|
-
-------
|
|
884
|
-
Matrix
|
|
885
|
-
"""
|
|
886
|
-
warnings.warn(
|
|
887
|
-
"`Matrix.from_values(...)` is deprecated; please use `Matrix.from_coo(...)` instead.",
|
|
888
|
-
DeprecationWarning,
|
|
889
|
-
stacklevel=2,
|
|
890
|
-
)
|
|
891
|
-
return cls.from_coo(
|
|
892
|
-
rows, columns, values, dtype, nrows=nrows, ncols=ncols, dup_op=dup_op, name=name
|
|
893
|
-
)
|
|
894
|
-
|
|
895
816
|
@classmethod
|
|
896
817
|
def from_coo(
|
|
897
818
|
cls,
|
|
@@ -939,6 +860,7 @@ class Matrix(BaseType):
|
|
|
939
860
|
Returns
|
|
940
861
|
-------
|
|
941
862
|
Matrix
|
|
863
|
+
|
|
942
864
|
"""
|
|
943
865
|
rows = ints_to_numpy_buffer(rows, np.uint64, name="row indices")
|
|
944
866
|
columns = ints_to_numpy_buffer(columns, np.uint64, name="column indices")
|
|
@@ -1018,6 +940,7 @@ class Matrix(BaseType):
|
|
|
1018
940
|
Returns
|
|
1019
941
|
-------
|
|
1020
942
|
Matrix
|
|
943
|
+
|
|
1021
944
|
"""
|
|
1022
945
|
edgelist_values = None
|
|
1023
946
|
if isinstance(edgelist, np.ndarray):
|
|
@@ -1187,6 +1110,7 @@ class Matrix(BaseType):
|
|
|
1187
1110
|
to_csr
|
|
1188
1111
|
Matrix.ss.import_csr
|
|
1189
1112
|
io.from_scipy_sparse
|
|
1113
|
+
|
|
1190
1114
|
"""
|
|
1191
1115
|
return cls._from_csx(_CSR_FORMAT, indptr, col_indices, values, dtype, ncols, nrows, name)
|
|
1192
1116
|
|
|
@@ -1234,6 +1158,7 @@ class Matrix(BaseType):
|
|
|
1234
1158
|
to_csc
|
|
1235
1159
|
Matrix.ss.import_csc
|
|
1236
1160
|
io.from_scipy_sparse
|
|
1161
|
+
|
|
1237
1162
|
"""
|
|
1238
1163
|
return cls._from_csx(_CSC_FORMAT, indptr, row_indices, values, dtype, nrows, ncols, name)
|
|
1239
1164
|
|
|
@@ -1294,6 +1219,7 @@ class Matrix(BaseType):
|
|
|
1294
1219
|
to_dcsr
|
|
1295
1220
|
Matrix.ss.import_hypercsr
|
|
1296
1221
|
io.from_scipy_sparse
|
|
1222
|
+
|
|
1297
1223
|
"""
|
|
1298
1224
|
if backend == "suitesparse":
|
|
1299
1225
|
return cls.ss.import_hypercsr(
|
|
@@ -1378,6 +1304,7 @@ class Matrix(BaseType):
|
|
|
1378
1304
|
to_dcsc
|
|
1379
1305
|
Matrix.ss.import_hypercsc
|
|
1380
1306
|
io.from_scipy_sparse
|
|
1307
|
+
|
|
1381
1308
|
"""
|
|
1382
1309
|
if backend == "suitesparse":
|
|
1383
1310
|
return cls.ss.import_hypercsc(
|
|
@@ -1439,6 +1366,7 @@ class Matrix(BaseType):
|
|
|
1439
1366
|
Returns
|
|
1440
1367
|
-------
|
|
1441
1368
|
Matrix
|
|
1369
|
+
|
|
1442
1370
|
"""
|
|
1443
1371
|
if type(value) is not Scalar:
|
|
1444
1372
|
try:
|
|
@@ -1492,6 +1420,7 @@ class Matrix(BaseType):
|
|
|
1492
1420
|
Returns
|
|
1493
1421
|
-------
|
|
1494
1422
|
Matrix
|
|
1423
|
+
|
|
1495
1424
|
"""
|
|
1496
1425
|
values, dtype = values_to_numpy_buffer(values, dtype, subarray_after=2)
|
|
1497
1426
|
if values.ndim == 0:
|
|
@@ -1551,6 +1480,7 @@ class Matrix(BaseType):
|
|
|
1551
1480
|
Returns
|
|
1552
1481
|
-------
|
|
1553
1482
|
np.ndarray
|
|
1483
|
+
|
|
1554
1484
|
"""
|
|
1555
1485
|
max_nvals = self._nrows * self._ncols
|
|
1556
1486
|
if fill_value is None or self._nvals == max_nvals:
|
|
@@ -1626,6 +1556,7 @@ class Matrix(BaseType):
|
|
|
1626
1556
|
Returns
|
|
1627
1557
|
-------
|
|
1628
1558
|
Matrix
|
|
1559
|
+
|
|
1629
1560
|
"""
|
|
1630
1561
|
order = get_order(order)
|
|
1631
1562
|
if isinstance(nested_dicts, Sequence):
|
|
@@ -1735,6 +1666,7 @@ class Matrix(BaseType):
|
|
|
1735
1666
|
from_csr
|
|
1736
1667
|
Matrix.ss.export
|
|
1737
1668
|
io.to_scipy_sparse
|
|
1669
|
+
|
|
1738
1670
|
"""
|
|
1739
1671
|
if backend == "suitesparse":
|
|
1740
1672
|
info = self.ss.export("csr", sort=sort)
|
|
@@ -1766,6 +1698,7 @@ class Matrix(BaseType):
|
|
|
1766
1698
|
from_csc
|
|
1767
1699
|
Matrix.ss.export
|
|
1768
1700
|
io.to_scipy_sparse
|
|
1701
|
+
|
|
1769
1702
|
"""
|
|
1770
1703
|
if backend == "suitesparse":
|
|
1771
1704
|
info = self.ss.export("csc", sort=sort)
|
|
@@ -1800,6 +1733,7 @@ class Matrix(BaseType):
|
|
|
1800
1733
|
from_dcsc
|
|
1801
1734
|
Matrix.ss.export
|
|
1802
1735
|
io.to_scipy_sparse
|
|
1736
|
+
|
|
1803
1737
|
"""
|
|
1804
1738
|
if backend == "suitesparse":
|
|
1805
1739
|
info = self.ss.export("hypercsr", sort=sort)
|
|
@@ -1842,6 +1776,7 @@ class Matrix(BaseType):
|
|
|
1842
1776
|
from_dcsc
|
|
1843
1777
|
Matrix.ss.export
|
|
1844
1778
|
io.to_scipy_sparse
|
|
1779
|
+
|
|
1845
1780
|
"""
|
|
1846
1781
|
if backend == "suitesparse":
|
|
1847
1782
|
info = self.ss.export("hypercsc", sort=sort)
|
|
@@ -1879,6 +1814,7 @@ class Matrix(BaseType):
|
|
|
1879
1814
|
Returns
|
|
1880
1815
|
-------
|
|
1881
1816
|
dict
|
|
1817
|
+
|
|
1882
1818
|
"""
|
|
1883
1819
|
order = get_order(order)
|
|
1884
1820
|
if order == "rowwise":
|
|
@@ -1948,6 +1884,7 @@ class Matrix(BaseType):
|
|
|
1948
1884
|
|
|
1949
1885
|
# Functional syntax
|
|
1950
1886
|
C << monoid.max(A | B)
|
|
1887
|
+
|
|
1951
1888
|
"""
|
|
1952
1889
|
return self._ewise_add(other, op)
|
|
1953
1890
|
|
|
@@ -2038,6 +1975,7 @@ class Matrix(BaseType):
|
|
|
2038
1975
|
|
|
2039
1976
|
# Functional syntax
|
|
2040
1977
|
C << binary.gt(A & B)
|
|
1978
|
+
|
|
2041
1979
|
"""
|
|
2042
1980
|
return self._ewise_mult(other, op)
|
|
2043
1981
|
|
|
@@ -2132,6 +2070,7 @@ class Matrix(BaseType):
|
|
|
2132
2070
|
|
|
2133
2071
|
# Functional syntax
|
|
2134
2072
|
C << binary.div(A | B, left_default=1, right_default=1)
|
|
2073
|
+
|
|
2135
2074
|
"""
|
|
2136
2075
|
return self._ewise_union(other, op, left_default, right_default)
|
|
2137
2076
|
|
|
@@ -2285,6 +2224,7 @@ class Matrix(BaseType):
|
|
|
2285
2224
|
|
|
2286
2225
|
# Functional syntax
|
|
2287
2226
|
C << semiring.min_plus(A @ v)
|
|
2227
|
+
|
|
2288
2228
|
"""
|
|
2289
2229
|
return self._mxv(other, op)
|
|
2290
2230
|
|
|
@@ -2345,6 +2285,7 @@ class Matrix(BaseType):
|
|
|
2345
2285
|
|
|
2346
2286
|
# Functional syntax
|
|
2347
2287
|
C << semiring.min_plus(A @ B)
|
|
2288
|
+
|
|
2348
2289
|
"""
|
|
2349
2290
|
return self._mxm(other, op)
|
|
2350
2291
|
|
|
@@ -2409,6 +2350,7 @@ class Matrix(BaseType):
|
|
|
2409
2350
|
.. code-block:: python
|
|
2410
2351
|
|
|
2411
2352
|
C << A.kronecker(B, op=binary.times)
|
|
2353
|
+
|
|
2412
2354
|
"""
|
|
2413
2355
|
method_name = "kronecker"
|
|
2414
2356
|
other = self._expect_type(
|
|
@@ -2465,6 +2407,7 @@ class Matrix(BaseType):
|
|
|
2465
2407
|
|
|
2466
2408
|
# Functional syntax
|
|
2467
2409
|
C << op.abs(A)
|
|
2410
|
+
|
|
2468
2411
|
"""
|
|
2469
2412
|
method_name = "apply"
|
|
2470
2413
|
extra_message = (
|
|
@@ -2613,6 +2556,7 @@ class Matrix(BaseType):
|
|
|
2613
2556
|
|
|
2614
2557
|
# Functional syntax
|
|
2615
2558
|
C << select.value(A >= 1)
|
|
2559
|
+
|
|
2616
2560
|
"""
|
|
2617
2561
|
method_name = "select"
|
|
2618
2562
|
if isinstance(op, str):
|
|
@@ -2707,6 +2651,7 @@ class Matrix(BaseType):
|
|
|
2707
2651
|
.. code-block:: python
|
|
2708
2652
|
|
|
2709
2653
|
w << A.reduce_rowwise(monoid.plus)
|
|
2654
|
+
|
|
2710
2655
|
"""
|
|
2711
2656
|
method_name = "reduce_rowwise"
|
|
2712
2657
|
op = get_typed_op(op, self.dtype, kind="binary|aggregator")
|
|
@@ -2744,6 +2689,7 @@ class Matrix(BaseType):
|
|
|
2744
2689
|
.. code-block:: python
|
|
2745
2690
|
|
|
2746
2691
|
w << A.reduce_columnwise(monoid.plus)
|
|
2692
|
+
|
|
2747
2693
|
"""
|
|
2748
2694
|
method_name = "reduce_columnwise"
|
|
2749
2695
|
op = get_typed_op(op, self.dtype, kind="binary|aggregator")
|
|
@@ -2762,8 +2708,7 @@ class Matrix(BaseType):
|
|
|
2762
2708
|
)
|
|
2763
2709
|
|
|
2764
2710
|
def reduce_scalar(self, op=monoid.plus, *, allow_empty=True):
|
|
2765
|
-
"""
|
|
2766
|
-
Reduce all values in the Matrix into a single value using ``op``.
|
|
2711
|
+
"""Reduce all values in the Matrix into a single value using ``op``.
|
|
2767
2712
|
|
|
2768
2713
|
See the `Reduce <../user_guide/operations.html#reduce>`__
|
|
2769
2714
|
section in the User Guide for more details.
|
|
@@ -2785,6 +2730,7 @@ class Matrix(BaseType):
|
|
|
2785
2730
|
.. code-block:: python
|
|
2786
2731
|
|
|
2787
2732
|
total << A.reduce_scalar(monoid.plus)
|
|
2733
|
+
|
|
2788
2734
|
"""
|
|
2789
2735
|
method_name = "reduce_scalar"
|
|
2790
2736
|
op = get_typed_op(op, self.dtype, kind="binary|aggregator")
|
|
@@ -2845,6 +2791,7 @@ class Matrix(BaseType):
|
|
|
2845
2791
|
.. code-block:: python
|
|
2846
2792
|
|
|
2847
2793
|
C = A.reposition(1, 2).new()
|
|
2794
|
+
|
|
2848
2795
|
"""
|
|
2849
2796
|
if nrows is None:
|
|
2850
2797
|
nrows = self._nrows
|
|
@@ -2926,6 +2873,7 @@ class Matrix(BaseType):
|
|
|
2926
2873
|
C = A.dup()
|
|
2927
2874
|
for i in range(1, 4):
|
|
2928
2875
|
C << A @ C
|
|
2876
|
+
|
|
2929
2877
|
"""
|
|
2930
2878
|
method_name = "power"
|
|
2931
2879
|
if self._nrows != self._ncols:
|
|
@@ -2970,6 +2918,7 @@ class Matrix(BaseType):
|
|
|
2970
2918
|
If it is Matrix Mask, then only the diagonal is used as the mask.
|
|
2971
2919
|
accum : Monoid or BinaryOp, optional
|
|
2972
2920
|
Operator to use to combine existing diagonal values and new values.
|
|
2921
|
+
|
|
2973
2922
|
"""
|
|
2974
2923
|
if (K := maybe_integral(k)) is None:
|
|
2975
2924
|
raise TypeError(f"k must be an integer; got bad type: {type(k)}")
|
|
@@ -3751,7 +3700,6 @@ class MatrixExpression(BaseExpression):
|
|
|
3751
3700
|
to_dense = wrapdoc(Matrix.to_dense)(property(automethods.to_dense))
|
|
3752
3701
|
to_dicts = wrapdoc(Matrix.to_dicts)(property(automethods.to_dicts))
|
|
3753
3702
|
to_edgelist = wrapdoc(Matrix.to_edgelist)(property(automethods.to_edgelist))
|
|
3754
|
-
to_values = wrapdoc(Matrix.to_values)(property(automethods.to_values))
|
|
3755
3703
|
wait = wrapdoc(Matrix.wait)(property(automethods.wait))
|
|
3756
3704
|
# These raise exceptions
|
|
3757
3705
|
__array__ = Matrix.__array__
|
|
@@ -3852,7 +3800,6 @@ class MatrixIndexExpr(AmbiguousAssignOrExtract):
|
|
|
3852
3800
|
to_dense = wrapdoc(Matrix.to_dense)(property(automethods.to_dense))
|
|
3853
3801
|
to_dicts = wrapdoc(Matrix.to_dicts)(property(automethods.to_dicts))
|
|
3854
3802
|
to_edgelist = wrapdoc(Matrix.to_edgelist)(property(automethods.to_edgelist))
|
|
3855
|
-
to_values = wrapdoc(Matrix.to_values)(property(automethods.to_values))
|
|
3856
3803
|
wait = wrapdoc(Matrix.wait)(property(automethods.wait))
|
|
3857
3804
|
# These raise exceptions
|
|
3858
3805
|
__array__ = Matrix.__array__
|
|
@@ -3927,13 +3874,6 @@ class TransposedMatrix:
|
|
|
3927
3874
|
)
|
|
3928
3875
|
return cols, rows, vals
|
|
3929
3876
|
|
|
3930
|
-
@wrapdoc(Matrix.to_values)
|
|
3931
|
-
def to_values(self, dtype=None, *, rows=True, columns=True, values=True, sort=True):
|
|
3932
|
-
rows, cols, vals = self._matrix.to_values(
|
|
3933
|
-
dtype, rows=rows, columns=columns, values=values, sort=sort
|
|
3934
|
-
)
|
|
3935
|
-
return cols, rows, vals
|
|
3936
|
-
|
|
3937
3877
|
@wrapdoc(Matrix.diag)
|
|
3938
3878
|
def diag(self, k=0, dtype=None, *, name=None, **opts):
|
|
3939
3879
|
return self._matrix.diag(-k, dtype, name=name, **opts)
|
|
@@ -405,7 +405,8 @@ class OpBase:
|
|
|
405
405
|
|
|
406
406
|
@classmethod
|
|
407
407
|
def _initialize(cls, include_in_ops=True):
|
|
408
|
-
"""
|
|
408
|
+
"""Initialize operators for this operator type.
|
|
409
|
+
|
|
409
410
|
include_in_ops determines whether the operators are included in the
|
|
410
411
|
``gb.ops`` namespace in addition to the defined module.
|
|
411
412
|
"""
|
|
@@ -663,6 +663,7 @@ class BinaryOp(OpBase):
|
|
|
663
663
|
Returns
|
|
664
664
|
-------
|
|
665
665
|
BinaryOp or ParameterizedBinaryOp
|
|
666
|
+
|
|
666
667
|
"""
|
|
667
668
|
cls._check_supports_udf("register_anonymous")
|
|
668
669
|
if parameterized:
|
|
@@ -725,6 +726,7 @@ class BinaryOp(OpBase):
|
|
|
725
726
|
>>> return x == y or abs(x - y) <= max(rel_tol * max(abs(x), abs(y)), abs_tol)
|
|
726
727
|
>>> return inner
|
|
727
728
|
>>> gb.binary.register_new("user_isclose", user_isclose, parameterized=True)
|
|
729
|
+
|
|
728
730
|
"""
|
|
729
731
|
cls._check_supports_udf("register_new")
|
|
730
732
|
module, funcname = cls._remove_nesting(name)
|
{python-graphblas-2023.12.0 → python-graphblas-2024.2.0}/graphblas/core/operator/indexunary.py
RENAMED
|
@@ -285,6 +285,7 @@ class IndexUnaryOp(OpBase):
|
|
|
285
285
|
Returns
|
|
286
286
|
-------
|
|
287
287
|
return IndexUnaryOp or ParameterizedIndexUnaryOp
|
|
288
|
+
|
|
288
289
|
"""
|
|
289
290
|
cls._check_supports_udf("register_anonymous")
|
|
290
291
|
if parameterized:
|
|
@@ -340,6 +341,7 @@ class IndexUnaryOp(OpBase):
|
|
|
340
341
|
>>> gb.indexunary.register_new("row_mod", lambda x, i, j, thunk: i % max(thunk, 2))
|
|
341
342
|
>>> dir(gb.indexunary)
|
|
342
343
|
[..., 'row_mod', ...]
|
|
344
|
+
|
|
343
345
|
"""
|
|
344
346
|
cls._check_supports_udf("register_new")
|
|
345
347
|
module, funcname = cls._remove_nesting(name)
|
|
@@ -270,6 +270,7 @@ class Monoid(OpBase):
|
|
|
270
270
|
Returns
|
|
271
271
|
-------
|
|
272
272
|
Monoid or ParameterizedMonoid
|
|
273
|
+
|
|
273
274
|
"""
|
|
274
275
|
if type(binaryop) is ParameterizedBinaryOp:
|
|
275
276
|
return ParameterizedMonoid(
|
|
@@ -309,6 +310,7 @@ class Monoid(OpBase):
|
|
|
309
310
|
>>> gb.core.operator.Monoid.register_new("max_zero", gb.binary.max_zero, 0)
|
|
310
311
|
>>> dir(gb.monoid)
|
|
311
312
|
[..., 'max_zero', ...]
|
|
313
|
+
|
|
312
314
|
"""
|
|
313
315
|
module, funcname = cls._remove_nesting(name)
|
|
314
316
|
if lazy:
|