Initialize an ndarray with zeros
A replacement for
ndarray.zeros (which was removed in ndarray 1.0.0)
var zeros = require"zeros"//Creates a 64x64 ndarray over a float64array filled with 0var x = zeros64 64
It also accepts an optional dtype as specified in the ndarray docs. For example,
//Creates a 64x64 ndarray over a float32array filled with 0var x = zeros64 64 'float32'
This makes it easy to create an array with the same size and dtype as an existing array:
var x = zeros64 64 'float32'var y = zeros xshape xdtype
If you find yourself frequently creating the same array over and over though, ndarray-scratch may be a better option.
Just use npm:
npm install zeros
Creates an ndarray with the given shape that is initialized to zero
shapeis the shape of the resulting array
dtypeis the data type of the array to allocate. Must be one of:
Returns An array which is initialized to 0
(c) 2013 Mikola Lysenko. MIT License