Skip to content

Latest commit

 

History

History
122 lines (74 loc) · 2.81 KB

File metadata and controls

122 lines (74 loc) · 2.81 KB

dunitspace

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

Usage

var dunitspace = require( '@stdlib/blas/ext/base/ndarray/dunitspace' );

dunitspace( arrays )

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.

Notes

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

Examples

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 ) );