Skip to content

Commit e0a04fe

Browse files
committed
fix: use computed order
--- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent 3fbb654 commit e0a04fe

File tree

1 file changed

+3
-2
lines changed
  • lib/node_modules/@stdlib/ndarray/base/unary-reduce-strided1d/lib

1 file changed

+3
-2
lines changed

lib/node_modules/@stdlib/ndarray/base/unary-reduce-strided1d/lib/main.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ var normalizeIndices = require( '@stdlib/ndarray/base/to-unique-normalized-indic
2525
var indicesComplement = require( '@stdlib/array/base/indices-complement' );
2626
var takeIndexed2 = require( '@stdlib/array/base/take-indexed2' );
2727
var iterationOrder = require( '@stdlib/ndarray/base/iteration-order' );
28+
var strides2order = require( '@stdlib/ndarray/base/strides2order' );
2829
var numel = require( '@stdlib/ndarray/base/numel' );
2930
var join = require( '@stdlib/array/base/join' );
3031
var format = require( '@stdlib/string/format' );
@@ -466,8 +467,8 @@ function unaryReduceStrided1d( fcn, arrays, dims, options ) { // eslint-disable-
466467
ioy = iterationOrder( sy ); // +/-1
467468

468469
// Determine whether we can avoid blocked iteration...
469-
if ( iox !== 0 && ioy !== 0 && iox === ioy && K <= MAX_DIMS ) {
470-
// So long as iteration for each respective array always moves in the same direction (i.e., no mixed sign strides), we can leverage cache-optimal (i.e., normal) nested loops without resorting to blocked iteration...
470+
if ( iox !== 0 && ioy !== 0 && strides2order( sl ) === strides2order( sy ) && K <= MAX_DIMS ) { // eslint-disable-line max-len
471+
// So long as iteration for each respective array always moves in the same direction (i.e., no mixed sign strides) and the memory layouts are the same, we can leverage cache-optimal (i.e., normal) nested loops without resorting to blocked iteration...
471472
if ( y.accessorProtocol ) {
472473
return ACCESSOR_UNARY[ K ]( fcn, arr, views, sl, strategy, opts );
473474
}

0 commit comments

Comments
 (0)