Skip to content

Commit 605dec2

Browse files
committed
fix: apply suggestion from code review
--- 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: passed - 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: passed - task: lint_typescript_tests status: passed - task: lint_license_headers status: passed ---
1 parent 9d5b3a9 commit 605dec2

File tree

4 files changed

+28
-13
lines changed

4 files changed

+28
-13
lines changed

lib/node_modules/@stdlib/blas/ext/base/ndarray/ssorthp/docs/types/index.d.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,15 @@
2020

2121
/// <reference types="@stdlib/types"/>
2222

23-
import { typedndarray } from '@stdlib/types/ndarray';
23+
import { typedndarray, float32ndarray } from '@stdlib/types/ndarray';
2424

2525
/**
2626
* Sorts a one-dimensional single-precision floating-point ndarray using heapsort.
2727
*
28+
* ## Notes
29+
*
30+
* - When the sort order is less than zero, the input ndarray is sorted in **decreasing** order. When the sort order is greater than zero, the input ndarray is sorted in **increasing** order. When the sort order is equal to zero, the input ndarray is left unchanged.
31+
*
2832
* @param arrays - array-like object containing a one-dimensional input ndarray and a zero-dimensional ndarray specifying the sort order
2933
* @returns input ndarray
3034
*
@@ -47,7 +51,7 @@ import { typedndarray } from '@stdlib/types/ndarray';
4751
* var arr = ndarray2array( out );
4852
* // returns [ -4.0, -2.0, 1.0, 3.0 ]
4953
*/
50-
declare function ssorthp<T = unknown>( arrays: [ typedndarray<T>, typedndarray<number> ] ): typedndarray<T>;
54+
declare function ssorthp( arrays: [ float32ndarray, typedndarray<number> ] ): float32ndarray;
5155

5256

5357
// EXPORTS //

lib/node_modules/@stdlib/blas/ext/base/ndarray/ssorthp/docs/types/test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ import ssorthp = require( './index' );
3434
'dtype': 'generic'
3535
});
3636

37-
ssorthp( [ x, order ] ); // $ExpectType typedndarray<number>
37+
ssorthp( [ x, order ] ); // $ExpectType float32ndarray
3838
}
3939

4040
// The compiler throws an error if the function is provided a first argument which is not an array of ndarrays...

lib/node_modules/@stdlib/blas/ext/base/ndarray/ssorthp/lib/main.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ var strided = require( '@stdlib/blas/ext/base/ssorthp' ).ndarray;
3333
/**
3434
* Sorts a one-dimensional single-precision floating-point ndarray using heapsort.
3535
*
36+
* ## Notes
37+
*
38+
* - When the sort order is less than zero, the input ndarray is sorted in **decreasing** order. When the sort order is greater than zero, the input ndarray is sorted in **increasing** order. When the sort order is equal to zero, the input ndarray is left unchanged.
39+
*
3640
* @param {ArrayLikeObject<Object>} arrays - array-like object containing a one-dimensional input ndarray and a zero-dimensional ndarray specifying the sort order
3741
* @returns {ndarray} input ndarray
3842
*

lib/node_modules/@stdlib/blas/ext/base/ndarray/ssorthp/test/test.js

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@
2323
var tape = require( 'tape' );
2424
var Float32Array = require( '@stdlib/array/float32' );
2525
var scalar2ndarray = require( '@stdlib/ndarray/from-scalar' );
26+
var getData = require( '@stdlib/ndarray/data-buffer' );
27+
var getDtype = require( '@stdlib/ndarray/dtype' );
28+
var getStrides = require( '@stdlib/ndarray/strides' );
29+
var getOffset = require( '@stdlib/ndarray/offset' );
30+
var getShape = require( '@stdlib/ndarray/shape' );
2631
var ndarray = require( '@stdlib/ndarray/base/ctor' );
2732
var ssorthp = require( './../lib' );
2833

@@ -46,11 +51,12 @@ tape( 'the function sorts a one-dimensional ndarray (increasing order)', functio
4651
});
4752

4853
actual = ssorthp( [ x, order ] );
49-
t.strictEqual( actual.dtype, x.dtype, 'returns expected value' );
50-
t.deepEqual( [ 1.0, 2.0, 3.0, 4.0, 5.0 ], x.data, 'returns expected value' );
51-
t.deepEqual( actual.shape, x.shape, 'returns expected value' );
52-
t.deepEqual( actual.strides, x.strides, 'return expected value' );
53-
t.strictEqual( actual.offset, x.offset, 'returns expected value' );
54+
t.strictEqual( actual, x, 'returns expected value' );
55+
t.strictEqual( getDtype( actual ), 'float32', 'returns expected value' );
56+
t.deepEqual( getData( actual ), new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] ), 'returns expected value' );
57+
t.deepEqual( getShape( actual ), [ 5 ], 'returns expected value' );
58+
t.deepEqual( getStrides( actual ), [ 1 ], 'return expected value' );
59+
t.strictEqual( getOffset( actual ), 0, 'returns expected value' );
5460

5561
t.end();
5662
});
@@ -66,11 +72,12 @@ tape( 'the function sorts a one-dimensional ndarray (decreasing order)', functio
6672
});
6773

6874
actual = ssorthp( [ x, order ] );
69-
t.strictEqual( actual.dtype, x.dtype, 'returns expected value' );
70-
t.deepEqual( [ 5.0, 4.0, 3.0, 2.0, 1.0 ], x.data, 'returns expected value' );
71-
t.deepEqual( actual.shape, x.shape, 'returns expected value' );
72-
t.deepEqual( actual.strides, x.strides, 'return expected value' );
73-
t.strictEqual( actual.offset, x.offset, 'returns expected value' );
75+
t.strictEqual( actual, x, 'returns expected value' );
76+
t.strictEqual( getDtype( actual ), 'float32', 'returns expected value' );
77+
t.deepEqual( getData( actual ), new Float32Array( [ 5.0, 4.0, 3.0, 2.0, 1.0 ] ), 'returns expected value' );
78+
t.deepEqual( getShape( actual ), [ 5 ], 'returns expected value' );
79+
t.deepEqual( getStrides( actual ), [ 1 ], 'return expected value' );
80+
t.strictEqual( getOffset( actual ), 0, 'returns expected value' );
7481

7582
t.end();
7683
});

0 commit comments

Comments
 (0)