Home

Awesome

ndarray-linspace Build Status npm version js-standard-style

Fill an ndarray with equally spaced values

Example

var ndarray = require('ndarray');
var linspace = require('ndarray-linspace');

linspace(ndarray([], [5]), 2, 3);
// => ndarray([2, 2.25, 2.5, 2.75, 3])

linspace(ndarray([], [5]), 2, 3, {endpoint: false});
// => ndarray([2, 2.2, 2.4, 2.6, 2.8])

linspace(ndarray([], [2, 2]), 0, 1);
// y => [ 0, 0 ]
//      [ 1, 1 ]

linspace(ndarray([], [2, 2]), 0, 1, {axis: 1});
// y => [ 0, 1 ]
//      [ 0, 1 ]

Installation

npm install ndarray-linspace

API

require('ndarray-linspace')(output, start, end[, options])

An array of equally spaced values.

Arguments:

Returns: A reference to the output

License

© 2015 Ricky Reusser. MIT License.