numpy- and scipy-backed arrays and algorithms. Almost all exposed functions are thin wrappers around numpy functions. The only exceptions are:

This module is the default array backend. It’s used by FiniteFunction.


The underlying array type used by functions in the backend. For numpy this is np.ndarray.

yarrow.array.numpy.array(*args, **kwargs)
yarrow.array.numpy.max(*args, **kwargs)
yarrow.array.numpy.arange(*args, **kwargs)
yarrow.array.numpy.all(*args, **kwargs)
yarrow.array.numpy.zeros(*args, **kwargs)
yarrow.array.numpy.ones(*args, **kwargs)
yarrow.array.numpy.cumsum(*args, **kwargs)
yarrow.array.numpy.sum(*args, **kwargs)
yarrow.array.numpy.repeat(*args, **kwargs)
yarrow.array.numpy.concatenate(*args, **kwargs)
yarrow.array.numpy.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 are source[i] target[i].

  • 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}.


A pair (c, cc_ix) of the number of connected components c and a mapping from nodes to connected components cc_ix.

Return type:

(int, array)


Given an array of sizes, [x₀, x₁, ...] output an array equal to the concatenation concatenate([arange(x₀), arange(x₁), ...])

>>> FiniteFunction._Array.segmented_arange([5, 2, 3, 1])
array([0, 1, 2, 3, 4, 0, 1, 0, 1, 2, 0])

x: An array of the sizes of each “segment” of the output


segmented array with segment i equal to arange(i).

Return type:


yarrow.array.numpy.bincount(x, *args, **kwargs)
yarrow.array.numpy.full(n, x, *args, **kwargs)