@stdlib/complex-float32 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  @license Apache-2.0
4
4
 
5
- Copyright (c) 2018 The Stdlib Authors.
5
+ Copyright (c) 2024 The Stdlib Authors.
6
6
 
7
7
  Licensed under the Apache License, Version 2.0 (the "License");
8
8
  you may not use this file except in compliance with the License.
@@ -33,17 +33,7 @@ limitations under the License.
33
33
 
34
34
  [![NPM version][npm-image]][npm-url] [![Build Status][test-image]][test-url] [![Coverage Status][coverage-image]][coverage-url] <!-- [![dependencies][dependencies-image]][dependencies-url] -->
35
35
 
36
- > 64-bit complex number.
37
-
38
- <!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
39
-
40
- <section class="intro">
41
-
42
- </section>
43
-
44
- <!-- /.intro -->
45
-
46
- <!-- Package usage documentation. -->
36
+ > Single-precision complex floating-point number functions.
47
37
 
48
38
  <section class="installation">
49
39
 
@@ -60,478 +50,83 @@ npm install @stdlib/complex-float32
60
50
  ## Usage
61
51
 
62
52
  ```javascript
63
- var Complex64 = require( '@stdlib/complex-float32' );
64
- ```
65
-
66
- #### Complex64( real, imag )
67
-
68
- 64-bit complex number constructor, where `real` and `imag` are the **real** and **imaginary** components, respectively.
69
-
70
- ```javascript
71
- var z = new Complex64( 5.0, 3.0 );
72
- // returns <Complex64>
73
- ```
74
-
75
- * * *
76
-
77
- ## Properties
78
-
79
- #### Complex64.BYTES_PER_ELEMENT
80
-
81
- Size (in bytes) of each component.
82
-
83
- ```javascript
84
- var nbytes = Complex64.BYTES_PER_ELEMENT;
85
- // returns 4
86
- ```
87
-
88
- #### Complex64.prototype.BYTES_PER_ELEMENT
89
-
90
- Size (in bytes) of each component.
91
-
92
- ```javascript
93
- var z = new Complex64( 5.0, 3.0 );
94
-
95
- var nbytes = z.BYTES_PER_ELEMENT;
96
- // returns 4
97
- ```
98
-
99
- #### Complex64.prototype.byteLength
100
-
101
- Length (in bytes) of a complex number.
102
-
103
- ```javascript
104
- var z = new Complex64( 5.0, 3.0 );
105
-
106
- var nbytes = z.byteLength;
107
- // returns 8
108
- ```
109
-
110
- ### Instance
111
-
112
- A `Complex64` instance has the following properties...
113
-
114
- #### re
115
-
116
- A **read-only** property returning the **real** component.
117
-
118
- ```javascript
119
- var z = new Complex64( 5.0, 3.0 );
120
-
121
- var re = z.re;
122
- // returns 5.0
53
+ var complex = require( '@stdlib/complex-float32' );
123
54
  ```
124
55
 
125
- #### im
56
+ #### complex
126
57
 
127
- A **read-only** property returning the **imaginary** component.
58
+ Namespace containing single-precision complex floating-point number functions.
128
59
 
129
60
  ```javascript
130
- var z = new Complex64( 5.0, -3.0 );
131
-
132
- var im = z.im;
133
- // returns -3.0
61
+ var ns = complex;
62
+ // returns {...}
134
63
  ```
135
64
 
136
- * * *
65
+ The namespace contains the following sub-namespaces:
137
66
 
138
- ## Methods
67
+ <!-- <toc pattern="+(base)"> -->
139
68
 
140
- ### Accessor Methods
69
+ <div class="namespace-toc">
141
70
 
142
- These methods do **not** mutate a `Complex64` instance and, instead, return a complex number representation.
71
+ - <span class="signature">[`base`][@stdlib/complex/float32/base]</span><span class="delimiter">: </span><span class="description">base (i.e., lower-level) single-precision complex floating-point number functions.</span>
143
72
 
144
- #### Complex64.prototype.toString()
73
+ </div>
145
74
 
146
- Returns a `string` representation of a `Complex64` instance.
75
+ <!-- </toc> -->
147
76
 
148
- ```javascript
149
- var z = new Complex64( 5.0, 3.0 );
150
- var str = z.toString();
151
- // returns '5 + 3i'
77
+ The namespace contains the following functions:
152
78
 
153
- z = new Complex64( -5.0, -3.0 );
154
- str = z.toString();
155
- // returns '-5 - 3i'
156
- ```
79
+ <!-- <toc pattern="*"> -->
157
80
 
158
- #### Complex64.prototype.toJSON()
81
+ <div class="namespace-toc">
159
82
 
160
- Returns a [JSON][json] representation of a `Complex64` instance. [`JSON.stringify()`][mdn-json-stringify] implicitly calls this method when stringifying a `Complex64` instance.
83
+ - <span class="signature">[`conj( z )`][@stdlib/complex/float32/conj]</span><span class="delimiter">: </span><span class="description">return the complex conjugate of a single-precision complex floating-point number.</span>
84
+ - <span class="signature">[`Complex64( real, imag )`][@stdlib/complex/float32/ctor]</span><span class="delimiter">: </span><span class="description">64-bit complex number.</span>
85
+ - <span class="signature">[`imag( z )`][@stdlib/complex/float32/imag]</span><span class="delimiter">: </span><span class="description">return the imaginary component of a single-precision complex floating-point number.</span>
86
+ - <span class="signature">[`parseComplex64( str )`][@stdlib/complex/float32/parse]</span><span class="delimiter">: </span><span class="description">parse a string representation of a 64-bit complex number.</span>
87
+ - <span class="signature">[`real( z )`][@stdlib/complex/float32/real]</span><span class="delimiter">: </span><span class="description">return the real component of a single-precision complex floating-point number.</span>
88
+ - <span class="signature">[`reim( z )`][@stdlib/complex/float32/reim]</span><span class="delimiter">: </span><span class="description">return the real and imaginary components of a single-precision complex floating-point number.</span>
89
+ - <span class="signature">[`reviveComplex64( key, value )`][@stdlib/complex/float32/reviver]</span><span class="delimiter">: </span><span class="description">revive a JSON-serialized 64-bit complex number.</span>
161
90
 
162
- ```javascript
163
- var z = new Complex64( 5.0, -3.0 );
164
-
165
- var o = z.toJSON();
166
- /*
167
- {
168
- "type": "Complex64",
169
- "re": 5.0,
170
- "im": -3.0
171
- }
172
- */
173
- ```
91
+ </div>
174
92
 
175
- To [revive][mdn-json-parse] a `Complex64` number from a [JSON][json] `string`, see [@stdlib/complex/reviver-float32][@stdlib/complex/reviver-float32].
93
+ <!-- </toc> -->
176
94
 
177
95
  </section>
178
96
 
179
97
  <!-- /.usage -->
180
98
 
181
- * * *
182
-
183
- <!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
99
+ <!-- Package notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
184
100
 
185
101
  <section class="notes">
186
102
 
187
- ## Notes
188
-
189
- - Both the **real** and **imaginary** components are stored as single-precision floating-point numbers.
190
-
191
103
  </section>
192
104
 
193
105
  <!-- /.notes -->
194
106
 
195
- * * *
196
-
197
- <!-- Package usage examples. -->
198
-
199
107
  <section class="examples">
200
108
 
201
109
  ## Examples
202
110
 
111
+ <!-- TODO: better examples -->
112
+
203
113
  <!-- eslint no-undef: "error" -->
204
114
 
205
115
  ```javascript
206
- var Complex64 = require( '@stdlib/complex-float32' );
207
-
208
- var z = new Complex64( 3.0, -2.0 );
116
+ var objectKeys = require( '@stdlib/utils-keys' );
117
+ var ns = require( '@stdlib/complex-float32' );
209
118
 
210
- console.log( 'type: %s', typeof z );
211
- // => 'type: object'
212
-
213
- console.log( 'str: %s', z );
214
- // => 'str: 3 - 2i'
215
-
216
- console.log( 'real: %d', z.re );
217
- // => 'real: 3'
218
-
219
- console.log( 'imag: %d', z.im );
220
- // => 'imag: -2'
221
-
222
- console.log( 'JSON: %s', JSON.stringify( z ) );
223
- // => 'JSON: {"type":"Complex64","re":3,"im":-2}'
119
+ console.log( objectKeys( ns ) );
224
120
  ```
225
121
 
226
122
  </section>
227
123
 
228
124
  <!-- /.examples -->
229
125
 
230
- <!-- C interface documentation. -->
231
-
232
- * * *
233
-
234
- <section class="c">
235
-
236
- ## C APIs
237
-
238
- <!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
239
-
240
- <section class="intro">
241
-
242
- </section>
243
-
244
- <!-- /.intro -->
245
-
246
- <!-- C usage documentation. -->
247
-
248
- <section class="usage">
249
-
250
- ### Usage
251
-
252
- ```c
253
- #include "stdlib/complex/float32.h"
254
- ```
255
-
256
- #### stdlib_complex64_t
257
-
258
- An opaque type definition for a single-precision complex floating-point number.
259
-
260
- ```c
261
- stdlib_complex64_t z = stdlib_complex64( 5.0f, 2.0f );
262
- ```
263
-
264
- #### stdlib_complex64_parts_t
265
-
266
- An opaque type definition for a union for accessing the real and imaginary parts of a single-precision complex floating-point number.
267
-
268
- ```c
269
- float realf( const stdlib_complex64_t z ) {
270
- stdlib_complex64_parts_t v;
271
-
272
- // Assign a single-precision complex floating-point number:
273
- v.value = z;
274
-
275
- // Extract the real component:
276
- float re = v.parts[ 0 ];
277
-
278
- return re;
279
- }
280
-
281
- // ...
282
-
283
- // Create a complex number:
284
- stdlib_complex64_t z = stdlib_complex64( 5.0f, 2.0f );
285
-
286
- // ...
287
-
288
- // Access the real component:
289
- float re = realf( z );
290
- // returns 5.0f
291
- ```
292
-
293
- The union has the following members:
294
-
295
- - **value**: `stdlib_complex64_t` single-precision complex floating-point number.
296
-
297
- - **parts**: `float[]` array having the following elements:
298
-
299
- - **0**: `float` real component.
300
- - **1**: `float` imaginary component.
301
-
302
- #### stdlib_complex64( real, imag )
303
-
304
- Returns a single-precision complex floating-point number.
305
-
306
- ```c
307
- stdlib_complex64_t z = stdlib_complex64( 5.0f, 2.0f );
308
- ```
309
-
310
- The function accepts the following arguments:
311
-
312
- - **real**: `[in] float` real component.
313
- - **imag**: `[in] float` imaginary component.
314
-
315
- ```c
316
- stdlib_complex64_t stdlib_complex64( const float real, const float imag );
317
- ```
318
-
319
- #### stdlib_complex64_from_float32( real )
320
-
321
- Converts a single-precision floating-point number to a single-precision complex floating-point number.
322
-
323
- ```c
324
- stdlib_complex64_t z = stdlib_complex64_from_float32( 5.0f );
325
- ```
326
-
327
- The function accepts the following arguments:
328
-
329
- - **real**: `[in] float` real component.
330
-
331
- ```c
332
- stdlib_complex64_t stdlib_complex64_from_float32( const float real );
333
- ```
334
-
335
- #### stdlib_complex64_from_float64( real )
336
-
337
- Converts a double-precision floating-point number to a single-precision complex floating-point number.
338
-
339
- ```c
340
- stdlib_complex64_t z = stdlib_complex64_from_float64( 5.0 );
341
- ```
342
-
343
- The function accepts the following arguments:
344
-
345
- - **real**: `[in] double` real component.
346
-
347
- ```c
348
- stdlib_complex64_t stdlib_complex64_from_float64( const double real );
349
- ```
350
-
351
- #### stdlib_complex64_from_complex64( z )
352
-
353
- Converts (copies) a single-precision complex floating-point number to a single-precision complex floating-point number.
354
-
355
- ```c
356
- stdlib_complex64_t z1 = stdlib_complex64( 5.0f, 3.0f );
357
- stdlib_complex64_t z2 = stdlib_complex64_from_complex64( z1 );
358
- ```
359
-
360
- The function accepts the following arguments:
361
-
362
- - **z**: `[in] stdlib_complex64_t` single-precision complex floating-point number.
363
-
364
- ```c
365
- stdlib_complex64_t stdlib_complex64_from_complex64( const stdlib_complex64_t z );
366
- ```
367
-
368
- #### stdlib_complex64_from_int8( real )
369
-
370
- Converts a signed 8-bit integer to a single-precision complex floating-point number.
371
-
372
- ```c
373
- stdlib_complex64_t z = stdlib_complex64_from_int8( 5 );
374
- ```
375
-
376
- The function accepts the following arguments:
377
-
378
- - **real**: `[in] int8_t` real component.
379
-
380
- ```c
381
- stdlib_complex64_t stdlib_complex64_from_int8( const int8_t real );
382
- ```
383
-
384
- #### stdlib_complex64_from_uint8( real )
385
-
386
- Converts an unsigned 8-bit integer to a single-precision complex floating-point number.
387
-
388
- ```c
389
- stdlib_complex64_t z = stdlib_complex64_from_uint8( 5 );
390
- ```
391
-
392
- The function accepts the following arguments:
393
-
394
- - **real**: `[in] uint8_t` real component.
395
-
396
- ```c
397
- stdlib_complex64_t stdlib_complex64_from_uint8( const uint8_t real );
398
- ```
399
-
400
- #### stdlib_complex64_from_int16( real )
401
-
402
- Converts a signed 16-bit integer to a single-precision complex floating-point number.
403
-
404
- ```c
405
- stdlib_complex64_t z = stdlib_complex64_from_int16( 5 );
406
- ```
407
-
408
- The function accepts the following arguments:
409
-
410
- - **real**: `[in] int16_t` real component.
411
-
412
- ```c
413
- stdlib_complex64_t stdlib_complex64_from_int16( const int16_t real );
414
- ```
415
-
416
- #### stdlib_complex64_from_uint16( real )
417
-
418
- Converts an unsigned 16-bit integer to a single-precision complex floating-point number.
419
-
420
- ```c
421
- stdlib_complex64_t z = stdlib_complex64_from_uint16( 5 );
422
- ```
423
-
424
- The function accepts the following arguments:
425
-
426
- - **real**: `[in] uint16_t` real component.
427
-
428
- ```c
429
- stdlib_complex64_t stdlib_complex64_from_uint16( const uint16_t real );
430
- ```
431
-
432
- </section>
433
-
434
- <!-- /.usage -->
435
-
436
- <!-- C API usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
437
-
438
- <section class="notes">
439
-
440
- </section>
441
-
442
- <!-- /.notes -->
443
-
444
- <!-- C API usage examples. -->
445
-
446
- <section class="examples">
447
-
448
- ### Examples
449
-
450
- ```c
451
- #include "stdlib/complex/float32.h"
452
- #include <stdint.h>
453
- #include <stdio.h>
454
-
455
- /**
456
- * Return the real component of a single-precision complex floating-point number.
457
- *
458
- * @param z complex number
459
- * @return real component
460
- */
461
- static float real( const stdlib_complex64_t z ) {
462
- stdlib_complex64_parts_t v;
463
-
464
- // Assign a single-precision complex floating-point number:
465
- v.value = z;
466
-
467
- // Extract the real component:
468
- float re = v.parts[ 0 ];
469
-
470
- return re;
471
- }
472
-
473
- /**
474
- * Return the imaginary component of a single-precision complex floating-point number.
475
- *
476
- * @param z complex number
477
- * @return imaginary component
478
- */
479
- static float imag( const stdlib_complex64_t z ) {
480
- stdlib_complex64_parts_t v;
481
-
482
- // Assign a single-precision complex floating-point number:
483
- v.value = z;
484
-
485
- // Extract the imaginary component:
486
- float im = v.parts[ 1 ];
487
-
488
- return im;
489
- }
490
-
491
- int main( void ) {
492
- const stdlib_complex64_t x[] = {
493
- stdlib_complex64( 5.0f, 2.0f ),
494
- stdlib_complex64( -2.0f, 1.0f ),
495
- stdlib_complex64( 0.0f, -0.0f ),
496
- stdlib_complex64( 0.0f/0.0f, 0.0f/0.0f )
497
- };
498
-
499
- stdlib_complex64_t v;
500
- int i;
501
- for ( i = 0; i < 4; i++ ) {
502
- v = x[ i ];
503
- printf( "%f + %fi\n", real( v ), imag( v ) );
504
- }
505
- }
506
- ```
507
-
508
- </section>
509
-
510
- <!-- /.examples -->
511
-
512
- </section>
513
-
514
- <!-- /.c -->
515
-
516
- <!-- 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. -->
517
-
518
- <section class="references">
519
-
520
- </section>
521
-
522
- <!-- /.references -->
523
-
524
126
  <!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
525
127
 
526
128
  <section class="related">
527
129
 
528
- * * *
529
-
530
- ## See Also
531
-
532
- - <span class="package-name">[`@stdlib/complex-cmplx`][@stdlib/complex/cmplx]</span><span class="delimiter">: </span><span class="description">create a complex number.</span>
533
- - <span class="package-name">[`@stdlib/complex-float64`][@stdlib/complex/float64]</span><span class="delimiter">: </span><span class="description">128-bit complex number.</span>
534
-
535
130
  </section>
536
131
 
537
132
  <!-- /.related -->
@@ -575,8 +170,8 @@ Copyright &copy; 2016-2024. The Stdlib [Authors][stdlib-authors].
575
170
  [npm-image]: http://img.shields.io/npm/v/@stdlib/complex-float32.svg
576
171
  [npm-url]: https://npmjs.org/package/@stdlib/complex-float32
577
172
 
578
- [test-image]: https://github.com/stdlib-js/complex-float32/actions/workflows/test.yml/badge.svg?branch=v0.2.0
579
- [test-url]: https://github.com/stdlib-js/complex-float32/actions/workflows/test.yml?query=branch:v0.2.0
173
+ [test-image]: https://github.com/stdlib-js/complex-float32/actions/workflows/test.yml/badge.svg?branch=v0.3.0
174
+ [test-url]: https://github.com/stdlib-js/complex-float32/actions/workflows/test.yml?query=branch:v0.3.0
580
175
 
581
176
  [coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/complex-float32/main.svg
582
177
  [coverage-url]: https://codecov.io/github/stdlib-js/complex-float32?branch=main
@@ -608,21 +203,25 @@ Copyright &copy; 2016-2024. The Stdlib [Authors][stdlib-authors].
608
203
 
609
204
  [stdlib-license]: https://raw.githubusercontent.com/stdlib-js/complex-float32/main/LICENSE
610
205
 
611
- [json]: http://www.json.org/
206
+ <!-- <toc-links> -->
207
+
208
+ [@stdlib/complex/float32/conj]: https://www.npmjs.com/package/@stdlib/complex-float32-conj
209
+
210
+ [@stdlib/complex/float32/ctor]: https://www.npmjs.com/package/@stdlib/complex-float32-ctor
612
211
 
613
- [mdn-json-stringify]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify
212
+ [@stdlib/complex/float32/imag]: https://www.npmjs.com/package/@stdlib/complex-float32-imag
614
213
 
615
- [mdn-json-parse]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse
214
+ [@stdlib/complex/float32/parse]: https://www.npmjs.com/package/@stdlib/complex-float32-parse
616
215
 
617
- [@stdlib/complex/reviver-float32]: https://www.npmjs.com/package/@stdlib/complex-reviver-float32
216
+ [@stdlib/complex/float32/real]: https://www.npmjs.com/package/@stdlib/complex-float32-real
618
217
 
619
- <!-- <related-links> -->
218
+ [@stdlib/complex/float32/reim]: https://www.npmjs.com/package/@stdlib/complex-float32-reim
620
219
 
621
- [@stdlib/complex/cmplx]: https://www.npmjs.com/package/@stdlib/complex-cmplx
220
+ [@stdlib/complex/float32/reviver]: https://www.npmjs.com/package/@stdlib/complex-float32-reviver
622
221
 
623
- [@stdlib/complex/float64]: https://www.npmjs.com/package/@stdlib/complex-float64
222
+ [@stdlib/complex/float32/base]: https://www.npmjs.com/package/@stdlib/complex-float32-base
624
223
 
625
- <!-- </related-links> -->
224
+ <!-- </toc-links> -->
626
225
 
627
226
  </section>
628
227
 
package/dist/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  /// <reference path="../docs/types/index.d.ts" />
2
- import Complex64 from '../docs/types/index';
3
- export = Complex64;
2
+ import ns from '../docs/types/index';
3
+ export = ns;
package/dist/index.js CHANGED
@@ -1,9 +1,3 @@
1
- "use strict";var o=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var a=o(function(S,n){
2
- function c(){var e=""+this.re;return this.im<0?e+=" - "+-this.im:e+=" + "+this.im,e+="i",e}n.exports=c
3
- });var u=o(function(T,s){
4
- function b(){var e={};return e.type="Complex64",e.re=this.re,e.im=this.im,e}s.exports=b
5
- });var h=o(function(d,v){
6
- var l=require('@stdlib/assert-is-number/dist').isPrimitive,m=require('@stdlib/utils-define-property/dist'),i=require('@stdlib/utils-define-nonenumerable-read-only-property/dist'),p=require('@stdlib/number-float64-base-to-float32/dist'),f=require('@stdlib/error-tools-fmtprodmsg/dist'),y=a(),E=u();function t(e,r){if(!(this instanceof t))throw new TypeError(f('0Gp0G'));if(!l(e))throw new TypeError(f('0Gp3e',e));if(!l(r))throw new TypeError(f('0Gp3f',r));return m(this,"re",{configurable:!1,enumerable:!0,writable:!1,value:p(e)}),m(this,"im",{configurable:!1,enumerable:!0,writable:!1,value:p(r)}),this}i(t,"BYTES_PER_ELEMENT",4);i(t.prototype,"BYTES_PER_ELEMENT",4);i(t.prototype,"byteLength",8);i(t.prototype,"toString",y);i(t.prototype,"toJSON",E);v.exports=t
7
- });var w=h();module.exports=w;
1
+ "use strict";var r=require('@stdlib/utils-define-read-only-property/dist'),e={};r(e,"base",require('@stdlib/complex-float32-base/dist'));r(e,"conj",require('@stdlib/complex-float32-conj/dist'));r(e,"Complex64",require('@stdlib/complex-float32-ctor/dist'));r(e,"imag",require('@stdlib/complex-float32-imag/dist'));r(e,"parseComplex64",require('@stdlib/complex-float32-parse/dist'));r(e,"real",require('@stdlib/complex-float32-real/dist'));r(e,"reim",require('@stdlib/complex-float32-reim/dist'));r(e,"reviveComplex64",require('@stdlib/complex-float32-reviver/dist'));module.exports=e;
8
2
  /** @license Apache-2.0 */
9
3
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../lib/tostring.js", "../lib/tojson.js", "../lib/main.js", "../lib/index.js"],
4
- "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Serializes a complex number as a string.\n*\n* @private\n* @returns {string} serialized complex number\n*/\nfunction toString() { // eslint-disable-line stdlib/no-redeclare\n\t/* eslint-disable no-invalid-this */\n\tvar str = '' + this.re;\n\tif ( this.im < 0 ) {\n\t\tstr += ' - ' + (-this.im);\n\t} else {\n\t\tstr += ' + ' + this.im;\n\t}\n\tstr += 'i';\n\treturn str;\n}\n\n\n// EXPORTS //\n\nmodule.exports = toString;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Serializes a complex number as a JSON object.\n*\n* @private\n* @returns {Object} JSON representation\n*/\nfunction toJSON() {\n\t/* eslint-disable no-invalid-this */\n\tvar out = {};\n\tout.type = 'Complex64';\n\tout.re = this.re;\n\tout.im = this.im;\n\treturn out;\n}\n\n\n// EXPORTS //\n\nmodule.exports = toJSON;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar isNumber = require( '@stdlib/assert-is-number' ).isPrimitive;\nvar defineProperty = require( '@stdlib/utils-define-property' );\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar float64ToFloat32 = require( '@stdlib/number-float64-base-to-float32' );\nvar format = require( '@stdlib/string-format' );\nvar toStr = require( './tostring.js' );\nvar toJSON = require( './tojson.js' );\n\n\n// MAIN //\n\n/**\n* 64-bit complex number constructor.\n*\n* @constructor\n* @param {number} real - real component\n* @param {number} imag - imaginary component\n* @throws {TypeError} must invoke using the `new` keyword\n* @throws {TypeError} real component must be a number\n* @throws {TypeError} imaginary component must be a number\n* @returns {Complex64} 64-bit complex number\n*\n* @example\n* var z = new Complex64( 5.0, 3.0 );\n* // returns <Complex64>\n*/\nfunction Complex64( real, imag ) {\n\tif ( !( this instanceof Complex64 ) ) {\n\t\tthrow new TypeError( 'invalid invocation. Constructor must be called with the `new` keyword.' );\n\t}\n\tif ( !isNumber( real ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Real component must be a number. Value: `%s`.', real ) );\n\t}\n\tif ( !isNumber( imag ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Imaginary component must be a number. Value: `%s`.', imag ) );\n\t}\n\tdefineProperty( this, 're', {\n\t\t'configurable': false,\n\t\t'enumerable': true,\n\t\t'writable': false,\n\t\t'value': float64ToFloat32( real )\n\t});\n\tdefineProperty( this, 'im', {\n\t\t'configurable': false,\n\t\t'enumerable': true,\n\t\t'writable': false,\n\t\t'value': float64ToFloat32( imag )\n\t});\n\treturn this;\n}\n\n/**\n* Size (in bytes) of each component.\n*\n* @name BYTES_PER_ELEMENT\n* @memberof Complex64\n* @type {integer}\n* @returns {integer} size of each component\n*\n* @example\n* var nbytes = Complex64.BYTES_PER_ELEMENT;\n* // returns 4\n*/\nsetReadOnly( Complex64, 'BYTES_PER_ELEMENT', 4 );\n\n/**\n* Size (in bytes) of each component.\n*\n* @name BYTES_PER_ELEMENT\n* @memberof Complex64.prototype\n* @type {integer}\n* @returns {integer} size of each component\n*\n* @example\n* var z = new Complex64( 5.0, 3.0 );\n*\n* var nbytes = z.BYTES_PER_ELEMENT;\n* // returns 4\n*/\nsetReadOnly( Complex64.prototype, 'BYTES_PER_ELEMENT', 4 );\n\n/**\n* Length (in bytes) of a complex number.\n*\n* @name byteLength\n* @memberof Complex64.prototype\n* @type {integer}\n* @returns {integer} byte length\n*\n* @example\n* var z = new Complex64( 5.0, 3.0 );\n*\n* var nbytes = z.byteLength;\n* // returns 8\n*/\nsetReadOnly( Complex64.prototype, 'byteLength', 8 );\n\n/**\n* Serializes a complex number as a string.\n*\n* @name toString\n* @memberof Complex64.prototype\n* @type {Function}\n* @returns {string} serialized complex number\n*\n* @example\n* var z = new Complex64( 5.0, 3.0 );\n*\n* var str = z.toString();\n* // returns '5 + 3i'\n*/\nsetReadOnly( Complex64.prototype, 'toString', toStr );\n\n/**\n* Serializes a complex number as a JSON object.\n*\n* ## Notes\n*\n* - `JSON.stringify()` implicitly calls this method when stringifying a `Complex64` instance.\n*\n* @name toJSON\n* @memberof Complex64.prototype\n* @type {Function}\n* @returns {Object} serialized complex number\n*\n* @example\n* var z = new Complex64( 5.0, 3.0 );\n*\n* var obj = z.toJSON();\n* // returns { 'type': 'Complex64', 're': 5.0, 'im': 3.0 }\n*/\nsetReadOnly( Complex64.prototype, 'toJSON', toJSON );\n\n\n// EXPORTS //\n\nmodule.exports = Complex64;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* 64-bit complex number constructor.\n*\n* @module @stdlib/complex-float32\n*\n* @example\n* var Complex64 = require( '@stdlib/complex-float32' );\n*\n* var z = new Complex64( 5.0, 3.0 );\n* // returns <Complex64>\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"],
5
- "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cA0BA,SAASC,GAAW,CAEnB,IAAIC,EAAM,GAAK,KAAK,GACpB,OAAK,KAAK,GAAK,EACdA,GAAO,MAAS,CAAC,KAAK,GAEtBA,GAAO,MAAQ,KAAK,GAErBA,GAAO,IACAA,CACR,CAKAF,EAAO,QAAUC,ICzCjB,IAAAE,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cA0BA,SAASC,GAAS,CAEjB,IAAIC,EAAM,CAAC,EACX,OAAAA,EAAI,KAAO,YACXA,EAAI,GAAK,KAAK,GACdA,EAAI,GAAK,KAAK,GACPA,CACR,CAKAF,EAAO,QAAUC,ICtCjB,IAAAE,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAW,QAAS,0BAA2B,EAAE,YACjDC,EAAiB,QAAS,+BAAgC,EAC1DC,EAAc,QAAS,uDAAwD,EAC/EC,EAAmB,QAAS,wCAAyC,EACrEC,EAAS,QAAS,uBAAwB,EAC1CC,EAAQ,IACRC,EAAS,IAoBb,SAASC,EAAWC,EAAMC,EAAO,CAChC,GAAK,EAAG,gBAAgBF,GACvB,MAAM,IAAI,UAAW,wEAAyE,EAE/F,GAAK,CAACP,EAAUQ,CAAK,EACpB,MAAM,IAAI,UAAWJ,EAAQ,kEAAmEI,CAAK,CAAE,EAExG,GAAK,CAACR,EAAUS,CAAK,EACpB,MAAM,IAAI,UAAWL,EAAQ,uEAAwEK,CAAK,CAAE,EAE7G,OAAAR,EAAgB,KAAM,KAAM,CAC3B,aAAgB,GAChB,WAAc,GACd,SAAY,GACZ,MAASE,EAAkBK,CAAK,CACjC,CAAC,EACDP,EAAgB,KAAM,KAAM,CAC3B,aAAgB,GAChB,WAAc,GACd,SAAY,GACZ,MAASE,EAAkBM,CAAK,CACjC,CAAC,EACM,IACR,CAcAP,EAAaK,EAAW,oBAAqB,CAAE,EAgB/CL,EAAaK,EAAU,UAAW,oBAAqB,CAAE,EAgBzDL,EAAaK,EAAU,UAAW,aAAc,CAAE,EAgBlDL,EAAaK,EAAU,UAAW,WAAYF,CAAM,EAoBpDH,EAAaK,EAAU,UAAW,SAAUD,CAAO,EAKnDP,EAAO,QAAUQ,IC5HjB,IAAIG,EAAO,IAKX,OAAO,QAAUA",
6
- "names": ["require_tostring", "__commonJSMin", "exports", "module", "toString", "str", "require_tojson", "__commonJSMin", "exports", "module", "toJSON", "out", "require_main", "__commonJSMin", "exports", "module", "isNumber", "defineProperty", "setReadOnly", "float64ToFloat32", "format", "toStr", "toJSON", "Complex64", "real", "imag", "main"]
3
+ "sources": ["../lib/index.js"],
4
+ "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/*\n* When adding modules to the namespace, ensure that they are added in alphabetical order according to module name.\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-read-only-property' );\n\n\n// MAIN //\n\n/**\n* Top-level namespace.\n*\n* @namespace ns\n*/\nvar ns = {};\n\n/**\n* @name base\n* @memberof ns\n* @readonly\n* @type {Namespace}\n* @see {@link module:@stdlib/complex/float32/base}\n*/\nsetReadOnly( ns, 'base', require( '@stdlib/complex-float32-base' ) );\n\n/**\n* @name conj\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/complex/float32/conj}\n*/\nsetReadOnly( ns, 'conj', require( '@stdlib/complex-float32-conj' ) );\n\n/**\n* @name Complex64\n* @memberof ns\n* @readonly\n* @constructor\n* @see {@link module:@stdlib/complex/float32/ctor}\n*/\nsetReadOnly( ns, 'Complex64', require( '@stdlib/complex-float32-ctor' ) );\n\n/**\n* @name imag\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/complex/float32/imag}\n*/\nsetReadOnly( ns, 'imag', require( '@stdlib/complex-float32-imag' ) );\n\n/**\n* @name parseComplex64\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/complex/float32/parse}\n*/\nsetReadOnly( ns, 'parseComplex64', require( '@stdlib/complex-float32-parse' ) );\n\n/**\n* @name real\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/complex/float32/real}\n*/\nsetReadOnly( ns, 'real', require( '@stdlib/complex-float32-real' ) );\n\n/**\n* @name reim\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/complex/float32/reim}\n*/\nsetReadOnly( ns, 'reim', require( '@stdlib/complex-float32-reim' ) );\n\n/**\n* @name reviveComplex64\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/complex/float32/reviver}\n*/\nsetReadOnly( ns, 'reviveComplex64', require( '@stdlib/complex-float32-reviver' ) );\n\n\n// EXPORTS //\n\nmodule.exports = ns;\n"],
5
+ "mappings": "aA0BA,IAAIA,EAAc,QAAS,yCAA0C,EAUjEC,EAAK,CAAC,EASVD,EAAaC,EAAI,OAAQ,QAAS,8BAA+B,CAAE,EASnED,EAAaC,EAAI,OAAQ,QAAS,8BAA+B,CAAE,EASnED,EAAaC,EAAI,YAAa,QAAS,8BAA+B,CAAE,EASxED,EAAaC,EAAI,OAAQ,QAAS,8BAA+B,CAAE,EASnED,EAAaC,EAAI,iBAAkB,QAAS,+BAAgC,CAAE,EAS9ED,EAAaC,EAAI,OAAQ,QAAS,8BAA+B,CAAE,EASnED,EAAaC,EAAI,OAAQ,QAAS,8BAA+B,CAAE,EASnED,EAAaC,EAAI,kBAAmB,QAAS,iCAAkC,CAAE,EAKjF,OAAO,QAAUA",
6
+ "names": ["setReadOnly", "ns"]
7
7
  }