Skip to content

Commit 8722299

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 e0a04fe commit 8722299

File tree

1 file changed

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

1 file changed

+3
-2
lines changed

lib/node_modules/@stdlib/ndarray/base/unary-reduce-subarray/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' );
@@ -437,8 +438,8 @@ function unaryReduceSubarray( fcn, arrays, dims, options ) { // eslint-disable-l
437438
ioy = iterationOrder( sy ); // +/-1
438439

439440
// Determine whether we can avoid blocked iteration...
440-
if ( iox !== 0 && ioy !== 0 && iox === ioy && K <= MAX_DIMS ) {
441-
// 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...
441+
if ( iox !== 0 && ioy !== 0 && strides2order( sl ) === strides2order( sy ) && K <= MAX_DIMS ) { // eslint-disable-line max-len
442+
// 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...
442443
if ( y.accessorProtocol ) {
443444
return ACCESSOR_UNARY[ K ]( fcn, arr, views, sl, opts );
444445
}

0 commit comments

Comments
 (0)