2.0.3 • Published 9 years ago
ndarray-linspace v2.0.3
ndarray-linspace

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.25, 2.5, 2.75])
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-linspaceAPI
require('ndarray-linspace')(output, start, end[, options])
An array of equally spaced values.
Arguments:
outputThe destination array to be filled with values.start: starting value of the intervalend: ending value of the intervaloptions(optional): A hash of options. Options are:endpoint(default:true): whether the output contains the endpoint of the intervalaxis(default:0): the dimension along which to fill the array. Must be an integer less than or equal to the dimension of the input.
Returns: A reference to the output
License
© 2015 Ricky Reusser. MIT License.