Skip to content

Commit be9d624

Browse files
committed
feat: add support for accessor strided arrays
1 parent e8ca7bf commit be9d624

File tree

1 file changed

+9
-1
lines changed
  • lib/node_modules/@stdlib/array/base/strided2array4d/lib

1 file changed

+9
-1
lines changed

lib/node_modules/@stdlib/array/base/strided2array4d/lib/main.js

+9-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@
1818

1919
'use strict';
2020

21+
// MODULES //
22+
23+
var resolveGetter = require( '@stdlib/array/base/resolve-getter' );
24+
25+
2126
// MAIN //
2227

2328
/**
@@ -46,6 +51,7 @@
4651
* // returns [ [ [ [ 1, 4 ], [ 2, 5 ], [ 3, 6 ] ] ] ]
4752
*/
4853
function strided2array4d( x, shape, strides, offset ) {
54+
var get;
4955
var out;
5056
var dx0;
5157
var dx1;
@@ -66,6 +72,8 @@ function strided2array4d( x, shape, strides, offset ) {
6672
var t2;
6773
var t1;
6874

75+
get = resolveGetter( x );
76+
6977
S3 = shape[ 0 ];
7078
S2 = shape[ 1 ];
7179
S1 = shape[ 2 ];
@@ -87,7 +95,7 @@ function strided2array4d( x, shape, strides, offset ) {
8795
t1 = [];
8896
ix0 = ix1 + ( dx1*i1 );
8997
for ( i0 = 0; i0 < S0; i0++ ) {
90-
t1.push( x[ ix0 ] );
98+
t1.push( get( x, ix0 ) );
9199
ix0 += dx0;
92100
}
93101
t2.push( t1 );

0 commit comments

Comments
 (0)