Array creation routines#

From shape or value#

empty(shape[, dtype, order, like])

Return a new array of given shape and type, without initializing entries.

empty_like(prototype[, dtype, order, subok, ...])

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

eye(N[, M, k, dtype, sparse, gpu, ...])

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

identity(n[, dtype, sparse, gpu, chunk_size])

Return the identity array.

ones(shape[, dtype, chunk_size, gpu, order])

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

ones_like(a[, dtype, gpu, order])

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

zeros(shape[, dtype, order, like])

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

zeros_like(a[, dtype, gpu, order])

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

full(shape, fill_value[, dtype, chunk_size, ...])

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

full_like(a, fill_value[, dtype, gpu, order])

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

From existing data#

array(x[, dtype, copy, order, ndmin, chunk_size])

array(object, dtype=None, *, copy=True, order='K', subok=False, ndmin=0,

asarray(a[, dtype, order, like])

Convert the input to an array.

ascontiguousarray(a[, dtype, like])

Return a contiguous array (ndim >= 1) in memory (C order).

copy(a[, order])

Return an array copy of the given object.

Numerical ranges#

arange([start,] stop[, step,][, dtype, like])

Return evenly spaced values within a given interval.

linspace(start, stop[, num, endpoint, ...])

Return evenly spaced numbers over a specified interval.

meshgrid(*xi, **kwargs)

Return coordinate matrices from coordinate vectors.

mgrid

nd_grid instance which returns a dense multi-dimensional "meshgrid".

ogrid

nd_grid instance which returns an open multi-dimensional "meshgrid".

Building matrices#

diag(v[, k, sparse, gpu, chunk_size])

Extract a diagonal or construct a diagonal array.

diagflat(v[, k, sparse, gpu, chunk_size])

Create a two-dimensional array with the flattened input as a diagonal.

tril(m[, k, gpu])

Lower triangle of an array.

triu(m[, k, gpu])

Upper triangle of an array.

The Matrix class#