@ohos-ports/stdlib-complex 0.0.0-stage → 0.4.1-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +177 -0
- package/NOTICE +1 -0
- package/README.md +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,617 @@
|
|
|
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
|
+
# Complex128
|
|
22
|
+
|
|
23
|
+
> 128-bit complex 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 Complex128 = require( '@stdlib/complex/float64/ctor' );
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
#### Complex128( real, imag )
|
|
44
|
+
|
|
45
|
+
128-bit complex number constructor, where `real` and `imag` are the **real** and **imaginary** components, respectively.
|
|
46
|
+
|
|
47
|
+
```javascript
|
|
48
|
+
var z = new Complex128( 5.0, 3.0 );
|
|
49
|
+
// returns <Complex128>
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
* * *
|
|
53
|
+
|
|
54
|
+
## Properties
|
|
55
|
+
|
|
56
|
+
#### Complex128.name
|
|
57
|
+
|
|
58
|
+
Static property returning the constructor name.
|
|
59
|
+
|
|
60
|
+
```javascript
|
|
61
|
+
var str = Complex128.name;
|
|
62
|
+
// returns 'Complex128'
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
#### Complex128.BYTES_PER_ELEMENT
|
|
66
|
+
|
|
67
|
+
Size (in bytes) of each component.
|
|
68
|
+
|
|
69
|
+
```javascript
|
|
70
|
+
var nbytes = Complex128.BYTES_PER_ELEMENT;
|
|
71
|
+
// returns 8
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
#### Complex128.prototype.BYTES_PER_ELEMENT
|
|
75
|
+
|
|
76
|
+
Size (in bytes) of each component.
|
|
77
|
+
|
|
78
|
+
```javascript
|
|
79
|
+
var z = new Complex128( 5.0, 3.0 );
|
|
80
|
+
|
|
81
|
+
var nbytes = z.BYTES_PER_ELEMENT;
|
|
82
|
+
// returns 8
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
#### Complex128.prototype.byteLength
|
|
86
|
+
|
|
87
|
+
Length (in bytes) of a complex number.
|
|
88
|
+
|
|
89
|
+
```javascript
|
|
90
|
+
var z = new Complex128( 5.0, 3.0 );
|
|
91
|
+
|
|
92
|
+
var nbytes = z.byteLength;
|
|
93
|
+
// returns 16
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Instance
|
|
97
|
+
|
|
98
|
+
A `Complex128` instance has the following properties...
|
|
99
|
+
|
|
100
|
+
#### re
|
|
101
|
+
|
|
102
|
+
A **read-only** property returning the **real** component.
|
|
103
|
+
|
|
104
|
+
```javascript
|
|
105
|
+
var z = new Complex128( 5.0, 3.0 );
|
|
106
|
+
|
|
107
|
+
var re = z.re;
|
|
108
|
+
// returns 5.0
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
#### im
|
|
112
|
+
|
|
113
|
+
A **read-only** property returning the **imaginary** component.
|
|
114
|
+
|
|
115
|
+
```javascript
|
|
116
|
+
var z = new Complex128( 5.0, -3.0 );
|
|
117
|
+
|
|
118
|
+
var im = z.im;
|
|
119
|
+
// returns -3.0
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
* * *
|
|
123
|
+
|
|
124
|
+
## Methods
|
|
125
|
+
|
|
126
|
+
### Accessor Methods
|
|
127
|
+
|
|
128
|
+
These methods do **not** mutate a `Complex128` instance and, instead, return a complex number representation.
|
|
129
|
+
|
|
130
|
+
#### Complex128.prototype.toString()
|
|
131
|
+
|
|
132
|
+
Returns a `string` representation of a `Complex128` instance.
|
|
133
|
+
|
|
134
|
+
```javascript
|
|
135
|
+
var z = new Complex128( 5.0, 3.0 );
|
|
136
|
+
var str = z.toString();
|
|
137
|
+
// returns '5 + 3i'
|
|
138
|
+
|
|
139
|
+
z = new Complex128( -5.0, -3.0 );
|
|
140
|
+
str = z.toString();
|
|
141
|
+
// returns '-5 - 3i'
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
#### Complex128.prototype.toJSON()
|
|
145
|
+
|
|
146
|
+
Returns a [JSON][json] representation of a `Complex128` instance. [`JSON.stringify()`][mdn-json-stringify] implicitly calls this method when stringifying a `Complex128` instance.
|
|
147
|
+
|
|
148
|
+
```javascript
|
|
149
|
+
var z = new Complex128( 5.0, -3.0 );
|
|
150
|
+
|
|
151
|
+
var o = z.toJSON();
|
|
152
|
+
/*
|
|
153
|
+
{
|
|
154
|
+
"type": "Complex128",
|
|
155
|
+
"re": 5.0,
|
|
156
|
+
"im": -3.0
|
|
157
|
+
}
|
|
158
|
+
*/
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
To [revive][mdn-json-parse] a `Complex128` number from a [JSON][json] `string`, see [@stdlib/complex/float64/reviver][@stdlib/complex/float64/reviver].
|
|
162
|
+
|
|
163
|
+
</section>
|
|
164
|
+
|
|
165
|
+
<!-- /.usage -->
|
|
166
|
+
|
|
167
|
+
* * *
|
|
168
|
+
|
|
169
|
+
<!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
|
|
170
|
+
|
|
171
|
+
<section class="notes">
|
|
172
|
+
|
|
173
|
+
## Notes
|
|
174
|
+
|
|
175
|
+
- Both the **real** and **imaginary** components are stored as double-precision floating-point numbers.
|
|
176
|
+
|
|
177
|
+
</section>
|
|
178
|
+
|
|
179
|
+
<!-- /.notes -->
|
|
180
|
+
|
|
181
|
+
* * *
|
|
182
|
+
|
|
183
|
+
<!-- Package usage examples. -->
|
|
184
|
+
|
|
185
|
+
<section class="examples">
|
|
186
|
+
|
|
187
|
+
## Examples
|
|
188
|
+
|
|
189
|
+
<!-- eslint no-undef: "error" -->
|
|
190
|
+
|
|
191
|
+
```javascript
|
|
192
|
+
var Complex128 = require( '@stdlib/complex/float64/ctor' );
|
|
193
|
+
|
|
194
|
+
var z = new Complex128( 3.0, -2.0 );
|
|
195
|
+
|
|
196
|
+
console.log( 'type: %s', typeof z );
|
|
197
|
+
// => 'type: object'
|
|
198
|
+
|
|
199
|
+
console.log( 'str: %s', z );
|
|
200
|
+
// => 'str: 3 - 2i'
|
|
201
|
+
|
|
202
|
+
console.log( 'real: %d', z.re );
|
|
203
|
+
// => 'real: 3'
|
|
204
|
+
|
|
205
|
+
console.log( 'imaginary: %d', z.im );
|
|
206
|
+
// => 'imaginary: -2'
|
|
207
|
+
|
|
208
|
+
console.log( 'JSON: %s', JSON.stringify( z ) );
|
|
209
|
+
// => 'JSON: {"type":"Complex128","re":3,"im":-2}'
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
</section>
|
|
213
|
+
|
|
214
|
+
<!-- /.examples -->
|
|
215
|
+
|
|
216
|
+
<!-- C interface documentation. -->
|
|
217
|
+
|
|
218
|
+
* * *
|
|
219
|
+
|
|
220
|
+
<section class="c">
|
|
221
|
+
|
|
222
|
+
## C APIs
|
|
223
|
+
|
|
224
|
+
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
|
|
225
|
+
|
|
226
|
+
<section class="intro">
|
|
227
|
+
|
|
228
|
+
</section>
|
|
229
|
+
|
|
230
|
+
<!-- /.intro -->
|
|
231
|
+
|
|
232
|
+
<!-- C usage documentation. -->
|
|
233
|
+
|
|
234
|
+
<section class="usage">
|
|
235
|
+
|
|
236
|
+
### Usage
|
|
237
|
+
|
|
238
|
+
```c
|
|
239
|
+
#include "stdlib/complex/float64/ctor.h"
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
#### stdlib_complex128_t
|
|
243
|
+
|
|
244
|
+
An opaque type definition for a double-precision complex floating-point number.
|
|
245
|
+
|
|
246
|
+
```c
|
|
247
|
+
stdlib_complex128_t z = stdlib_complex128( 5.0, 2.0 );
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
#### stdlib_complex128_parts_t
|
|
251
|
+
|
|
252
|
+
An opaque type definition for a union for accessing the real and imaginary parts of a double-precision complex floating-point number.
|
|
253
|
+
|
|
254
|
+
```c
|
|
255
|
+
double real( const stdlib_complex128_t z ) {
|
|
256
|
+
stdlib_complex128_parts_t v;
|
|
257
|
+
|
|
258
|
+
// Assign a double-precision complex floating-point number:
|
|
259
|
+
v.value = z;
|
|
260
|
+
|
|
261
|
+
// Extract the real component:
|
|
262
|
+
double re = v.parts[ 0 ];
|
|
263
|
+
|
|
264
|
+
return re;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
// ...
|
|
268
|
+
|
|
269
|
+
// Create a complex number:
|
|
270
|
+
stdlib_complex128_t z = stdlib_complex128( 5.0, 2.0 );
|
|
271
|
+
|
|
272
|
+
// ...
|
|
273
|
+
|
|
274
|
+
// Access the real component:
|
|
275
|
+
double re = real( z );
|
|
276
|
+
// returns 5.0
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
The union has the following members:
|
|
280
|
+
|
|
281
|
+
- **value**: `stdlib_complex128_t` double-precision complex floating-point number.
|
|
282
|
+
|
|
283
|
+
- **parts**: `double[]` array having the following elements:
|
|
284
|
+
|
|
285
|
+
- **0**: `double` real component.
|
|
286
|
+
- **1**: `double` imaginary component.
|
|
287
|
+
|
|
288
|
+
#### stdlib_complex128( real, imag )
|
|
289
|
+
|
|
290
|
+
Returns a double-precision complex floating-point number.
|
|
291
|
+
|
|
292
|
+
```c
|
|
293
|
+
stdlib_complex128_t z = stdlib_complex128( 5.0, 2.0 );
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
The function accepts the following arguments:
|
|
297
|
+
|
|
298
|
+
- **real**: `[in] double` real component.
|
|
299
|
+
- **imag**: `[in] double` imaginary component.
|
|
300
|
+
|
|
301
|
+
```c
|
|
302
|
+
stdlib_complex128_t stdlib_complex128( const double real, const double imag );
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
#### stdlib_complex128_from_float32( real )
|
|
306
|
+
|
|
307
|
+
Converts a single-precision floating-point number to a double-precision complex floating-point number.
|
|
308
|
+
|
|
309
|
+
```c
|
|
310
|
+
stdlib_complex128_t z = stdlib_complex128_from_float32( 5.0f );
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
The function accepts the following arguments:
|
|
314
|
+
|
|
315
|
+
- **real**: `[in] float` real component.
|
|
316
|
+
|
|
317
|
+
```c
|
|
318
|
+
stdlib_complex128_t stdlib_complex128_from_float32( const float real );
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
#### stdlib_complex128_from_float64( real )
|
|
322
|
+
|
|
323
|
+
Converts a double-precision floating-point number to a double-precision complex floating-point number.
|
|
324
|
+
|
|
325
|
+
```c
|
|
326
|
+
stdlib_complex128_t z = stdlib_complex128_from_float64( 5.0 );
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
The function accepts the following arguments:
|
|
330
|
+
|
|
331
|
+
- **real**: `[in] double` real component.
|
|
332
|
+
|
|
333
|
+
```c
|
|
334
|
+
stdlib_complex128_t stdlib_complex128_from_float64( const double real );
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
#### stdlib_complex128_from_complex64( z )
|
|
338
|
+
|
|
339
|
+
Converts a single-precision complex floating-point number to a double-precision complex floating-point number.
|
|
340
|
+
|
|
341
|
+
```c
|
|
342
|
+
#include "stdlib/complex/float32/ctor.h"
|
|
343
|
+
|
|
344
|
+
stdlib_complex64_t z1 = stdlib_complex64( 5.0f, 3.0f );
|
|
345
|
+
stdlib_complex128_t z2 = stdlib_complex128_from_complex64( z1 );
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
The function accepts the following arguments:
|
|
349
|
+
|
|
350
|
+
- **z**: `[in] stdlib_complex64_t` single-precision complex floating-point number.
|
|
351
|
+
|
|
352
|
+
```c
|
|
353
|
+
stdlib_complex128_t stdlib_complex128_from_complex64( const stdlib_complex64_t z );
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
#### stdlib_complex128_from_complex128( z )
|
|
357
|
+
|
|
358
|
+
Converts (copies) a double-precision complex floating-point number to a double-precision complex floating-point number.
|
|
359
|
+
|
|
360
|
+
```c
|
|
361
|
+
stdlib_complex128_t z1 = stdlib_complex128( 5.0, 3.0 );
|
|
362
|
+
stdlib_complex128_t z2 = stdlib_complex128_from_complex128( z1 );
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
The function accepts the following arguments:
|
|
366
|
+
|
|
367
|
+
- **z**: `[in] stdlib_complex128_t` double-precision complex floating-point number.
|
|
368
|
+
|
|
369
|
+
```c
|
|
370
|
+
stdlib_complex128_t stdlib_complex128_from_complex128( const stdlib_complex128_t z );
|
|
371
|
+
```
|
|
372
|
+
|
|
373
|
+
#### stdlib_complex128_from_int8( real )
|
|
374
|
+
|
|
375
|
+
Converts a signed 8-bit integer to a double-precision complex floating-point number.
|
|
376
|
+
|
|
377
|
+
```c
|
|
378
|
+
stdlib_complex128_t z = stdlib_complex128_from_int8( 5 );
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
The function accepts the following arguments:
|
|
382
|
+
|
|
383
|
+
- **real**: `[in] int8_t` real component.
|
|
384
|
+
|
|
385
|
+
```c
|
|
386
|
+
stdlib_complex128_t stdlib_complex128_from_int8( const int8_t real );
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
#### stdlib_complex128_from_uint8( real )
|
|
390
|
+
|
|
391
|
+
Converts an unsigned 8-bit integer to a double-precision complex floating-point number.
|
|
392
|
+
|
|
393
|
+
```c
|
|
394
|
+
stdlib_complex128_t z = stdlib_complex128_from_uint8( 5 );
|
|
395
|
+
```
|
|
396
|
+
|
|
397
|
+
The function accepts the following arguments:
|
|
398
|
+
|
|
399
|
+
- **real**: `[in] uint8_t` real component.
|
|
400
|
+
|
|
401
|
+
```c
|
|
402
|
+
stdlib_complex128_t stdlib_complex128_from_uint8( const uint8_t real );
|
|
403
|
+
```
|
|
404
|
+
|
|
405
|
+
#### stdlib_complex128_from_int16( real )
|
|
406
|
+
|
|
407
|
+
Converts a signed 16-bit integer to a double-precision complex floating-point number.
|
|
408
|
+
|
|
409
|
+
```c
|
|
410
|
+
stdlib_complex128_t z = stdlib_complex128_from_int16( 5 );
|
|
411
|
+
```
|
|
412
|
+
|
|
413
|
+
The function accepts the following arguments:
|
|
414
|
+
|
|
415
|
+
- **real**: `[in] int16_t` real component.
|
|
416
|
+
|
|
417
|
+
```c
|
|
418
|
+
stdlib_complex128_t stdlib_complex128_from_int16( const int16_t real );
|
|
419
|
+
```
|
|
420
|
+
|
|
421
|
+
#### stdlib_complex128_from_uint16( real )
|
|
422
|
+
|
|
423
|
+
Converts an unsigned 16-bit integer to a double-precision complex floating-point number.
|
|
424
|
+
|
|
425
|
+
```c
|
|
426
|
+
stdlib_complex128_t z = stdlib_complex128_from_uint16( 5 );
|
|
427
|
+
```
|
|
428
|
+
|
|
429
|
+
The function accepts the following arguments:
|
|
430
|
+
|
|
431
|
+
- **real**: `[in] uint16_t` real component.
|
|
432
|
+
|
|
433
|
+
```c
|
|
434
|
+
stdlib_complex128_t stdlib_complex128_from_uint16( const uint16_t real );
|
|
435
|
+
```
|
|
436
|
+
|
|
437
|
+
#### stdlib_complex128_from_int32( real )
|
|
438
|
+
|
|
439
|
+
Converts a signed 32-bit integer to a double-precision complex floating-point number.
|
|
440
|
+
|
|
441
|
+
```c
|
|
442
|
+
stdlib_complex128_t z = stdlib_complex128_from_int32( 5 );
|
|
443
|
+
```
|
|
444
|
+
|
|
445
|
+
The function accepts the following arguments:
|
|
446
|
+
|
|
447
|
+
- **real**: `[in] int32_t` real component.
|
|
448
|
+
|
|
449
|
+
```c
|
|
450
|
+
stdlib_complex128_t stdlib_complex128_from_int32( const int32_t real );
|
|
451
|
+
```
|
|
452
|
+
|
|
453
|
+
#### stdlib_complex128_from_uint32( real )
|
|
454
|
+
|
|
455
|
+
Converts an unsigned 32-bit integer to a double-precision complex floating-point number.
|
|
456
|
+
|
|
457
|
+
```c
|
|
458
|
+
stdlib_complex128_t z = stdlib_complex128_from_uint32( 5 );
|
|
459
|
+
```
|
|
460
|
+
|
|
461
|
+
The function accepts the following arguments:
|
|
462
|
+
|
|
463
|
+
- **real**: `[in] uint32_t` real component.
|
|
464
|
+
|
|
465
|
+
```c
|
|
466
|
+
stdlib_complex128_t stdlib_complex128_from_uint32( const uint32_t real );
|
|
467
|
+
```
|
|
468
|
+
|
|
469
|
+
#### stdlib_complex128_to_complex64( z )
|
|
470
|
+
|
|
471
|
+
Converts a double-precision complex floating-point number to a single-precision complex floating-point number.
|
|
472
|
+
|
|
473
|
+
```c
|
|
474
|
+
#include "stdlib/complex/float32/ctor.h"
|
|
475
|
+
|
|
476
|
+
stdlib_complex128_t z1 = stdlib_complex128( 5.0, 3.0 );
|
|
477
|
+
stdlib_complex64_t z2 = stdlib_complex128_to_complex64( z1 );
|
|
478
|
+
```
|
|
479
|
+
|
|
480
|
+
The function accepts the following arguments:
|
|
481
|
+
|
|
482
|
+
- **z**: `[in] stdlib_complex64_t` double-precision complex floating-point number.
|
|
483
|
+
|
|
484
|
+
```c
|
|
485
|
+
stdlib_complex64_t stdlib_complex128_to_complex64( const stdlib_complex128_t z );
|
|
486
|
+
```
|
|
487
|
+
|
|
488
|
+
</section>
|
|
489
|
+
|
|
490
|
+
<!-- /.usage -->
|
|
491
|
+
|
|
492
|
+
<!-- C API usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
|
|
493
|
+
|
|
494
|
+
<section class="notes">
|
|
495
|
+
|
|
496
|
+
</section>
|
|
497
|
+
|
|
498
|
+
<!-- /.notes -->
|
|
499
|
+
|
|
500
|
+
<!-- C API usage examples. -->
|
|
501
|
+
|
|
502
|
+
<section class="examples">
|
|
503
|
+
|
|
504
|
+
### Examples
|
|
505
|
+
|
|
506
|
+
```c
|
|
507
|
+
#include "stdlib/complex/float64/ctor.h"
|
|
508
|
+
#include <stdint.h>
|
|
509
|
+
#include <stdio.h>
|
|
510
|
+
|
|
511
|
+
/**
|
|
512
|
+
* Return the real component of a double-precision complex floating-point number.
|
|
513
|
+
*
|
|
514
|
+
* @param z complex number
|
|
515
|
+
* @return real component
|
|
516
|
+
*/
|
|
517
|
+
static double real( const stdlib_complex128_t z ) {
|
|
518
|
+
stdlib_complex128_parts_t v;
|
|
519
|
+
|
|
520
|
+
// Assign a double-precision complex floating-point number:
|
|
521
|
+
v.value = z;
|
|
522
|
+
|
|
523
|
+
// Extract the real component:
|
|
524
|
+
double re = v.parts[ 0 ];
|
|
525
|
+
|
|
526
|
+
return re;
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
/**
|
|
530
|
+
* Return the imaginary component of a double-precision complex floating-point number.
|
|
531
|
+
*
|
|
532
|
+
* @param z complex number
|
|
533
|
+
* @return imaginary component
|
|
534
|
+
*/
|
|
535
|
+
static double imag( const stdlib_complex128_t z ) {
|
|
536
|
+
stdlib_complex128_parts_t v;
|
|
537
|
+
|
|
538
|
+
// Assign a double-precision complex floating-point number:
|
|
539
|
+
v.value = z;
|
|
540
|
+
|
|
541
|
+
// Extract the imaginary component:
|
|
542
|
+
double im = v.parts[ 1 ];
|
|
543
|
+
|
|
544
|
+
return im;
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
int main( void ) {
|
|
548
|
+
const stdlib_complex128_t x[] = {
|
|
549
|
+
stdlib_complex128( 5.0, 2.0 ),
|
|
550
|
+
stdlib_complex128( -2.0, 1.0 ),
|
|
551
|
+
stdlib_complex128( 0.0, -0.0 ),
|
|
552
|
+
stdlib_complex128( 0.0/0.0, 0.0/0.0 )
|
|
553
|
+
};
|
|
554
|
+
|
|
555
|
+
stdlib_complex128_t v;
|
|
556
|
+
int i;
|
|
557
|
+
for ( i = 0; i < 4; i++ ) {
|
|
558
|
+
v = x[ i ];
|
|
559
|
+
printf( "%lf + %lfi\n", real( v ), imag( v ) );
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
```
|
|
563
|
+
|
|
564
|
+
</section>
|
|
565
|
+
|
|
566
|
+
<!-- /.examples -->
|
|
567
|
+
|
|
568
|
+
</section>
|
|
569
|
+
|
|
570
|
+
<!-- /.c -->
|
|
571
|
+
|
|
572
|
+
<!-- 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. -->
|
|
573
|
+
|
|
574
|
+
<section class="references">
|
|
575
|
+
|
|
576
|
+
</section>
|
|
577
|
+
|
|
578
|
+
<!-- /.references -->
|
|
579
|
+
|
|
580
|
+
<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
|
|
581
|
+
|
|
582
|
+
<section class="related">
|
|
583
|
+
|
|
584
|
+
* * *
|
|
585
|
+
|
|
586
|
+
## See Also
|
|
587
|
+
|
|
588
|
+
- <span class="package-name">[`@stdlib/complex/cmplx`][@stdlib/complex/cmplx]</span><span class="delimiter">: </span><span class="description">create a complex number.</span>
|
|
589
|
+
- <span class="package-name">[`@stdlib/complex/float32/ctor`][@stdlib/complex/float32/ctor]</span><span class="delimiter">: </span><span class="description">64-bit complex number.</span>
|
|
590
|
+
|
|
591
|
+
</section>
|
|
592
|
+
|
|
593
|
+
<!-- /.related -->
|
|
594
|
+
|
|
595
|
+
<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
|
|
596
|
+
|
|
597
|
+
<section class="links">
|
|
598
|
+
|
|
599
|
+
[json]: http://www.json.org/
|
|
600
|
+
|
|
601
|
+
[mdn-json-stringify]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify
|
|
602
|
+
|
|
603
|
+
[mdn-json-parse]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse
|
|
604
|
+
|
|
605
|
+
[@stdlib/complex/float64/reviver]: https://github.com/stdlib-js/complex/tree/main/float64/reviver
|
|
606
|
+
|
|
607
|
+
<!-- <related-links> -->
|
|
608
|
+
|
|
609
|
+
[@stdlib/complex/cmplx]: https://github.com/stdlib-js/complex/tree/main/cmplx
|
|
610
|
+
|
|
611
|
+
[@stdlib/complex/float32/ctor]: https://github.com/stdlib-js/complex/tree/main/float32/ctor
|
|
612
|
+
|
|
613
|
+
<!-- </related-links> -->
|
|
614
|
+
|
|
615
|
+
</section>
|
|
616
|
+
|
|
617
|
+
<!-- /.links -->
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
|
|
2
|
+
{{alias}}( real, imag )
|
|
3
|
+
128-bit complex number constructor.
|
|
4
|
+
|
|
5
|
+
Both the real and imaginary components are stored as double-precision
|
|
6
|
+
floating-point numbers.
|
|
7
|
+
|
|
8
|
+
Parameters
|
|
9
|
+
----------
|
|
10
|
+
real: number
|
|
11
|
+
Real component.
|
|
12
|
+
|
|
13
|
+
imag: number
|
|
14
|
+
Imaginary component.
|
|
15
|
+
|
|
16
|
+
Returns
|
|
17
|
+
-------
|
|
18
|
+
z: Complex128
|
|
19
|
+
128-bit complex number.
|
|
20
|
+
|
|
21
|
+
z.re: number
|
|
22
|
+
Read-only property returning the real component.
|
|
23
|
+
|
|
24
|
+
z.im: number
|
|
25
|
+
Read-only property returning the imaginary component.
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
{{alias}}.name
|
|
29
|
+
Constructor name.
|
|
30
|
+
|
|
31
|
+
Examples
|
|
32
|
+
--------
|
|
33
|
+
> var str = {{alias}}.name
|
|
34
|
+
'Complex128'
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
{{alias}}.BYTES_PER_ELEMENT
|
|
38
|
+
Size (in bytes) of each component.
|
|
39
|
+
|
|
40
|
+
Returns
|
|
41
|
+
-------
|
|
42
|
+
v: integer
|
|
43
|
+
Size (in bytes) of each component.
|
|
44
|
+
|
|
45
|
+
Examples
|
|
46
|
+
--------
|
|
47
|
+
> var s = {{alias}}.BYTES_PER_ELEMENT
|
|
48
|
+
8
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
{{alias}}.prototype.BYTES_PER_ELEMENT
|
|
52
|
+
Size (in bytes) of each component.
|
|
53
|
+
|
|
54
|
+
Returns
|
|
55
|
+
-------
|
|
56
|
+
s: integer
|
|
57
|
+
Size (in bytes) of each component.
|
|
58
|
+
|
|
59
|
+
Examples
|
|
60
|
+
--------
|
|
61
|
+
> var z = new {{alias}}( 5.0, 3.0 )
|
|
62
|
+
<Complex128>
|
|
63
|
+
> var s = z.BYTES_PER_ELEMENT
|
|
64
|
+
8
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
{{alias}}.prototype.byteLength
|
|
68
|
+
Length (in bytes) of a complex number.
|
|
69
|
+
|
|
70
|
+
Returns
|
|
71
|
+
-------
|
|
72
|
+
len: integer
|
|
73
|
+
Length (in bytes) of a complex number.
|
|
74
|
+
|
|
75
|
+
Examples
|
|
76
|
+
--------
|
|
77
|
+
> var z = new {{alias}}( 5.0, 3.0 )
|
|
78
|
+
<Complex128>
|
|
79
|
+
> var s = z.byteLength
|
|
80
|
+
16
|
|
81
|
+
|
|
82
|
+
See Also
|
|
83
|
+
--------
|
|
84
|
+
|