Skip to content

Commit 7fee0df

Browse files
committed
feat: add support for accessor strided arrays
1 parent 0aed067 commit 7fee0df

File tree

1 file changed

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

1 file changed

+9
-1
lines changed

lib/node_modules/@stdlib/array/base/strided2array2d/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 strided2array2d( x, shape, strides, offset ) {
54+
var get;
4955
var out;
5056
var tmp;
5157
var dx0;
@@ -56,6 +62,8 @@ function strided2array2d( x, shape, strides, offset ) {
5662
var i1;
5763
var ix;
5864

65+
get = resolveGetter( x );
66+
5967
S1 = shape[ 0 ];
6068
S0 = shape[ 1 ];
6169

@@ -67,7 +75,7 @@ function strided2array2d( x, shape, strides, offset ) {
6775
tmp = [];
6876
ix = offset + ( dx1*i1 );
6977
for ( i0 = 0; i0 < S0; i0++ ) {
70-
tmp.push( x[ ix ] );
78+
tmp.push( get( x, ix ) );
7179
ix += dx0;
7280
}
7381
out.push( tmp );

0 commit comments

Comments
 (0)