@stdlib/blas-ext-base-dsort 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +177 -0
- package/NOTICE +1 -0
- package/README.md +390 -0
- package/SECURITY.md +5 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +7 -0
- package/docs/types/index.d.ts +95 -0
- package/include/stdlib/blas/ext/base/dsort.h +45 -0
- package/lib/dsort.js +53 -0
- package/lib/dsort.native.js +53 -0
- package/lib/index.js +68 -0
- package/lib/main.js +35 -0
- package/lib/native.js +35 -0
- package/lib/ndarray.js +53 -0
- package/lib/ndarray.native.js +53 -0
- package/manifest.json +82 -0
- package/package.json +88 -0
- package/src/addon.c +62 -0
- package/src/main.c +48 -0
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @license Apache-2.0
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2026 The Stdlib Authors.
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
// TypeScript Version: 4.1
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Interface describing `dsort`.
|
|
23
|
+
*/
|
|
24
|
+
interface Routine {
|
|
25
|
+
/**
|
|
26
|
+
* Sorts a double-precision floating-point strided array.
|
|
27
|
+
*
|
|
28
|
+
* @param N - number of indexed elements
|
|
29
|
+
* @param order - sort order
|
|
30
|
+
* @param x - input array
|
|
31
|
+
* @param strideX - stride length
|
|
32
|
+
* @returns input array
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* var Float64Array = require( '@stdlib/array-float64' );
|
|
36
|
+
*
|
|
37
|
+
* var x = new Float64Array( [ 1.0, -2.0, 3.0, -4.0 ] );
|
|
38
|
+
*
|
|
39
|
+
* dsort( x.length, 1.0, x, 1 );
|
|
40
|
+
* // x => <Float64Array>[ -4.0, -2.0, 1.0, 3.0 ]
|
|
41
|
+
*/
|
|
42
|
+
( N: number, order: number, x: Float64Array, strideX: number ): Float64Array;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Sorts a double-precision floating-point strided array using alternative indexing semantics.
|
|
46
|
+
*
|
|
47
|
+
* @param N - number of indexed elements
|
|
48
|
+
* @param order - sort order
|
|
49
|
+
* @param x - input array
|
|
50
|
+
* @param strideX - stride length
|
|
51
|
+
* @param offsetX - starting index
|
|
52
|
+
* @returns input array
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* var Float64Array = require( '@stdlib/array-float64' );
|
|
56
|
+
*
|
|
57
|
+
* var x = new Float64Array( [ 1.0, -2.0, 3.0, -4.0 ] );
|
|
58
|
+
*
|
|
59
|
+
* dsort.ndarray( x.length, 1.0, x, 1, 0 );
|
|
60
|
+
* // x => <Float64Array>[ -4.0, -2.0, 1.0, 3.0 ]
|
|
61
|
+
*/
|
|
62
|
+
ndarray( N: number, order: number, x: Float64Array, strideX: number, offsetX: number ): Float64Array;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Sorts a double-precision floating-point strided array.
|
|
67
|
+
*
|
|
68
|
+
* @param N - number of indexed elements
|
|
69
|
+
* @param order - sort order
|
|
70
|
+
* @param x - input array
|
|
71
|
+
* @param strideX - stride length
|
|
72
|
+
* @returns input array
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* var Float64Array = require( '@stdlib/array-float64' );
|
|
76
|
+
*
|
|
77
|
+
* var x = new Float64Array( [ 1.0, -2.0, 3.0, -4.0 ] );
|
|
78
|
+
*
|
|
79
|
+
* dsort( x.length, 1.0, x, 1 );
|
|
80
|
+
* // x => <Float64Array>[ -4.0, -2.0, 1.0, 3.0 ]
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* var Float64Array = require( '@stdlib/array-float64' );
|
|
84
|
+
*
|
|
85
|
+
* var x = new Float64Array( [ 1.0, -2.0, 3.0, -4.0 ] );
|
|
86
|
+
*
|
|
87
|
+
* dsort.ndarray( x.length, 1.0, x, 1, 0 );
|
|
88
|
+
* // x => <Float64Array>[ -4.0, -2.0, 1.0, 3.0 ]
|
|
89
|
+
*/
|
|
90
|
+
declare var dsort: Routine;
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
// EXPORTS //
|
|
94
|
+
|
|
95
|
+
export = dsort;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Apache-2.0
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2026 The Stdlib Authors.
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
#ifndef STDLIB_BLAS_EXT_BASE_DSORT_H
|
|
20
|
+
#define STDLIB_BLAS_EXT_BASE_DSORT_H
|
|
21
|
+
|
|
22
|
+
#include "stdlib/blas/base/shared.h"
|
|
23
|
+
|
|
24
|
+
/*
|
|
25
|
+
* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler.
|
|
26
|
+
*/
|
|
27
|
+
#ifdef __cplusplus
|
|
28
|
+
extern "C" {
|
|
29
|
+
#endif
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Sorts a double-precision floating-point strided array.
|
|
33
|
+
*/
|
|
34
|
+
void API_SUFFIX(stdlib_strided_dsort)( const CBLAS_INT N, const double order, double *X, const CBLAS_INT strideX );
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Sorts a double-precision floating-point strided array using alternative indexing semantics.
|
|
38
|
+
*/
|
|
39
|
+
void API_SUFFIX(stdlib_strided_dsort_ndarray)( const CBLAS_INT N, const double order, double *X, const CBLAS_INT strideX, const CBLAS_INT offsetX );
|
|
40
|
+
|
|
41
|
+
#ifdef __cplusplus
|
|
42
|
+
}
|
|
43
|
+
#endif
|
|
44
|
+
|
|
45
|
+
#endif // !STDLIB_BLAS_EXT_BASE_DSORT_H
|
package/lib/dsort.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Apache-2.0
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2026 The Stdlib Authors.
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
'use strict';
|
|
20
|
+
|
|
21
|
+
// MODULES //
|
|
22
|
+
|
|
23
|
+
var stride2offset = require( '@stdlib/strided-base-stride2offset' );
|
|
24
|
+
var ndarray = require( './ndarray.js' );
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
// MAIN //
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Sorts a double-precision floating-point strided array.
|
|
31
|
+
*
|
|
32
|
+
* @param {PositiveInteger} N - number of indexed elements
|
|
33
|
+
* @param {number} order - sort order
|
|
34
|
+
* @param {Float64Array} x - input array
|
|
35
|
+
* @param {integer} strideX - stride length
|
|
36
|
+
* @returns {Float64Array} input array
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* var Float64Array = require( '@stdlib/array-float64' );
|
|
40
|
+
*
|
|
41
|
+
* var x = new Float64Array( [ 1.0, -2.0, 3.0, -4.0 ] );
|
|
42
|
+
*
|
|
43
|
+
* dsort( x.length, 1.0, x, 1 );
|
|
44
|
+
* // x => <Float64Array>[ -4.0, -2.0, 1.0, 3.0 ]
|
|
45
|
+
*/
|
|
46
|
+
function dsort( N, order, x, strideX ) {
|
|
47
|
+
return ndarray( N, order, x, strideX, stride2offset( N, strideX ) );
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
// EXPORTS //
|
|
52
|
+
|
|
53
|
+
module.exports = dsort;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Apache-2.0
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2026 The Stdlib Authors.
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
'use strict';
|
|
20
|
+
|
|
21
|
+
// MODULES //
|
|
22
|
+
|
|
23
|
+
var addon = require( './../src/addon.node' );
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
// MAIN //
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Sorts a double-precision floating-point strided array.
|
|
30
|
+
*
|
|
31
|
+
* @param {PositiveInteger} N - number of indexed elements
|
|
32
|
+
* @param {number} order - sort order
|
|
33
|
+
* @param {Float64Array} x - input array
|
|
34
|
+
* @param {integer} strideX - stride length
|
|
35
|
+
* @returns {Float64Array} input array
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* var Float64Array = require( '@stdlib/array-float64' );
|
|
39
|
+
*
|
|
40
|
+
* var x = new Float64Array( [ 1.0, -2.0, 3.0, -4.0 ] );
|
|
41
|
+
*
|
|
42
|
+
* dsort( x.length, 1.0, x, 1 );
|
|
43
|
+
* // x => <Float64Array>[ -4.0, -2.0, 1.0, 3.0 ]
|
|
44
|
+
*/
|
|
45
|
+
function dsort( N, order, x, strideX ) {
|
|
46
|
+
addon( N, order, x, strideX );
|
|
47
|
+
return x;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
// EXPORTS //
|
|
52
|
+
|
|
53
|
+
module.exports = dsort;
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Apache-2.0
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2026 The Stdlib Authors.
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
'use strict';
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Sort a double-precision floating-point strided array.
|
|
23
|
+
*
|
|
24
|
+
* @module @stdlib/blas-ext-base-dsort
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* var Float64Array = require( '@stdlib/array-float64' );
|
|
28
|
+
* var dsort = require( '@stdlib/blas-ext-base-dsort' );
|
|
29
|
+
*
|
|
30
|
+
* var x = new Float64Array( [ 1.0, -2.0, 3.0, -4.0 ] );
|
|
31
|
+
*
|
|
32
|
+
* dsort( x.length, 1.0, x, 1 );
|
|
33
|
+
* // x => <Float64Array>[ -4.0, -2.0, 1.0, 3.0 ]
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* var Float64Array = require( '@stdlib/array-float64' );
|
|
37
|
+
* var dsort = require( '@stdlib/blas-ext-base-dsort' );
|
|
38
|
+
*
|
|
39
|
+
* var x = new Float64Array( [ 1.0, -2.0, 3.0, -4.0 ] );
|
|
40
|
+
*
|
|
41
|
+
* dsort.ndarray( x.length, 1.0, x, 1, 0 );
|
|
42
|
+
* // x => <Float64Array>[ -4.0, -2.0, 1.0, 3.0 ]
|
|
43
|
+
*/
|
|
44
|
+
|
|
45
|
+
// MODULES //
|
|
46
|
+
|
|
47
|
+
var join = require( 'path' ).join;
|
|
48
|
+
var tryRequire = require( '@stdlib/utils-try-require' );
|
|
49
|
+
var isError = require( '@stdlib/assert-is-error' );
|
|
50
|
+
var main = require( './main.js' );
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
// MAIN //
|
|
54
|
+
|
|
55
|
+
var dsort;
|
|
56
|
+
var tmp = tryRequire( join( __dirname, './native.js' ) );
|
|
57
|
+
if ( isError( tmp ) ) {
|
|
58
|
+
dsort = main;
|
|
59
|
+
} else {
|
|
60
|
+
dsort = tmp;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
// EXPORTS //
|
|
65
|
+
|
|
66
|
+
module.exports = dsort;
|
|
67
|
+
|
|
68
|
+
// exports: { "ndarray": "dsort.ndarray" }
|
package/lib/main.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Apache-2.0
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2026 The Stdlib Authors.
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
'use strict';
|
|
20
|
+
|
|
21
|
+
// MODULES //
|
|
22
|
+
|
|
23
|
+
var setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );
|
|
24
|
+
var dsort = require( './dsort.js' );
|
|
25
|
+
var ndarray = require( './ndarray.js' );
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
// MAIN //
|
|
29
|
+
|
|
30
|
+
setReadOnly( dsort, 'ndarray', ndarray );
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
// EXPORTS //
|
|
34
|
+
|
|
35
|
+
module.exports = dsort;
|
package/lib/native.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Apache-2.0
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2026 The Stdlib Authors.
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
'use strict';
|
|
20
|
+
|
|
21
|
+
// MODULES //
|
|
22
|
+
|
|
23
|
+
var setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );
|
|
24
|
+
var dsort = require( './dsort.native.js' );
|
|
25
|
+
var ndarray = require( './ndarray.native.js' );
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
// MAIN //
|
|
29
|
+
|
|
30
|
+
setReadOnly( dsort, 'ndarray', ndarray );
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
// EXPORTS //
|
|
34
|
+
|
|
35
|
+
module.exports = dsort;
|
package/lib/ndarray.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Apache-2.0
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2026 The Stdlib Authors.
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
'use strict';
|
|
20
|
+
|
|
21
|
+
// MODULES //
|
|
22
|
+
|
|
23
|
+
var dsorthp = require( '@stdlib/blas-ext-base-dsorthp' ).ndarray;
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
// MAIN //
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Sorts a double-precision floating-point strided array.
|
|
30
|
+
*
|
|
31
|
+
* @param {PositiveInteger} N - number of indexed elements
|
|
32
|
+
* @param {number} order - sort order
|
|
33
|
+
* @param {Float64Array} x - input array
|
|
34
|
+
* @param {integer} strideX - stride length
|
|
35
|
+
* @param {NonNegativeInteger} offsetX - starting index
|
|
36
|
+
* @returns {Float64Array} input array
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* var Float64Array = require( '@stdlib/array-float64' );
|
|
40
|
+
*
|
|
41
|
+
* var x = new Float64Array( [ 1.0, -2.0, 3.0, -4.0 ] );
|
|
42
|
+
*
|
|
43
|
+
* dsort( x.length, 1.0, x, 1, 0 );
|
|
44
|
+
* // x => <Float64Array>[ -4.0, -2.0, 1.0, 3.0 ]
|
|
45
|
+
*/
|
|
46
|
+
function dsort( N, order, x, strideX, offsetX ) {
|
|
47
|
+
return dsorthp( N, order, x, strideX, offsetX );
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
// EXPORTS //
|
|
52
|
+
|
|
53
|
+
module.exports = dsort;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Apache-2.0
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2026 The Stdlib Authors.
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
'use strict';
|
|
20
|
+
|
|
21
|
+
// MODULES //
|
|
22
|
+
|
|
23
|
+
var addon = require( './../src/addon.node' );
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
// MAIN //
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Sorts a double-precision floating-point strided array.
|
|
30
|
+
*
|
|
31
|
+
* @param {PositiveInteger} N - number of indexed elements
|
|
32
|
+
* @param {number} order - sort order
|
|
33
|
+
* @param {Float64Array} x - input array
|
|
34
|
+
* @param {integer} strideX - stride length
|
|
35
|
+
* @param {NonNegativeInteger} offsetX - starting index
|
|
36
|
+
* @returns {Float64Array} input array
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* var Float64Array = require( '@stdlib/array-float64' );
|
|
40
|
+
*
|
|
41
|
+
* var x = new Float64Array( [ 1.0, -2.0, 3.0, -4.0 ] );
|
|
42
|
+
*
|
|
43
|
+
* dsort( x.length, 1.0, x, 1, 0 );
|
|
44
|
+
*/
|
|
45
|
+
function dsort( N, order, x, strideX, offsetX ) {
|
|
46
|
+
addon.ndarray( N, order, x, strideX, offsetX );
|
|
47
|
+
return x;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
// EXPORTS //
|
|
52
|
+
|
|
53
|
+
module.exports = dsort;
|
package/manifest.json
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
{
|
|
2
|
+
"options": {
|
|
3
|
+
"task": "build"
|
|
4
|
+
},
|
|
5
|
+
"fields": [
|
|
6
|
+
{
|
|
7
|
+
"field": "src",
|
|
8
|
+
"resolve": true,
|
|
9
|
+
"relative": true
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"field": "include",
|
|
13
|
+
"resolve": true,
|
|
14
|
+
"relative": true
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"field": "libraries",
|
|
18
|
+
"resolve": false,
|
|
19
|
+
"relative": false
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"field": "libpath",
|
|
23
|
+
"resolve": true,
|
|
24
|
+
"relative": false
|
|
25
|
+
}
|
|
26
|
+
],
|
|
27
|
+
"confs": [
|
|
28
|
+
{
|
|
29
|
+
"task": "build",
|
|
30
|
+
"src": [
|
|
31
|
+
"./src/main.c"
|
|
32
|
+
],
|
|
33
|
+
"include": [
|
|
34
|
+
"./include"
|
|
35
|
+
],
|
|
36
|
+
"libraries": [],
|
|
37
|
+
"libpath": [],
|
|
38
|
+
"dependencies": [
|
|
39
|
+
"@stdlib/napi-export",
|
|
40
|
+
"@stdlib/napi-argv",
|
|
41
|
+
"@stdlib/napi-argv-int64",
|
|
42
|
+
"@stdlib/napi-argv-double",
|
|
43
|
+
"@stdlib/napi-argv-strided-float64array",
|
|
44
|
+
"@stdlib/strided-base-stride2offset",
|
|
45
|
+
"@stdlib/blas-base-shared",
|
|
46
|
+
"@stdlib/blas-ext-base-dsorthp"
|
|
47
|
+
]
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"task": "benchmark",
|
|
51
|
+
"src": [
|
|
52
|
+
"./src/main.c"
|
|
53
|
+
],
|
|
54
|
+
"include": [
|
|
55
|
+
"./include"
|
|
56
|
+
],
|
|
57
|
+
"libraries": [],
|
|
58
|
+
"libpath": [],
|
|
59
|
+
"dependencies": [
|
|
60
|
+
"@stdlib/strided-base-stride2offset",
|
|
61
|
+
"@stdlib/blas-base-shared",
|
|
62
|
+
"@stdlib/blas-ext-base-dsorthp"
|
|
63
|
+
]
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"task": "examples",
|
|
67
|
+
"src": [
|
|
68
|
+
"./src/main.c"
|
|
69
|
+
],
|
|
70
|
+
"include": [
|
|
71
|
+
"./include"
|
|
72
|
+
],
|
|
73
|
+
"libraries": [],
|
|
74
|
+
"libpath": [],
|
|
75
|
+
"dependencies": [
|
|
76
|
+
"@stdlib/strided-base-stride2offset",
|
|
77
|
+
"@stdlib/blas-base-shared",
|
|
78
|
+
"@stdlib/blas-ext-base-dsorthp"
|
|
79
|
+
]
|
|
80
|
+
}
|
|
81
|
+
]
|
|
82
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@stdlib/blas-ext-base-dsort",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Sort a double-precision floating-point strided array.",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"author": {
|
|
7
|
+
"name": "The Stdlib Authors",
|
|
8
|
+
"url": "https://github.com/stdlib-js/stdlib/graphs/contributors"
|
|
9
|
+
},
|
|
10
|
+
"contributors": [
|
|
11
|
+
{
|
|
12
|
+
"name": "The Stdlib Authors",
|
|
13
|
+
"url": "https://github.com/stdlib-js/stdlib/graphs/contributors"
|
|
14
|
+
}
|
|
15
|
+
],
|
|
16
|
+
"main": "./lib",
|
|
17
|
+
"browser": "./lib/main.js",
|
|
18
|
+
"gypfile": false,
|
|
19
|
+
"directories": {
|
|
20
|
+
"doc": "./docs",
|
|
21
|
+
"include": "./include",
|
|
22
|
+
"lib": "./lib",
|
|
23
|
+
"src": "./src",
|
|
24
|
+
"dist": "./dist"
|
|
25
|
+
},
|
|
26
|
+
"types": "./docs/types",
|
|
27
|
+
"scripts": {},
|
|
28
|
+
"homepage": "https://stdlib.io",
|
|
29
|
+
"repository": {
|
|
30
|
+
"type": "git",
|
|
31
|
+
"url": "git://github.com/stdlib-js/blas-ext-base-dsort.git"
|
|
32
|
+
},
|
|
33
|
+
"bugs": {
|
|
34
|
+
"url": "https://github.com/stdlib-js/stdlib/issues"
|
|
35
|
+
},
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"@stdlib/assert-is-error": "^0.2.2",
|
|
38
|
+
"@stdlib/blas-base-shared": "^0.1.0",
|
|
39
|
+
"@stdlib/blas-ext-base-dsorthp": "^0.3.0",
|
|
40
|
+
"@stdlib/napi-argv": "^0.2.2",
|
|
41
|
+
"@stdlib/napi-argv-double": "^0.2.1",
|
|
42
|
+
"@stdlib/napi-argv-int64": "^0.2.2",
|
|
43
|
+
"@stdlib/napi-argv-strided-float64array": "^0.2.2",
|
|
44
|
+
"@stdlib/napi-export": "^0.3.0",
|
|
45
|
+
"@stdlib/strided-base-stride2offset": "^0.1.0",
|
|
46
|
+
"@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2",
|
|
47
|
+
"@stdlib/utils-library-manifest": "^0.2.3",
|
|
48
|
+
"@stdlib/utils-try-require": "^0.2.2"
|
|
49
|
+
},
|
|
50
|
+
"devDependencies": {},
|
|
51
|
+
"engines": {
|
|
52
|
+
"node": ">=0.10.0",
|
|
53
|
+
"npm": ">2.7.0"
|
|
54
|
+
},
|
|
55
|
+
"os": [
|
|
56
|
+
"aix",
|
|
57
|
+
"darwin",
|
|
58
|
+
"freebsd",
|
|
59
|
+
"linux",
|
|
60
|
+
"macos",
|
|
61
|
+
"openbsd",
|
|
62
|
+
"sunos",
|
|
63
|
+
"win32",
|
|
64
|
+
"windows"
|
|
65
|
+
],
|
|
66
|
+
"keywords": [
|
|
67
|
+
"stdlib",
|
|
68
|
+
"stdmath",
|
|
69
|
+
"mathematics",
|
|
70
|
+
"math",
|
|
71
|
+
"blas",
|
|
72
|
+
"extended",
|
|
73
|
+
"sort",
|
|
74
|
+
"order",
|
|
75
|
+
"arrange",
|
|
76
|
+
"permute",
|
|
77
|
+
"strided",
|
|
78
|
+
"array",
|
|
79
|
+
"ndarray",
|
|
80
|
+
"float64",
|
|
81
|
+
"double",
|
|
82
|
+
"float64array"
|
|
83
|
+
],
|
|
84
|
+
"funding": {
|
|
85
|
+
"type": "opencollective",
|
|
86
|
+
"url": "https://opencollective.com/stdlib"
|
|
87
|
+
}
|
|
88
|
+
}
|