@ohos-ports/stdlib-complex-real 0.0.0-stage → 0.2.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 +320 -2
- package/SECURITY.md +5 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +7 -0
- package/docs/types/index.d.ts +44 -0
- package/include/stdlib/complex/real.h +40 -0
- package/lib/index.js +43 -0
- package/lib/main.js +42 -0
- package/manifest.json +40 -0
- package/node_modules/@stdlib/array-float32/LICENSE +177 -0
- package/node_modules/@stdlib/array-float32/NOTICE +1 -0
- package/node_modules/@stdlib/array-float32/README.md +1577 -0
- package/node_modules/@stdlib/array-float32/SECURITY.md +5 -0
- package/node_modules/@stdlib/array-float32/dist/index.d.ts +3 -0
- package/node_modules/@stdlib/array-float32/dist/index.js +19 -0
- package/node_modules/@stdlib/array-float32/dist/index.js.map +7 -0
- package/node_modules/@stdlib/array-float32/docs/types/index.d.ts +26 -0
- package/node_modules/@stdlib/array-float32/lib/index.js +52 -0
- package/node_modules/@stdlib/array-float32/lib/main.js +28 -0
- package/node_modules/@stdlib/array-float32/lib/polyfill.js +37 -0
- package/node_modules/@stdlib/array-float32/package.json +72 -0
- package/node_modules/@stdlib/assert-has-float32array-support/LICENSE +177 -0
- package/node_modules/@stdlib/assert-has-float32array-support/NOTICE +1 -0
- package/node_modules/@stdlib/assert-has-float32array-support/README.md +187 -0
- package/node_modules/@stdlib/assert-has-float32array-support/SECURITY.md +5 -0
- package/node_modules/@stdlib/assert-has-float32array-support/dist/index.d.ts +3 -0
- package/node_modules/@stdlib/assert-has-float32array-support/dist/index.js +7 -0
- package/node_modules/@stdlib/assert-has-float32array-support/dist/index.js.map +7 -0
- package/node_modules/@stdlib/assert-has-float32array-support/docs/types/index.d.ts +35 -0
- package/node_modules/@stdlib/assert-has-float32array-support/lib/float32array.js +28 -0
- package/node_modules/@stdlib/assert-has-float32array-support/lib/index.js +40 -0
- package/node_modules/@stdlib/assert-has-float32array-support/lib/main.js +65 -0
- package/node_modules/@stdlib/assert-has-float32array-support/package.json +77 -0
- package/node_modules/@stdlib/assert-has-own-property/LICENSE +177 -0
- package/node_modules/@stdlib/assert-has-own-property/NOTICE +1 -0
- package/node_modules/@stdlib/assert-has-own-property/README.md +263 -0
- package/node_modules/@stdlib/assert-has-own-property/SECURITY.md +5 -0
- package/node_modules/@stdlib/assert-has-own-property/dist/index.d.ts +3 -0
- package/node_modules/@stdlib/assert-has-own-property/dist/index.js +5 -0
- package/node_modules/@stdlib/assert-has-own-property/dist/index.js.map +7 -0
- package/node_modules/@stdlib/assert-has-own-property/docs/types/index.d.ts +49 -0
- package/node_modules/@stdlib/assert-has-own-property/lib/index.js +47 -0
- package/node_modules/@stdlib/assert-has-own-property/lib/main.js +64 -0
- package/node_modules/@stdlib/assert-has-own-property/package.json +73 -0
- package/node_modules/@stdlib/assert-has-symbol-support/LICENSE +177 -0
- package/node_modules/@stdlib/assert-has-symbol-support/NOTICE +1 -0
- package/node_modules/@stdlib/assert-has-symbol-support/README.md +193 -0
- package/node_modules/@stdlib/assert-has-symbol-support/SECURITY.md +5 -0
- package/node_modules/@stdlib/assert-has-symbol-support/dist/index.d.ts +3 -0
- package/node_modules/@stdlib/assert-has-symbol-support/dist/index.js +5 -0
- package/node_modules/@stdlib/assert-has-symbol-support/dist/index.js.map +7 -0
- package/node_modules/@stdlib/assert-has-symbol-support/docs/types/index.d.ts +35 -0
- package/node_modules/@stdlib/assert-has-symbol-support/lib/index.js +40 -0
- package/node_modules/@stdlib/assert-has-symbol-support/lib/main.js +42 -0
- package/node_modules/@stdlib/assert-has-symbol-support/package.json +72 -0
- package/node_modules/@stdlib/assert-has-tostringtag-support/LICENSE +177 -0
- package/node_modules/@stdlib/assert-has-tostringtag-support/NOTICE +1 -0
- package/node_modules/@stdlib/assert-has-tostringtag-support/README.md +187 -0
- package/node_modules/@stdlib/assert-has-tostringtag-support/SECURITY.md +5 -0
- package/node_modules/@stdlib/assert-has-tostringtag-support/dist/index.d.ts +3 -0
- package/node_modules/@stdlib/assert-has-tostringtag-support/dist/index.js +5 -0
- package/node_modules/@stdlib/assert-has-tostringtag-support/dist/index.js.map +7 -0
- package/node_modules/@stdlib/assert-has-tostringtag-support/docs/types/index.d.ts +35 -0
- package/node_modules/@stdlib/assert-has-tostringtag-support/lib/index.js +40 -0
- package/node_modules/@stdlib/assert-has-tostringtag-support/lib/main.js +49 -0
- package/node_modules/@stdlib/assert-has-tostringtag-support/package.json +78 -0
- package/node_modules/@stdlib/assert-is-float32array/LICENSE +177 -0
- package/node_modules/@stdlib/assert-is-float32array/NOTICE +1 -0
- package/node_modules/@stdlib/assert-is-float32array/README.md +229 -0
- package/node_modules/@stdlib/assert-is-float32array/SECURITY.md +5 -0
- package/node_modules/@stdlib/assert-is-float32array/dist/index.d.ts +3 -0
- package/node_modules/@stdlib/assert-is-float32array/dist/index.js +5 -0
- package/node_modules/@stdlib/assert-is-float32array/dist/index.js.map +7 -0
- package/node_modules/@stdlib/assert-is-float32array/docs/types/index.d.ts +42 -0
- package/node_modules/@stdlib/assert-is-float32array/lib/index.js +44 -0
- package/node_modules/@stdlib/assert-is-float32array/lib/main.js +59 -0
- package/node_modules/@stdlib/assert-is-float32array/package.json +81 -0
- package/node_modules/@stdlib/assert-is-number/LICENSE +177 -0
- package/node_modules/@stdlib/assert-is-number/NOTICE +1 -0
- package/node_modules/@stdlib/assert-is-number/README.md +231 -0
- package/node_modules/@stdlib/assert-is-number/SECURITY.md +5 -0
- package/node_modules/@stdlib/assert-is-number/dist/index.d.ts +3 -0
- package/node_modules/@stdlib/assert-is-number/dist/index.js +13 -0
- package/node_modules/@stdlib/assert-is-number/dist/index.js.map +7 -0
- package/node_modules/@stdlib/assert-is-number/docs/types/index.d.ts +121 -0
- package/node_modules/@stdlib/assert-is-number/lib/index.js +79 -0
- package/node_modules/@stdlib/assert-is-number/lib/main.js +58 -0
- package/node_modules/@stdlib/assert-is-number/lib/object.js +66 -0
- package/node_modules/@stdlib/assert-is-number/lib/primitive.js +46 -0
- package/node_modules/@stdlib/assert-is-number/lib/tostring.js +34 -0
- package/node_modules/@stdlib/assert-is-number/lib/try2serialize.js +47 -0
- package/node_modules/@stdlib/assert-is-number/package.json +80 -0
- package/node_modules/@stdlib/complex-float32/LICENSE +177 -0
- package/node_modules/@stdlib/complex-float32/NOTICE +1 -0
- package/node_modules/@stdlib/complex-float32/README.md +629 -0
- package/node_modules/@stdlib/complex-float32/SECURITY.md +5 -0
- package/node_modules/@stdlib/complex-float32/dist/index.d.ts +3 -0
- package/node_modules/@stdlib/complex-float32/dist/index.js +9 -0
- package/node_modules/@stdlib/complex-float32/dist/index.js.map +7 -0
- package/node_modules/@stdlib/complex-float32/docs/types/index.d.ts +111 -0
- package/node_modules/@stdlib/complex-float32/include/stdlib/complex/float32.h +148 -0
- package/node_modules/@stdlib/complex-float32/lib/index.js +40 -0
- package/node_modules/@stdlib/complex-float32/lib/main.js +159 -0
- package/node_modules/@stdlib/complex-float32/lib/tojson.js +39 -0
- package/node_modules/@stdlib/complex-float32/lib/tostring.js +42 -0
- package/node_modules/@stdlib/complex-float32/manifest.json +38 -0
- package/node_modules/@stdlib/complex-float32/package.json +76 -0
- package/node_modules/@stdlib/complex-float32/src/main.c +151 -0
- package/node_modules/@stdlib/complex-float64/LICENSE +177 -0
- package/node_modules/@stdlib/complex-float64/NOTICE +1 -0
- package/node_modules/@stdlib/complex-float64/README.md +699 -0
- package/node_modules/@stdlib/complex-float64/SECURITY.md +5 -0
- package/node_modules/@stdlib/complex-float64/dist/index.d.ts +3 -0
- package/node_modules/@stdlib/complex-float64/dist/index.js +9 -0
- package/node_modules/@stdlib/complex-float64/dist/index.js.map +7 -0
- package/node_modules/@stdlib/complex-float64/docs/types/index.d.ts +111 -0
- package/node_modules/@stdlib/complex-float64/include/stdlib/complex/float64.h +169 -0
- package/node_modules/@stdlib/complex-float64/lib/index.js +40 -0
- package/node_modules/@stdlib/complex-float64/lib/main.js +158 -0
- package/node_modules/@stdlib/complex-float64/lib/tojson.js +39 -0
- package/node_modules/@stdlib/complex-float64/lib/tostring.js +42 -0
- package/node_modules/@stdlib/complex-float64/manifest.json +40 -0
- package/node_modules/@stdlib/complex-float64/package.json +75 -0
- package/node_modules/@stdlib/complex-float64/src/main.c +224 -0
- package/node_modules/@stdlib/constants-float64-pinf/LICENSE +177 -0
- package/node_modules/@stdlib/constants-float64-pinf/NOTICE +1 -0
- package/node_modules/@stdlib/constants-float64-pinf/README.md +238 -0
- package/node_modules/@stdlib/constants-float64-pinf/SECURITY.md +5 -0
- package/node_modules/@stdlib/constants-float64-pinf/dist/index.d.ts +3 -0
- package/node_modules/@stdlib/constants-float64-pinf/dist/index.js +3 -0
- package/node_modules/@stdlib/constants-float64-pinf/dist/index.js.map +7 -0
- package/node_modules/@stdlib/constants-float64-pinf/docs/types/index.d.ts +33 -0
- package/node_modules/@stdlib/constants-float64-pinf/include/stdlib/constants/float64/pinf.h +29 -0
- package/node_modules/@stdlib/constants-float64-pinf/lib/index.js +56 -0
- package/node_modules/@stdlib/constants-float64-pinf/manifest.json +36 -0
- package/node_modules/@stdlib/constants-float64-pinf/package.json +71 -0
- package/node_modules/@stdlib/error-tools-fmtprodmsg/LICENSE +177 -0
- package/node_modules/@stdlib/error-tools-fmtprodmsg/NOTICE +1 -0
- package/node_modules/@stdlib/error-tools-fmtprodmsg/README.md +182 -0
- package/node_modules/@stdlib/error-tools-fmtprodmsg/SECURITY.md +5 -0
- package/node_modules/@stdlib/error-tools-fmtprodmsg/dist/index.d.ts +3 -0
- package/node_modules/@stdlib/error-tools-fmtprodmsg/dist/index.js +5 -0
- package/node_modules/@stdlib/error-tools-fmtprodmsg/dist/index.js.map +7 -0
- package/node_modules/@stdlib/error-tools-fmtprodmsg/docs/types/index.d.ts +39 -0
- package/node_modules/@stdlib/error-tools-fmtprodmsg/lib/index.js +40 -0
- package/node_modules/@stdlib/error-tools-fmtprodmsg/lib/main.js +48 -0
- package/node_modules/@stdlib/error-tools-fmtprodmsg/package.json +70 -0
- package/node_modules/@stdlib/number-ctor/LICENSE +177 -0
- package/node_modules/@stdlib/number-ctor/NOTICE +1 -0
- package/node_modules/@stdlib/number-ctor/README.md +212 -0
- package/node_modules/@stdlib/number-ctor/SECURITY.md +5 -0
- package/node_modules/@stdlib/number-ctor/dist/index.d.ts +3 -0
- package/node_modules/@stdlib/number-ctor/dist/index.js +5 -0
- package/node_modules/@stdlib/number-ctor/dist/index.js.map +7 -0
- package/node_modules/@stdlib/number-ctor/docs/types/index.d.ts +30 -0
- package/node_modules/@stdlib/number-ctor/lib/index.js +40 -0
- package/node_modules/@stdlib/number-ctor/lib/main.js +23 -0
- package/node_modules/@stdlib/number-ctor/package.json +62 -0
- package/node_modules/@stdlib/number-float64-base-to-float32/LICENSE +177 -0
- package/node_modules/@stdlib/number-float64-base-to-float32/NOTICE +1 -0
- package/node_modules/@stdlib/number-float64-base-to-float32/README.md +191 -0
- package/node_modules/@stdlib/number-float64-base-to-float32/SECURITY.md +5 -0
- package/node_modules/@stdlib/number-float64-base-to-float32/dist/index.d.ts +3 -0
- package/node_modules/@stdlib/number-float64-base-to-float32/dist/index.js +19 -0
- package/node_modules/@stdlib/number-float64-base-to-float32/dist/index.js.map +7 -0
- package/node_modules/@stdlib/number-float64-base-to-float32/docs/types/index.d.ts +36 -0
- package/node_modules/@stdlib/number-float64-base-to-float32/lib/index.js +51 -0
- package/node_modules/@stdlib/number-float64-base-to-float32/lib/main.js +28 -0
- package/node_modules/@stdlib/number-float64-base-to-float32/lib/polyfill.js +51 -0
- package/node_modules/@stdlib/number-float64-base-to-float32/package.json +76 -0
- package/node_modules/@stdlib/string-base-format-interpolate/LICENSE +177 -0
- package/node_modules/@stdlib/string-base-format-interpolate/NOTICE +1 -0
- package/node_modules/@stdlib/string-base-format-interpolate/README.md +219 -0
- package/node_modules/@stdlib/string-base-format-interpolate/SECURITY.md +5 -0
- package/node_modules/@stdlib/string-base-format-interpolate/dist/index.d.ts +3 -0
- package/node_modules/@stdlib/string-base-format-interpolate/dist/index.js +17 -0
- package/node_modules/@stdlib/string-base-format-interpolate/dist/index.js.map +7 -0
- package/node_modules/@stdlib/string-base-format-interpolate/docs/types/index.d.ts +71 -0
- package/node_modules/@stdlib/string-base-format-interpolate/lib/format_double.js +103 -0
- package/node_modules/@stdlib/string-base-format-interpolate/lib/format_integer.js +115 -0
- package/node_modules/@stdlib/string-base-format-interpolate/lib/index.js +41 -0
- package/node_modules/@stdlib/string-base-format-interpolate/lib/is_number.js +46 -0
- package/node_modules/@stdlib/string-base-format-interpolate/lib/is_string.js +42 -0
- package/node_modules/@stdlib/string-base-format-interpolate/lib/main.js +243 -0
- package/node_modules/@stdlib/string-base-format-interpolate/lib/space_pad.js +65 -0
- package/node_modules/@stdlib/string-base-format-interpolate/lib/zero_pad.js +84 -0
- package/node_modules/@stdlib/string-base-format-interpolate/package.json +71 -0
- package/node_modules/@stdlib/string-base-format-tokenize/LICENSE +177 -0
- package/node_modules/@stdlib/string-base-format-tokenize/NOTICE +1 -0
- package/node_modules/@stdlib/string-base-format-tokenize/README.md +203 -0
- package/node_modules/@stdlib/string-base-format-tokenize/SECURITY.md +5 -0
- package/node_modules/@stdlib/string-base-format-tokenize/dist/index.d.ts +3 -0
- package/node_modules/@stdlib/string-base-format-tokenize/dist/index.js +5 -0
- package/node_modules/@stdlib/string-base-format-tokenize/dist/index.js.map +7 -0
- package/node_modules/@stdlib/string-base-format-tokenize/docs/types/index.d.ts +68 -0
- package/node_modules/@stdlib/string-base-format-tokenize/lib/index.js +41 -0
- package/node_modules/@stdlib/string-base-format-tokenize/lib/main.js +95 -0
- package/node_modules/@stdlib/string-base-format-tokenize/package.json +69 -0
- package/node_modules/@stdlib/string-format/LICENSE +177 -0
- package/node_modules/@stdlib/string-format/NOTICE +1 -0
- package/node_modules/@stdlib/string-format/README.md +341 -0
- package/node_modules/@stdlib/string-format/SECURITY.md +5 -0
- package/node_modules/@stdlib/string-format/dist/index.d.ts +3 -0
- package/node_modules/@stdlib/string-format/dist/index.js +7 -0
- package/node_modules/@stdlib/string-format/dist/index.js.map +7 -0
- package/node_modules/@stdlib/string-format/docs/types/index.d.ts +42 -0
- package/node_modules/@stdlib/string-format/lib/index.js +43 -0
- package/node_modules/@stdlib/string-format/lib/is_string.js +42 -0
- package/node_modules/@stdlib/string-format/lib/main.js +64 -0
- package/node_modules/@stdlib/string-format/package.json +72 -0
- package/node_modules/@stdlib/symbol-ctor/LICENSE +177 -0
- package/node_modules/@stdlib/symbol-ctor/NOTICE +1 -0
- package/node_modules/@stdlib/symbol-ctor/README.md +234 -0
- package/node_modules/@stdlib/symbol-ctor/SECURITY.md +5 -0
- package/node_modules/@stdlib/symbol-ctor/dist/index.d.ts +3 -0
- package/node_modules/@stdlib/symbol-ctor/dist/index.js +5 -0
- package/node_modules/@stdlib/symbol-ctor/dist/index.js.map +7 -0
- package/node_modules/@stdlib/symbol-ctor/docs/types/index.d.ts +34 -0
- package/node_modules/@stdlib/symbol-ctor/lib/index.js +40 -0
- package/node_modules/@stdlib/symbol-ctor/lib/main.js +28 -0
- package/node_modules/@stdlib/symbol-ctor/package.json +62 -0
- package/node_modules/@stdlib/types/LICENSE +177 -0
- package/node_modules/@stdlib/types/NOTICE +1 -0
- package/node_modules/@stdlib/types/README.md +212 -0
- package/node_modules/@stdlib/types/SECURITY.md +5 -0
- package/node_modules/@stdlib/types/index.d.ts +3923 -0
- package/node_modules/@stdlib/types/lib/browser.js +28 -0
- package/node_modules/@stdlib/types/lib/index.js +39 -0
- package/node_modules/@stdlib/types/lib/main.js +40 -0
- package/node_modules/@stdlib/types/package.json +67 -0
- package/node_modules/@stdlib/types/test.ts +734 -0
- package/node_modules/@stdlib/utils-define-nonenumerable-read-only-property/LICENSE +177 -0
- package/node_modules/@stdlib/utils-define-nonenumerable-read-only-property/NOTICE +1 -0
- package/node_modules/@stdlib/utils-define-nonenumerable-read-only-property/README.md +216 -0
- package/node_modules/@stdlib/utils-define-nonenumerable-read-only-property/SECURITY.md +5 -0
- package/node_modules/@stdlib/utils-define-nonenumerable-read-only-property/dist/index.d.ts +3 -0
- package/node_modules/@stdlib/utils-define-nonenumerable-read-only-property/dist/index.js +31 -0
- package/node_modules/@stdlib/utils-define-nonenumerable-read-only-property/dist/index.js.map +7 -0
- package/node_modules/@stdlib/utils-define-nonenumerable-read-only-property/dist/main.js +58 -0
- package/node_modules/@stdlib/utils-define-nonenumerable-read-only-property/docs/types/index.d.ts +52 -0
- package/node_modules/@stdlib/utils-define-nonenumerable-read-only-property/lib/index.js +47 -0
- package/node_modules/@stdlib/utils-define-nonenumerable-read-only-property/lib/main.js +58 -0
- package/node_modules/@stdlib/utils-define-nonenumerable-read-only-property/package.json +92 -0
- package/node_modules/@stdlib/utils-define-property/LICENSE +177 -0
- package/node_modules/@stdlib/utils-define-property/NOTICE +1 -0
- package/node_modules/@stdlib/utils-define-property/README.md +228 -0
- package/node_modules/@stdlib/utils-define-property/SECURITY.md +5 -0
- package/node_modules/@stdlib/utils-define-property/dist/index.d.ts +3 -0
- package/node_modules/@stdlib/utils-define-property/dist/index.js +36 -0
- package/node_modules/@stdlib/utils-define-property/dist/index.js.map +7 -0
- package/node_modules/@stdlib/utils-define-property/docs/types/index.d.ts +52 -0
- package/node_modules/@stdlib/utils-define-property/lib/builtin.js +61 -0
- package/node_modules/@stdlib/utils-define-property/lib/define_property.js +28 -0
- package/node_modules/@stdlib/utils-define-property/lib/has_define_property_support.js +51 -0
- package/node_modules/@stdlib/utils-define-property/lib/index.js +58 -0
- package/node_modules/@stdlib/utils-define-property/lib/polyfill.js +122 -0
- package/node_modules/@stdlib/utils-define-property/package.json +74 -0
- package/node_modules/@stdlib/utils-native-class/LICENSE +177 -0
- package/node_modules/@stdlib/utils-native-class/NOTICE +1 -0
- package/node_modules/@stdlib/utils-native-class/README.md +349 -0
- package/node_modules/@stdlib/utils-native-class/SECURITY.md +5 -0
- package/node_modules/@stdlib/utils-native-class/dist/index.d.ts +3 -0
- package/node_modules/@stdlib/utils-native-class/dist/index.js +11 -0
- package/node_modules/@stdlib/utils-native-class/dist/index.js.map +7 -0
- package/node_modules/@stdlib/utils-native-class/docs/types/index.d.ts +51 -0
- package/node_modules/@stdlib/utils-native-class/lib/index.js +61 -0
- package/node_modules/@stdlib/utils-native-class/lib/main.js +56 -0
- package/node_modules/@stdlib/utils-native-class/lib/polyfill.js +81 -0
- package/node_modules/@stdlib/utils-native-class/lib/tostring.js +28 -0
- package/node_modules/@stdlib/utils-native-class/lib/tostringtag.js +33 -0
- package/node_modules/@stdlib/utils-native-class/package.json +83 -0
- package/package.json +72 -4
- package/src/main.c +42 -0
|
@@ -0,0 +1,111 @@
|
|
|
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
|
+
// TypeScript Version: 4.1
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* 64-bit complex number.
|
|
23
|
+
*/
|
|
24
|
+
declare class Complex64 {
|
|
25
|
+
/**
|
|
26
|
+
* 64-bit complex number constructor.
|
|
27
|
+
*
|
|
28
|
+
* @param real - real component
|
|
29
|
+
* @param imag - imaginary component
|
|
30
|
+
* @returns 64-bit complex number
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* var z = new Complex64( 5.0, 3.0 );
|
|
34
|
+
* // returns <Complex64>
|
|
35
|
+
*/
|
|
36
|
+
constructor( real: number, imag: number );
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Read-only property returning the real component.
|
|
40
|
+
*
|
|
41
|
+
* @returns real component
|
|
42
|
+
*/
|
|
43
|
+
readonly re: number;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Read-only property returning the imaginary component.
|
|
47
|
+
*
|
|
48
|
+
* @returns imaginary component
|
|
49
|
+
*/
|
|
50
|
+
readonly im: number;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Size (in bytes) of each component.
|
|
54
|
+
*
|
|
55
|
+
* @returns size of each component
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* var nbytes = Complex64.BYTES_PER_ELEMENT;
|
|
59
|
+
* // returns 4
|
|
60
|
+
*/
|
|
61
|
+
readonly BYTES_PER_ELEMENT: 4;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Length (in bytes) of a complex number.
|
|
65
|
+
*
|
|
66
|
+
* @returns byte length
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* var z = new Complex64( 5.0, 3.0 );
|
|
70
|
+
*
|
|
71
|
+
* var nbytes = z.byteLength;
|
|
72
|
+
* // returns 8
|
|
73
|
+
*/
|
|
74
|
+
readonly byteLength: 8;
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Serializes a complex number as a string.
|
|
78
|
+
*
|
|
79
|
+
* @returns serialized complex number
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
* var z = new Complex64( 5.0, 3.0 );
|
|
83
|
+
*
|
|
84
|
+
* var str = z.toString();
|
|
85
|
+
* // returns '5 + 3i'
|
|
86
|
+
*/
|
|
87
|
+
toString(): string;
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Serializes a complex number as a JSON object.
|
|
91
|
+
*
|
|
92
|
+
* ## Notes
|
|
93
|
+
*
|
|
94
|
+
* - `JSON.stringify()` implicitly calls this method when stringifying a `Complex64` instance.
|
|
95
|
+
*
|
|
96
|
+
*
|
|
97
|
+
* @returns serialized complex number
|
|
98
|
+
*
|
|
99
|
+
* @example
|
|
100
|
+
* var z = new Complex64( 5.0, 3.0 );
|
|
101
|
+
*
|
|
102
|
+
* var obj = z.toJSON();
|
|
103
|
+
* // returns { 'type': 'Complex64', 're': 5.0, 'im': 3.0 }
|
|
104
|
+
*/
|
|
105
|
+
toJSON(): any;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
// EXPORTS //
|
|
110
|
+
|
|
111
|
+
export = Complex64;
|
|
@@ -0,0 +1,148 @@
|
|
|
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
|
+
#ifndef STDLIB_COMPLEX_FLOAT32_H
|
|
20
|
+
#define STDLIB_COMPLEX_FLOAT32_H
|
|
21
|
+
|
|
22
|
+
#include <complex.h>
|
|
23
|
+
#include <stdint.h>
|
|
24
|
+
|
|
25
|
+
/*
|
|
26
|
+
* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler.
|
|
27
|
+
*/
|
|
28
|
+
#ifdef __cplusplus
|
|
29
|
+
extern "C" {
|
|
30
|
+
#endif
|
|
31
|
+
|
|
32
|
+
// Check for C11 support where we can precisely define a complex number and thus avoid issues concerning infinities and NaNs as real and/or imaginary components... (TODO: revisit the following check; similar to NumPy, we may want to check for a compile time variable (e.g., STDLIB_USE_C99_COMPLEX), rather than checking for C11 support, especially if we are not using C11 functionality)
|
|
33
|
+
#if defined(_Imaginary_I) && defined(CMPLXF)
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* An opaque type definition for a single-precision complex floating-point number.
|
|
37
|
+
*/
|
|
38
|
+
typedef float complex stdlib_complex64_t;
|
|
39
|
+
|
|
40
|
+
// If we aren't going to use the native complex number type, we need to define a complex number as an "opaque" struct (here, "opaque" meaning type consumers should **not** be accessing the components directly, but only through dedicated functions) for storing the real and imaginary components...
|
|
41
|
+
#else
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* An opaque type definition for a single-precision complex floating-point number.
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* stdlib_complex64_t z;
|
|
48
|
+
*
|
|
49
|
+
* // Set the real component:
|
|
50
|
+
* z.re = 5.0f;
|
|
51
|
+
*
|
|
52
|
+
* // Set the imaginary component:
|
|
53
|
+
* z.im = 2.0f;
|
|
54
|
+
*/
|
|
55
|
+
typedef struct {
|
|
56
|
+
/**
|
|
57
|
+
* Real component.
|
|
58
|
+
*/
|
|
59
|
+
float re;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Imaginary component.
|
|
63
|
+
*/
|
|
64
|
+
float im;
|
|
65
|
+
} stdlib_complex64_t;
|
|
66
|
+
|
|
67
|
+
#endif
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* An opaque type definition for a union for accessing the real and imaginary parts of a single-precision complex floating-point number.
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* float realf( const stdlib_complex64_t z ) {
|
|
74
|
+
* stdlib_complex64_parts_t v;
|
|
75
|
+
*
|
|
76
|
+
* // Assign a single-precision complex floating-point number:
|
|
77
|
+
* v.value = z;
|
|
78
|
+
*
|
|
79
|
+
* // Extract the real component:
|
|
80
|
+
* float re = v.parts[ 0 ];
|
|
81
|
+
*
|
|
82
|
+
* return re;
|
|
83
|
+
* }
|
|
84
|
+
*
|
|
85
|
+
* // ...
|
|
86
|
+
*
|
|
87
|
+
* // Create a complex number:
|
|
88
|
+
* stdlib_complex64_t z = stdlib_complex64( 5.0f, 2.0f );
|
|
89
|
+
*
|
|
90
|
+
* // ...
|
|
91
|
+
*
|
|
92
|
+
* // Access the real component:
|
|
93
|
+
* float re = realf( z );
|
|
94
|
+
* // returns 5.0f
|
|
95
|
+
*/
|
|
96
|
+
typedef union {
|
|
97
|
+
// An opaque type for the output value (e.g., could be a `struct` or a C99 complex number):
|
|
98
|
+
stdlib_complex64_t value;
|
|
99
|
+
|
|
100
|
+
// Leverage the fact that C99 specifies that complex numbers have the same representation and alignment as a two-element array (see <https://en.cppreference.com/w/c/language/arithmetic_types#Complex_floating_types>), where the first element is the real component and the second element is the imaginary component, thus allowing us to create a complex number irrespective of its native data type (e.g., `struct` vs `float complex`):
|
|
101
|
+
float parts[ 2 ];
|
|
102
|
+
} stdlib_complex64_parts_t;
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Returns a single-precision complex floating-point number.
|
|
106
|
+
*/
|
|
107
|
+
stdlib_complex64_t stdlib_complex64( const float real, const float imag );
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Converts a single-precision floating-point number to a single-precision complex floating-point number.
|
|
111
|
+
*/
|
|
112
|
+
stdlib_complex64_t stdlib_complex64_from_float32( const float real );
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Converts a double-precision floating-point number to a single-precision complex floating-point number.
|
|
116
|
+
*/
|
|
117
|
+
stdlib_complex64_t stdlib_complex64_from_float64( const double real );
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Converts (copies) a single-precision complex floating-point number to a single-precision complex floating-point number.
|
|
121
|
+
*/
|
|
122
|
+
stdlib_complex64_t stdlib_complex64_from_complex64( const stdlib_complex64_t z );
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Converts a signed 8-bit integer to a single-precision complex floating-point number.
|
|
126
|
+
*/
|
|
127
|
+
stdlib_complex64_t stdlib_complex64_from_int8( const int8_t real );
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Converts an unsigned 8-bit integer to a single-precision complex floating-point number.
|
|
131
|
+
*/
|
|
132
|
+
stdlib_complex64_t stdlib_complex64_from_uint8( const uint8_t real );
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Converts a signed 16-bit integer to a single-precision complex floating-point number.
|
|
136
|
+
*/
|
|
137
|
+
stdlib_complex64_t stdlib_complex64_from_int16( const int16_t real );
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Converts an unsigned 16-bit integer to a single-precision complex floating-point number.
|
|
141
|
+
*/
|
|
142
|
+
stdlib_complex64_t stdlib_complex64_from_uint16( const uint16_t real );
|
|
143
|
+
|
|
144
|
+
#ifdef __cplusplus
|
|
145
|
+
}
|
|
146
|
+
#endif
|
|
147
|
+
|
|
148
|
+
#endif // !STDLIB_COMPLEX_FLOAT32_H
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Apache-2.0
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2018 The Stdlib Authors.
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
'use strict';
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* 64-bit complex number constructor.
|
|
23
|
+
*
|
|
24
|
+
* @module @stdlib/complex-float32
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* var Complex64 = require( '@stdlib/complex-float32' );
|
|
28
|
+
*
|
|
29
|
+
* var z = new Complex64( 5.0, 3.0 );
|
|
30
|
+
* // returns <Complex64>
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
// MODULES //
|
|
34
|
+
|
|
35
|
+
var main = require( './main.js' );
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
// EXPORTS //
|
|
39
|
+
|
|
40
|
+
module.exports = main;
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Apache-2.0
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2018 The Stdlib Authors.
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
'use strict';
|
|
20
|
+
|
|
21
|
+
// MODULES //
|
|
22
|
+
|
|
23
|
+
var isNumber = require( '@stdlib/assert-is-number' ).isPrimitive;
|
|
24
|
+
var defineProperty = require( '@stdlib/utils-define-property' );
|
|
25
|
+
var setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );
|
|
26
|
+
var float64ToFloat32 = require( '@stdlib/number-float64-base-to-float32' );
|
|
27
|
+
var format = require( '@stdlib/string-format' );
|
|
28
|
+
var toStr = require( './tostring.js' );
|
|
29
|
+
var toJSON = require( './tojson.js' );
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
// MAIN //
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* 64-bit complex number constructor.
|
|
36
|
+
*
|
|
37
|
+
* @constructor
|
|
38
|
+
* @param {number} real - real component
|
|
39
|
+
* @param {number} imag - imaginary component
|
|
40
|
+
* @throws {TypeError} must invoke using the `new` keyword
|
|
41
|
+
* @throws {TypeError} real component must be a number
|
|
42
|
+
* @throws {TypeError} imaginary component must be a number
|
|
43
|
+
* @returns {Complex64} 64-bit complex number
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* var z = new Complex64( 5.0, 3.0 );
|
|
47
|
+
* // returns <Complex64>
|
|
48
|
+
*/
|
|
49
|
+
function Complex64( real, imag ) {
|
|
50
|
+
if ( !( this instanceof Complex64 ) ) {
|
|
51
|
+
throw new TypeError( 'invalid invocation. Constructor must be called with the `new` keyword.' );
|
|
52
|
+
}
|
|
53
|
+
if ( !isNumber( real ) ) {
|
|
54
|
+
throw new TypeError( format( 'invalid argument. Real component must be a number. Value: `%s`.', real ) );
|
|
55
|
+
}
|
|
56
|
+
if ( !isNumber( imag ) ) {
|
|
57
|
+
throw new TypeError( format( 'invalid argument. Imaginary component must be a number. Value: `%s`.', imag ) );
|
|
58
|
+
}
|
|
59
|
+
defineProperty( this, 're', {
|
|
60
|
+
'configurable': false,
|
|
61
|
+
'enumerable': true,
|
|
62
|
+
'writable': false,
|
|
63
|
+
'value': float64ToFloat32( real )
|
|
64
|
+
});
|
|
65
|
+
defineProperty( this, 'im', {
|
|
66
|
+
'configurable': false,
|
|
67
|
+
'enumerable': true,
|
|
68
|
+
'writable': false,
|
|
69
|
+
'value': float64ToFloat32( imag )
|
|
70
|
+
});
|
|
71
|
+
return this;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Size (in bytes) of each component.
|
|
76
|
+
*
|
|
77
|
+
* @name BYTES_PER_ELEMENT
|
|
78
|
+
* @memberof Complex64
|
|
79
|
+
* @type {integer}
|
|
80
|
+
* @returns {integer} size of each component
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* var nbytes = Complex64.BYTES_PER_ELEMENT;
|
|
84
|
+
* // returns 4
|
|
85
|
+
*/
|
|
86
|
+
setReadOnly( Complex64, 'BYTES_PER_ELEMENT', 4 );
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Size (in bytes) of each component.
|
|
90
|
+
*
|
|
91
|
+
* @name BYTES_PER_ELEMENT
|
|
92
|
+
* @memberof Complex64.prototype
|
|
93
|
+
* @type {integer}
|
|
94
|
+
* @returns {integer} size of each component
|
|
95
|
+
*
|
|
96
|
+
* @example
|
|
97
|
+
* var z = new Complex64( 5.0, 3.0 );
|
|
98
|
+
*
|
|
99
|
+
* var nbytes = z.BYTES_PER_ELEMENT;
|
|
100
|
+
* // returns 4
|
|
101
|
+
*/
|
|
102
|
+
setReadOnly( Complex64.prototype, 'BYTES_PER_ELEMENT', 4 );
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Length (in bytes) of a complex number.
|
|
106
|
+
*
|
|
107
|
+
* @name byteLength
|
|
108
|
+
* @memberof Complex64.prototype
|
|
109
|
+
* @type {integer}
|
|
110
|
+
* @returns {integer} byte length
|
|
111
|
+
*
|
|
112
|
+
* @example
|
|
113
|
+
* var z = new Complex64( 5.0, 3.0 );
|
|
114
|
+
*
|
|
115
|
+
* var nbytes = z.byteLength;
|
|
116
|
+
* // returns 8
|
|
117
|
+
*/
|
|
118
|
+
setReadOnly( Complex64.prototype, 'byteLength', 8 );
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Serializes a complex number as a string.
|
|
122
|
+
*
|
|
123
|
+
* @name toString
|
|
124
|
+
* @memberof Complex64.prototype
|
|
125
|
+
* @type {Function}
|
|
126
|
+
* @returns {string} serialized complex number
|
|
127
|
+
*
|
|
128
|
+
* @example
|
|
129
|
+
* var z = new Complex64( 5.0, 3.0 );
|
|
130
|
+
*
|
|
131
|
+
* var str = z.toString();
|
|
132
|
+
* // returns '5 + 3i'
|
|
133
|
+
*/
|
|
134
|
+
setReadOnly( Complex64.prototype, 'toString', toStr );
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Serializes a complex number as a JSON object.
|
|
138
|
+
*
|
|
139
|
+
* ## Notes
|
|
140
|
+
*
|
|
141
|
+
* - `JSON.stringify()` implicitly calls this method when stringifying a `Complex64` instance.
|
|
142
|
+
*
|
|
143
|
+
* @name toJSON
|
|
144
|
+
* @memberof Complex64.prototype
|
|
145
|
+
* @type {Function}
|
|
146
|
+
* @returns {Object} serialized complex number
|
|
147
|
+
*
|
|
148
|
+
* @example
|
|
149
|
+
* var z = new Complex64( 5.0, 3.0 );
|
|
150
|
+
*
|
|
151
|
+
* var obj = z.toJSON();
|
|
152
|
+
* // returns { 'type': 'Complex64', 're': 5.0, 'im': 3.0 }
|
|
153
|
+
*/
|
|
154
|
+
setReadOnly( Complex64.prototype, 'toJSON', toJSON );
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
// EXPORTS //
|
|
158
|
+
|
|
159
|
+
module.exports = Complex64;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Apache-2.0
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2018 The Stdlib Authors.
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
'use strict';
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Serializes a complex number as a JSON object.
|
|
23
|
+
*
|
|
24
|
+
* @private
|
|
25
|
+
* @returns {Object} JSON representation
|
|
26
|
+
*/
|
|
27
|
+
function toJSON() {
|
|
28
|
+
/* eslint-disable no-invalid-this */
|
|
29
|
+
var out = {};
|
|
30
|
+
out.type = 'Complex64';
|
|
31
|
+
out.re = this.re;
|
|
32
|
+
out.im = this.im;
|
|
33
|
+
return out;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
// EXPORTS //
|
|
38
|
+
|
|
39
|
+
module.exports = toJSON;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Apache-2.0
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2018 The Stdlib Authors.
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
'use strict';
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Serializes a complex number as a string.
|
|
23
|
+
*
|
|
24
|
+
* @private
|
|
25
|
+
* @returns {string} serialized complex number
|
|
26
|
+
*/
|
|
27
|
+
function toString() { // eslint-disable-line stdlib/no-redeclare
|
|
28
|
+
/* eslint-disable no-invalid-this */
|
|
29
|
+
var str = '' + this.re;
|
|
30
|
+
if ( this.im < 0 ) {
|
|
31
|
+
str += ' - ' + (-this.im);
|
|
32
|
+
} else {
|
|
33
|
+
str += ' + ' + this.im;
|
|
34
|
+
}
|
|
35
|
+
str += 'i';
|
|
36
|
+
return str;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
// EXPORTS //
|
|
41
|
+
|
|
42
|
+
module.exports = toString;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"options": {},
|
|
3
|
+
"fields": [
|
|
4
|
+
{
|
|
5
|
+
"field": "src",
|
|
6
|
+
"resolve": true,
|
|
7
|
+
"relative": true
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"field": "include",
|
|
11
|
+
"resolve": true,
|
|
12
|
+
"relative": true
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"field": "libraries",
|
|
16
|
+
"resolve": false,
|
|
17
|
+
"relative": false
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"field": "libpath",
|
|
21
|
+
"resolve": true,
|
|
22
|
+
"relative": false
|
|
23
|
+
}
|
|
24
|
+
],
|
|
25
|
+
"confs": [
|
|
26
|
+
{
|
|
27
|
+
"src": [
|
|
28
|
+
"./src/main.c"
|
|
29
|
+
],
|
|
30
|
+
"include": [
|
|
31
|
+
"./include"
|
|
32
|
+
],
|
|
33
|
+
"libraries": [],
|
|
34
|
+
"libpath": [],
|
|
35
|
+
"dependencies": []
|
|
36
|
+
}
|
|
37
|
+
]
|
|
38
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@stdlib/complex-float32",
|
|
3
|
+
"version": "0.2.1",
|
|
4
|
+
"description": "64-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
|
+
"doc": "./docs",
|
|
19
|
+
"include": "./include",
|
|
20
|
+
"lib": "./lib",
|
|
21
|
+
"src": "./src",
|
|
22
|
+
"dist": "./dist"
|
|
23
|
+
},
|
|
24
|
+
"types": "./docs/types",
|
|
25
|
+
"scripts": {},
|
|
26
|
+
"homepage": "https://stdlib.io",
|
|
27
|
+
"repository": {
|
|
28
|
+
"type": "git",
|
|
29
|
+
"url": "git://github.com/stdlib-js/complex-float32.git"
|
|
30
|
+
},
|
|
31
|
+
"bugs": {
|
|
32
|
+
"url": "https://github.com/stdlib-js/stdlib/issues"
|
|
33
|
+
},
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"@stdlib/assert-is-number": "^0.2.1",
|
|
36
|
+
"@stdlib/number-float64-base-to-float32": "^0.2.1",
|
|
37
|
+
"@stdlib/string-format": "^0.2.1",
|
|
38
|
+
"@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.1",
|
|
39
|
+
"@stdlib/utils-define-property": "^0.2.1"
|
|
40
|
+
},
|
|
41
|
+
"devDependencies": {},
|
|
42
|
+
"engines": {
|
|
43
|
+
"node": ">=0.10.0",
|
|
44
|
+
"npm": ">2.7.0"
|
|
45
|
+
},
|
|
46
|
+
"os": [
|
|
47
|
+
"aix",
|
|
48
|
+
"darwin",
|
|
49
|
+
"freebsd",
|
|
50
|
+
"linux",
|
|
51
|
+
"macos",
|
|
52
|
+
"openbsd",
|
|
53
|
+
"sunos",
|
|
54
|
+
"win32",
|
|
55
|
+
"windows"
|
|
56
|
+
],
|
|
57
|
+
"keywords": [
|
|
58
|
+
"stdlib",
|
|
59
|
+
"stdtypes",
|
|
60
|
+
"types",
|
|
61
|
+
"data",
|
|
62
|
+
"structure",
|
|
63
|
+
"complex",
|
|
64
|
+
"complex64",
|
|
65
|
+
"64-bit",
|
|
66
|
+
"float32",
|
|
67
|
+
"float",
|
|
68
|
+
"single",
|
|
69
|
+
"single-precision",
|
|
70
|
+
"ieee754"
|
|
71
|
+
],
|
|
72
|
+
"funding": {
|
|
73
|
+
"type": "opencollective",
|
|
74
|
+
"url": "https://opencollective.com/stdlib"
|
|
75
|
+
}
|
|
76
|
+
}
|