@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
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@stdlib/complex/float64/ctor",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"description": "128-bit complex number.",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"author": {
|
|
7
|
+
"name": "The Stdlib Authors",
|
|
8
|
+
"url": "https://github.com/stdlib-js/stdlib/graphs/contributors"
|
|
9
|
+
},
|
|
10
|
+
"contributors": [
|
|
11
|
+
{
|
|
12
|
+
"name": "The Stdlib Authors",
|
|
13
|
+
"url": "https://github.com/stdlib-js/stdlib/graphs/contributors"
|
|
14
|
+
}
|
|
15
|
+
],
|
|
16
|
+
"main": "./lib",
|
|
17
|
+
"directories": {
|
|
18
|
+
"benchmark": "./benchmark",
|
|
19
|
+
"doc": "./docs",
|
|
20
|
+
"example": "./examples",
|
|
21
|
+
"include": "./include",
|
|
22
|
+
"lib": "./lib",
|
|
23
|
+
"src": "./src",
|
|
24
|
+
"test": "./test"
|
|
25
|
+
},
|
|
26
|
+
"types": "./docs/types",
|
|
27
|
+
"scripts": {},
|
|
28
|
+
"homepage": "https://github.com/stdlib-js/stdlib",
|
|
29
|
+
"repository": {
|
|
30
|
+
"type": "git",
|
|
31
|
+
"url": "git://github.com/stdlib-js/stdlib.git"
|
|
32
|
+
},
|
|
33
|
+
"bugs": {
|
|
34
|
+
"url": "https://github.com/stdlib-js/stdlib/issues"
|
|
35
|
+
},
|
|
36
|
+
"dependencies": {},
|
|
37
|
+
"devDependencies": {},
|
|
38
|
+
"engines": {
|
|
39
|
+
"node": ">=0.10.0",
|
|
40
|
+
"npm": ">2.7.0"
|
|
41
|
+
},
|
|
42
|
+
"os": [
|
|
43
|
+
"aix",
|
|
44
|
+
"darwin",
|
|
45
|
+
"freebsd",
|
|
46
|
+
"linux",
|
|
47
|
+
"macos",
|
|
48
|
+
"openbsd",
|
|
49
|
+
"sunos",
|
|
50
|
+
"win32",
|
|
51
|
+
"windows"
|
|
52
|
+
],
|
|
53
|
+
"keywords": [
|
|
54
|
+
"stdlib",
|
|
55
|
+
"stdtypes",
|
|
56
|
+
"types",
|
|
57
|
+
"data",
|
|
58
|
+
"structure",
|
|
59
|
+
"constructor",
|
|
60
|
+
"ctor",
|
|
61
|
+
"complex",
|
|
62
|
+
"complex128",
|
|
63
|
+
"128-bit",
|
|
64
|
+
"float64",
|
|
65
|
+
"double",
|
|
66
|
+
"double-precision",
|
|
67
|
+
"ieee754"
|
|
68
|
+
]
|
|
69
|
+
}
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Apache-2.0
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2021 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/complex/float64/ctor.h"
|
|
20
|
+
#include "stdlib/complex/float32/ctor.h"
|
|
21
|
+
#include <stdint.h>
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Returns a double-precision complex floating-point number.
|
|
25
|
+
*
|
|
26
|
+
* @param real real component
|
|
27
|
+
* @param imag imaginary component
|
|
28
|
+
* @return double-precision complex floating-point number
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* stdlib_complex128_t z = stdlib_complex128( 5.0, 2.0 );
|
|
32
|
+
*/
|
|
33
|
+
stdlib_complex128_t stdlib_complex128( const double real, const double imag ) {
|
|
34
|
+
stdlib_complex128_parts_t z;
|
|
35
|
+
z.parts[ 0 ] = real;
|
|
36
|
+
z.parts[ 1 ] = imag; // cppcheck-suppress unreadVariable
|
|
37
|
+
return z.value;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Converts a single-precision floating-point number to a double-precision complex floating-point number.
|
|
42
|
+
*
|
|
43
|
+
* @param real real component
|
|
44
|
+
* @return double-precision complex floating-point number
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* stdlib_complex128_t z = stdlib_complex128_from_float32( 5.0f );
|
|
48
|
+
*/
|
|
49
|
+
stdlib_complex128_t stdlib_complex128_from_float32( const float real ) {
|
|
50
|
+
stdlib_complex128_parts_t z;
|
|
51
|
+
z.parts[ 0 ] = (double)real;
|
|
52
|
+
z.parts[ 1 ] = 0.0; // cppcheck-suppress unreadVariable
|
|
53
|
+
return z.value;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Converts a double-precision floating-point number to a double-precision complex floating-point number.
|
|
58
|
+
*
|
|
59
|
+
* @param real real component
|
|
60
|
+
* @return double-precision complex floating-point number
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* stdlib_complex128_t z = stdlib_complex128_from_float64( 5.0 );
|
|
64
|
+
*/
|
|
65
|
+
stdlib_complex128_t stdlib_complex128_from_float64( const double real ) {
|
|
66
|
+
stdlib_complex128_parts_t z;
|
|
67
|
+
z.parts[ 0 ] = real;
|
|
68
|
+
z.parts[ 1 ] = 0.0; // cppcheck-suppress unreadVariable
|
|
69
|
+
return z.value;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Converts a single-precision complex floating-point number to a double-precision complex floating-point number.
|
|
74
|
+
*
|
|
75
|
+
* @param z single-precision complex floating-point number
|
|
76
|
+
* @return double-precision complex floating-point number
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* #include "stdlib/complex/float32/ctor.h"
|
|
80
|
+
*
|
|
81
|
+
* stdlib_complex64_t z1 = stdlib_complex64( 5.0f, 3.0f );
|
|
82
|
+
* stdlib_complex128_t z2 = stdlib_complex128_from_complex64( z1 );
|
|
83
|
+
*/
|
|
84
|
+
stdlib_complex128_t stdlib_complex128_from_complex64( const stdlib_complex64_t z ) {
|
|
85
|
+
stdlib_complex64_parts_t v1 = { z };
|
|
86
|
+
stdlib_complex128_parts_t v2;
|
|
87
|
+
v2.parts[ 0 ] = (double)v1.parts[ 0 ];
|
|
88
|
+
v2.parts[ 1 ] = (double)v1.parts[ 1 ]; // cppcheck-suppress unreadVariable
|
|
89
|
+
return v2.value;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Converts (copies) a double-precision complex floating-point number to a double-precision complex floating-point number.
|
|
94
|
+
*
|
|
95
|
+
* @param z double-precision complex floating-point number
|
|
96
|
+
* @return double-precision complex floating-point number
|
|
97
|
+
*
|
|
98
|
+
* @example
|
|
99
|
+
* stdlib_complex128_t z1 = stdlib_complex128( 5.0, 3.0 );
|
|
100
|
+
* stdlib_complex128_t z2 = stdlib_complex128_from_complex128( z1 );
|
|
101
|
+
*/
|
|
102
|
+
stdlib_complex128_t stdlib_complex128_from_complex128( const stdlib_complex128_t z ) {
|
|
103
|
+
stdlib_complex128_parts_t v1 = { z };
|
|
104
|
+
stdlib_complex128_parts_t v2;
|
|
105
|
+
v2.parts[ 0 ] = v1.parts[ 0 ];
|
|
106
|
+
v2.parts[ 1 ] = v1.parts[ 1 ]; // cppcheck-suppress unreadVariable
|
|
107
|
+
return v2.value;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Converts a signed 8-bit integer to a double-precision complex floating-point number.
|
|
112
|
+
*
|
|
113
|
+
* @param real real component
|
|
114
|
+
* @return double-precision complex floating-point number
|
|
115
|
+
*
|
|
116
|
+
* @example
|
|
117
|
+
* stdlib_complex128_t z = stdlib_complex128_from_int8( 5 );
|
|
118
|
+
*/
|
|
119
|
+
stdlib_complex128_t stdlib_complex128_from_int8( const int8_t real ) {
|
|
120
|
+
stdlib_complex128_parts_t z;
|
|
121
|
+
z.parts[ 0 ] = (double)real;
|
|
122
|
+
z.parts[ 1 ] = 0.0; // cppcheck-suppress unreadVariable
|
|
123
|
+
return z.value;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Converts an unsigned 8-bit integer to a double-precision complex floating-point number.
|
|
128
|
+
*
|
|
129
|
+
* @param real real component
|
|
130
|
+
* @return double-precision complex floating-point number
|
|
131
|
+
*
|
|
132
|
+
* @example
|
|
133
|
+
* stdlib_complex128_t z = stdlib_complex128_from_uint8( 5 );
|
|
134
|
+
*/
|
|
135
|
+
stdlib_complex128_t stdlib_complex128_from_uint8( const uint8_t real ) {
|
|
136
|
+
stdlib_complex128_parts_t z;
|
|
137
|
+
z.parts[ 0 ] = (double)real;
|
|
138
|
+
z.parts[ 1 ] = 0.0; // cppcheck-suppress unreadVariable
|
|
139
|
+
return z.value;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Converts a signed 16-bit integer to a double-precision complex floating-point number.
|
|
144
|
+
*
|
|
145
|
+
* @param real real component
|
|
146
|
+
* @return double-precision complex floating-point number
|
|
147
|
+
*
|
|
148
|
+
* @example
|
|
149
|
+
* stdlib_complex128_t z = stdlib_complex128_from_int16( 5 );
|
|
150
|
+
*/
|
|
151
|
+
stdlib_complex128_t stdlib_complex128_from_int16( const int16_t real ) {
|
|
152
|
+
stdlib_complex128_parts_t z;
|
|
153
|
+
z.parts[ 0 ] = (double)real;
|
|
154
|
+
z.parts[ 1 ] = 0.0; // cppcheck-suppress unreadVariable
|
|
155
|
+
return z.value;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Converts an unsigned 16-bit integer to a double-precision complex floating-point number.
|
|
160
|
+
*
|
|
161
|
+
* @param real real component
|
|
162
|
+
* @return double-precision complex floating-point number
|
|
163
|
+
*
|
|
164
|
+
* @example
|
|
165
|
+
* stdlib_complex128_t z = stdlib_complex128_from_uint16( 5 );
|
|
166
|
+
*/
|
|
167
|
+
stdlib_complex128_t stdlib_complex128_from_uint16( const uint16_t real ) {
|
|
168
|
+
stdlib_complex128_parts_t z;
|
|
169
|
+
z.parts[ 0 ] = (double)real;
|
|
170
|
+
z.parts[ 1 ] = 0.0; // cppcheck-suppress unreadVariable
|
|
171
|
+
return z.value;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Converts a signed 32-bit integer to a double-precision complex floating-point number.
|
|
176
|
+
*
|
|
177
|
+
* @param real real component
|
|
178
|
+
* @return double-precision complex floating-point number
|
|
179
|
+
*
|
|
180
|
+
* @example
|
|
181
|
+
* stdlib_complex128_t z = stdlib_complex128_from_int32( 5 );
|
|
182
|
+
*/
|
|
183
|
+
stdlib_complex128_t stdlib_complex128_from_int32( const int32_t real ) {
|
|
184
|
+
stdlib_complex128_parts_t z;
|
|
185
|
+
z.parts[ 0 ] = (double)real;
|
|
186
|
+
z.parts[ 1 ] = 0.0; // cppcheck-suppress unreadVariable
|
|
187
|
+
return z.value;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Converts an unsigned 32-bit integer to a double-precision complex floating-point number.
|
|
192
|
+
*
|
|
193
|
+
* @param real real component
|
|
194
|
+
* @return double-precision complex floating-point number
|
|
195
|
+
*
|
|
196
|
+
* @example
|
|
197
|
+
* stdlib_complex128_t z = stdlib_complex128_from_uint32( 5 );
|
|
198
|
+
*/
|
|
199
|
+
stdlib_complex128_t stdlib_complex128_from_uint32( const uint32_t real ) {
|
|
200
|
+
stdlib_complex128_parts_t z;
|
|
201
|
+
z.parts[ 0 ] = (double)real;
|
|
202
|
+
z.parts[ 1 ] = 0.0; // cppcheck-suppress unreadVariable
|
|
203
|
+
return z.value;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* Converts a double-precision complex floating-point number to a single-precision complex floating-point number.
|
|
208
|
+
*
|
|
209
|
+
* @param z double-precision complex floating-point number
|
|
210
|
+
* @return single-precision complex floating-point number
|
|
211
|
+
*
|
|
212
|
+
* @example
|
|
213
|
+
* #include "stdlib/complex/float32/ctor.h"
|
|
214
|
+
*
|
|
215
|
+
* stdlib_complex128_t z1 = stdlib_complex128( 5.0, 3.0 );
|
|
216
|
+
* stdlib_complex64_t z2 = stdlib_complex128_to_complex64( z1 );
|
|
217
|
+
*/
|
|
218
|
+
stdlib_complex64_t stdlib_complex128_to_complex64( const stdlib_complex128_t z ) {
|
|
219
|
+
stdlib_complex128_parts_t v1 = { z };
|
|
220
|
+
stdlib_complex64_parts_t v2;
|
|
221
|
+
v2.parts[ 0 ] = (float)v1.parts[ 0 ];
|
|
222
|
+
v2.parts[ 1 ] = (float)v1.parts[ 1 ]; // cppcheck-suppress unreadVariable
|
|
223
|
+
return v2.value;
|
|
224
|
+
}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @license Apache-2.0
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2024 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
|
+
/* eslint-disable max-lines */
|
|
22
|
+
|
|
23
|
+
import base = require( './../../../float64/base' );
|
|
24
|
+
import conj = require( './../../../float64/conj' );
|
|
25
|
+
import Complex128 = require( './../../../float64/ctor' );
|
|
26
|
+
import imag = require( './../../../float64/imag' );
|
|
27
|
+
import parseComplex128 = require( './../../../float64/parse' );
|
|
28
|
+
import real = require( './../../../float64/real' );
|
|
29
|
+
import reim = require( './../../../float64/reim' );
|
|
30
|
+
import reviveComplex128 = require( './../../../float64/reviver' );
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Interface describing the `float64` namespace.
|
|
34
|
+
*/
|
|
35
|
+
interface Namespace {
|
|
36
|
+
/**
|
|
37
|
+
* Base (i.e., lower-level) double-precision complex number functions.
|
|
38
|
+
*/
|
|
39
|
+
base: typeof base;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Returns the complex conjugate of a double-precision complex floating-point number.
|
|
43
|
+
*
|
|
44
|
+
* @param z - complex number
|
|
45
|
+
* @returns complex conjugate
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* var Complex128 = require( './../../../float64/ctor' );
|
|
49
|
+
*
|
|
50
|
+
* var z = new Complex128( 5.0, 3.0 );
|
|
51
|
+
*
|
|
52
|
+
* var v = ns.conj( z );
|
|
53
|
+
* // returns <Complex128>[ 5.0, -3.0 ]
|
|
54
|
+
*/
|
|
55
|
+
conj: typeof conj;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* 128-bit complex number.
|
|
59
|
+
*/
|
|
60
|
+
Complex128: typeof Complex128;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Returns the imaginary component of a double-precision complex floating-point number.
|
|
64
|
+
*
|
|
65
|
+
* @param z - complex number
|
|
66
|
+
* @returns imaginary component
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* var Complex128 = require( './../../../float64/ctor' );
|
|
70
|
+
*
|
|
71
|
+
* var z = new Complex128( 5.0, 3.0 );
|
|
72
|
+
*
|
|
73
|
+
* var im = ns.imag( z );
|
|
74
|
+
* // returns 3.0
|
|
75
|
+
*/
|
|
76
|
+
imag: typeof imag;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Parse a string representation of a 128-bit complex number.
|
|
80
|
+
*
|
|
81
|
+
* @param str - string representation of a complex number
|
|
82
|
+
* @throws must provide a string recognized as a complex number
|
|
83
|
+
* @returns Complex128 instance
|
|
84
|
+
*
|
|
85
|
+
* @example
|
|
86
|
+
* var str = '5 + 3i';
|
|
87
|
+
*
|
|
88
|
+
* var z = ns.parseComplex128( str );
|
|
89
|
+
* // returns <Complex128>
|
|
90
|
+
*/
|
|
91
|
+
parseComplex128: typeof parseComplex128;
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Returns the real component of a double-precision complex floating-point number.
|
|
95
|
+
*
|
|
96
|
+
* @param z - complex number
|
|
97
|
+
* @returns real component
|
|
98
|
+
*
|
|
99
|
+
* @example
|
|
100
|
+
* var Complex128 = require( './../../../float64/ctor' );
|
|
101
|
+
*
|
|
102
|
+
* var z = new Complex128( 5.0, 3.0 );
|
|
103
|
+
*
|
|
104
|
+
* var re = ns.real( z );
|
|
105
|
+
* // returns 5.0
|
|
106
|
+
*/
|
|
107
|
+
real: typeof real;
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Returns the real and imaginary components of a double-precision complex floating-point number.
|
|
111
|
+
*
|
|
112
|
+
* @param z - complex number
|
|
113
|
+
* @returns real and imaginary components
|
|
114
|
+
*
|
|
115
|
+
* @example
|
|
116
|
+
* var Complex128 = require( './../../../float64/ctor' );
|
|
117
|
+
*
|
|
118
|
+
* var z = new Complex128( 5.0, 3.0 );
|
|
119
|
+
*
|
|
120
|
+
* var out = ns.reim( z );
|
|
121
|
+
* // returns <Float64Array>[ 5.0, 3.0 ]
|
|
122
|
+
*/
|
|
123
|
+
reim: typeof reim;
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Revives a JSON-serialized 128-bit complex number.
|
|
127
|
+
*
|
|
128
|
+
* @param key - key
|
|
129
|
+
* @param value - value
|
|
130
|
+
* @returns value or 128-bit complex number
|
|
131
|
+
*
|
|
132
|
+
* @example
|
|
133
|
+
* var parseJSON = require( '@stdlib/utils/parse-json' );
|
|
134
|
+
*
|
|
135
|
+
* var str = '{"type":"Complex128","re":5,"im":3}';
|
|
136
|
+
*
|
|
137
|
+
* var z = parseJSON( str, ns.reviveComplex128 );
|
|
138
|
+
* // returns <Complex128>
|
|
139
|
+
*/
|
|
140
|
+
reviveComplex128: typeof reviveComplex128;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Double-precision complex number functions.
|
|
145
|
+
*/
|
|
146
|
+
declare var ns: Namespace;
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
// EXPORTS //
|
|
150
|
+
|
|
151
|
+
export = ns;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @license Apache-2.0
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2024 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
|
+
/* eslint-disable @typescript-eslint/no-unused-expressions */
|
|
20
|
+
|
|
21
|
+
import ns = require( './index' );
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
// TESTS //
|
|
25
|
+
|
|
26
|
+
// The exported value is the expected interface...
|
|
27
|
+
{
|
|
28
|
+
ns; // $ExpectType Namespace
|
|
29
|
+
}
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
|
|
3
|
+
@license Apache-2.0
|
|
4
|
+
|
|
5
|
+
Copyright (c) 2018 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
|
+
# imag
|
|
22
|
+
|
|
23
|
+
> Return the imaginary component of a double-precision complex floating-point number.
|
|
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 imag = require( '@stdlib/complex/float64/imag' );
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
#### imag( z )
|
|
44
|
+
|
|
45
|
+
Returns the **imaginary** component of a double-precision complex floating-point number.
|
|
46
|
+
|
|
47
|
+
```javascript
|
|
48
|
+
var Complex128 = require( '@stdlib/complex/float64/ctor' );
|
|
49
|
+
|
|
50
|
+
var z = new Complex128( 5.0, 3.0 );
|
|
51
|
+
var im = imag( z );
|
|
52
|
+
// returns 3.0
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
</section>
|
|
56
|
+
|
|
57
|
+
<!-- /.usage -->
|
|
58
|
+
|
|
59
|
+
<!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
|
|
60
|
+
|
|
61
|
+
<section class="notes">
|
|
62
|
+
|
|
63
|
+
</section>
|
|
64
|
+
|
|
65
|
+
<!-- /.notes -->
|
|
66
|
+
|
|
67
|
+
<!-- Package usage examples. -->
|
|
68
|
+
|
|
69
|
+
<section class="examples">
|
|
70
|
+
|
|
71
|
+
## Examples
|
|
72
|
+
|
|
73
|
+
<!-- eslint-disable max-len -->
|
|
74
|
+
|
|
75
|
+
<!-- eslint no-undef: "error" -->
|
|
76
|
+
|
|
77
|
+
```javascript
|
|
78
|
+
var Complex128 = require( '@stdlib/complex/float64/ctor' );
|
|
79
|
+
var discreteUniform = require( '@stdlib/random/base/discrete-uniform' );
|
|
80
|
+
var filledarrayBy = require( '@stdlib/array/filled-by' );
|
|
81
|
+
var imag = require( '@stdlib/complex/float64/imag' );
|
|
82
|
+
|
|
83
|
+
function random() {
|
|
84
|
+
return new Complex128( discreteUniform( -10, 10 ), discreteUniform( -10, 10 ) );
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// Generate an array of random complex numbers:
|
|
88
|
+
var x = filledarrayBy( 100, 'complex128', random );
|
|
89
|
+
// returns <Complex128Array>
|
|
90
|
+
|
|
91
|
+
// Retrieve the imaginary component of each complex number...
|
|
92
|
+
var z;
|
|
93
|
+
var i;
|
|
94
|
+
for ( i = 0; i < x.length; i++ ) {
|
|
95
|
+
z = x.get( i );
|
|
96
|
+
console.log( 'imag(%s) = %d', z.toString(), imag( z ) );
|
|
97
|
+
}
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
</section>
|
|
101
|
+
|
|
102
|
+
<!-- /.examples -->
|
|
103
|
+
|
|
104
|
+
<!-- C interface documentation. -->
|
|
105
|
+
|
|
106
|
+
* * *
|
|
107
|
+
|
|
108
|
+
<section class="c">
|
|
109
|
+
|
|
110
|
+
## C APIs
|
|
111
|
+
|
|
112
|
+
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
|
|
113
|
+
|
|
114
|
+
<section class="intro">
|
|
115
|
+
|
|
116
|
+
</section>
|
|
117
|
+
|
|
118
|
+
<!-- /.intro -->
|
|
119
|
+
|
|
120
|
+
<!-- C usage documentation. -->
|
|
121
|
+
|
|
122
|
+
<section class="usage">
|
|
123
|
+
|
|
124
|
+
### Usage
|
|
125
|
+
|
|
126
|
+
```c
|
|
127
|
+
#include "stdlib/complex/float64/imag.h"
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
#### stdlib_complex128_imag( z )
|
|
131
|
+
|
|
132
|
+
Returns the imaginary component of a double-precision complex floating-point number.
|
|
133
|
+
|
|
134
|
+
```c
|
|
135
|
+
#include "stdlib/complex/float64/ctor.h"
|
|
136
|
+
|
|
137
|
+
stdlib_complex128_t z = stdlib_complex128( 5.0, 2.0 );
|
|
138
|
+
|
|
139
|
+
// ...
|
|
140
|
+
|
|
141
|
+
double im = stdlib_complex128_imag( z );
|
|
142
|
+
// returns 2.0
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
The function accepts the following arguments:
|
|
146
|
+
|
|
147
|
+
- **z**: `[in] stdlib_complex128_t` double-precision complex floating-point number.
|
|
148
|
+
|
|
149
|
+
```c
|
|
150
|
+
double stdlib_complex128_imag( const stdlib_complex128_t z );
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
</section>
|
|
154
|
+
|
|
155
|
+
<!-- /.usage -->
|
|
156
|
+
|
|
157
|
+
<!-- C API usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
|
|
158
|
+
|
|
159
|
+
<section class="notes">
|
|
160
|
+
|
|
161
|
+
</section>
|
|
162
|
+
|
|
163
|
+
<!-- /.notes -->
|
|
164
|
+
|
|
165
|
+
<!-- C API usage examples. -->
|
|
166
|
+
|
|
167
|
+
<section class="examples">
|
|
168
|
+
|
|
169
|
+
### Examples
|
|
170
|
+
|
|
171
|
+
```c
|
|
172
|
+
#include "stdlib/complex/float64/imag.h"
|
|
173
|
+
#include "stdlib/complex/float64/ctor.h"
|
|
174
|
+
#include <stdio.h>
|
|
175
|
+
|
|
176
|
+
int main( void ) {
|
|
177
|
+
const stdlib_complex128_t x[] = {
|
|
178
|
+
stdlib_complex128( 5.0, 2.0 ),
|
|
179
|
+
stdlib_complex128( -2.0, 1.0 ),
|
|
180
|
+
stdlib_complex128( 0.0, -0.0 ),
|
|
181
|
+
stdlib_complex128( 0.0/0.0, 0.0/0.0 )
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
int i;
|
|
185
|
+
for ( i = 0; i < 4; i++ ) {
|
|
186
|
+
printf( "imag(v) = %lf\n", stdlib_complex128_imag( x[ i ] ) );
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
</section>
|
|
192
|
+
|
|
193
|
+
<!-- /.examples -->
|
|
194
|
+
|
|
195
|
+
</section>
|
|
196
|
+
|
|
197
|
+
<!-- /.c -->
|
|
198
|
+
|
|
199
|
+
<!-- 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. -->
|
|
200
|
+
|
|
201
|
+
<section class="references">
|
|
202
|
+
|
|
203
|
+
</section>
|
|
204
|
+
|
|
205
|
+
<!-- /.references -->
|
|
206
|
+
|
|
207
|
+
<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
|
|
208
|
+
|
|
209
|
+
<section class="related">
|
|
210
|
+
|
|
211
|
+
* * *
|
|
212
|
+
|
|
213
|
+
## See Also
|
|
214
|
+
|
|
215
|
+
- <span class="package-name">[`@stdlib/complex/float64/real`][@stdlib/complex/float64/real]</span><span class="delimiter">: </span><span class="description">return the real component of a double-precision complex floating-point number.</span>
|
|
216
|
+
- <span class="package-name">[`@stdlib/complex/float64/reim`][@stdlib/complex/float64/reim]</span><span class="delimiter">: </span><span class="description">return the real and imaginary components of a double-precision complex floating-point number.</span>
|
|
217
|
+
|
|
218
|
+
</section>
|
|
219
|
+
|
|
220
|
+
<!-- /.related -->
|
|
221
|
+
|
|
222
|
+
<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
|
|
223
|
+
|
|
224
|
+
<section class="links">
|
|
225
|
+
|
|
226
|
+
<!-- <related-links> -->
|
|
227
|
+
|
|
228
|
+
[@stdlib/complex/float64/real]: https://github.com/stdlib-js/complex/tree/main/float64/real
|
|
229
|
+
|
|
230
|
+
[@stdlib/complex/float64/reim]: https://github.com/stdlib-js/complex/tree/main/float64/reim
|
|
231
|
+
|
|
232
|
+
<!-- </related-links> -->
|
|
233
|
+
|
|
234
|
+
</section>
|
|
235
|
+
|
|
236
|
+
<!-- /.links -->
|