Skip to content

Latest commit

 

History

History
110 lines (66 loc) · 2.71 KB

File metadata and controls

110 lines (66 loc) · 2.71 KB

coneTo

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

Usage

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

coneTo( arrays )

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

var Complex64Array = require( '@stdlib/array/complex64' );
var ndarray = require( '@stdlib/ndarray/base/ctor' );

var xbuf = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] );
var x = new ndarray( 'complex64', xbuf, [ 4 ], [ 1 ], 0, 'row-major' );

var out = coneTo( [ x ] );
// returns <ndarray>[ <Complex64>[ 1.0, 0.0 ], <Complex64>[ 2.0, 0.0 ], <Complex64>[ 3.0, 0.0 ], <Complex64>[ 4.0, 0.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 coneTo = require( '@stdlib/blas/ext/base/ndarray/cone-to' );

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

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