@stdlib/array-base-from-strided
v0.2.2
Published
Convert a strided array to a non-strided generic array.
Downloads
2
Readme
strided2array
Convert a strided array to a non-strided generic array.
Installation
npm install @stdlib/array-base-from-strided
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 );
Notice
This package is part of stdlib, a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more.
For more information on the project, filing bug reports and feature requests, and guidance on how to develop stdlib, see the main project repository.
Community
License
See LICENSE.
Copyright
Copyright © 2016-2024. The Stdlib Authors.