Skip to content

Commit f84a198

Browse files
saurabhraghuvanshiikgryte
authored andcommitted
refactor: address unnecessary casting and fix docs
PR-URL: stdlib-js#5079 Closes: stdlib-js#5072 Co-authored-by: Athan Reines <[email protected]> Reviewed-by: Athan Reines <[email protected]>
1 parent 6bbedfa commit f84a198

File tree

3 files changed

+7
-12
lines changed

3 files changed

+7
-12
lines changed

Diff for: lib/node_modules/@stdlib/blas/ext/base/dsorthp/README.md

+4-5
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ The function has the following additional parameters:
9494

9595
- **offsetX**: starting index.
9696

97-
While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying buffer, the offset parameter supports indexing semantics based on starting a index. For example, to access only the last three elements:
97+
While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying buffer, the offset parameter supports indexing semantics based on a starting index. For example, to access only the last three elements:
9898

9999
```javascript
100100
var Float64Array = require( '@stdlib/array/float64' );
@@ -184,7 +184,7 @@ stdlib_strided_dsorthp( 2, -1.0, x, 1 );
184184
The function accepts the following arguments:
185185
186186
- **N**: `[in] CBLAS_INT` number of indexed elements.
187-
- **order**: `[in] double` sort order. If `order < 0.0`, the input strided array `x` is sorted in **decreasing** order. If `order > 0.0`, the input strided array `x` is sorted in **increasing** order. If `order == 0.0`, the input strided arrays are left unchanged.
187+
- **order**: `[in] double` sort order. If `order < 0.0`, the input strided array is sorted in **decreasing** order. If `order > 0.0`, the input strided array is sorted in **increasing** order. If `order == 0.0`, the input strided array is left unchanged.
188188
- **X**: `[inout] double*` input array.
189189
- **strideX**: `[in] CBLAS_INT` stride length.
190190
@@ -209,8 +209,8 @@ stdlib_strided_dsorthp_ndarray( 4, 1.0, x, 1, 0 );
209209
The function accepts the following arguments:
210210
211211
- **N**: `[in] CBLAS_INT` number of indexed elements.
212-
- **order**: `[in] double` sort order.
213-
- **X**: `[inout] double*` input array. If `order < 0.0`, the input strided array `x` is sorted in **decreasing** order. If `order > 0.0`, the input strided array `x` is sorted in **increasing** order. If `order == 0.0`, the input strided arrays are left unchanged.
212+
- **order**: `[in] double` sort order. If `order < 0.0`, the input strided array is sorted in **decreasing** order. If `order > 0.0`, the input strided array is sorted in **increasing** order. If `order == 0.0`, the input strided array is left unchanged.
213+
- **X**: `[inout] double*` input array.
214214
- **strideX**: `[in] CBLAS_INT` stride length.
215215
- **offsetX**: `[in] CBLAS_INT` starting index.
216216
@@ -258,7 +258,6 @@ int main( void ) {
258258
printf( "x[ %i ] = %lf\n", i, x[ i ] );
259259
}
260260
}
261-
262261
```
263262
264263
</section>

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

-3
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
"@stdlib/napi/argv-double",
4343
"@stdlib/napi/argv-strided-float64array",
4444
"@stdlib/math/base/assert/is-nan",
45-
"@stdlib/math/base/special/floor",
4645
"@stdlib/math/base/assert/is-positive-zero",
4746
"@stdlib/strided/base/stride2offset",
4847
"@stdlib/blas/base/shared"
@@ -60,7 +59,6 @@
6059
"libpath": [],
6160
"dependencies": [
6261
"@stdlib/math/base/assert/is-nan",
63-
"@stdlib/math/base/special/floor",
6462
"@stdlib/math/base/assert/is-positive-zero",
6563
"@stdlib/strided/base/stride2offset",
6664
"@stdlib/blas/base/shared"
@@ -78,7 +76,6 @@
7876
"libpath": [],
7977
"dependencies": [
8078
"@stdlib/math/base/assert/is-nan",
81-
"@stdlib/math/base/special/floor",
8279
"@stdlib/math/base/assert/is-positive-zero",
8380
"@stdlib/strided/base/stride2offset",
8481
"@stdlib/blas/base/shared"

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

+3-4
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
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"
2524

2625
/**
2726
* Sorts a double-precision floating-point strided array using heapsort.
@@ -81,17 +80,17 @@ void API_SUFFIX(stdlib_strided_dsorthp_ndarray)( const CBLAS_INT N, const double
8180
}
8281
// 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...
8382
if ( order < 0.0 ) {
84-
sx = strideX * -1;
83+
sx = -strideX;
8584
ox = offsetX - ( (N-1)*sx );
86-
}else{
85+
} else {
8786
sx = strideX;
8887
ox = offsetX;
8988
}
9089
// Set the initial heap size:
9190
n = N;
9291

9392
// Specify an initial "parent" index for building the heap:
94-
parent = stdlib_base_floor( N / 2 );
93+
parent = N / 2;
9594

9695
// Continue looping until the array is sorted...
9796
while ( true ) {

0 commit comments

Comments
 (0)