@stdlib/math-base-napi-unary 0.2.1 → 0.2.3
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/README.md +14 -14
- package/include/stdlib/math/base/napi/unary.h +10 -10
- package/manifest.json +4 -4
- package/package.json +6 -6
- package/src/main.c +6 -6
- package/include.gypi +0 -53
package/README.md
CHANGED
|
@@ -210,7 +210,7 @@ void stdlib_math_base_napi_f_f( napi_env env, napi_callback_info info, float (*f
|
|
|
210
210
|
Invokes a unary function accepting and returning double-precision complex floating-point numbers.
|
|
211
211
|
|
|
212
212
|
```c
|
|
213
|
-
#include "stdlib/complex/float64.h"
|
|
213
|
+
#include "stdlib/complex/float64/ctor.h"
|
|
214
214
|
#include <node_api.h>
|
|
215
215
|
|
|
216
216
|
// ...
|
|
@@ -250,7 +250,7 @@ void stdlib_math_base_napi_z_z( napi_env env, napi_callback_info info, stdlib_co
|
|
|
250
250
|
Invokes a unary function accepting a double-precision complex floating-point number and returning a double-precision floating-point number.
|
|
251
251
|
|
|
252
252
|
```c
|
|
253
|
-
#include "stdlib/complex/float64.h"
|
|
253
|
+
#include "stdlib/complex/float64/ctor.h"
|
|
254
254
|
#include <node_api.h>
|
|
255
255
|
|
|
256
256
|
// ...
|
|
@@ -290,7 +290,7 @@ void stdlib_math_base_napi_z_d( napi_env env, napi_callback_info info, double (*
|
|
|
290
290
|
Invokes a unary function accepting and returning single-precision complex floating-point numbers.
|
|
291
291
|
|
|
292
292
|
```c
|
|
293
|
-
#include "stdlib/complex/float32.h"
|
|
293
|
+
#include "stdlib/complex/float32/ctor.h"
|
|
294
294
|
#include <node_api.h>
|
|
295
295
|
|
|
296
296
|
// ...
|
|
@@ -330,7 +330,7 @@ void stdlib_math_base_napi_c_c( napi_env env, napi_callback_info info, stdlib_co
|
|
|
330
330
|
Invokes a unary function accepting a single-precision complex floating-point number and returning a single-precision floating-point number.
|
|
331
331
|
|
|
332
332
|
```c
|
|
333
|
-
#include "stdlib/complex/float32.h"
|
|
333
|
+
#include "stdlib/complex/float32/ctor.h"
|
|
334
334
|
#include <node_api.h>
|
|
335
335
|
|
|
336
336
|
// ...
|
|
@@ -492,14 +492,14 @@ When used, this macro should be used **instead of** `NAPI_MODULE`. The macro inc
|
|
|
492
492
|
Macro for registering a Node-API module exporting an interface for invoking a unary function accepting and returning double-precision complex floating-point numbers.
|
|
493
493
|
|
|
494
494
|
```c
|
|
495
|
-
#include "stdlib/complex/float64.h"
|
|
496
|
-
#include "stdlib/complex/reim.h"
|
|
495
|
+
#include "stdlib/complex/float64/ctor.h"
|
|
496
|
+
#include "stdlib/complex/float64/reim.h"
|
|
497
497
|
|
|
498
498
|
static stdlib_complex128_t scale( const stdlib_complex128_t x ) {
|
|
499
499
|
double re;
|
|
500
500
|
double im;
|
|
501
501
|
|
|
502
|
-
|
|
502
|
+
stdlib_complex128_reim( x, &re, &im );
|
|
503
503
|
|
|
504
504
|
re *= 10.0;
|
|
505
505
|
im *= 10.0;
|
|
@@ -524,7 +524,7 @@ When used, this macro should be used **instead of** `NAPI_MODULE`. The macro inc
|
|
|
524
524
|
Macro for registering a Node-API module exporting an interface for invoking a unary function accepting a double-precision complex floating-point number and returning a double-precision floating-point number.
|
|
525
525
|
|
|
526
526
|
```c
|
|
527
|
-
#include "stdlib/complex/float64.h"
|
|
527
|
+
#include "stdlib/complex/float64/ctor.h"
|
|
528
528
|
|
|
529
529
|
static double fcn( const stdlib_complex128_t x ) {
|
|
530
530
|
// ...
|
|
@@ -547,14 +547,14 @@ When used, this macro should be used **instead of** `NAPI_MODULE`. The macro inc
|
|
|
547
547
|
Macro for registering a Node-API module exporting an interface for invoking a unary function accepting and returning single-precision complex floating-point numbers.
|
|
548
548
|
|
|
549
549
|
```c
|
|
550
|
-
#include "stdlib/complex/float32.h"
|
|
551
|
-
#include "stdlib/complex/
|
|
550
|
+
#include "stdlib/complex/float32/ctor.h"
|
|
551
|
+
#include "stdlib/complex/float32/reim.h"
|
|
552
552
|
|
|
553
553
|
static stdlib_complex64_t scale( const stdlib_complex64_t x ) {
|
|
554
554
|
float re;
|
|
555
555
|
float im;
|
|
556
556
|
|
|
557
|
-
|
|
557
|
+
stdlib_complex64_reim( x, &re, &im );
|
|
558
558
|
|
|
559
559
|
re *= 10.0f;
|
|
560
560
|
im *= 10.0f;
|
|
@@ -579,7 +579,7 @@ When used, this macro should be used **instead of** `NAPI_MODULE`. The macro inc
|
|
|
579
579
|
Macro for registering a Node-API module exporting an interface for invoking a unary function accepting a single-precision complex floating-point number and returning a single-precision floating-point number.
|
|
580
580
|
|
|
581
581
|
```c
|
|
582
|
-
#include "stdlib/complex/float32.h"
|
|
582
|
+
#include "stdlib/complex/float32/ctor.h"
|
|
583
583
|
|
|
584
584
|
static float fcn( const stdlib_complex64_t x ) {
|
|
585
585
|
// ...
|
|
@@ -728,8 +728,8 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors].
|
|
|
728
728
|
[npm-image]: http://img.shields.io/npm/v/@stdlib/math-base-napi-unary.svg
|
|
729
729
|
[npm-url]: https://npmjs.org/package/@stdlib/math-base-napi-unary
|
|
730
730
|
|
|
731
|
-
[test-image]: https://github.com/stdlib-js/math-base-napi-unary/actions/workflows/test.yml/badge.svg?branch=v0.2.
|
|
732
|
-
[test-url]: https://github.com/stdlib-js/math-base-napi-unary/actions/workflows/test.yml?query=branch:v0.2.
|
|
731
|
+
[test-image]: https://github.com/stdlib-js/math-base-napi-unary/actions/workflows/test.yml/badge.svg?branch=v0.2.3
|
|
732
|
+
[test-url]: https://github.com/stdlib-js/math-base-napi-unary/actions/workflows/test.yml?query=branch:v0.2.3
|
|
733
733
|
|
|
734
734
|
[coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/math-base-napi-unary/main.svg
|
|
735
735
|
[coverage-url]: https://codecov.io/github/stdlib-js/math-base-napi-unary?branch=main
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
#ifndef STDLIB_MATH_BASE_NAPI_UNARY_H
|
|
20
20
|
#define STDLIB_MATH_BASE_NAPI_UNARY_H
|
|
21
21
|
|
|
22
|
-
#include "stdlib/complex/float32.h"
|
|
23
|
-
#include "stdlib/complex/float64.h"
|
|
22
|
+
#include "stdlib/complex/float32/ctor.h"
|
|
23
|
+
#include "stdlib/complex/float64/ctor.h"
|
|
24
24
|
#include <node_api.h>
|
|
25
25
|
#include <assert.h>
|
|
26
26
|
#include <stdint.h>
|
|
@@ -111,14 +111,14 @@
|
|
|
111
111
|
* @param fcn unary function
|
|
112
112
|
*
|
|
113
113
|
* @example
|
|
114
|
-
* #include "stdlib/complex/float64.h"
|
|
115
|
-
* #include "stdlib/complex/reim.h"
|
|
114
|
+
* #include "stdlib/complex/float64/ctor.h"
|
|
115
|
+
* #include "stdlib/complex/float64/reim.h"
|
|
116
116
|
*
|
|
117
117
|
* static stdlib_complex128_t scale( const stdlib_complex128_t x ) {
|
|
118
118
|
* double re;
|
|
119
119
|
* double im;
|
|
120
120
|
*
|
|
121
|
-
*
|
|
121
|
+
* stdlib_complex128_reim( x, &re, &im );
|
|
122
122
|
*
|
|
123
123
|
* re *= 10.0;
|
|
124
124
|
* im *= 10.0;
|
|
@@ -162,7 +162,7 @@
|
|
|
162
162
|
* @param fcn unary function
|
|
163
163
|
*
|
|
164
164
|
* @example
|
|
165
|
-
* #include "stdlib/complex/float64.h"
|
|
165
|
+
* #include "stdlib/complex/float64/ctor.h"
|
|
166
166
|
*
|
|
167
167
|
* static double fcn( const stdlib_complex128_t x ) {
|
|
168
168
|
* // ...
|
|
@@ -204,14 +204,14 @@
|
|
|
204
204
|
* @param fcn unary function
|
|
205
205
|
*
|
|
206
206
|
* @example
|
|
207
|
-
* #include "stdlib/complex/float32.h"
|
|
208
|
-
* #include "stdlib/complex/
|
|
207
|
+
* #include "stdlib/complex/float32/ctor.h"
|
|
208
|
+
* #include "stdlib/complex/float32/reim.h"
|
|
209
209
|
*
|
|
210
210
|
* static stdlib_complex64_t scale( const stdlib_complex64_t x ) {
|
|
211
211
|
* float re;
|
|
212
212
|
* float im;
|
|
213
213
|
*
|
|
214
|
-
*
|
|
214
|
+
* stdlib_complex64_reim( x, &re, &im );
|
|
215
215
|
*
|
|
216
216
|
* re *= 10.0f;
|
|
217
217
|
* im *= 10.0f;
|
|
@@ -255,7 +255,7 @@
|
|
|
255
255
|
* @param fcn unary function
|
|
256
256
|
*
|
|
257
257
|
* @example
|
|
258
|
-
* #include "stdlib/complex/float32.h"
|
|
258
|
+
* #include "stdlib/complex/float32/ctor.h"
|
|
259
259
|
*
|
|
260
260
|
* static float fcn( const stdlib_complex64_t x ) {
|
|
261
261
|
* // ...
|
package/manifest.json
CHANGED
|
@@ -33,10 +33,10 @@
|
|
|
33
33
|
"libraries": [],
|
|
34
34
|
"libpath": [],
|
|
35
35
|
"dependencies": [
|
|
36
|
-
"@stdlib/complex-float32",
|
|
37
|
-
"@stdlib/complex-float64",
|
|
38
|
-
"@stdlib/complex-reim",
|
|
39
|
-
"@stdlib/complex-
|
|
36
|
+
"@stdlib/complex-float32-ctor",
|
|
37
|
+
"@stdlib/complex-float64-ctor",
|
|
38
|
+
"@stdlib/complex-float64-reim",
|
|
39
|
+
"@stdlib/complex-float32-reim"
|
|
40
40
|
]
|
|
41
41
|
}
|
|
42
42
|
]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stdlib/math-base-napi-unary",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"description": "C APIs for registering a Node-API module exporting an interface for invoking a unary numerical function.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": {
|
|
@@ -34,11 +34,11 @@
|
|
|
34
34
|
"url": "https://github.com/stdlib-js/stdlib/issues"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@stdlib/complex-float32": "^0.2
|
|
38
|
-
"@stdlib/complex-
|
|
39
|
-
"@stdlib/complex-
|
|
40
|
-
"@stdlib/complex-
|
|
41
|
-
"@stdlib/utils-library-manifest": "^0.2.
|
|
37
|
+
"@stdlib/complex-float32-ctor": "^0.0.2",
|
|
38
|
+
"@stdlib/complex-float32-reim": "^0.1.1",
|
|
39
|
+
"@stdlib/complex-float64-ctor": "^0.0.3",
|
|
40
|
+
"@stdlib/complex-float64-reim": "^0.1.1",
|
|
41
|
+
"@stdlib/utils-library-manifest": "^0.2.2"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {},
|
|
44
44
|
"engines": {
|
package/src/main.c
CHANGED
|
@@ -17,10 +17,10 @@
|
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
#include "stdlib/math/base/napi/unary.h"
|
|
20
|
-
#include "stdlib/complex/float64.h"
|
|
21
|
-
#include "stdlib/complex/float32.h"
|
|
22
|
-
#include "stdlib/complex/reim.h"
|
|
23
|
-
#include "stdlib/complex/
|
|
20
|
+
#include "stdlib/complex/float64/ctor.h"
|
|
21
|
+
#include "stdlib/complex/float32/ctor.h"
|
|
22
|
+
#include "stdlib/complex/float64/reim.h"
|
|
23
|
+
#include "stdlib/complex/float32/reim.h"
|
|
24
24
|
#include <node_api.h>
|
|
25
25
|
#include <stdint.h>
|
|
26
26
|
#include <assert.h>
|
|
@@ -204,7 +204,7 @@ napi_value stdlib_math_base_napi_z_z( napi_env env, napi_callback_info info, std
|
|
|
204
204
|
stdlib_complex128_t v = fcn( stdlib_complex128( re0, im0 ) );
|
|
205
205
|
double re;
|
|
206
206
|
double im;
|
|
207
|
-
|
|
207
|
+
stdlib_complex128_reim( v, &re, &im );
|
|
208
208
|
|
|
209
209
|
napi_value obj;
|
|
210
210
|
status = napi_create_object( env, &obj );
|
|
@@ -395,7 +395,7 @@ napi_value stdlib_math_base_napi_c_c( napi_env env, napi_callback_info info, std
|
|
|
395
395
|
stdlib_complex64_t v = fcn( stdlib_complex64( (float)re0, (float)im0 ) );
|
|
396
396
|
float re;
|
|
397
397
|
float im;
|
|
398
|
-
|
|
398
|
+
stdlib_complex64_reim( v, &re, &im );
|
|
399
399
|
|
|
400
400
|
napi_value obj;
|
|
401
401
|
status = napi_create_object( env, &obj );
|
package/include.gypi
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
# @license Apache-2.0
|
|
2
|
-
#
|
|
3
|
-
# Copyright (c) 2020 The Stdlib Authors.
|
|
4
|
-
#
|
|
5
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
# you may not use this file except in compliance with the License.
|
|
7
|
-
# You may obtain a copy of the License at
|
|
8
|
-
#
|
|
9
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
#
|
|
11
|
-
# Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
# See the License for the specific language governing permissions and
|
|
15
|
-
# limitations under the License.
|
|
16
|
-
|
|
17
|
-
# A GYP include file for building a Node.js native add-on.
|
|
18
|
-
#
|
|
19
|
-
# Main documentation:
|
|
20
|
-
#
|
|
21
|
-
# [1]: https://gyp.gsrc.io/docs/InputFormatReference.md
|
|
22
|
-
# [2]: https://gyp.gsrc.io/docs/UserDocumentation.md
|
|
23
|
-
{
|
|
24
|
-
# Define variables to be used throughout the configuration for all targets:
|
|
25
|
-
'variables': {
|
|
26
|
-
# Source directory:
|
|
27
|
-
'src_dir': './src',
|
|
28
|
-
|
|
29
|
-
# Include directories:
|
|
30
|
-
'include_dirs': [
|
|
31
|
-
'<!@(node -e "var arr = require(\'@stdlib/utils-library-manifest\')(\'./manifest.json\',{},{\'basedir\':process.cwd(),\'paths\':\'posix\'}).include; for ( var i = 0; i < arr.length; i++ ) { console.log( arr[ i ] ); }")',
|
|
32
|
-
],
|
|
33
|
-
|
|
34
|
-
# Add-on destination directory:
|
|
35
|
-
'addon_output_dir': './src',
|
|
36
|
-
|
|
37
|
-
# Source files:
|
|
38
|
-
'src_files': [
|
|
39
|
-
'<(src_dir)/addon.c',
|
|
40
|
-
'<!@(node -e "var arr = require(\'@stdlib/utils-library-manifest\')(\'./manifest.json\',{},{\'basedir\':process.cwd(),\'paths\':\'posix\'}).src; for ( var i = 0; i < arr.length; i++ ) { console.log( arr[ i ] ); }")',
|
|
41
|
-
],
|
|
42
|
-
|
|
43
|
-
# Library dependencies:
|
|
44
|
-
'libraries': [
|
|
45
|
-
'<!@(node -e "var arr = require(\'@stdlib/utils-library-manifest\')(\'./manifest.json\',{},{\'basedir\':process.cwd(),\'paths\':\'posix\'}).libraries; for ( var i = 0; i < arr.length; i++ ) { console.log( arr[ i ] ); }")',
|
|
46
|
-
],
|
|
47
|
-
|
|
48
|
-
# Library directories:
|
|
49
|
-
'library_dirs': [
|
|
50
|
-
'<!@(node -e "var arr = require(\'@stdlib/utils-library-manifest\')(\'./manifest.json\',{},{\'basedir\':process.cwd(),\'paths\':\'posix\'}).libpath; for ( var i = 0; i < arr.length; i++ ) { console.log( arr[ i ] ); }")',
|
|
51
|
-
],
|
|
52
|
-
}, # end variables
|
|
53
|
-
}
|