nlcpy.full

nlcpy.full(shape, fill_value, dtype=None, order='C')[ソース]

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

Parameters
shapeint or sequence of ints

Shape of the new array, e.g., (2, 3) or 2.

fill_valuescalar

Fill value.

dtypedtype, optional

The desired dtype for the array, e.g, nlcpy.int64. Default is nlcpy.float64.

order{'C', 'F'}, optional

Whether to store multidimensional data in C- or Fortran-contiguous (row- or column-wise) order in memory.

Returns
outndarray

Array of fill_value with the given shape, dtype, and order.

参考

full_like

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

empty

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

ones

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

zeros

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

Examples

>>> import nlcpy as vp
>>> vp.full((2, 2), vp.inf)
array([[inf, inf],
       [inf, inf]])
>>> vp.full((2, 2), 10)
array([[10, 10],
       [10, 10]])