Skip to content

Commit d2584c5

Browse files
feat: add floor function dependency and refactor sorting logic in dsorthp
--- 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: na - 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: passed - 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 8a4ff43 commit d2584c5

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

lib/node_modules/@stdlib/blas/ext/base/dsorthp/manifest.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
"@stdlib/napi/argv-double",
4343
"@stdlib/napi/argv-strided-float64array",
4444
"@stdlib/math/base/assert/is-nan",
45+
"@stdlib/math/base/special/floor",
4546
"@stdlib/math/base/assert/is-positive-zero",
4647
"@stdlib/strided/base/stride2offset",
4748
"@stdlib/blas/base/shared"
@@ -59,6 +60,7 @@
5960
"libpath": [],
6061
"dependencies": [
6162
"@stdlib/math/base/assert/is-nan",
63+
"@stdlib/math/base/special/floor",
6264
"@stdlib/math/base/assert/is-positive-zero",
6365
"@stdlib/strided/base/stride2offset",
6466
"@stdlib/blas/base/shared"
@@ -76,6 +78,7 @@
7678
"libpath": [],
7779
"dependencies": [
7880
"@stdlib/math/base/assert/is-nan",
81+
"@stdlib/math/base/special/floor",
7982
"@stdlib/math/base/assert/is-positive-zero",
8083
"@stdlib/strided/base/stride2offset",
8184
"@stdlib/blas/base/shared"

lib/node_modules/@stdlib/blas/ext/base/dsorthp/src/main.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include "stdlib/math/base/assert/is_nan.h"
2222
#include "stdlib/blas/base/shared.h"
2323
#include "stdlib/strided/base/stride2offset.h"
24+
#include "stdlib/math/base/special/floor.h"
2425
#include <math.h>
2526

2627
/**
@@ -81,14 +82,17 @@ void API_SUFFIX(stdlib_strided_dsorthp_ndarray)( const CBLAS_INT N, const double
8182
}
8283
// For a positive stride, sorting in decreasing order is equivalent to providing a negative stride and sorting in increasing order, and, for a negative stride, sorting in decreasing order is equivalent to providing a positive stride and sorting in increasing order...
8384
if ( order < 0.0 ) {
84-
sx = -strideX;
85+
sx = strideX * -1;
8586
ox = offsetX - ( (N-1)*sx );
87+
}else{
88+
sx = strideX;
89+
ox = offsetX;
8690
}
8791
// Set the initial heap size:
8892
n = N;
8993

9094
// Specify an initial "parent" index for building the heap:
91-
parent = floor( N / 2 );
95+
parent = stdlib_base_floor( N / 2 );
9296

9397
// Continue looping until the array is sorted...
9498
while ( true ) {

0 commit comments

Comments
 (0)