Skip to content

Commit 3fbb654

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 5fcde08 commit 3fbb654

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ var indicesComplement = require( '@stdlib/array/base/indices-complement' );
2626
var takeIndexed2 = require( '@stdlib/array/base/take-indexed2' );
2727
var takeIndexed = require( '@stdlib/array/base/take-indexed' );
2828
var iterationOrder = require( '@stdlib/ndarray/base/iteration-order' );
29+
var strides2order = require( '@stdlib/ndarray/base/strides2order' );
2930
var numel = require( '@stdlib/ndarray/base/numel' );
3031
var join = require( '@stdlib/array/base/join' );
3132
var format = require( '@stdlib/string/format' );
@@ -500,8 +501,8 @@ function factory( options ) {
500501
ioy = iterationOrder( sly ); // +/-1
501502

502503
// Determine whether we can avoid blocked iteration...
503-
if ( iox !== 0 && ioy !== 0 && iox === ioy && K <= MAX_DIMS ) {
504-
// 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...
504+
if ( iox !== 0 && ioy !== 0 && strides2order( slx ) === strides2order( sly ) && K <= MAX_DIMS ) { // eslint-disable-line max-len
505+
// 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...
505506
return UNARY[ K ]( fcn, arr, views, shl, slx, sly, strategyX, strategyY, opts ); // eslint-disable-line max-len
506507
}
507508
// Check whether blocked iteration is prohibited due to a requirement that the order of element traversal match the memory layout of a provided input ndarray...

0 commit comments

Comments
 (0)