@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
package/src/addon.c
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
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
|
+
#include "stdlib/blas/ext/base/dsort.h"
|
|
20
|
+
#include "stdlib/napi/export.h"
|
|
21
|
+
#include "stdlib/napi/argv.h"
|
|
22
|
+
#include "stdlib/napi/argv_double.h"
|
|
23
|
+
#include "stdlib/napi/argv_int64.h"
|
|
24
|
+
#include "stdlib/napi/argv_strided_float64array.h"
|
|
25
|
+
#include <node_api.h>
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Receives JavaScript callback invocation data.
|
|
29
|
+
*
|
|
30
|
+
* @param env environment under which the function is invoked
|
|
31
|
+
* @param info callback data
|
|
32
|
+
* @return Node-API value
|
|
33
|
+
*/
|
|
34
|
+
static napi_value addon( napi_env env, napi_callback_info info ) {
|
|
35
|
+
STDLIB_NAPI_ARGV( env, info, argv, argc, 4 );
|
|
36
|
+
STDLIB_NAPI_ARGV_INT64( env, N, argv, 0 );
|
|
37
|
+
STDLIB_NAPI_ARGV_DOUBLE( env, order, argv, 1 );
|
|
38
|
+
STDLIB_NAPI_ARGV_INT64( env, strideX, argv, 3 );
|
|
39
|
+
STDLIB_NAPI_ARGV_STRIDED_FLOAT64ARRAY( env, X, N, strideX, argv, 2 );
|
|
40
|
+
API_SUFFIX(stdlib_strided_dsort)( N, order, X, strideX );
|
|
41
|
+
return NULL;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Receives JavaScript callback invocation data.
|
|
46
|
+
*
|
|
47
|
+
* @param env environment under which the function is invoked
|
|
48
|
+
* @param info callback data
|
|
49
|
+
* @return Node-API value
|
|
50
|
+
*/
|
|
51
|
+
static napi_value addon_method( napi_env env, napi_callback_info info ) {
|
|
52
|
+
STDLIB_NAPI_ARGV( env, info, argv, argc, 5 );
|
|
53
|
+
STDLIB_NAPI_ARGV_INT64( env, N, argv, 0 );
|
|
54
|
+
STDLIB_NAPI_ARGV_INT64( env, strideX, argv, 3 );
|
|
55
|
+
STDLIB_NAPI_ARGV_INT64( env, offsetX, argv, 4 );
|
|
56
|
+
STDLIB_NAPI_ARGV_DOUBLE( env, order, argv, 1 );
|
|
57
|
+
STDLIB_NAPI_ARGV_STRIDED_FLOAT64ARRAY( env, X, N, strideX, argv, 2 );
|
|
58
|
+
API_SUFFIX(stdlib_strided_dsort_ndarray)( N, order, X, strideX, offsetX );
|
|
59
|
+
return NULL;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
STDLIB_NAPI_MODULE_EXPORT_FCN_WITH_METHOD( addon, "ndarray", addon_method );
|
package/src/main.c
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
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
|
+
#include "stdlib/blas/ext/base/dsort.h"
|
|
20
|
+
#include "stdlib/blas/ext/base/dsorthp.h"
|
|
21
|
+
#include "stdlib/blas/base/shared.h"
|
|
22
|
+
#include "stdlib/strided/base/stride2offset.h"
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Sorts a double-precision floating-point strided array.
|
|
26
|
+
*
|
|
27
|
+
* @param N number of indexed elements
|
|
28
|
+
* @param order sort order
|
|
29
|
+
* @param X input array
|
|
30
|
+
* @param strideX stride length
|
|
31
|
+
*/
|
|
32
|
+
void API_SUFFIX(stdlib_strided_dsort)( const CBLAS_INT N, const double order, double *X, const CBLAS_INT strideX ) {
|
|
33
|
+
CBLAS_INT ox = stdlib_strided_stride2offset( N, strideX );
|
|
34
|
+
API_SUFFIX(stdlib_strided_dsort_ndarray)( N, order, X, strideX, ox );
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Sorts a double-precision floating-point strided array using alternative indexing semantics.
|
|
39
|
+
*
|
|
40
|
+
* @param N number of indexed elements
|
|
41
|
+
* @param order sort order
|
|
42
|
+
* @param X input array
|
|
43
|
+
* @param strideX stride length
|
|
44
|
+
* @param offsetX starting index
|
|
45
|
+
*/
|
|
46
|
+
void API_SUFFIX(stdlib_strided_dsort_ndarray)( const CBLAS_INT N, const double order, double *X, const CBLAS_INT strideX, const CBLAS_INT offsetX ) {
|
|
47
|
+
API_SUFFIX(stdlib_strided_dsorthp_ndarray)( N, order, X, strideX, offsetX );
|
|
48
|
+
}
|