yarrow.array.cupy
A CuPy array backend.
Danger
Experimental Module
This code is not thoroughly tested. It’s included here as a proof-of-concept for GPU acceleration.
- yarrow.array.cupy.array(*args, **kwargs)
- yarrow.array.cupy.max(*args, **kwargs)
- yarrow.array.cupy.arange(*args, **kwargs)
- yarrow.array.cupy.all(*args, **kwargs)
- yarrow.array.cupy.zeros(*args, **kwargs)
- yarrow.array.cupy.ones(*args, **kwargs)
- yarrow.array.cupy.cumsum(*args, **kwargs)
- yarrow.array.cupy.sum(*args, **kwargs)
- yarrow.array.cupy.repeat(*args, **kwargs)
- yarrow.array.cupy.concatenate(*args, **kwargs)
- yarrow.array.cupy.connected_components(source, target, n, dtype='int64')
Compute the connected components of a graph with
N
nodes, whose edges are encoded as a pair of arrays(source, target)
such that the edges of the graph aresource[i] → target[i]
.- Parameters:
source (array) – A length-N array with elements in the set
{0 .. N - 1}
.target (array) – A length-N array with elements in the set
{0 .. N - 1}
.
- Returns:
A pair
(c, cc_ix)
of the number of connected componentsc
and a mapping from nodes to connected componentscc_ix
.- Return type:
(int, array)
- yarrow.array.cupy.argsort(x)
- yarrow.array.cupy.segmented_arange(x)
Given an array of sizes,
[x₀, x₁, ...]
output an array equal to the concatenationconcatenate([arange(x₀), arange(x₁), ...])
>>> FiniteFunction._Array.segmented_arange([5, 2, 3, 1]) array([0, 1, 2, 3, 4, 0, 1, 0, 1, 2, 0])
- Params:
x: An array of the sizes of each “segment” of the output
- Returns:
segmented array with segment
i
equal toarange(i)
.- Return type:
array
- yarrow.array.cupy.bincount(x, *args, **kwargs)
- yarrow.array.cupy.full(n, x, *args, **kwargs)