strided2array
Convert a strided array to a non-strided generic array.
Usage
var strided2array = require( '@stdlib/array/base/from-strided' );
strided2array( N, x, stride, offset )
Converts a strided array to a non-strided generic array.
var x = [ 1, 2, 3, 4, 5, 6 ];
var arr = strided2array( 3, x, 2, 0 );
// returns [ 1, 3, 5 ]
The function accepts the following arguments:
- N: number of indexed elements.
- x: input array.
- stride: index stride.
- offset: index of the first indexed value in the input array.
Notes
- The function assumes that the input array is compatible with the specified number of elements, index stride, and index offset.
Examples
var zeroTo = require( '@stdlib/array/base/zero-to' );
var strided2array = require( '@stdlib/array/base/from-strided' );
var x = zeroTo( 10 );
console.log( x );
var y = strided2array( 5, x, -2, x.length-1 );
console.log( y );