input array from which to derive the output array length
zero-filled array
var zeros = require( '@stdlib/array/zeros' );
var x = zeros( 2, 'generic' );
// returns [ 0, 0 ]
var y = zerosLike( x );
// returns [ 0, 0 ]
Creates a zero-filled array having the same length and data type as a provided input array.
input array from which to derive the output array length
zero-filled array
var zeros = require( '@stdlib/array/zeros' );
var x = zeros( 2, 'float64' );
// returns <Float64Array>[ 0.0, 0.0 ]
var y = zerosLike( x );
// returns <Float64Array>[ 0.0, 0.0 ]
Creates a zero-filled array having the same length as a provided input array.
The function supports the following data types:
float64
: double-precision floating-point numbers (IEEE 754)float32
: single-precision floating-point numbers (IEEE 754)complex128
: double-precision complex floating-point numberscomplex64
: single-precision complex floating-point numbersint32
: 32-bit two's complement signed integersuint32
: 32-bit unsigned integersint16
: 16-bit two's complement signed integersuint16
: 16-bit unsigned integersint8
: 8-bit two's complement signed integersuint8
: 8-bit unsigned integersuint8c
: 8-bit unsigned integers clamped to 0-255
generic
: generic JavaScript valuesinput array from which to derive the output array length
data type
zero-filled array
var zeros = require( '@stdlib/array/zeros' );
var x = zeros( 2, 'float64' );
// returns <Float64Array>[ 0.0, 0.0 ]
var y = zerosLike( x, 'float32' );
// returns <Float32Array>[ 0.0, 0.0 ]
Creates a zero-filled array having the same length and data type as a provided input array.