Skip to content

Commit b53ebd9

Browse files
committed
Add links to gather and scatter
1 parent 3cd4c61 commit b53ebd9

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/sprog/sparse.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313

1414
def scatter(indices: Sequence[Integral], m: int = -1, n: int = -1) -> sparse.csr_array:
15-
"""Scatter consecutive indices of x into (larger) result vector y.
15+
"""`Scatter`_ consecutive indices of x into (larger) result vector y.
1616
1717
Args:
1818
indices: subset of range to populate (rest will be 0)
@@ -29,6 +29,8 @@ def scatter(indices: Sequence[Integral], m: int = -1, n: int = -1) -> sparse.csr
2929
>>> scatter([1, 3]) @ [6, 7]
3030
array([0., 6., 0., 7.])
3131
32+
.. _Scatter: https://w.wiki/CHWk
33+
3234
"""
3335
if m < 0:
3436
m = max(indices) + 1
@@ -42,7 +44,7 @@ def scatter(indices: Sequence[Integral], m: int = -1, n: int = -1) -> sparse.csr
4244

4345

4446
def gather(indices: Sequence[Integral], m: int = -1, n: int = -1) -> sparse.csr_array:
45-
"""Gather subset of x into (smaller) consecutive result vector y.
47+
"""`Gather`_ subset of x into (smaller) consecutive result vector y.
4648
4749
Args:
4850
indices: subset of domain to select
@@ -59,6 +61,8 @@ def gather(indices: Sequence[Integral], m: int = -1, n: int = -1) -> sparse.csr_
5961
>>> gather([1, 3]) @ [4, 5, 6, 7]
6062
array([5., 7.])
6163
64+
.. _Gather: https://w.wiki/CHWi
65+
6266
"""
6367
k = len(indices)
6468
if m < 0:

0 commit comments

Comments
 (0)