API

Description

Classes

COO(coords[, data, shape, has_duplicates, …])

A sparse multidimensional array.

DOK(shape[, data, dtype, fill_value])

A class for building sparse multidimensional arrays.

SparseArray(shape[, fill_value])

An abstract base class for all the sparse array classes.

Functions

argwhere(a)

Find the indices of array elements that are non-zero, grouped by element.

as_coo(x[, shape, fill_value])

Converts any given format to COO.

concatenate(arrays[, axis])

Concatenate the input arrays along the given dimension.

dot(a, b)

Perform the equivalent of numpy.dot on two arrays.

elemwise(func, *args, **kwargs)

Apply a function to any number of arguments.

eye(N[, M, k, dtype])

Return a 2-D COO array with ones on the diagonal and zeros elsewhere.

full(shape, fill_value[, dtype])

Return a COO array of given shape and type, filled with fill_value.

full_like(a, fill_value[, dtype])

Return a full array with the same shape and type as a given array.

isposinf(x[, out])

Test element-wise for positive infinity, return result as sparse bool array.

isneginf(x[, out])

Test element-wise for negative infinity, return result as sparse bool array.

kron(a, b)

Kronecker product of 2 sparse arrays.

load_npz(filename)

Load a sparse matrix in numpy’s .npz format from disk.

matmul(a, b)

Perform the equivalent of numpy.matmul on two arrays.

nanmax(x[, axis, keepdims, dtype, out])

Maximize along the given axes, skipping NaN values.

nanmean(x[, axis, keepdims, dtype, out])

Performs a NaN skipping mean operation along the given axes.

nanmin(x[, axis, keepdims, dtype, out])

Minimize along the given axes, skipping NaN values.

nanprod(x[, axis, keepdims, dtype, out])

Performs a product operation along the given axes, skipping NaN values.

nanreduce(x, method[, identity, axis, keepdims])

Performs an NaN skipping reduction on this array.

nansum(x[, axis, keepdims, dtype, out])

Performs a NaN skipping sum operation along the given axes.

ones(shape[, dtype])

Return a COO array of given shape and type, filled with ones.

ones_like(a[, dtype])

Return a COO array of ones with the same shape and type as a.

random(shape[, density, random_state, …])

Generate a random sparse multidimensional array

roll(a, shift[, axis])

Shifts elements of an array along specified axis.

save_npz(filename, matrix[, compressed])

Save a sparse matrix to disk in numpy’s .npz format.

stack(arrays[, axis])

Stack the input arrays along the given dimension.

tensordot(a, b[, axes])

Perform the equivalent of numpy.tensordot.

tril(x[, k])

Returns an array with all elements above the k-th diagonal set to zero.

triu(x[, k])

Returns an array with all elements below the k-th diagonal set to zero.

where(condition[, x, y])

Select values from either x or y depending on condition.

zeros(shape[, dtype])

Return a COO array of given shape and type, filled with zeros.

zeros_like(a[, dtype])

Return a COO array of zeros with the same shape and type as a.