@stdlib/math-base-napi-binary 0.0.8 → 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/README.md CHANGED
@@ -18,6 +18,17 @@ limitations under the License.
18
18
 
19
19
  -->
20
20
 
21
+
22
+ <details>
23
+ <summary>
24
+ About stdlib...
25
+ </summary>
26
+ <p>We believe in a future in which the web is a preferred environment for numerical computation. To help realize this future, we've built stdlib. stdlib is a standard library, with an emphasis on numerical and scientific computation, written in JavaScript (and C) for execution in browsers and in Node.js.</p>
27
+ <p>The library is fully decomposable, being architected in such a way that you can swap out and mix and match APIs and functionality to cater to your exact preferences and use cases.</p>
28
+ <p>When you use stdlib, you can be absolutely certain that you are using the most thorough, rigorous, well-written, studied, documented, tested, measured, and high-quality code out there.</p>
29
+ <p>To join us in bringing numerical computing to the web, get started by checking us out on <a href="https://github.com/stdlib-js/stdlib">GitHub</a>, and please consider <a href="https://opencollective.com/stdlib">financially supporting stdlib</a>. We greatly appreciate your continued support!</p>
30
+ </details>
31
+
21
32
  # binary
22
33
 
23
34
  [![NPM version][npm-image]][npm-url] [![Build Status][test-image]][test-url] [![Coverage Status][coverage-image]][coverage-url] <!-- [![dependencies][dependencies-image]][dependencies-url] -->
@@ -303,6 +314,190 @@ The function accepts the following arguments:
303
314
  void stdlib_math_base_napi_cc_c( napi_env env, napi_callback_info info, stdlib_complex64_t (*fcn)( stdlib_complex64_t, stdlib_complex64_t ) );
304
315
  ```
305
316
 
317
+ #### stdlib_math_base_napi_di_d( env, info, fcn )
318
+
319
+ Invokes a binary function accepting a double-precision floating-point number and a signed 32-bit integer and returning a double-precision floating-point number.
320
+
321
+ ```c
322
+ #include <node_api.h>
323
+ #include <stdint.h>
324
+
325
+ // ...
326
+
327
+ static double mul( const double x, const int32_t y ) {
328
+ return x * y;
329
+ }
330
+
331
+ // ...
332
+
333
+ /**
334
+ * Receives JavaScript callback invocation data.
335
+ *
336
+ * @param env environment under which the function is invoked
337
+ * @param info callback data
338
+ * @return Node-API value
339
+ */
340
+ napi_value addon( napi_env env, napi_callback_info info ) {
341
+ return stdlib_math_base_napi_di_d( env, info, mul );
342
+ }
343
+
344
+ // ...
345
+ ```
346
+
347
+ The function accepts the following arguments:
348
+
349
+ - **env**: `[in] napi_env` environment under which the function is invoked.
350
+ - **info**: `[in] napi_callback_info` callback data.
351
+ - **fcn**: `[in] double (*fcn)( double, int32_t )` binary function.
352
+
353
+ ```c
354
+ void stdlib_math_base_napi_di_d( napi_env env, napi_callback_info info, double (*fcn)( double, int32_t ) );
355
+ ```
356
+
357
+ #### stdlib_math_base_napi_fi_f( env, info, fcn )
358
+
359
+ Invokes a binary function accepting a single-precision floating-point number and a signed 32-bit integer and returning a single-precision floating-point number.
360
+
361
+ ```c
362
+ #include <node_api.h>
363
+ #include <stdint.h>
364
+
365
+ // ...
366
+
367
+ static float mulf( const float x, const int32_t y ) {
368
+ return x * y;
369
+ }
370
+
371
+ // ...
372
+
373
+ /**
374
+ * Receives JavaScript callback invocation data.
375
+ *
376
+ * @param env environment under which the function is invoked
377
+ * @param info callback data
378
+ * @return Node-API value
379
+ */
380
+ napi_value addon( napi_env env, napi_callback_info info ) {
381
+ return stdlib_math_base_napi_fi_f( env, info, mulf );
382
+ }
383
+
384
+ // ...
385
+ ```
386
+
387
+ The function accepts the following arguments:
388
+
389
+ - **env**: `[in] napi_env` environment under which the function is invoked.
390
+ - **info**: `[in] napi_callback_info` callback data.
391
+ - **fcn**: `[in] float (*fcn)( float, int32_t )` binary function.
392
+
393
+ ```c
394
+ void stdlib_math_base_napi_fi_f( napi_env env, napi_callback_info info, float (*fcn)( float, int32_t ) );
395
+ ```
396
+
397
+ #### stdlib_math_base_napi_zi_z( env, info, fcn )
398
+
399
+ Invokes a binary function accepting a double-precision complex floating-point number and a signed 32-bit integer and returning a double-precision complex floating-point number.
400
+
401
+ ```c
402
+ #include "stdlib/complex/float64.h"
403
+ #include "stdlib/complex/reim.h"
404
+ #include <node_api.h>
405
+ #include <stdint.h>
406
+
407
+ // ...
408
+
409
+ static stdlib_complex128_t mul( const stdlib_complex128_t x, const int32_t y ) {
410
+ double xre;
411
+ double xim;
412
+ double re;
413
+ double im;
414
+
415
+ stdlib_reim( x, &xre, &xim );
416
+
417
+ re = xre * y;
418
+ im = xim * y;
419
+
420
+ return stdlib_complex128( re, im );
421
+ }
422
+
423
+ // ...
424
+
425
+ /**
426
+ * Receives JavaScript callback invocation data.
427
+ *
428
+ * @param env environment under which the function is invoked
429
+ * @param info callback data
430
+ * @return Node-API value
431
+ */
432
+ napi_value addon( napi_env env, napi_callback_info info ) {
433
+ return stdlib_math_base_napi_zi_z( env, info, mul );
434
+ }
435
+
436
+ // ...
437
+ ```
438
+
439
+ The function accepts the following arguments:
440
+
441
+ - **env**: `[in] napi_env` environment under which the function is invoked.
442
+ - **info**: `[in] napi_callback_info` callback data.
443
+ - **fcn**: `[in] stdlib_complex128_t (*fcn)( stdlib_complex128_t, int32_t )` binary function.
444
+
445
+ ```c
446
+ void stdlib_math_base_napi_zi_z( napi_env env, napi_callback_info info, stdlib_complex128_t (*fcn)( stdlib_complex128_t, int32_t ) );
447
+ ```
448
+
449
+ #### stdlib_math_base_napi_ci_c( env, info, fcn )
450
+
451
+ Invokes a binary function accepting a single-precision complex floating-point number and a signed 32-bit integer and returning a single-precision complex floating-point number.
452
+
453
+ ```c
454
+ #include "stdlib/complex/float64.h"
455
+ #include "stdlib/complex/reimf.h"
456
+ #include <node_api.h>
457
+ #include <stdint.h>
458
+
459
+ // ...
460
+
461
+ static stdlib_complex64_t mul( const stdlib_complex64_t x, const int32_t y ) {
462
+ float xre;
463
+ float xim;
464
+ float re;
465
+ float im;
466
+
467
+ stdlib_reimf( x, &xre, &xim );
468
+
469
+ re = xre * y;
470
+ im = xim * y;
471
+
472
+ return stdlib_complex64( re, im );
473
+ }
474
+
475
+ // ...
476
+
477
+ /**
478
+ * Receives JavaScript callback invocation data.
479
+ *
480
+ * @param env environment under which the function is invoked
481
+ * @param info callback data
482
+ * @return Node-API value
483
+ */
484
+ napi_value addon( napi_env env, napi_callback_info info ) {
485
+ return stdlib_math_base_napi_ci_c( env, info, mul );
486
+ }
487
+
488
+ // ...
489
+ ```
490
+
491
+ The function accepts the following arguments:
492
+
493
+ - **env**: `[in] napi_env` environment under which the function is invoked.
494
+ - **info**: `[in] napi_callback_info` callback data.
495
+ - **fcn**: `[in] stdlib_complex64_t (*fcn)( stdlib_complex64_t, int32_t )` binary function.
496
+
497
+ ```c
498
+ void stdlib_math_base_napi_ci_c( napi_env env, napi_callback_info info, stdlib_complex64_t (*fcn)( stdlib_complex64_t, int32_t ) );
499
+ ```
500
+
306
501
  #### STDLIB_MATH_BASE_NAPI_MODULE_DD_D( fcn )
307
502
 
308
503
  Macro for registering a Node-API module exporting an interface for invoking a binary function accepting and returning double-precision floating-point numbers.
@@ -419,6 +614,190 @@ The macro expects the following arguments:
419
614
 
420
615
  When used, this macro should be used **instead of** `NAPI_MODULE`. The macro includes `NAPI_MODULE`, thus ensuring Node-API module registration.
421
616
 
617
+ #### STDLIB_MATH_BASE_NAPI_MODULE_DI_D( fcn )
618
+
619
+ Macro for registering a Node-API module exporting an interface invoking a binary function accepting a double-precision floating-point number and a signed 32-bit integer and returning a double-precision floating-point number.
620
+
621
+ ```c
622
+ #include <stdint.h>
623
+
624
+ static double mul( const double x, const int32_t y ) {
625
+ return x * y;
626
+ }
627
+
628
+ // ...
629
+
630
+ // Register a Node-API module:
631
+ STDLIB_MATH_BASE_NAPI_MODULE_DI_D( mul );
632
+ ```
633
+
634
+ The macro expects the following arguments:
635
+
636
+ - **fcn**: `double (*fcn)( double, int32_t )` binary function.
637
+
638
+ When used, this macro should be used **instead of** `NAPI_MODULE`. The macro includes `NAPI_MODULE`, thus ensuring Node-API module registration.
639
+
640
+ #### STDLIB_MATH_BASE_NAPI_MODULE_FI_F( fcn )
641
+
642
+ Macro for registering a Node-API module exporting an interface invoking a binary function accepting a single-precision floating-point number and a signed 32-bit integer and returning a single-precision floating-point number.
643
+
644
+ ```c
645
+ #include <stdint.h>
646
+
647
+ static float mulf( const float x, const int32_t y ) {
648
+ return x * y;
649
+ }
650
+
651
+ // ...
652
+
653
+ // Register a Node-API module:
654
+ STDLIB_MATH_BASE_NAPI_MODULE_FI_F( mulf );
655
+ ```
656
+
657
+ The macro expects the following arguments:
658
+
659
+ - **fcn**: `float (*fcn)( float, int32_t )` binary function.
660
+
661
+ When used, this macro should be used **instead of** `NAPI_MODULE`. The macro includes `NAPI_MODULE`, thus ensuring Node-API module registration.
662
+
663
+ #### STDLIB_MATH_BASE_NAPI_MODULE_ZI_Z( fcn )
664
+
665
+ Macro for registering a Node-API module exporting an interface invoking a binary function accepting a double-precision complex floating-point number and a signed 32-bit and returning a double-precision complex floating-point number.
666
+
667
+ ```c
668
+ #include "stdlib/complex/float64.h"
669
+ #include "stdlib/complex/reim.h"
670
+ #include <stdint.h>
671
+
672
+ static stdlib_complex128_t mul( const stdlib_complex128_t x, const int32_t y ) {
673
+ double xre;
674
+ double xim;
675
+ double re;
676
+ double im;
677
+
678
+ stdlib_reim( x, &xre, &xim );
679
+
680
+ re = xre * y;
681
+ im = xim * y;
682
+
683
+ return stdlib_complex128( re, im );
684
+ }
685
+
686
+ // ...
687
+
688
+ // Register a Node-API module:
689
+ STDLIB_MATH_BASE_NAPI_MODULE_ZI_Z( mul );
690
+ ```
691
+
692
+ The macro expects the following arguments:
693
+
694
+ - **fcn**: `stdlib_complex128_t (*fcn)( stdlib_complex128_t, int32_t )` binary function.
695
+
696
+ When used, this macro should be used **instead of** `NAPI_MODULE`. The macro includes `NAPI_MODULE`, thus ensuring Node-API module registration.
697
+
698
+ #### STDLIB_MATH_BASE_NAPI_MODULE_CI_C( fcn )
699
+
700
+ Macro for registering a Node-API module exporting an interface invoking a binary function accepting a single-precision complex floating-point number and a signed 32-bit integer and returning a single-precision complex floating-point number.
701
+
702
+ ```c
703
+ #include "stdlib/complex/float32.h"
704
+ #include "stdlib/complex/reimf.h"
705
+ #include <stdint.h>
706
+
707
+ static stdlib_complex64_t add( const stdlib_complex64_t x, const int32_t y ) {
708
+ float xre;
709
+ float xim;
710
+ float re;
711
+ float im;
712
+
713
+ stdlib_reimf( x, &xre, &xim );
714
+
715
+ re = xre * y;
716
+ im = xim * y;
717
+
718
+ return stdlib_complex64( re, im );
719
+ }
720
+
721
+ // ...
722
+
723
+ // Register a Node-API module:
724
+ STDLIB_MATH_BASE_NAPI_MODULE_CI_C( add );
725
+ ```
726
+
727
+ The macro expects the following arguments:
728
+
729
+ - **fcn**: `stdlib_complex64_t (*fcn)( stdlib_complex64_t, int32_t )` binary function.
730
+
731
+ When used, this macro should be used **instead of** `NAPI_MODULE`. The macro includes `NAPI_MODULE`, thus ensuring Node-API module registration.
732
+
733
+ #### STDLIB_MATH_BASE_NAPI_MODULE_ZD_Z( fcn )
734
+
735
+ Macro for registering a Node-API module exporting an interface invoking a binary function accepting a double-precision complex floating-point number and a double-precision floating-point number and returning a double-precision complex floating-point number.
736
+
737
+ ```c
738
+ #include "stdlib/complex/float64.h"
739
+ #include "stdlib/complex/reim.h"
740
+
741
+ static stdlib_complex128_t mul( const stdlib_complex128_t x, const double y ) {
742
+ double xre;
743
+ double xim;
744
+ double re;
745
+ double im;
746
+
747
+ stdlib_reim( x, &xre, &xim );
748
+
749
+ re = xre * y;
750
+ im = xim * y;
751
+
752
+ return stdlib_complex128( re, im );
753
+ }
754
+
755
+ // ...
756
+
757
+ // Register a Node-API module:
758
+ STDLIB_MATH_BASE_NAPI_MODULE_ZD_Z( mul );
759
+ ```
760
+
761
+ The macro expects the following arguments:
762
+
763
+ - **fcn**: `stdlib_complex128_t (*fcn)( stdlib_complex128_t, double )` binary function.
764
+
765
+ When used, this macro should be used **instead of** `NAPI_MODULE`. The macro includes `NAPI_MODULE`, thus ensuring Node-API module registration.
766
+
767
+ #### STDLIB_MATH_BASE_NAPI_MODULE_CF_C( fcn )
768
+
769
+ Macro for registering a Node-API module exporting an interface invoking a binary function accepting a single-precision complex floating-point number and a single-precision floating-point number and returning a single-precision complex floating-point number.
770
+
771
+ ```c
772
+ #include "stdlib/complex/float32.h"
773
+ #include "stdlib/complex/reimf.h"
774
+
775
+ static stdlib_complex64_t add( const stdlib_complex64_t x, const float y ) {
776
+ float xre;
777
+ float xim;
778
+ float re;
779
+ float im;
780
+
781
+ stdlib_reimf( x, &xre, &xim );
782
+
783
+ re = xre * y;
784
+ im = xim * y;
785
+
786
+ return stdlib_complex64( re, im );
787
+ }
788
+
789
+ // ...
790
+
791
+ // Register a Node-API module:
792
+ STDLIB_MATH_BASE_NAPI_MODULE_CF_C( add );
793
+ ```
794
+
795
+ The macro expects the following arguments:
796
+
797
+ - **fcn**: `stdlib_complex64_t (*fcn)( stdlib_complex64_t, float )` binary function.
798
+
799
+ When used, this macro should be used **instead of** `NAPI_MODULE`. The macro includes `NAPI_MODULE`, thus ensuring Node-API module registration.
800
+
422
801
  </section>
423
802
 
424
803
  <!-- /.usage -->
@@ -492,7 +871,7 @@ See [LICENSE][stdlib-license].
492
871
 
493
872
  ## Copyright
494
873
 
495
- Copyright &copy; 2016-2022. The Stdlib [Authors][stdlib-authors].
874
+ Copyright &copy; 2016-2023. The Stdlib [Authors][stdlib-authors].
496
875
 
497
876
  </section>
498
877
 
@@ -505,8 +884,8 @@ Copyright &copy; 2016-2022. The Stdlib [Authors][stdlib-authors].
505
884
  [npm-image]: http://img.shields.io/npm/v/@stdlib/math-base-napi-binary.svg
506
885
  [npm-url]: https://npmjs.org/package/@stdlib/math-base-napi-binary
507
886
 
508
- [test-image]: https://github.com/stdlib-js/math-base-napi-binary/actions/workflows/test.yml/badge.svg
509
- [test-url]: https://github.com/stdlib-js/math-base-napi-binary/actions/workflows/test.yml
887
+ [test-image]: https://github.com/stdlib-js/math-base-napi-binary/actions/workflows/test.yml/badge.svg?branch=v0.1.0
888
+ [test-url]: https://github.com/stdlib-js/math-base-napi-binary/actions/workflows/test.yml?query=branch:v0.1.0
510
889
 
511
890
  [coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/math-base-napi-binary/main.svg
512
891
  [coverage-url]: https://codecov.io/github/stdlib-js/math-base-napi-binary?branch=main
@@ -518,15 +897,8 @@ Copyright &copy; 2016-2022. The Stdlib [Authors][stdlib-authors].
518
897
 
519
898
  -->
520
899
 
521
- [umd]: https://github.com/umdjs/umd
522
- [es-module]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules
523
-
524
- [deno-url]: https://github.com/stdlib-js/math-base-napi-binary/tree/deno
525
- [umd-url]: https://github.com/stdlib-js/math-base-napi-binary/tree/umd
526
- [esm-url]: https://github.com/stdlib-js/math-base-napi-binary/tree/esm
527
-
528
900
  [chat-image]: https://img.shields.io/gitter/room/stdlib-js/stdlib.svg
529
- [chat-url]: https://gitter.im/stdlib-js/stdlib/
901
+ [chat-url]: https://app.gitter.im/#/room/#stdlib-js_stdlib:gitter.im
530
902
 
531
903
  [stdlib]: https://github.com/stdlib-js/stdlib
532
904
 
@@ -0,0 +1,3 @@
1
+ /// <reference path="../docs/types/index.d.ts" />
2
+ import headerDir from '../docs/types/index';
3
+ export = headerDir;
package/dist/index.js ADDED
@@ -0,0 +1,5 @@
1
+ "use strict";var a=function(s,e){return function(){return e||s((e={exports:{}}).exports,e),e.exports}};var i=a(function(c,r){
2
+ var t=require("path").resolve,u=t(__dirname,"..","include");r.exports=u
3
+ });var v=i();module.exports=v;
4
+ /** @license Apache-2.0 */
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../lib/main.js", "../lib/index.js"],
4
+ "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2020 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar resolve = require( 'path' ).resolve;\n\n\n// MAIN //\n\n/**\n* Absolute file path for the directory containing header files for C APIs.\n*\n* @name headerDir\n* @constant\n* @type {string}\n*/\nvar headerDir = resolve( __dirname, '..', 'include' );\n\n\n// EXPORTS //\n\nmodule.exports = headerDir;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2020 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Absolute file path for the directory containing header files for C APIs.\n*\n* @module @stdlib/math-base-napi-binary\n*\n* @example\n* var headerDir = require( '@stdlib/math-base-napi-binary' );\n*\n* console.log( headerDir );\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"],
5
+ "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAU,QAAS,MAAO,EAAE,QAY5BC,EAAYD,EAAS,UAAW,KAAM,SAAU,EAKpDD,EAAO,QAAUE,ICNjB,IAAIC,EAAO,IAKX,OAAO,QAAUA",
6
+ "names": ["require_main", "__commonJSMin", "exports", "module", "resolve", "headerDir", "main"]
7
+ }
@@ -16,7 +16,7 @@
16
16
  * limitations under the License.
17
17
  */
18
18
 
19
- // TypeScript Version: 2.0
19
+ // TypeScript Version: 4.1
20
20
 
21
21
  /**
22
22
  * Absolute file path for the directory containing header files for C APIs.