Fill a one-dimensional ndarray with linearly spaced numeric elements which increment by
1starting from one.
var goneTo = require( '@stdlib/blas/ext/base/ndarray/gone-to' );Fills a one-dimensional ndarray with linearly spaced numeric elements which increment by 1 starting from one.
var ndarray = require( '@stdlib/ndarray/base/ctor' );
var xbuf = [ 0.0, 0.0, 0.0, 0.0 ];
var x = new ndarray( 'generic', xbuf, [ 4 ], [ 1 ], 0, 'row-major' );
// returns <ndarray>[ 0.0, 0.0, 0.0, 0.0 ]
var out = goneTo( [ x ] );
// returns <ndarray>[ 1.0, 2.0, 3.0, 4.0 ]The function has the following parameters:
- arrays: array-like object containing a one-dimensional input ndarray.
- The input ndarray is modified in-place (i.e., the input ndarray is mutated).
var zeros = require( '@stdlib/array/zeros' );
var ndarray = require( '@stdlib/ndarray/base/ctor' );
var ndarray2array = require( '@stdlib/ndarray/to-array' );
var goneTo = require( '@stdlib/blas/ext/base/ndarray/gone-to' );
var xbuf = zeros( 10, 'generic' );
var x = new ndarray( 'generic', xbuf, [ xbuf.length ], [ 1 ], 0, 'row-major' );
console.log( ndarray2array( x ) );
goneTo( [ x ] );
console.log( ndarray2array( x ) );