
Security News
Browserslist-rs Gets Major Refactor, Cutting Binary Size by Over 1MB
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
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 0
var x = zeros([64, 64])
It also accepts an optional dtype as specified in the ndarray docs. For example,
//Creates a 64x64 ndarray over a float32array filled with 0
var x = zeros([64, 64], 'float32')
This makes it easy to create an array with the same size and dtype as an existing array:
var x = zeros([64, 64], 'float32')
var y = zeros( x.shape, x.dtype )
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
require("zeros")(shape[, dtype])
Creates an ndarray with the given shape that is initialized to zero
shape
is the shape of the resulting arraydtype
is the data type of the array to allocate. Must be one of:
"array"
"uint8"
"uint16"
"uint32"
"int8"
"int16"
"int32"
"float"
"float32"
"double"
"float64"
"data"
"uint8_clamped"
"buffer"
Returns An array which is initialized to 0
(c) 2013 Mikola Lysenko. MIT License
FAQs
Initialize an ndarray with zeros
The npm package zeros receives a total of 10,238 weekly downloads. As such, zeros popularity was classified as popular.
We found that zeros demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.
Security News
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.