zeros
Create an array filled with zeros.
Returns:
NDArray — Array of zeros with the given shape.
ones
Create an array filled with ones.
Returns:
NDArray — Array of ones with the given shape.
empty
Create an uninitialized array. In JavaScript, this is equivalent tozeros since typed arrays are zero-initialized.
Returns:
NDArray — Uninitialized array (zero-filled in practice).
full
Create an array filled with a constant value.
Returns:
NDArray — Array filled with fill_value.
array
Create an array from nested JavaScript arrays, typed arrays, or existing arrays.
Returns:
NDArray — An ndarray constructed from the input data.
asarray
Convert the input to an array. If the input is already anNDArray with the correct dtype, it is returned without copying.
Returns:
NDArray — Array interpretation of a. No copy is made if a is already an ndarray of the matching dtype.
asanyarray
Convert input to an array, passing through subclasses. Behaves identically toasarray in numpy-ts.
Returns:
NDArray — Array interpretation of a.
asarray_chkfinite
Convert input to an array, raising an error if the input containsInf or NaN.
Returns:
NDArray — Array interpretation of a.
Throws: Error if the array contains Inf or NaN.
ascontiguousarray
Return a contiguous array (C order) in memory. In numpy-ts, this always returns a copy.
Returns:
NDArray — Contiguous array with C-order memory layout.
asfortranarray
Return an array laid out in Fortran order in memory. In numpy-ts, this returns a C-order copy (Fortran order is not natively supported).
Returns:
NDArray — Array copy (C-order in practice).
require
Return an array that satisfies requirements. In numpy-ts, requirements like'C', 'F', 'A', 'W', 'O', 'E' are mostly no-ops.
Returns:
NDArray — Array satisfying the given requirements.
copy
Return a deep copy of an array.
Returns:
NDArray — A copy of the input array. Modifications to the copy do not affect the original.
zeros_like
Return an array of zeros with the same shape and dtype as a given array.
Returns:
NDArray — Array of zeros matching the shape (and optionally dtype) of a.
ones_like
Return an array of ones with the same shape and dtype as a given array.
Returns:
NDArray — Array of ones matching the shape of a.
empty_like
Return an uninitialized array with the same shape and dtype as a given array.
Returns:
NDArray — Uninitialized array (zero-filled in practice) matching the shape of a.
full_like
Return a filled array with the same shape and dtype as a given array.
Returns:
NDArray — Array filled with fill_value, matching the shape of a.