Skip to content

Commit 5804066

Browse files
committed
refactor: remove the extra loop
--- 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 --- --- type: pre_push_report description: Results of running various checks prior to pushing changes. report: - task: run_javascript_examples status: na - task: run_c_examples status: na - task: run_cpp_examples status: na - task: run_javascript_readme_examples status: na - task: run_c_benchmarks status: na - task: run_cpp_benchmarks status: na - task: run_fortran_benchmarks status: na - task: run_javascript_benchmarks status: na - task: run_julia_benchmarks status: na - task: run_python_benchmarks status: na - task: run_r_benchmarks status: na - task: run_javascript_tests status: na ---
1 parent 4358c3e commit 5804066

File tree

1 file changed

+5
-11
lines changed
  • lib/node_modules/@stdlib/array/base/linspace2d/lib

1 file changed

+5
-11
lines changed

lib/node_modules/@stdlib/array/base/linspace2d/lib/main.js

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -63,20 +63,14 @@ function linspace2d( start, stop, shape, colexicographic ) {
6363
arr = linspace( start, stop, n );
6464
out = zeros2d( shape );
6565
idx = 0;
66-
67-
if ( colexicographic ) {
68-
for ( i1 = 0; i1 < s1; i1++ ) {
69-
for ( i0 = 0; i0 < s0; i0++ ) {
66+
for ( i1 = 0; i1 < s1; i1++ ) {
67+
for ( i0 = 0; i0 < s0; i0++ ) {
68+
if ( colexicographic ) {
7069
idx = ( i0 * s1 ) + i1;
71-
out[ i1 ][ i0 ] = arr[ idx ];
72-
}
73-
}
74-
} else {
75-
for ( i1 = 0; i1 < s1; i1++ ) {
76-
for ( i0 = 0; i0 < s0; i0++ ) {
70+
} else {
7771
idx = ( i1 * s0 ) + i0;
78-
out[ i1 ][ i0 ] = arr[ idx ];
7972
}
73+
out[ i1 ][ i0 ] = arr[ idx ];
8074
}
8175
}
8276
return out;

0 commit comments

Comments
 (0)