Skip to content

Commit 046025d

Browse files
committed
Refactor based on updated arraylike2object
1 parent 5ebb348 commit 046025d

File tree

3 files changed

+8
-12
lines changed

3 files changed

+8
-12
lines changed

lib/node_modules/@stdlib/blas/base/gswap/lib/accessors.js

+6-10
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,12 @@
2727
* @param {PositiveInteger} N - number of indexed elements
2828
* @param {Object} x - first input array object
2929
* @param {Collection} x.data - first input array data
30-
* @param {Function} x.get - getter
31-
* @param {Function} x.set - setter
30+
* @param {Array<Function>} x.accessors - array element accessors
3231
* @param {integer} strideX - `x` stride length
3332
* @param {NonNegativeInteger} offsetX - starting `x` index
3433
* @param {Object} y - second input array object
3534
* @param {Collection} y.data - second input array array
36-
* @param {Function} y.get - getter
37-
* @param {Function} y.set - setter
35+
* @param {Array<Function>} y.accessors - array element accessors
3836
* @param {integer} strideY - `y` stride length
3937
* @param {NonNegativeInteger} offsetY - starting `y` index
4038
* @returns {Object} `y`
@@ -54,14 +52,12 @@
5452
*
5553
* var x = {
5654
* 'data': new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ),
57-
* 'setter': setter,
58-
* 'getter': getter
55+
* 'accessors': [ getter, setter ]
5956
* };
6057
*
6158
* var y = {
6259
* 'data': new Complex64Array( [ 5.0, 6.0, 7.0, 8.0 ] ),
63-
* 'setter': setter,
64-
* 'getter': getter
60+
* 'accessors': [ getter, setter ]
6561
* };
6662
*
6763
* gswap( x.data.length, x, 1, 0, y, 1, 0 );
@@ -87,8 +83,8 @@ function gswap( N, x, strideX, offsetX, y, strideY, offsetY ) {
8783
ybuf = y.data;
8884

8985
// Cache a reference to the element accessors:
90-
get = x.getter;
91-
set = y.setter;
86+
get = x.accessors[ 0 ];
87+
set = y.accessors[ 1 ];
9288

9389
ix = offsetX;
9490
iy = offsetY;

lib/node_modules/@stdlib/blas/base/gswap/lib/main.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ function gswap( N, x, strideX, y, strideY ) {
6464
}
6565
ox = arraylike2object( x );
6666
oy = arraylike2object( y );
67-
if ( ox.accessors || oy.accessors ) {
67+
if ( ox.accessorProtocol || oy.accessorProtocol ) {
6868
if ( strideX < 0 ) {
6969
ix = (1-N) * strideX;
7070
} else {

lib/node_modules/@stdlib/blas/base/gswap/lib/ndarray.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ function gswap( N, x, strideX, offsetX, y, strideY, offsetY ) {
6565
}
6666
ox = arraylike2object( x );
6767
oy = arraylike2object( y );
68-
if ( ox.accessors || oy.accessors ) {
68+
if ( ox.accessorProtocol || oy.accessorProtocol ) {
6969
accessors( N, ox, strideX, offsetX, oy, strideY, offsetY );
7070
return oy.data;
7171
}

0 commit comments

Comments
 (0)