2020
2121// MODULES //
2222
23- var isComplexArray = require ( '@stdlib/array/base/assert/is-complex-typed-array' ) ;
24- var isBooleanArray = require ( '@stdlib/array/base/assert/is-booleanarray' ) ;
2523var iterationOrder = require ( '@stdlib/ndarray/base/iteration-order' ) ;
2624var minmaxViewBufferIndex = require ( '@stdlib/ndarray/base/minmax-view-buffer-index' ) ;
2725var ndarray2object = require ( '@stdlib/ndarray/base/ndarraylike2object' ) ;
28- var reinterpretComplex = require ( '@stdlib/strided/base/reinterpret-complex' ) ;
29- var reinterpretBoolean = require ( '@stdlib/strided/base/reinterpret-boolean' ) ;
30- var gscal = require ( '@stdlib/blas/base/gscal' ) ;
3126var blockedaccessorevery2d = require ( './2d_blocked_accessors.js' ) ;
3227var blockedaccessorevery3d = require ( './3d_blocked_accessors.js' ) ;
33- var blockedcomplexevery2d = require ( './2d_blocked_complex.js' ) ;
34- var blockedcomplexevery3d = require ( './3d_blocked_complex.js' ) ;
3528var blockedevery2d = require ( './2d_blocked.js' ) ;
3629var blockedevery3d = require ( './3d_blocked.js' ) ;
3730var accessorevery0d = require ( './0d_accessors.js' ) ;
3831var accessorevery1d = require ( './1d_accessors.js' ) ;
3932var accessorevery2d = require ( './2d_accessors.js' ) ;
4033var accessorevery3d = require ( './3d_accessors.js' ) ;
4134var accessoreverynd = require ( './nd_accessors.js' ) ;
42- var complexevery0d = require ( './0d_complex.js' ) ;
43- var complexevery1d = require ( './1d_complex.js' ) ;
44- var complexevery2d = require ( './2d_complex.js' ) ;
45- var complexevery3d = require ( './3d_complex.js' ) ;
46- var complexeverynd = require ( './nd_complex.js' ) ;
4735var every0d = require ( './0d.js' ) ;
4836var every1d = require ( './1d.js' ) ;
4937var every2d = require ( './2d.js' ) ;
@@ -65,12 +53,6 @@ var ACCESSOR_EVERY = [
6553 accessorevery2d ,
6654 accessorevery3d
6755] ;
68- var COMPLEX_EVERY = [
69- complexevery0d ,
70- complexevery1d ,
71- complexevery2d ,
72- complexevery3d
73- ] ;
7456var BLOCKED_EVERY = [
7557 blockedevery2d , // 0
7658 blockedevery3d
@@ -79,10 +61,6 @@ var BLOCKED_ACCESSOR_EVERY = [
7961 blockedaccessorevery2d , // 0
8062 blockedaccessorevery3d
8163] ;
82- var BLOCKED_COMPLEX_EVERY = [
83- blockedcomplexevery2d , // 0
84- blockedcomplexevery3d
85- ] ;
8664var MAX_DIMS = EVERY . length - 1 ;
8765
8866
@@ -160,25 +138,11 @@ function everyBy( arrays, clbk, thisArg ) {
160138 shx = x . shape ;
161139 ndims = shx . length ;
162140
163- // Check for known array types which can be reinterpreted for better iteration performance...
164- if ( isBooleanArray ( x . data ) ) {
165- x . data = reinterpretBoolean ( x . data , 0 ) ;
166- x . accessorProtocol = false ;
167- } else if ( isComplexArray ( x . data ) ) {
168- x . data = reinterpretComplex ( x . data , 0 ) ;
169- x . accessorProtocol = false ;
170- x . strides = gscal ( ndims , 2 , x . strides , 1 ) ;
171- x . offset *= 2 ;
172- isCmplx = true ;
173- }
174141 // Determine whether we can avoid iteration altogether...
175142 if ( ndims === 0 ) {
176143 if ( x . accessorProtocol ) {
177144 return ACCESSOR_EVERY [ ndims ] ( x , clbk , thisArg ) ;
178145 }
179- if ( isCmplx ) {
180- return COMPLEX_EVERY [ ndims ] ( x , clbk , thisArg ) ;
181- }
182146 return EVERY [ ndims ] ( x , clbk , thisArg ) ;
183147 }
184148 // Compute the number of elements and the number of singleton dimensions...
@@ -204,9 +168,6 @@ function everyBy( arrays, clbk, thisArg ) {
204168 if ( x . accessorProtocol ) {
205169 return ACCESSOR_EVERY [ ndims ] ( x , clbk , thisArg ) ;
206170 }
207- if ( isCmplx ) {
208- return COMPLEX_EVERY [ ndims ] ( x , clbk , thisArg ) ;
209- }
210171 return EVERY [ ndims ] ( x , clbk , thisArg ) ;
211172 }
212173 sx = x . strides ;
@@ -224,9 +185,6 @@ function everyBy( arrays, clbk, thisArg ) {
224185 if ( x . accessorProtocol ) {
225186 return ACCESSOR_EVERY [ 1 ] ( x , clbk , thisArg ) ;
226187 }
227- if ( isCmplx ) {
228- return COMPLEX_EVERY [ 1 ] ( x , clbk , thisArg ) ;
229- }
230188 return EVERY [ 1 ] ( x , clbk , thisArg ) ;
231189 }
232190 iox = iterationOrder ( sx ) ; // +/-1
@@ -250,9 +208,6 @@ function everyBy( arrays, clbk, thisArg ) {
250208 if ( x . accessorProtocol ) {
251209 return ACCESSOR_EVERY [ 1 ] ( x , clbk , thisArg ) ;
252210 }
253- if ( isCmplx ) {
254- return COMPLEX_EVERY [ 1 ] ( x , clbk , thisArg ) ;
255- }
256211 return EVERY [ 1 ] ( x , clbk , thisArg ) ;
257212 }
258213 // The ndarray is non-contiguous, so we cannot directly use one-dimensional array functionality...
@@ -263,9 +218,6 @@ function everyBy( arrays, clbk, thisArg ) {
263218 if ( x . accessorProtocol ) {
264219 return ACCESSOR_EVERY [ ndims ] ( x , clbk , thisArg ) ;
265220 }
266- if ( isCmplx ) {
267- return COMPLEX_EVERY [ ndims ] ( x , clbk , thisArg ) ;
268- }
269221 return EVERY [ ndims ] ( x , clbk , thisArg ) ;
270222 }
271223 // Fall-through to blocked iteration...
@@ -277,18 +229,12 @@ function everyBy( arrays, clbk, thisArg ) {
277229 if ( x . accessorProtocol ) {
278230 return BLOCKED_ACCESSOR_EVERY [ ndims - 2 ] ( x , clbk , thisArg ) ;
279231 }
280- if ( isCmplx ) {
281- return BLOCKED_COMPLEX_EVERY [ ndims - 2 ] ( x , clbk , thisArg ) ;
282- }
283232 return BLOCKED_EVERY [ ndims - 2 ] ( x , clbk , thisArg ) ;
284233 }
285234 // Fall-through to linear view iteration without regard for how data is stored in memory (i.e., take the slow path)...
286235 if ( x . accessorProtocol ) {
287236 return accessoreverynd ( x , clbk , thisArg ) ;
288237 }
289- if ( isCmplx ) {
290- return complexeverynd ( x , clbk , thisArg ) ;
291- }
292238 return everynd ( x , clbk , thisArg ) ;
293239}
294240
0 commit comments