Skip to content

Latest commit

 

History

History
111 lines (67 loc) · 2.63 KB

File metadata and controls

111 lines (67 loc) · 2.63 KB

doneTo

Fill a one-dimensional double-precision floating-point ndarray with linearly spaced numeric elements which increment by 1 starting from one.

Usage

var doneTo = require( '@stdlib/blas/ext/base/ndarray/done-to' );

doneTo( arrays )

Fills a one-dimensional double-precision floating-point ndarray with linearly spaced numeric elements which increment by 1 starting from one.

var Float64Array = require( '@stdlib/array/float64' );
var ndarray = require( '@stdlib/ndarray/base/ctor' );

var xbuf = new Float64Array( [ 0.0, 0.0, 0.0, 0.0 ] );
var x = new ndarray( 'float64', xbuf, [ 4 ], [ 1 ], 0, 'row-major' );
// returns <ndarray>[ 0.0, 0.0, 0.0, 0.0 ]

var out = doneTo( [ 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.

Notes

  • The input ndarray is modified in-place (i.e., the input ndarray is mutated).

Examples

var zeros = require( '@stdlib/array/zeros' );
var ndarray = require( '@stdlib/ndarray/base/ctor' );
var ndarray2array = require( '@stdlib/ndarray/to-array' );
var doneTo = require( '@stdlib/blas/ext/base/ndarray/done-to' );

var xbuf = zeros( 10, 'float64' );
var x = new ndarray( 'float64', xbuf, [ xbuf.length ], [ 1 ], 0, 'row-major' );
console.log( ndarray2array( x ) );

doneTo( [ x ] );
console.log( ndarray2array( x ) );