Skip to content

Commit 6323c10

Browse files
committed
Small changes
1 parent 0fc848c commit 6323c10

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

sdh_documentation/docs/pycomputations.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,9 @@ and demonstrates how matrix-vector multiplication can be expressed in index
8181
notation. Both forms are supported by TACO:
8282

8383
```python
84+
i, j = pytaco.get_index_vars(2)
8485
y[i] = A[i,j] * x[j]
85-
y[i] = sum(j, A[i,j] * x[j])
86+
y[i] = pytaco.sum(j, A[i,j] * x[j])
8687
```
8788

8889
Reductions that are not explicitly expressed are assumed to be over the
@@ -135,6 +136,7 @@ stores the result in matrix `A`:
135136
A = pt.tensor([3,3], pt.format([dense, dense]))
136137
B = pt.tensor([3,3], pt.format([dense, dense]))
137138
C = pt.tensor([3,3], pt.format([dense, dense]))
139+
i, j = pt.get_index_vars(2)
138140

139141
A[i,j] = B[i,j] + C[j,i]
140142
```
@@ -153,6 +155,7 @@ before `i`:
153155
A = pt.tensor([3,3], pt.format([dense, compressed]))
154156
B = pt.tensor([3,3], pt.format([dense, compressed]))
155157
C = pt.tensor([3,3], pt.format([dense, compressed]))
158+
i, j = pt.get_index_vars(2)
156159

157160
A[i,j] = B[i,j] + C[j,i]
158161
```
@@ -165,6 +168,7 @@ addition with the already-transposed temporary:
165168
A = pt.tensor([3,3], pt.format([dense, compressed]))
166169
B = pt.tensor([3,3], pt.format([dense, compressed]))
167170
C = pt.tensor([3,3], pt.format([dense, compressed]))
171+
i, j = pt.get_index_vars(2)
168172

169173
Ct = C.transpose([1, 0]) # Ct is also stored in the CSR format
170174
A[i,j] = B[i,j] + Ct[i,j]
@@ -179,6 +183,7 @@ order, requires `j` to be accessed before `i`:
179183
A = pt.tensor([3,3], pt.format([dense, compressed]))
180184
B = pt.tensor([3,3], pt.format([dense, compressed]))
181185
C = pt.tensor([3,3], pt.format([dense, compressed], [1, 0]))
186+
i, j = pt.get_index_vars(2)
182187

183188
A[i,j] = B[i,j] + C[i,j]
184189
```
@@ -191,6 +196,7 @@ addition:
191196
A = pt.tensor([3,3], pt.format([dense, compressed]))
192197
B = pt.tensor([3,3], pt.format([dense, compressed]))
193198
C = pt.tensor([3,3], pt.format([dense, compressed], [1, 0]))
199+
i, j = pt.get_index_vars(2)
194200

195201
Cp = C.transpose([0, 1], pt.format([dense, compressed])) # Store a copy of C in the CSR format
196202
A[i,j] = B[i,j] + Cp[i,j]

sdh_documentation/docs/pytensors.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ As demonstrated above, you can define a new tensor storage format by creating a
7676
`pytaco.format` object. This requires specifying whether each tensor dimension
7777
is dense or sparse as well as (optionally) the order in which dimensions should
7878
be stored. TACO also predefines some common tensor formats (including
79-
```pt.csr```, ```pt.csc``` and ```pt.csf```) that you can use out of the box.
79+
```pt.csr``` and ```pt.csc```) that you can use out of the box.
8080

8181
# Initializing Tensors
8282

@@ -120,7 +120,7 @@ A.pack()
120120
You can then iterate over the nonzero elements of the tensor as follows:
121121

122122
```python
123-
for elem in A:
123+
for coordinate, elem in A:
124124
print(elem)
125125
```
126126

0 commit comments

Comments
 (0)