Fill a one-dimensional double-precision floating-point ndarray with linearly spaced numeric elements which increment by
1starting from a specified value.
var dunitspace = require( '@stdlib/blas/ext/base/ndarray/dunitspace' );Fills a one-dimensional double-precision floating-point ndarray with linearly spaced numeric elements which increment by 1 starting from a specified value.
var Float64Vector = require( '@stdlib/ndarray/vector/float64' );
var scalar2ndarray = require( '@stdlib/ndarray/from-scalar' );
var x = new Float64Vector( [ 0.0, 0.0, 0.0, 0.0 ] );
// returns <ndarray>[ 0.0, 0.0, 0.0, 0.0 ]
var start = scalar2ndarray( 3.0, {
'dtype': 'float64'
});
var out = dunitspace( [ x, start ] );
// returns <ndarray>[ 3.0, 4.0, 5.0, 6.0 ]The function has the following parameters:
-
arrays: array-like object containing the following ndarrays:
- a one-dimensional input ndarray.
- a zero-dimensional ndarray containing a starting value.
- The input ndarray is modified in-place (i.e., the input ndarray is mutated).
var zeros = require( '@stdlib/ndarray/zeros' );
var scalar2ndarray = require( '@stdlib/ndarray/from-scalar' );
var ndarray2array = require( '@stdlib/ndarray/to-array' );
var dunitspace = require( '@stdlib/blas/ext/base/ndarray/dunitspace' );
var opts = {
'dtype': 'float64'
};
var x = zeros( [ 10 ], opts );
console.log( ndarray2array( x ) );
var start = scalar2ndarray( 3.0, opts );
dunitspace( [ x, start ] );
console.log( ndarray2array( x ) );