You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+26-18Lines changed: 26 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,7 +11,7 @@ Python wrapper around GraphBLAS
11
11
12
12
To install, `conda install -c conda-forge grblas`. This will also install the SuiteSparse `graphblas` compiled C library.
13
13
14
-
Currently works with SuiteSparse:GraphBLAS, but the goal is to make it work with all implementations of the GraphBLAS spec.
14
+
Currently works with [SuiteSparse:GraphBLAS](https://github.com/DrTimothyAldenDavis/GraphBLAS), but the goal is to make it work with all implementations of the GraphBLAS spec.
15
15
16
16
The approach taken with this library is to follow the C-API specification as closely as possible while making improvements
17
17
allowed with the Python syntax. Because the spec always passes in the output object to be written to, we follow the same,
@@ -86,11 +86,12 @@ s = A[row_index, col_index].value # extract single element
86
86
```
87
87
## Assign
88
88
```python
89
-
M[rows, cols](mask, accum) << A # rows and cols are a list or a slice
90
-
M[rows, col_index](mask, accum) << v # assign column
91
-
M[row_index, cols](mask, accum) << v # assign row
92
-
M[rows, cols](mask, accum) << s # assign scalar to many elements
93
-
M[row_index, col_index] << s # assign scalar to single element (mask and accum not allowed)
89
+
M(mask, accum)[rows, cols] << A # rows and cols are a list or a slice
90
+
M(mask, accum)[rows, col_index] << v # assign column
91
+
M(mask, accum)[row_index, cols] << v # assign row
92
+
M(mask, accum)[rows, cols] << s # assign scalar to many elements
93
+
M[row_index, col_index] << s # assign scalar to single element
94
+
# (mask and accum not allowed)
94
95
del M[row_index, col_index] # remove single element
95
96
```
96
97
## Apply
@@ -113,7 +114,7 @@ B = A.dup() # dup
113
114
A = Matrix.from_values([row_indices], [col_indices], [values]) # build
114
115
```
115
116
## New from delayed
116
-
Delayed objects can be used to create a new object using `.new()` method instead of `<<` into an existing object
117
+
Delayed objects can be used to create a new object using `.new()` method
117
118
```python
118
119
C = A.mxm(B, semiring).new()
119
120
```
@@ -130,9 +131,9 @@ There is a mechanism to initialize `grblas` with a context prior to use. This al
130
131
use as well as the blocking/non-blocking mode. If the context is not initialized, a default initialization will
131
132
be performed automatically.
132
133
```python
133
-
import grblas
134
+
import grblasas gb
134
135
# Context initialization must happen before any other imports
135
-
grblas.init('suitesparse', blocking=True)
136
+
gb.init('suitesparse', blocking=True)
136
137
137
138
# Now we can import other items from grblas
138
139
from grblas import binary, semiring
@@ -161,15 +162,22 @@ Similar methods exist for BinaryOp, Monoid, and Semiring.
161
162
162
163
## Import/Export connectors to the Python ecosystem
163
164
`grblas.io` contains functions for converting to and from:
0 commit comments