Home

Awesome

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

Returns a temporary ndarray

pool.zeros(shape[,dtype])

Creates a scratch ndarray initialized to 0

Returns A temporary ndarray initialized to 0

pool.ones(shape[,dtype])

Creates a scratch ndarray initialized to 1

Returns A temporary ndarray initialized to 1

pool.eye(shape[,dtype])

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

Returns A temporary ndarray initialized to the identity matrix

pool.free(array)

Releases a temporary ndarray

pool.clone(array)

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

Returns A temporary copy of array

Credits

(c) 2013-2014 Mikola Lysenko. MIT License