Socket
Socket
Sign inDemoInstall

ndarray-scratch

Package Overview
Dependencies
Maintainers
6
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ndarray-scratch

Pooled memory for ndarrays


Version published
Weekly downloads
61K
decreased by-3.4%
Maintainers
6
Weekly downloads
 
Created
Source

ndarray-scratch

A simple wrapper for typedarray-pool. I got tired of manually constructing ndarrays from typedarrays, and so this module saves some keystrokes/sanity.

testling badge

build status

Example

var pool = require("ndarray-scratch")

//Create a temporary typed array
var x = pool.malloc([100,100])

//Do stuff with x

//Release x
pool.free(x)

Install

npm install ndarray-scratch

API

var pool = require("ndarray-pool")

pool.malloc(shape[, dtype])

Allocates a temporary ndarray

  • shape is the shape of the array to allocate
  • dtype is the dtype of the array to allocate (default "double")

Returns a temporary ndarray

pool.zeros(shape[,dtype])

Creates a scratch ndarray initialized to 0

  • shape is the shape of the resulting array
  • dtype is the datatype of the array (default "double")

Returns A temporary ndarray initialized to 0

pool.ones(shape[,dtype])

Creates a scratch ndarray initialized to 1

  • shape is the shape of the resulting array
  • dtype is the datatype of the array (default "double")

Returns A temporary ndarray initialized to 1

pool.eye(shape[,dtype])

Creates a scratch ndarray initialized to 1 if all indices equal, 0 otherwise.

  • shape is the shape of the resulting array
  • dtype is the datatype of the array (default "double")

Returns A temporary ndarray initialized to the identity matrix

pool.free(array)

Releases a temporary ndarray

  • array is the ndarray to release.

pool.clone(array)

Creates a copy of an ndarray with row-major order.

  • array is an ndarray

Returns A temporary copy of array

Credits

(c) 2013-2014 Mikola Lysenko. MIT License

Keywords

FAQs

Package last updated on 27 Jul 2015

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc