@ohos-ports/stdlib-complex 0.0.0-stage → 0.4.1-beta.1
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 +222 -2
- package/SECURITY.md +5 -0
- package/base/README.md +114 -0
- package/base/assert/README.md +108 -0
- package/base/assert/docs/types/index.d.ts +94 -0
- package/base/assert/docs/types/test.ts +29 -0
- package/base/assert/is-almost-equal/README.md +159 -0
- package/base/assert/is-almost-equal/docs/repl.txt +45 -0
- package/base/assert/is-almost-equal/docs/types/index.d.ts +56 -0
- package/base/assert/is-almost-equal/docs/types/test.ts +83 -0
- package/base/assert/is-almost-equal/lib/index.js +48 -0
- package/base/assert/is-almost-equal/lib/main.js +89 -0
- package/base/assert/is-almost-equal/package.json +73 -0
- package/base/assert/is-almost-same-value/README.md +159 -0
- package/base/assert/is-almost-same-value/docs/repl.txt +41 -0
- package/base/assert/is-almost-same-value/docs/types/index.d.ts +55 -0
- package/base/assert/is-almost-same-value/docs/types/test.ts +83 -0
- package/base/assert/is-almost-same-value/lib/index.js +48 -0
- package/base/assert/is-almost-same-value/lib/main.js +91 -0
- package/base/assert/is-almost-same-value/package.json +73 -0
- package/base/assert/lib/index.js +60 -0
- package/base/assert/package.json +62 -0
- package/base/cast-return/README.md +128 -0
- package/base/cast-return/docs/repl.txt +41 -0
- package/base/cast-return/docs/types/index.d.ts +378 -0
- package/base/cast-return/docs/types/test.ts +192 -0
- package/base/cast-return/lib/index.js +46 -0
- package/base/cast-return/lib/main.js +204 -0
- package/base/cast-return/package.json +65 -0
- package/base/docs/types/index.d.ts +130 -0
- package/base/docs/types/test.ts +29 -0
- package/base/lib/index.js +78 -0
- package/base/package.json +61 -0
- package/base/parse/README.md +137 -0
- package/base/parse/docs/repl.txt +21 -0
- package/base/parse/docs/types/index.d.ts +42 -0
- package/base/parse/docs/types/test.ts +34 -0
- package/base/parse/lib/index.js +42 -0
- package/base/parse/lib/main.js +124 -0
- package/base/parse/package.json +71 -0
- package/base/wrap-function/README.md +128 -0
- package/base/wrap-function/docs/repl.txt +43 -0
- package/base/wrap-function/docs/types/index.d.ts +417 -0
- package/base/wrap-function/docs/types/test.ts +629 -0
- package/base/wrap-function/lib/index.js +46 -0
- package/base/wrap-function/lib/main.js +225 -0
- package/base/wrap-function/package.json +63 -0
- package/cmplx/README.md +137 -0
- package/cmplx/docs/repl.txt +35 -0
- package/cmplx/docs/types/index.d.ts +44 -0
- package/cmplx/docs/types/test.ts +66 -0
- package/cmplx/lib/index.js +40 -0
- package/cmplx/lib/main.js +66 -0
- package/cmplx/package.json +63 -0
- package/ctors/README.md +136 -0
- package/ctors/docs/repl.txt +29 -0
- package/ctors/docs/types/index.d.ts +67 -0
- package/ctors/docs/types/test.ts +35 -0
- package/ctors/lib/ctors.js +38 -0
- package/ctors/lib/index.js +43 -0
- package/ctors/lib/main.js +49 -0
- package/ctors/package.json +72 -0
- package/docs/types/index.d.ts +151 -0
- package/dtype/README.md +142 -0
- package/dtype/docs/repl.txt +28 -0
- package/dtype/docs/types/index.d.ts +82 -0
- package/dtype/docs/types/test.ts +36 -0
- package/dtype/lib/ctor2dtype.js +32 -0
- package/dtype/lib/ctors.js +38 -0
- package/dtype/lib/dtypes.js +33 -0
- package/dtype/lib/index.js +49 -0
- package/dtype/lib/main.js +65 -0
- package/dtype/package.json +67 -0
- package/dtypes/README.md +142 -0
- package/dtypes/docs/repl.txt +22 -0
- package/dtypes/docs/types/index.d.ts +39 -0
- package/dtypes/docs/types/test.ts +33 -0
- package/dtypes/lib/dtypes.json +4 -0
- package/dtypes/lib/index.js +40 -0
- package/dtypes/lib/main.js +44 -0
- package/dtypes/package.json +68 -0
- package/float32/README.md +137 -0
- package/float32/base/README.md +140 -0
- package/float32/base/add/README.md +279 -0
- package/float32/base/add/docs/repl.txt +118 -0
- package/float32/base/add/docs/types/index.d.ts +136 -0
- package/float32/base/add/docs/types/test.ts +356 -0
- package/float32/base/add/include/stdlib/complex/float32/base/add.h +40 -0
- package/float32/base/add/lib/assign.js +55 -0
- package/float32/base/add/lib/index.js +54 -0
- package/float32/base/add/lib/main.js +55 -0
- package/float32/base/add/lib/native.js +53 -0
- package/float32/base/add/lib/strided.js +60 -0
- package/float32/base/add/manifest.json +75 -0
- package/float32/base/add/package.json +69 -0
- package/float32/base/add/src/addon.c +22 -0
- package/float32/base/add/src/main.c +60 -0
- package/float32/base/add3/README.md +275 -0
- package/float32/base/add3/docs/repl.txt +133 -0
- package/float32/base/add3/docs/types/index.d.ts +145 -0
- package/float32/base/add3/docs/types/test.ts +465 -0
- package/float32/base/add3/include/stdlib/complex/float32/base/add3.h +40 -0
- package/float32/base/add3/lib/assign.js +57 -0
- package/float32/base/add3/lib/index.js +54 -0
- package/float32/base/add3/lib/main.js +56 -0
- package/float32/base/add3/lib/native.js +54 -0
- package/float32/base/add3/lib/strided.js +64 -0
- package/float32/base/add3/manifest.json +75 -0
- package/float32/base/add3/package.json +69 -0
- package/float32/base/add3/src/addon.c +22 -0
- package/float32/base/add3/src/main.c +64 -0
- package/float32/base/assert/README.md +120 -0
- package/float32/base/assert/docs/types/index.d.ts +181 -0
- package/float32/base/assert/docs/types/test.ts +29 -0
- package/float32/base/assert/is-almost-equal/README.md +158 -0
- package/float32/base/assert/is-almost-equal/docs/repl.txt +45 -0
- package/float32/base/assert/is-almost-equal/docs/types/index.d.ts +56 -0
- package/float32/base/assert/is-almost-equal/docs/types/test.ts +83 -0
- package/float32/base/assert/is-almost-equal/lib/index.js +48 -0
- package/float32/base/assert/is-almost-equal/lib/main.js +67 -0
- package/float32/base/assert/is-almost-equal/package.json +73 -0
- package/float32/base/assert/is-almost-same-value/README.md +158 -0
- package/float32/base/assert/is-almost-same-value/docs/repl.txt +43 -0
- package/float32/base/assert/is-almost-same-value/docs/types/index.d.ts +55 -0
- package/float32/base/assert/is-almost-same-value/docs/types/test.ts +83 -0
- package/float32/base/assert/is-almost-same-value/lib/index.js +48 -0
- package/float32/base/assert/is-almost-same-value/lib/main.js +69 -0
- package/float32/base/assert/is-almost-same-value/package.json +74 -0
- package/float32/base/assert/is-equal/README.md +221 -0
- package/float32/base/assert/is-equal/docs/repl.txt +27 -0
- package/float32/base/assert/is-equal/docs/types/index.d.ts +46 -0
- package/float32/base/assert/is-equal/docs/types/test.ts +67 -0
- package/float32/base/assert/is-equal/include/stdlib/complex/float32/base/assert/is_equal.h +41 -0
- package/float32/base/assert/is-equal/lib/index.js +44 -0
- package/float32/base/assert/is-equal/lib/main.js +56 -0
- package/float32/base/assert/is-equal/manifest.json +59 -0
- package/float32/base/assert/is-equal/package.json +71 -0
- package/float32/base/assert/is-equal/src/main.c +48 -0
- package/float32/base/assert/is-not-equal/README.md +221 -0
- package/float32/base/assert/is-not-equal/docs/repl.txt +28 -0
- package/float32/base/assert/is-not-equal/docs/types/index.d.ts +46 -0
- package/float32/base/assert/is-not-equal/docs/types/test.ts +67 -0
- package/float32/base/assert/is-not-equal/include/stdlib/complex/float32/base/assert/is_not_equal.h +41 -0
- package/float32/base/assert/is-not-equal/lib/index.js +44 -0
- package/float32/base/assert/is-not-equal/lib/main.js +56 -0
- package/float32/base/assert/is-not-equal/manifest.json +59 -0
- package/float32/base/assert/is-not-equal/package.json +72 -0
- package/float32/base/assert/is-not-equal/src/main.c +48 -0
- package/float32/base/assert/is-same-value/README.md +245 -0
- package/float32/base/assert/is-same-value/docs/repl.txt +31 -0
- package/float32/base/assert/is-same-value/docs/types/index.d.ts +53 -0
- package/float32/base/assert/is-same-value/docs/types/test.ts +67 -0
- package/float32/base/assert/is-same-value/include/stdlib/complex/float32/base/assert/is_same_value.h +41 -0
- package/float32/base/assert/is-same-value/lib/index.js +44 -0
- package/float32/base/assert/is-same-value/lib/main.js +64 -0
- package/float32/base/assert/is-same-value/manifest.json +61 -0
- package/float32/base/assert/is-same-value/package.json +74 -0
- package/float32/base/assert/is-same-value/src/main.c +52 -0
- package/float32/base/assert/is-same-value-zero/README.md +247 -0
- package/float32/base/assert/is-same-value-zero/docs/repl.txt +31 -0
- package/float32/base/assert/is-same-value-zero/docs/types/index.d.ts +50 -0
- package/float32/base/assert/is-same-value-zero/docs/types/test.ts +67 -0
- package/float32/base/assert/is-same-value-zero/include/stdlib/complex/float32/base/assert/is_same_value_zero.h +41 -0
- package/float32/base/assert/is-same-value-zero/lib/index.js +44 -0
- package/float32/base/assert/is-same-value-zero/lib/main.js +62 -0
- package/float32/base/assert/is-same-value-zero/manifest.json +61 -0
- package/float32/base/assert/is-same-value-zero/package.json +74 -0
- package/float32/base/assert/is-same-value-zero/src/main.c +52 -0
- package/float32/base/assert/lib/index.js +96 -0
- package/float32/base/assert/package.json +63 -0
- package/float32/base/docs/types/index.d.ts +297 -0
- package/float32/base/docs/types/test.ts +29 -0
- package/float32/base/identity/README.md +233 -0
- package/float32/base/identity/docs/img/equation_identity_function.svg +18 -0
- package/float32/base/identity/docs/repl.txt +27 -0
- package/float32/base/identity/docs/types/index.d.ts +42 -0
- package/float32/base/identity/docs/types/test.ts +45 -0
- package/float32/base/identity/include/stdlib/complex/float32/base/identity.h +40 -0
- package/float32/base/identity/lib/index.js +41 -0
- package/float32/base/identity/lib/main.js +42 -0
- package/float32/base/identity/lib/native.js +50 -0
- package/float32/base/identity/manifest.json +75 -0
- package/float32/base/identity/package.json +68 -0
- package/float32/base/identity/src/addon.c +22 -0
- package/float32/base/identity/src/main.c +44 -0
- package/float32/base/lib/index.js +123 -0
- package/float32/base/mul/README.md +281 -0
- package/float32/base/mul/docs/repl.txt +120 -0
- package/float32/base/mul/docs/types/index.d.ts +138 -0
- package/float32/base/mul/docs/types/test.ts +356 -0
- package/float32/base/mul/include/stdlib/complex/float32/base/mul.h +40 -0
- package/float32/base/mul/lib/assign.js +55 -0
- package/float32/base/mul/lib/index.js +55 -0
- package/float32/base/mul/lib/main.js +60 -0
- package/float32/base/mul/lib/native.js +54 -0
- package/float32/base/mul/lib/strided.js +64 -0
- package/float32/base/mul/manifest.json +95 -0
- package/float32/base/mul/package.json +69 -0
- package/float32/base/mul/src/addon.c +22 -0
- package/float32/base/mul/src/main.c +61 -0
- package/float32/base/mul-add/README.md +286 -0
- package/float32/base/mul-add/docs/repl.txt +141 -0
- package/float32/base/mul-add/docs/types/index.d.ts +151 -0
- package/float32/base/mul-add/docs/types/test.ts +465 -0
- package/float32/base/mul-add/include/stdlib/complex/float32/base/mul_add.h +40 -0
- package/float32/base/mul-add/lib/assign.js +57 -0
- package/float32/base/mul-add/lib/index.js +56 -0
- package/float32/base/mul-add/lib/main.js +64 -0
- package/float32/base/mul-add/lib/native.js +56 -0
- package/float32/base/mul-add/lib/strided.js +70 -0
- package/float32/base/mul-add/manifest.json +75 -0
- package/float32/base/mul-add/package.json +70 -0
- package/float32/base/mul-add/src/addon.c +22 -0
- package/float32/base/mul-add/src/main.c +66 -0
- package/float32/base/neg/README.md +259 -0
- package/float32/base/neg/docs/repl.txt +28 -0
- package/float32/base/neg/docs/types/index.d.ts +60 -0
- package/float32/base/neg/docs/types/test.ts +51 -0
- package/float32/base/neg/include/stdlib/complex/float32/base/neg.h +40 -0
- package/float32/base/neg/lib/index.js +61 -0
- package/float32/base/neg/lib/main.js +67 -0
- package/float32/base/neg/lib/native.js +68 -0
- package/float32/base/neg/manifest.json +75 -0
- package/float32/base/neg/package.json +67 -0
- package/float32/base/neg/src/addon.c +22 -0
- package/float32/base/neg/src/main.c +50 -0
- package/float32/base/package.json +67 -0
- package/float32/base/scale/README.md +263 -0
- package/float32/base/scale/docs/repl.txt +110 -0
- package/float32/base/scale/docs/types/index.d.ts +131 -0
- package/float32/base/scale/docs/types/test.ts +296 -0
- package/float32/base/scale/include/stdlib/complex/float32/base/scale.h +40 -0
- package/float32/base/scale/lib/assign.js +54 -0
- package/float32/base/scale/lib/index.js +54 -0
- package/float32/base/scale/lib/main.js +53 -0
- package/float32/base/scale/lib/native.js +53 -0
- package/float32/base/scale/lib/strided.js +57 -0
- package/float32/base/scale/manifest.json +75 -0
- package/float32/base/scale/package.json +69 -0
- package/float32/base/scale/src/addon.c +22 -0
- package/float32/base/scale/src/main.c +51 -0
- package/float32/base/sub/README.md +225 -0
- package/float32/base/sub/docs/repl.txt +33 -0
- package/float32/base/sub/docs/types/index.d.ts +46 -0
- package/float32/base/sub/docs/types/test.ts +67 -0
- package/float32/base/sub/include/stdlib/complex/float32/base/sub.h +40 -0
- package/float32/base/sub/lib/index.js +44 -0
- package/float32/base/sub/lib/main.js +56 -0
- package/float32/base/sub/lib/native.js +54 -0
- package/float32/base/sub/manifest.json +75 -0
- package/float32/base/sub/package.json +72 -0
- package/float32/base/sub/src/addon.c +22 -0
- package/float32/base/sub/src/main.c +62 -0
- package/float32/conj/README.md +258 -0
- package/float32/conj/docs/repl.txt +27 -0
- package/float32/conj/docs/types/index.d.ts +42 -0
- package/float32/conj/docs/types/test.ts +45 -0
- package/float32/conj/include/stdlib/complex/float32/conj.h +40 -0
- package/float32/conj/lib/index.js +43 -0
- package/float32/conj/lib/main.js +42 -0
- package/float32/conj/manifest.json +75 -0
- package/float32/conj/package.json +64 -0
- package/float32/conj/src/main.c +49 -0
- package/float32/ctor/README.md +547 -0
- package/float32/ctor/docs/repl.txt +93 -0
- package/float32/ctor/docs/types/index.d.ts +120 -0
- package/float32/ctor/docs/types/test.ts +59 -0
- package/float32/ctor/include/stdlib/complex/float32/ctor.h +148 -0
- package/float32/ctor/lib/index.js +40 -0
- package/float32/ctor/lib/main.js +164 -0
- package/float32/ctor/lib/tojson.js +39 -0
- package/float32/ctor/lib/tostring.js +42 -0
- package/float32/ctor/manifest.json +38 -0
- package/float32/ctor/package.json +70 -0
- package/float32/ctor/src/main.c +151 -0
- package/float32/docs/types/index.d.ts +151 -0
- package/float32/docs/types/test.ts +29 -0
- package/float32/imag/README.md +239 -0
- package/float32/imag/docs/repl.txt +24 -0
- package/float32/imag/docs/types/index.d.ts +44 -0
- package/float32/imag/docs/types/test.ts +45 -0
- package/float32/imag/include/stdlib/complex/float32/imag.h +40 -0
- package/float32/imag/lib/index.js +43 -0
- package/float32/imag/lib/main.js +42 -0
- package/float32/imag/manifest.json +40 -0
- package/float32/imag/package.json +67 -0
- package/float32/imag/src/main.c +42 -0
- package/float32/lib/index.js +114 -0
- package/float32/package.json +61 -0
- package/float32/parse/README.md +133 -0
- package/float32/parse/docs/repl.txt +22 -0
- package/float32/parse/docs/types/index.d.ts +46 -0
- package/float32/parse/docs/types/test.ts +44 -0
- package/float32/parse/lib/index.js +42 -0
- package/float32/parse/lib/main.js +90 -0
- package/float32/parse/package.json +67 -0
- package/float32/real/README.md +239 -0
- package/float32/real/docs/repl.txt +24 -0
- package/float32/real/docs/types/index.d.ts +44 -0
- package/float32/real/docs/types/test.ts +45 -0
- package/float32/real/include/stdlib/complex/float32/real.h +40 -0
- package/float32/real/lib/index.js +43 -0
- package/float32/real/lib/main.js +42 -0
- package/float32/real/manifest.json +40 -0
- package/float32/real/package.json +67 -0
- package/float32/real/src/main.c +42 -0
- package/float32/reim/README.md +248 -0
- package/float32/reim/docs/repl.txt +24 -0
- package/float32/reim/docs/types/index.d.ts +44 -0
- package/float32/reim/docs/types/test.ts +45 -0
- package/float32/reim/include/stdlib/complex/float32/reim.h +40 -0
- package/float32/reim/lib/index.js +43 -0
- package/float32/reim/lib/main.js +52 -0
- package/float32/reim/manifest.json +40 -0
- package/float32/reim/package.json +67 -0
- package/float32/reim/src/main.c +46 -0
- package/float32/reviver/README.md +145 -0
- package/float32/reviver/docs/repl.txt +26 -0
- package/float32/reviver/docs/types/index.d.ts +41 -0
- package/float32/reviver/docs/types/test.ts +50 -0
- package/float32/reviver/lib/index.js +43 -0
- package/float32/reviver/lib/main.js +60 -0
- package/float32/reviver/package.json +72 -0
- package/float64/README.md +137 -0
- package/float64/base/README.md +143 -0
- package/float64/base/add/README.md +279 -0
- package/float64/base/add/docs/repl.txt +118 -0
- package/float64/base/add/docs/types/index.d.ts +136 -0
- package/float64/base/add/docs/types/test.ts +357 -0
- package/float64/base/add/include/stdlib/complex/float64/base/add.h +40 -0
- package/float64/base/add/lib/assign.js +50 -0
- package/float64/base/add/lib/index.js +54 -0
- package/float64/base/add/lib/main.js +54 -0
- package/float64/base/add/lib/native.js +53 -0
- package/float64/base/add/lib/strided.js +55 -0
- package/float64/base/add/manifest.json +75 -0
- package/float64/base/add/package.json +68 -0
- package/float64/base/add/src/addon.c +22 -0
- package/float64/base/add/src/main.c +60 -0
- package/float64/base/add3/README.md +275 -0
- package/float64/base/add3/docs/repl.txt +133 -0
- package/float64/base/add3/docs/types/index.d.ts +145 -0
- package/float64/base/add3/docs/types/test.ts +467 -0
- package/float64/base/add3/include/stdlib/complex/float64/base/add3.h +40 -0
- package/float64/base/add3/lib/assign.js +52 -0
- package/float64/base/add3/lib/index.js +54 -0
- package/float64/base/add3/lib/main.js +55 -0
- package/float64/base/add3/lib/native.js +54 -0
- package/float64/base/add3/lib/strided.js +59 -0
- package/float64/base/add3/manifest.json +75 -0
- package/float64/base/add3/package.json +68 -0
- package/float64/base/add3/src/addon.c +22 -0
- package/float64/base/add3/src/main.c +64 -0
- package/float64/base/assert/README.md +120 -0
- package/float64/base/assert/docs/types/index.d.ts +181 -0
- package/float64/base/assert/docs/types/test.ts +29 -0
- package/float64/base/assert/is-almost-equal/README.md +158 -0
- package/float64/base/assert/is-almost-equal/docs/repl.txt +45 -0
- package/float64/base/assert/is-almost-equal/docs/types/index.d.ts +56 -0
- package/float64/base/assert/is-almost-equal/docs/types/test.ts +83 -0
- package/float64/base/assert/is-almost-equal/lib/index.js +48 -0
- package/float64/base/assert/is-almost-equal/lib/main.js +67 -0
- package/float64/base/assert/is-almost-equal/package.json +73 -0
- package/float64/base/assert/is-almost-same-value/README.md +158 -0
- package/float64/base/assert/is-almost-same-value/docs/repl.txt +43 -0
- package/float64/base/assert/is-almost-same-value/docs/types/index.d.ts +55 -0
- package/float64/base/assert/is-almost-same-value/docs/types/test.ts +83 -0
- package/float64/base/assert/is-almost-same-value/lib/index.js +48 -0
- package/float64/base/assert/is-almost-same-value/lib/main.js +69 -0
- package/float64/base/assert/is-almost-same-value/package.json +74 -0
- package/float64/base/assert/is-equal/README.md +221 -0
- package/float64/base/assert/is-equal/docs/repl.txt +27 -0
- package/float64/base/assert/is-equal/docs/types/index.d.ts +46 -0
- package/float64/base/assert/is-equal/docs/types/test.ts +67 -0
- package/float64/base/assert/is-equal/include/stdlib/complex/float64/base/assert/is_equal.h +41 -0
- package/float64/base/assert/is-equal/lib/index.js +44 -0
- package/float64/base/assert/is-equal/lib/main.js +56 -0
- package/float64/base/assert/is-equal/manifest.json +59 -0
- package/float64/base/assert/is-equal/package.json +71 -0
- package/float64/base/assert/is-equal/src/main.c +48 -0
- package/float64/base/assert/is-not-equal/README.md +221 -0
- package/float64/base/assert/is-not-equal/docs/repl.txt +28 -0
- package/float64/base/assert/is-not-equal/docs/types/index.d.ts +46 -0
- package/float64/base/assert/is-not-equal/docs/types/test.ts +67 -0
- package/float64/base/assert/is-not-equal/include/stdlib/complex/float64/base/assert/is_not_equal.h +41 -0
- package/float64/base/assert/is-not-equal/lib/index.js +44 -0
- package/float64/base/assert/is-not-equal/lib/main.js +56 -0
- package/float64/base/assert/is-not-equal/manifest.json +59 -0
- package/float64/base/assert/is-not-equal/package.json +72 -0
- package/float64/base/assert/is-not-equal/src/main.c +48 -0
- package/float64/base/assert/is-same-value/README.md +245 -0
- package/float64/base/assert/is-same-value/docs/repl.txt +31 -0
- package/float64/base/assert/is-same-value/docs/types/index.d.ts +53 -0
- package/float64/base/assert/is-same-value/docs/types/test.ts +67 -0
- package/float64/base/assert/is-same-value/include/stdlib/complex/float64/base/assert/is_same_value.h +41 -0
- package/float64/base/assert/is-same-value/lib/index.js +44 -0
- package/float64/base/assert/is-same-value/lib/main.js +64 -0
- package/float64/base/assert/is-same-value/manifest.json +61 -0
- package/float64/base/assert/is-same-value/package.json +74 -0
- package/float64/base/assert/is-same-value/src/main.c +52 -0
- package/float64/base/assert/is-same-value-zero/README.md +247 -0
- package/float64/base/assert/is-same-value-zero/docs/repl.txt +31 -0
- package/float64/base/assert/is-same-value-zero/docs/types/index.d.ts +50 -0
- package/float64/base/assert/is-same-value-zero/docs/types/test.ts +67 -0
- package/float64/base/assert/is-same-value-zero/include/stdlib/complex/float64/base/assert/is_same_value_zero.h +41 -0
- package/float64/base/assert/is-same-value-zero/lib/index.js +44 -0
- package/float64/base/assert/is-same-value-zero/lib/main.js +62 -0
- package/float64/base/assert/is-same-value-zero/manifest.json +61 -0
- package/float64/base/assert/is-same-value-zero/package.json +74 -0
- package/float64/base/assert/is-same-value-zero/src/main.c +52 -0
- package/float64/base/assert/lib/index.js +96 -0
- package/float64/base/assert/package.json +63 -0
- package/float64/base/div/README.md +304 -0
- package/float64/base/div/docs/repl.txt +119 -0
- package/float64/base/div/docs/types/index.d.ts +119 -0
- package/float64/base/div/docs/types/test.ts +357 -0
- package/float64/base/div/include/stdlib/complex/float64/base/div.h +40 -0
- package/float64/base/div/lib/assign.js +106 -0
- package/float64/base/div/lib/index.js +55 -0
- package/float64/base/div/lib/internal_compreal.js +56 -0
- package/float64/base/div/lib/main.js +76 -0
- package/float64/base/div/lib/native.js +54 -0
- package/float64/base/div/lib/robust_internal.js +61 -0
- package/float64/base/div/lib/strided.js +58 -0
- package/float64/base/div/manifest.json +87 -0
- package/float64/base/div/package.json +68 -0
- package/float64/base/div/src/addon.c +22 -0
- package/float64/base/div/src/main.c +173 -0
- package/float64/base/docs/types/index.d.ts +316 -0
- package/float64/base/docs/types/test.ts +29 -0
- package/float64/base/identity/README.md +235 -0
- package/float64/base/identity/docs/img/equation_identity_function.svg +18 -0
- package/float64/base/identity/docs/repl.txt +27 -0
- package/float64/base/identity/docs/types/index.d.ts +42 -0
- package/float64/base/identity/docs/types/test.ts +45 -0
- package/float64/base/identity/include/stdlib/complex/float64/base/identity.h +40 -0
- package/float64/base/identity/lib/index.js +41 -0
- package/float64/base/identity/lib/main.js +42 -0
- package/float64/base/identity/lib/native.js +50 -0
- package/float64/base/identity/manifest.json +75 -0
- package/float64/base/identity/package.json +68 -0
- package/float64/base/identity/src/addon.c +22 -0
- package/float64/base/identity/src/main.c +44 -0
- package/float64/base/lib/index.js +132 -0
- package/float64/base/mul/README.md +288 -0
- package/float64/base/mul/docs/repl.txt +120 -0
- package/float64/base/mul/docs/types/index.d.ts +138 -0
- package/float64/base/mul/docs/types/test.ts +358 -0
- package/float64/base/mul/include/stdlib/complex/float64/base/mul.h +40 -0
- package/float64/base/mul/lib/assign.js +50 -0
- package/float64/base/mul/lib/index.js +55 -0
- package/float64/base/mul/lib/main.js +59 -0
- package/float64/base/mul/lib/native.js +54 -0
- package/float64/base/mul/lib/strided.js +59 -0
- package/float64/base/mul/manifest.json +95 -0
- package/float64/base/mul/package.json +69 -0
- package/float64/base/mul/src/addon.c +22 -0
- package/float64/base/mul/src/main.c +61 -0
- package/float64/base/mul-add/README.md +286 -0
- package/float64/base/mul-add/docs/repl.txt +142 -0
- package/float64/base/mul-add/docs/types/index.d.ts +151 -0
- package/float64/base/mul-add/docs/types/test.ts +467 -0
- package/float64/base/mul-add/include/stdlib/complex/float64/base/mul_add.h +40 -0
- package/float64/base/mul-add/lib/assign.js +52 -0
- package/float64/base/mul-add/lib/index.js +56 -0
- package/float64/base/mul-add/lib/main.js +63 -0
- package/float64/base/mul-add/lib/native.js +56 -0
- package/float64/base/mul-add/lib/strided.js +65 -0
- package/float64/base/mul-add/manifest.json +75 -0
- package/float64/base/mul-add/package.json +70 -0
- package/float64/base/mul-add/src/addon.c +22 -0
- package/float64/base/mul-add/src/main.c +66 -0
- package/float64/base/neg/README.md +257 -0
- package/float64/base/neg/docs/repl.txt +28 -0
- package/float64/base/neg/docs/types/index.d.ts +60 -0
- package/float64/base/neg/docs/types/test.ts +51 -0
- package/float64/base/neg/include/stdlib/complex/float64/base/neg.h +40 -0
- package/float64/base/neg/lib/index.js +61 -0
- package/float64/base/neg/lib/main.js +67 -0
- package/float64/base/neg/lib/native.js +68 -0
- package/float64/base/neg/manifest.json +75 -0
- package/float64/base/neg/package.json +67 -0
- package/float64/base/neg/src/addon.c +22 -0
- package/float64/base/neg/src/main.c +49 -0
- package/float64/base/package.json +67 -0
- package/float64/base/scale/README.md +263 -0
- package/float64/base/scale/docs/repl.txt +106 -0
- package/float64/base/scale/docs/types/index.d.ts +131 -0
- package/float64/base/scale/docs/types/test.ts +297 -0
- package/float64/base/scale/include/stdlib/complex/float64/base/scale.h +40 -0
- package/float64/base/scale/lib/assign.js +49 -0
- package/float64/base/scale/lib/index.js +54 -0
- package/float64/base/scale/lib/main.js +52 -0
- package/float64/base/scale/lib/native.js +53 -0
- package/float64/base/scale/lib/strided.js +52 -0
- package/float64/base/scale/manifest.json +75 -0
- package/float64/base/scale/package.json +69 -0
- package/float64/base/scale/src/addon.c +22 -0
- package/float64/base/scale/src/main.c +51 -0
- package/float64/base/sub/README.md +226 -0
- package/float64/base/sub/docs/repl.txt +33 -0
- package/float64/base/sub/docs/types/index.d.ts +46 -0
- package/float64/base/sub/docs/types/test.ts +67 -0
- package/float64/base/sub/include/stdlib/complex/float64/base/sub.h +40 -0
- package/float64/base/sub/lib/index.js +44 -0
- package/float64/base/sub/lib/main.js +55 -0
- package/float64/base/sub/lib/native.js +54 -0
- package/float64/base/sub/manifest.json +75 -0
- package/float64/base/sub/package.json +71 -0
- package/float64/base/sub/src/addon.c +22 -0
- package/float64/base/sub/src/main.c +61 -0
- package/float64/conj/README.md +255 -0
- package/float64/conj/docs/repl.txt +27 -0
- package/float64/conj/docs/types/index.d.ts +42 -0
- package/float64/conj/docs/types/test.ts +45 -0
- package/float64/conj/include/stdlib/complex/float64/conj.h +40 -0
- package/float64/conj/lib/index.js +43 -0
- package/float64/conj/lib/main.js +48 -0
- package/float64/conj/lib/native.js +52 -0
- package/float64/conj/manifest.json +76 -0
- package/float64/conj/package.json +65 -0
- package/float64/conj/src/addon.c +22 -0
- package/float64/conj/src/main.c +49 -0
- package/float64/ctor/README.md +617 -0
- package/float64/ctor/docs/repl.txt +84 -0
- package/float64/ctor/docs/types/index.d.ts +120 -0
- package/float64/ctor/docs/types/test.ts +69 -0
- package/float64/ctor/include/stdlib/complex/float64/ctor.h +169 -0
- package/float64/ctor/lib/index.js +40 -0
- package/float64/ctor/lib/main.js +163 -0
- package/float64/ctor/lib/tojson.js +39 -0
- package/float64/ctor/lib/tostring.js +42 -0
- package/float64/ctor/manifest.json +40 -0
- package/float64/ctor/package.json +69 -0
- package/float64/ctor/src/main.c +224 -0
- package/float64/docs/types/index.d.ts +151 -0
- package/float64/docs/types/test.ts +29 -0
- package/float64/imag/README.md +236 -0
- package/float64/imag/docs/repl.txt +24 -0
- package/float64/imag/docs/types/index.d.ts +44 -0
- package/float64/imag/docs/types/test.ts +45 -0
- package/float64/imag/include/stdlib/complex/float64/imag.h +40 -0
- package/float64/imag/lib/index.js +43 -0
- package/float64/imag/lib/main.js +42 -0
- package/float64/imag/manifest.json +40 -0
- package/float64/imag/package.json +67 -0
- package/float64/imag/src/main.c +42 -0
- package/float64/lib/index.js +114 -0
- package/float64/package.json +61 -0
- package/float64/parse/README.md +132 -0
- package/float64/parse/docs/repl.txt +23 -0
- package/float64/parse/docs/types/index.d.ts +46 -0
- package/float64/parse/docs/types/test.ts +44 -0
- package/float64/parse/lib/index.js +42 -0
- package/float64/parse/lib/main.js +90 -0
- package/float64/parse/package.json +67 -0
- package/float64/real/README.md +236 -0
- package/float64/real/docs/repl.txt +24 -0
- package/float64/real/docs/types/index.d.ts +44 -0
- package/float64/real/docs/types/test.ts +45 -0
- package/float64/real/include/stdlib/complex/float64/real.h +40 -0
- package/float64/real/lib/index.js +43 -0
- package/float64/real/lib/main.js +42 -0
- package/float64/real/manifest.json +40 -0
- package/float64/real/package.json +67 -0
- package/float64/real/src/main.c +42 -0
- package/float64/reim/README.md +245 -0
- package/float64/reim/docs/repl.txt +24 -0
- package/float64/reim/docs/types/index.d.ts +44 -0
- package/float64/reim/docs/types/test.ts +45 -0
- package/float64/reim/include/stdlib/complex/float64/reim.h +40 -0
- package/float64/reim/lib/index.js +43 -0
- package/float64/reim/lib/main.js +52 -0
- package/float64/reim/manifest.json +40 -0
- package/float64/reim/package.json +67 -0
- package/float64/reim/src/main.c +46 -0
- package/float64/reviver/README.md +145 -0
- package/float64/reviver/docs/repl.txt +26 -0
- package/float64/reviver/docs/types/index.d.ts +41 -0
- package/float64/reviver/docs/types/test.ts +50 -0
- package/float64/reviver/lib/index.js +43 -0
- package/float64/reviver/lib/main.js +60 -0
- package/float64/reviver/package.json +72 -0
- package/lib/index.js +123 -0
- package/package.json +71 -4
- package/promotion-rules/README.md +164 -0
- package/promotion-rules/docs/repl.txt +33 -0
- package/promotion-rules/docs/types/index.d.ts +102 -0
- package/promotion-rules/docs/types/test.ts +66 -0
- package/promotion-rules/lib/index.js +46 -0
- package/promotion-rules/lib/main.js +102 -0
- package/promotion-rules/lib/promotion_rules.json +64 -0
- package/promotion-rules/package.json +69 -0
- package/reviver/README.md +148 -0
- package/reviver/docs/repl.txt +33 -0
- package/reviver/docs/types/index.d.ts +41 -0
- package/reviver/docs/types/test.ts +45 -0
- package/reviver/lib/ctors.js +37 -0
- package/reviver/lib/index.js +43 -0
- package/reviver/lib/main.js +63 -0
- package/reviver/package.json +73 -0
package/lib/index.js
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Apache-2.0
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2018 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
|
+
* When adding modules to the namespace, ensure that they are added in alphabetical order according to module name.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
// MODULES //
|
|
26
|
+
|
|
27
|
+
var setReadOnly = require( '@ohos-ports/stdlib-utils/define-read-only-property' );
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
// MAIN //
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Top-level namespace.
|
|
34
|
+
*
|
|
35
|
+
* @namespace ns
|
|
36
|
+
*/
|
|
37
|
+
var ns = {};
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* @name base
|
|
41
|
+
* @memberof ns
|
|
42
|
+
* @readonly
|
|
43
|
+
* @type {Namespace}
|
|
44
|
+
* @see {@link module:@stdlib/complex/base}
|
|
45
|
+
*/
|
|
46
|
+
setReadOnly( ns, 'base', require( './../base' ) );
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* @name complex
|
|
50
|
+
* @memberof ns
|
|
51
|
+
* @readonly
|
|
52
|
+
* @type {Function}
|
|
53
|
+
* @see {@link module:@stdlib/complex/cmplx}
|
|
54
|
+
*/
|
|
55
|
+
setReadOnly( ns, 'complex', require( './../cmplx' ) );
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* @name ctors
|
|
59
|
+
* @memberof ns
|
|
60
|
+
* @readonly
|
|
61
|
+
* @type {Function}
|
|
62
|
+
* @see {@link module:@stdlib/complex/ctors}
|
|
63
|
+
*/
|
|
64
|
+
setReadOnly( ns, 'ctors', require( './../ctors' ) );
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* @name dtype
|
|
68
|
+
* @memberof ns
|
|
69
|
+
* @readonly
|
|
70
|
+
* @type {Function}
|
|
71
|
+
* @see {@link module:@stdlib/complex/dtype}
|
|
72
|
+
*/
|
|
73
|
+
setReadOnly( ns, 'dtype', require( './../dtype' ) );
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* @name dtypes
|
|
77
|
+
* @memberof ns
|
|
78
|
+
* @readonly
|
|
79
|
+
* @type {Function}
|
|
80
|
+
* @see {@link module:@stdlib/complex/dtypes}
|
|
81
|
+
*/
|
|
82
|
+
setReadOnly( ns, 'dtypes', require( './../dtypes' ) );
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* @name float32
|
|
86
|
+
* @memberof ns
|
|
87
|
+
* @readonly
|
|
88
|
+
* @type {Namespace}
|
|
89
|
+
* @see {@link module:@stdlib/complex/float32}
|
|
90
|
+
*/
|
|
91
|
+
setReadOnly( ns, 'float32', require( './../float32' ) );
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* @name float64
|
|
95
|
+
* @memberof ns
|
|
96
|
+
* @readonly
|
|
97
|
+
* @type {Namespace}
|
|
98
|
+
* @see {@link module:@stdlib/complex/float64}
|
|
99
|
+
*/
|
|
100
|
+
setReadOnly( ns, 'float64', require( './../float64' ) );
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* @name promotionRules
|
|
104
|
+
* @memberof ns
|
|
105
|
+
* @readonly
|
|
106
|
+
* @type {Function}
|
|
107
|
+
* @see {@link module:@stdlib/complex/promotion-rules}
|
|
108
|
+
*/
|
|
109
|
+
setReadOnly( ns, 'promotionRules', require( './../promotion-rules' ) );
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* @name reviveComplex
|
|
113
|
+
* @memberof ns
|
|
114
|
+
* @readonly
|
|
115
|
+
* @type {Function}
|
|
116
|
+
* @see {@link module:@stdlib/complex/reviver}
|
|
117
|
+
*/
|
|
118
|
+
setReadOnly( ns, 'reviveComplex', require( './../reviver' ) );
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
// EXPORTS //
|
|
122
|
+
|
|
123
|
+
module.exports = ns;
|
package/package.json
CHANGED
|
@@ -1,6 +1,73 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ohos-ports/stdlib-complex",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.4.1-beta.1",
|
|
4
|
+
"description": "Complex numbers.",
|
|
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/index.js",
|
|
17
|
+
"directories": {
|
|
18
|
+
"doc": "./docs",
|
|
19
|
+
"lib": "./lib"
|
|
20
|
+
},
|
|
21
|
+
"types": "./docs/types",
|
|
22
|
+
"scripts": {},
|
|
23
|
+
"homepage": "https://stdlib.io",
|
|
24
|
+
"repository": {
|
|
25
|
+
"type": "git",
|
|
26
|
+
"url": "https://github.com/ohos-ports/ohos-ports.git",
|
|
27
|
+
"directory": "ports/stdlib-complex/0.4.1"
|
|
28
|
+
},
|
|
29
|
+
"bugs": {
|
|
30
|
+
"url": "https://github.com/ohos-ports/ohos-ports/issues"
|
|
31
|
+
},
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"@ohos-ports/stdlib-array": "^0.5.1-beta.0",
|
|
34
|
+
"@ohos-ports/stdlib-assert": "^0.4.1-beta.2",
|
|
35
|
+
"@ohos-ports/stdlib-constants": "^0.4.1-beta.1",
|
|
36
|
+
"@ohos-ports/stdlib-math": "^0.4.1-beta.0",
|
|
37
|
+
"@ohos-ports/stdlib-number": "^0.4.1-beta.1",
|
|
38
|
+
"@ohos-ports/stdlib-string": "^0.4.1-beta.2",
|
|
39
|
+
"@ohos-ports/stdlib-types": "^0.5.1-beta.1",
|
|
40
|
+
"@ohos-ports/stdlib-utils": "^0.4.1-beta.1"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {},
|
|
43
|
+
"engines": {
|
|
44
|
+
"node": ">=0.10.0",
|
|
45
|
+
"npm": ">2.7.0"
|
|
46
|
+
},
|
|
47
|
+
"os": [
|
|
48
|
+
"aix",
|
|
49
|
+
"darwin",
|
|
50
|
+
"freebsd",
|
|
51
|
+
"linux",
|
|
52
|
+
"macos",
|
|
53
|
+
"openbsd",
|
|
54
|
+
"sunos",
|
|
55
|
+
"win32",
|
|
56
|
+
"windows",
|
|
57
|
+
"openharmony"
|
|
58
|
+
],
|
|
59
|
+
"keywords": [
|
|
60
|
+
"stdlib",
|
|
61
|
+
"stdtypes",
|
|
62
|
+
"types",
|
|
63
|
+
"complex",
|
|
64
|
+
"cmplx",
|
|
65
|
+
"number",
|
|
66
|
+
"namespace",
|
|
67
|
+
"ns"
|
|
68
|
+
],
|
|
69
|
+
"funding": {
|
|
70
|
+
"type": "opencollective",
|
|
71
|
+
"url": "https://opencollective.com/stdlib"
|
|
72
|
+
}
|
|
73
|
+
}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
|
|
3
|
+
@license Apache-2.0
|
|
4
|
+
|
|
5
|
+
Copyright (c) 2022 The Stdlib Authors.
|
|
6
|
+
|
|
7
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
you may not use this file except in compliance with the License.
|
|
9
|
+
You may obtain a copy of the License at
|
|
10
|
+
|
|
11
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
|
|
13
|
+
Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
See the License for the specific language governing permissions and
|
|
17
|
+
limitations under the License.
|
|
18
|
+
|
|
19
|
+
-->
|
|
20
|
+
|
|
21
|
+
# Promotion Rules
|
|
22
|
+
|
|
23
|
+
> Return the complex number [data type][@stdlib/complex/dtypes] with the smallest size and closest "kind" to which data types can be **safely** cast.
|
|
24
|
+
|
|
25
|
+
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
|
|
26
|
+
|
|
27
|
+
<section class="intro">
|
|
28
|
+
|
|
29
|
+
</section>
|
|
30
|
+
|
|
31
|
+
<!-- /.intro -->
|
|
32
|
+
|
|
33
|
+
<!-- Package usage documentation. -->
|
|
34
|
+
|
|
35
|
+
<section class="usage">
|
|
36
|
+
|
|
37
|
+
## Usage
|
|
38
|
+
|
|
39
|
+
```javascript
|
|
40
|
+
var promotionRules = require( '@stdlib/complex/promotion-rules' );
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
#### promotionRules( \[dtype1, dtype2] )
|
|
44
|
+
|
|
45
|
+
If provided data types, returns the complex number [data type][@stdlib/complex/dtypes] with the smallest size and closest "kind" to which data types can be **safely** cast.
|
|
46
|
+
|
|
47
|
+
```javascript
|
|
48
|
+
var out = promotionRules( 'complex128', 'complex64' );
|
|
49
|
+
// returns 'complex128'
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
If not provided data types, the function returns a promotion table.
|
|
53
|
+
|
|
54
|
+
```javascript
|
|
55
|
+
var out = promotionRules();
|
|
56
|
+
// returns {...}
|
|
57
|
+
|
|
58
|
+
var c128 = out[ 'complex128' ];
|
|
59
|
+
// returns {...}
|
|
60
|
+
|
|
61
|
+
var rule = c128[ 'uint32' ];
|
|
62
|
+
// returns 'complex128'
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
If provided an unrecognized or unsupported `dtype`, the function returns `null`.
|
|
66
|
+
|
|
67
|
+
```javascript
|
|
68
|
+
var out = promotionRules( 'foo', 'complex128' );
|
|
69
|
+
// returns null
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
</section>
|
|
73
|
+
|
|
74
|
+
<!-- /.usage -->
|
|
75
|
+
|
|
76
|
+
<!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
|
|
77
|
+
|
|
78
|
+
<section class="notes">
|
|
79
|
+
|
|
80
|
+
## Notes
|
|
81
|
+
|
|
82
|
+
- If a [data type][@stdlib/complex/dtypes] to which data types can be safely cast does **not** exist (or is not supported), the function returns `-1`.
|
|
83
|
+
|
|
84
|
+
</section>
|
|
85
|
+
|
|
86
|
+
<!-- /.notes -->
|
|
87
|
+
|
|
88
|
+
<!-- Package usage examples. -->
|
|
89
|
+
|
|
90
|
+
<section class="examples">
|
|
91
|
+
|
|
92
|
+
## Examples
|
|
93
|
+
|
|
94
|
+
<!-- eslint no-undef: "error" -->
|
|
95
|
+
|
|
96
|
+
```javascript
|
|
97
|
+
var dtypes = require( '@stdlib/complex/dtypes' );
|
|
98
|
+
var promotionRules = require( '@stdlib/complex/promotion-rules' );
|
|
99
|
+
|
|
100
|
+
var DTYPES;
|
|
101
|
+
var dt1;
|
|
102
|
+
var dt2;
|
|
103
|
+
var dt;
|
|
104
|
+
var i;
|
|
105
|
+
var j;
|
|
106
|
+
|
|
107
|
+
// Get the list of supported data types:
|
|
108
|
+
DTYPES = dtypes();
|
|
109
|
+
|
|
110
|
+
// Print the promotion rule for each pair of data types...
|
|
111
|
+
for ( i = 0; i < DTYPES.length; i++ ) {
|
|
112
|
+
dt1 = DTYPES[ i ];
|
|
113
|
+
for ( j = 0; j < DTYPES.length; j++ ) {
|
|
114
|
+
dt2 = DTYPES[ j ];
|
|
115
|
+
dt = promotionRules( dt1, dt2 );
|
|
116
|
+
console.log( '(%s, %s) => %s', dt1, dt2, dt );
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
</section>
|
|
122
|
+
|
|
123
|
+
<!-- /.examples -->
|
|
124
|
+
|
|
125
|
+
<!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
|
|
126
|
+
|
|
127
|
+
<section class="references">
|
|
128
|
+
|
|
129
|
+
</section>
|
|
130
|
+
|
|
131
|
+
<!-- /.references -->
|
|
132
|
+
|
|
133
|
+
<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
|
|
134
|
+
|
|
135
|
+
<section class="related">
|
|
136
|
+
|
|
137
|
+
* * *
|
|
138
|
+
|
|
139
|
+
## See Also
|
|
140
|
+
|
|
141
|
+
- <span class="package-name">[`@stdlib/array/promotion-rules`][@stdlib/array/promotion-rules]</span><span class="delimiter">: </span><span class="description">return the array data type with the smallest size and closest kind to which array data types can be safely cast.</span>
|
|
142
|
+
- <span class="package-name">[`@stdlib/ndarray/promotion-rules`][@stdlib/ndarray/promotion-rules]</span><span class="delimiter">: </span><span class="description">return the ndarray data type with the smallest size and closest kind to which ndarray data types can be safely cast.</span>
|
|
143
|
+
|
|
144
|
+
</section>
|
|
145
|
+
|
|
146
|
+
<!-- /.related -->
|
|
147
|
+
|
|
148
|
+
<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
|
|
149
|
+
|
|
150
|
+
<section class="links">
|
|
151
|
+
|
|
152
|
+
[@stdlib/complex/dtypes]: https://github.com/stdlib-js/complex/tree/main/dtypes
|
|
153
|
+
|
|
154
|
+
<!-- <related-links> -->
|
|
155
|
+
|
|
156
|
+
[@stdlib/array/promotion-rules]: https://www.npmjs.com/package/@stdlib/array-promotion-rules
|
|
157
|
+
|
|
158
|
+
[@stdlib/ndarray/promotion-rules]: https://www.npmjs.com/package/@stdlib/ndarray-promotion-rules
|
|
159
|
+
|
|
160
|
+
<!-- </related-links> -->
|
|
161
|
+
|
|
162
|
+
</section>
|
|
163
|
+
|
|
164
|
+
<!-- /.links -->
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
|
|
2
|
+
{{alias}}( [dtype1, dtype2] )
|
|
3
|
+
Returns the complex number data type with the smallest size and closest
|
|
4
|
+
"kind" to which data types can be safely cast.
|
|
5
|
+
|
|
6
|
+
If not provided data types, the function returns a type promotion table.
|
|
7
|
+
|
|
8
|
+
If a data type to which data types can be safely cast does *not* exist (or
|
|
9
|
+
is not supported), the function returns `-1`.
|
|
10
|
+
|
|
11
|
+
If provided an unrecognized data type, the function returns `null`.
|
|
12
|
+
|
|
13
|
+
Parameters
|
|
14
|
+
----------
|
|
15
|
+
dtype1: string (optional)
|
|
16
|
+
Data type.
|
|
17
|
+
|
|
18
|
+
dtype2: string (optional)
|
|
19
|
+
Data type.
|
|
20
|
+
|
|
21
|
+
Returns
|
|
22
|
+
-------
|
|
23
|
+
out: Object|string|integer|null
|
|
24
|
+
Promotion rule(s).
|
|
25
|
+
|
|
26
|
+
Examples
|
|
27
|
+
--------
|
|
28
|
+
> var out = {{alias}}( 'complex128', 'complex64' )
|
|
29
|
+
'complex128'
|
|
30
|
+
|
|
31
|
+
See Also
|
|
32
|
+
--------
|
|
33
|
+
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @license Apache-2.0
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2022 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
|
+
/// <reference types="@stdlib/types"/>
|
|
22
|
+
|
|
23
|
+
import { ComplexFloatingPointDataType } from '@stdlib/types/complex';
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Real number data types.
|
|
27
|
+
*/
|
|
28
|
+
type RealDataTypes = 'float64' | 'float32' | 'int32' | 'int16' | 'int8' | 'uint32' | 'uint16' | 'uint8' | 'uint8c';
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Number data types.
|
|
32
|
+
*/
|
|
33
|
+
type DataType = RealDataTypes | ComplexFloatingPointDataType;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Interface describing a promotion table.
|
|
37
|
+
*/
|
|
38
|
+
interface Table {
|
|
39
|
+
/**
|
|
40
|
+
* Data type promotion rules.
|
|
41
|
+
*/
|
|
42
|
+
[key: string]: DataType | number;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Promotion rule.
|
|
47
|
+
*/
|
|
48
|
+
type PromotionRule = DataType | number;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Returns the complex number data type with the smallest size and closest "kind" to which data types can be safely cast.
|
|
52
|
+
*
|
|
53
|
+
* @param dtype1 - data type
|
|
54
|
+
* @param dtype2 - data type
|
|
55
|
+
* @returns promotion rule
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* var dt = promotionRules( 'complex128', 'complex64' );
|
|
59
|
+
* // returns 'complex128'
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* var dt = promotionRules( 'complex128', 'foo' );
|
|
63
|
+
* // returns null
|
|
64
|
+
*/
|
|
65
|
+
declare function promotionRules( dtype1: DataType, dtype2: DataType ): PromotionRule;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Returns the complex number data type with the smallest size and closest "kind" to which data types can be safely cast.
|
|
69
|
+
*
|
|
70
|
+
* @param dtype1 - data type
|
|
71
|
+
* @param dtype2 - data type
|
|
72
|
+
* @returns promotion rule
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* var dt = promotionRules( 'complex128', 'foo' );
|
|
76
|
+
* // returns null
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* var dt = promotionRules( 'bar', 'complex128' );
|
|
80
|
+
* // returns null
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* var dt = promotionRules( 'bar', 'foo' );
|
|
84
|
+
* // returns null
|
|
85
|
+
*/
|
|
86
|
+
declare function promotionRules( dtype1: string, dtype2: string ): null;
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Returns a type promotion table displaying complex number data types with the smallest size and closest "kind" to which data types can be safely cast.
|
|
90
|
+
*
|
|
91
|
+
* @returns promotion rule table
|
|
92
|
+
*
|
|
93
|
+
* @example
|
|
94
|
+
* var table = promotionRules();
|
|
95
|
+
* // returns {...}
|
|
96
|
+
*/
|
|
97
|
+
declare function promotionRules(): Table;
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
// EXPORTS //
|
|
101
|
+
|
|
102
|
+
export = promotionRules;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @license Apache-2.0
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2022 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
|
+
import promotionRules = require( './index' );
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
// TESTS //
|
|
23
|
+
|
|
24
|
+
// The function returns an object when not provided any arguments...
|
|
25
|
+
{
|
|
26
|
+
promotionRules(); // $ExpectType Table
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// The function returns a promoted data type promotion rule when provided recognized data types...
|
|
30
|
+
{
|
|
31
|
+
promotionRules( 'complex128', 'complex64' ); // $ExpectType PromotionRule
|
|
32
|
+
promotionRules( 'float64', 'complex128' ); // $ExpectType PromotionRule
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// The function returns null when provided unrecognized data types...
|
|
36
|
+
{
|
|
37
|
+
promotionRules( 'complex128', 'foo' ); // $ExpectType null
|
|
38
|
+
promotionRules( 'bar', 'foo' ); // $ExpectType null
|
|
39
|
+
promotionRules( 'bar', 'complex128' ); // $ExpectType null
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// The compiler throws an error if the function is provided a first argument that is not a string...
|
|
43
|
+
{
|
|
44
|
+
promotionRules( 123, 'complex128' ); // $ExpectError
|
|
45
|
+
promotionRules( true, 'complex128' ); // $ExpectError
|
|
46
|
+
promotionRules( false, 'complex128' ); // $ExpectError
|
|
47
|
+
promotionRules( null, 'complex128' ); // $ExpectError
|
|
48
|
+
promotionRules( {}, 'complex128' ); // $ExpectError
|
|
49
|
+
promotionRules( ( x: number ): number => x, 'complex128' ); // $ExpectError
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// The compiler throws an error if the function is provided a second argument that is not a string...
|
|
53
|
+
{
|
|
54
|
+
promotionRules( 'complex64', 123 ); // $ExpectError
|
|
55
|
+
promotionRules( 'complex64', true ); // $ExpectError
|
|
56
|
+
promotionRules( 'complex64', false ); // $ExpectError
|
|
57
|
+
promotionRules( 'complex64', null ); // $ExpectError
|
|
58
|
+
promotionRules( 'complex64', {} ); // $ExpectError
|
|
59
|
+
promotionRules( 'complex64', ( x: number ): number => x ); // $ExpectError
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// The compiler throws an error if the function is provided more than one argument...
|
|
63
|
+
{
|
|
64
|
+
promotionRules( 'complex128' ); // $ExpectError
|
|
65
|
+
promotionRules( 'complex128', 'complex64', {} ); // $ExpectError
|
|
66
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Apache-2.0
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2022 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
|
+
* Return the complex number data type with the smallest size and closest "kind" to which data types can be safely cast.
|
|
23
|
+
*
|
|
24
|
+
* @module @stdlib/complex/promotion-rules
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* var promotionRules = require( '@ohos-ports/stdlib-complex/promotion-rules' );
|
|
28
|
+
*
|
|
29
|
+
* var table = promotionRules();
|
|
30
|
+
* // returns {...}
|
|
31
|
+
*
|
|
32
|
+
* var dt = promotionRules( 'complex128', 'complex64' );
|
|
33
|
+
* // returns 'complex128'
|
|
34
|
+
*
|
|
35
|
+
* dt = promotionRules( 'complex128', 'foo' );
|
|
36
|
+
* // returns null
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
// MODULES //
|
|
40
|
+
|
|
41
|
+
var main = require( './main.js' );
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
// EXPORTS //
|
|
45
|
+
|
|
46
|
+
module.exports = main;
|