-
-
Notifications
You must be signed in to change notification settings - Fork 400
/
index.d.ts
1492 lines (1415 loc) · 44.6 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* @license Apache-2.0
*
* Copyright (c) 2021 The Stdlib Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// TypeScript Version: 2.0
/* tslint:disable:max-line-length */
/* tslint:disable:max-file-line-count */
import base = require( '@stdlib/array/base' );
import ArrayBuffer = require( '@stdlib/array/buffer' );
import Complex64Array = require( '@stdlib/array/complex64' );
import Complex128Array = require( '@stdlib/array/complex128' );
import convertArray = require( '@stdlib/array/convert' );
import convertArraySame = require( '@stdlib/array/convert-same' );
import arrayCtors = require( '@stdlib/array/ctors' );
import DataView = require( '@stdlib/array/dataview' );
import datespace = require( '@stdlib/array/datespace' );
import arrayDataType = require( '@stdlib/array/dtype' );
import arrayDataTypes = require( '@stdlib/array/dtypes' );
import filledarray = require( '@stdlib/array/filled' );
import filledarrayBy = require( '@stdlib/array/filled-by' );
import Float32Array = require( '@stdlib/array/float32' );
import Float64Array = require( '@stdlib/array/float64' );
import iterator2array = require( '@stdlib/array/from-iterator' );
import afull = require( '@stdlib/array/full' );
import afullLike = require( '@stdlib/array/full-like' );
import incrspace = require( '@stdlib/array/incrspace' );
import Int8Array = require( '@stdlib/array/int8' );
import Int16Array = require( '@stdlib/array/int16' );
import Int32Array = require( '@stdlib/array/int32' );
import linspace = require( '@stdlib/array/linspace' );
import logspace = require( '@stdlib/array/logspace' );
import arrayMinDataType = require( '@stdlib/array/min-dtype' );
import arrayNextDataType = require( '@stdlib/array/next-dtype' );
import aones = require( '@stdlib/array/ones' );
import aonesLike = require( '@stdlib/array/ones-like' );
import typedarraypool = require( '@stdlib/array/pool' );
import arrayPromotionRules = require( '@stdlib/array/promotion-rules' );
import reviveTypedArray = require( '@stdlib/array/reviver' );
import arraySafeCasts = require( '@stdlib/array/safe-casts' );
import arraySameKindCasts = require( '@stdlib/array/same-kind-casts' );
import arrayShape = require( '@stdlib/array/shape' );
import SharedArrayBuffer = require( '@stdlib/array/shared-buffer' );
import circarray2iterator = require( '@stdlib/array/to-circular-iterator' );
import array2iterator = require( '@stdlib/array/to-iterator' );
import array2iteratorRight = require( '@stdlib/array/to-iterator-right' );
import typedarray2json = require( '@stdlib/array/to-json' );
import sparsearray2iterator = require( '@stdlib/array/to-sparse-iterator' );
import sparsearray2iteratorRight = require( '@stdlib/array/to-sparse-iterator-right' );
import stridedarray2iterator = require( '@stdlib/array/to-strided-iterator' );
import arrayview2iterator = require( '@stdlib/array/to-view-iterator' );
import arrayview2iteratorRight = require( '@stdlib/array/to-view-iterator-right' );
import typedarray = require( '@stdlib/array/typed' );
import complexarray = require( '@stdlib/array/typed-complex' );
import complexarrayCtors = require( '@stdlib/array/typed-complex-ctors' );
import complexarrayDataTypes = require( '@stdlib/array/typed-complex-dtypes' );
import typedarrayCtors = require( '@stdlib/array/typed-ctors' );
import typedarrayDataTypes = require( '@stdlib/array/typed-dtypes' );
import floatarrayCtors = require( '@stdlib/array/typed-float-ctors' );
import floatarrayDataTypes = require( '@stdlib/array/typed-float-dtypes' );
import intarrayCtors = require( '@stdlib/array/typed-integer-ctors' );
import intarrayDataTypes = require( '@stdlib/array/typed-integer-dtypes' );
import realarray = require( '@stdlib/array/typed-real' );
import realarrayCtors = require( '@stdlib/array/typed-real-ctors' );
import realarrayDataTypes = require( '@stdlib/array/typed-real-dtypes' );
import realarrayFloatCtors = require( '@stdlib/array/typed-real-float-ctors' );
import realarrayFloatDataTypes = require( '@stdlib/array/typed-real-float-dtypes' );
import intarraySignedCtors = require( '@stdlib/array/typed-signed-integer-ctors' );
import intarraySignedDataTypes = require( '@stdlib/array/typed-signed-integer-dtypes' );
import intarrayUnsignedCtors = require( '@stdlib/array/typed-unsigned-integer-ctors' );
import intarrayUnsignedDataTypes = require( '@stdlib/array/typed-unsigned-integer-dtypes' );
import Uint8Array = require( '@stdlib/array/uint8' );
import Uint8ClampedArray = require( '@stdlib/array/uint8c' );
import Uint16Array = require( '@stdlib/array/uint16' );
import Uint32Array = require( '@stdlib/array/uint32' );
import azeros = require( '@stdlib/array/zeros' );
import azerosLike = require( '@stdlib/array/zeros-like' );
import constants = require( '@stdlib/constants/array' );
/**
* Interface describing the `array` namespace.
*/
interface Namespace {
/**
* Base (i.e., lower-level) array utilities.
*/
base: typeof base;
/**
* Constructor which returns an object used to represent a generic, fixed-length raw binary data buffer.
*/
ArrayBuffer: typeof ArrayBuffer;
/**
* 64-bit complex number array constructor.
*
* @param arg - length, typed array, array-like object, or buffer
* @param byteOffset - byte offset (default: 0)
* @param length - view length
* @throws ArrayBuffer byte length must be a multiple of `8`
* @throws array-like object and typed array input arguments must have a length which is a multiple of two
* @throws if provided only a single argument, must provide a valid argument
* @throws byte offset must be a nonnegative integer
* @throws byte offset must be a multiple of `8`
* @throws view length must be a positive multiple of `8`
* @throws must provide sufficient memory to accommodate byte offset and view length requirements
* @throws an iterator must return either a two element array containing real and imaginary components or a complex number
* @returns complex number array
*
* @example
* var arr = new ns.Complex64Array();
* // returns <ns.Complex64Array>
*
* var len = arr.length;
* // returns 0
*
* @example
* var arr = new ns.Complex64Array( 2 );
* // returns <ns.Complex64Array>
*
* var len = arr.length;
* // returns 2
*
* @example
* var arr = new ns.Complex64Array( [ 1.0, -1.0 ] );
* // returns <ns.Complex64Array>
*
* var len = arr.length;
* // returns 1
*
* @example
* var ArrayBuffer = require( `@stdlib/array/buffer` );
*
* var buf = new ArrayBuffer( 16 );
* var arr = new ns.Complex64Array( buf );
* // returns <ns.Complex64Array>
*
* var len = arr.length;
* // returns 2
*
* @example
* var ArrayBuffer = require( `@stdlib/array/buffer` );
*
* var buf = new ArrayBuffer( 16 );
* var arr = new ns.Complex64Array( buf, 8 );
* // returns <ns.Complex64Array>
*
* var len = arr.length;
* // returns 1
*
* @example
* var ArrayBuffer = require( `@stdlib/array/buffer` );
*
* var buf = new ArrayBuffer( 32 );
* var arr = new ns.Complex64Array( buf, 8, 2 );
* // returns <ns.Complex64Array>
*
* var len = arr.length;
* // returns 2
*/
Complex64Array: typeof Complex64Array;
/**
* 128-bit complex number array constructor.
*
* @param arg - length, typed array, array-like object, or buffer
* @param byteOffset - byte offset (default: 0)
* @param length - view length
* @throws ArrayBuffer byte length must be a multiple of `8`
* @throws array-like object and typed array input arguments must have a length which is a multiple of two
* @throws if provided only a single argument, must provide a valid argument
* @throws byte offset must be a nonnegative integer
* @throws byte offset must be a multiple of `8`
* @throws view length must be a positive multiple of `8`
* @throws must provide sufficient memory to accommodate byte offset and view length requirements
* @throws an iterator must return either a two element array containing real and imaginary components or a complex number
* @returns complex number array
*
* @example
* var arr = new ns.Complex128Array();
* // returns <ns.Complex128Array>
*
* var len = arr.length;
* // returns 0
*
* @example
* var arr = new ns.Complex128Array( 2 );
* // returns <ns.Complex128Array>
*
* var len = arr.length;
* // returns 2
*
* @example
* var arr = new ns.Complex128Array( [ 1.0, -1.0 ] );
* // returns <ns.Complex128Array>
*
* var len = arr.length;
* // returns 1
*
* @example
* var ArrayBuffer = require( `@stdlib/array/buffer` );
*
* var buf = new ArrayBuffer( 16 );
* var arr = new ns.Complex128Array( buf );
* // returns <ns.Complex128Array>
*
* var len = arr.length;
* // returns 2
*
* @example
* var ArrayBuffer = require( `@stdlib/array/buffer` );
*
* var buf = new ArrayBuffer( 16 );
* var arr = new ns.Complex128Array( buf, 8 );
* // returns <ns.Complex128Array>
*
* var len = arr.length;
* // returns 1
*
* @example
* var ArrayBuffer = require( `@stdlib/array/buffer` );
*
* var buf = new ArrayBuffer( 32 );
* var arr = new ns.Complex128Array( buf, 8, 2 );
* // returns <ns.Complex128Array>
*
* var len = arr.length;
* // returns 2
*/
Complex128Array: typeof Complex128Array;
/**
* Converts an array to an array of a different data type.
*
* @param x - array to convert
* @param dtype - output data type
* @returns output array
*
* @example
* var arr = [ 1.0, 2.0, 3.0, 4.0 ];
* var out = ns.convertArray( arr, 'float64' );
* // returns <Float64Array>[ 1.0, 2.0, 3.0, 4.0 ]
*/
convertArray: typeof convertArray;
/**
* Converts an array to the same data type as a second input array.
*
* @param x - array to convert
* @param y - array having the desired output data type
* @returns output array
*
* @example
* var Float64Array = require( `@stdlib/array/float64` );
*
* var x = [ 1.0, 2.0, 3.0, 4.0 ];
* var y = new Float64Array( 0 );
*
* var out = ns.convertArraySame( x, y );
* // returns <Float64Array>[ 1.0, 2.0, 3.0, 4.0 ]
*/
convertArraySame: typeof convertArraySame;
/**
* Returns an array constructor.
*
* @param dtype - data type
* @returns constructor or null
*
* @example
* var ctor = ns.arrayCtors( 'float64' );
* // returns <Function>
*
* @example
* var ctor = ns.arrayCtors( 'float' );
* // returns null
*/
arrayCtors: typeof arrayCtors;
/**
* Constructor which returns a data view representing a provided array buffer.
*/
DataView: typeof DataView;
/**
* Generates an array of linearly spaced dates.
*
* @param start - start time as either a `Date` object, Unix timestamp, JavaScript timestamp, or date string
* @param stop - stop time as either a `Date` object, Unix timestamp, JavaScript timestamp, or date string
* @param length - output array length (default: 100)
* @param options - function options
* @param options.round - specifies how sub-millisecond times should be rounded: [ 'floor', 'ceil', 'round' ] (default: 'floor' )
* @throws length argument must a positive integer
* @throws must provide valid options
* @returns array of dates
*
* @example
* var stop = '2014-12-02T07:00:54.973Z';
* var start = new Date( stop ) - 60000;
*
* var arr = ns.datespace( start, stop, 6 );
* // returns [...]
*
* @example
* // Equivalent of Math.ceil():
* var arr = ns.datespace( 1417503655000, 1417503655001, 3, { 'round': 'ceil' } );
* // returns [...]
*
* // Equivalent of Math.round():
* var arr = ns.datespace( 1417503655000, 1417503655001, 3, { 'round': 'round' } );
* // returns [...]
*/
datespace: typeof datespace;
/**
* Returns the data type of an array.
*
* ## Notes
*
* - If provided an argument having an unknown or unsupported type, the function returns `null`.
*
* @param value - input value
* @returns data type
*
* @example
* var dt = ns.arrayDataType( [ 1, 2, 3 ] );
* // returns 'generic'
*
* var dt = ns.arrayDataType( 'beep' );
* // returns null
*/
arrayDataType: typeof arrayDataType;
/**
* Returns a list of array data types.
*
* @returns list of array data types
*
* @example
* var list = ns.arrayDataTypes();
* // e.g., returns [ 'float32', 'float64', 'generic', 'int16', 'int32', 'int8', 'uint16', 'uint32', 'uint8', 'uint8c', 'complex64', 'complex128' ]
*/
arrayDataTypes: typeof arrayDataTypes;
/**
* Returns a filled typed array view of an `ArrayBuffer`.
*
* ## Notes
*
* - Creating a generic array from an `ArrayBuffer` is **not** supported.
*
* @param value - fill value
* @param buffer - `ArrayBuffer`
* @param dtype - data type (default: 'float64')
* @returns filled array
*
* @example
* var ArrayBuffer = require( `@stdlib/array/buffer` );
*
* var buf = new ArrayBuffer( 32 );
* var arr = ns.filledarray( 1.0, buf );
* // returns <Float64Array>[ 1.0, 1.0, 1.0, 1.0 ]
*
* @example
* var ArrayBuffer = require( `@stdlib/array/buffer` );
*
* var buf = new ArrayBuffer( 32 );
* var arr = ns.filledarray( 1.0, buf, 'float32' );
* // returns <Float32Array>[ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ]
*/
filledarray: typeof filledarray;
/**
* Returns a filled typed array view of an `ArrayBuffer` according to a provided callback function.
*
* The function recognizes the following data types:
*
* - `float64`: double-precision floating-point numbers (IEEE 754)
* - `float32`: single-precision floating-point numbers (IEEE 754)
* - `complex128`: double-precision complex floating-point numbers
* - `complex64`: single-precision complex floating-point numbers
* - `int32`: 32-bit two's complement signed integers
* - `uint32`: 32-bit unsigned integers
* - `int16`: 16-bit two's complement signed integers
* - `uint16`: 16-bit unsigned integers
* - `int8`: 8-bit two's complement signed integers
* - `uint8`: 8-bit unsigned integers
* - `uint8c`: 8-bit unsigned integers clamped to `0-255`
* - `generic`: generic JavaScript values
*
* ## Notes
*
* - Creating a generic array from an `ArrayBuffer` is **not** supported.
*
* @param buffer - `ArrayBuffer`
* @param dtype - data type
* @param clbk - callback function
* @param thisArg - callback function execution context
* @returns filled array
*
* @example
* var constantFunction = require( `@stdlib/utils/constant-function` );
* var ArrayBuffer = require( `@stdlib/array/buffer` );
*
* var buf = new ArrayBuffer( 32 );
* var arr = ns.filledarrayBy( buf, 'float64', constantFunction( 1.0 ) );
* // returns <Float64Array>[ 1.0, 1.0, 1.0, 1.0 ]
*/
filledarrayBy: typeof filledarrayBy;
/**
* Typed array constructor which returns a typed array representing an array of single-precision floating-point numbers in the platform byte order.
*/
Float32Array: typeof Float32Array;
/**
* Typed array constructor which returns a typed array representing an array of double-precision floating-point numbers in the platform byte order.
*/
Float64Array: typeof Float64Array;
/**
* Creates (or fills) an array from an iterator.
*
* @param iterator - source iterator
* @param out - output array
* @param mapFcn - function to invoke for each iterated value
* @param thisArg - execution context
* @returns output array
*
* @example
* var Float64Array = require( `@stdlib/array/float64` );
* var randu = require( `@stdlib/random/iter/randu` );
*
* var iter = randu({
* 'iter': 10
* });
*
* var out = new Float64Array( 10 );
* var arr = ns.iterator2array( iter, out );
* // returns <Array>
*/
iterator2array: typeof iterator2array;
/**
* Creates a filled array having a specified length.
*
* The function recognizes the following data types:
*
* - `float64`: double-precision floating-point numbers (IEEE 754)
* - `float32`: single-precision floating-point numbers (IEEE 754)
* - `complex128`: double-precision complex floating-point numbers
* - `complex64`: single-precision complex floating-point numbers
* - `int32`: 32-bit two's complement signed integers
* - `uint32`: 32-bit unsigned integers
* - `int16`: 16-bit two's complement signed integers
* - `uint16`: 16-bit unsigned integers
* - `int8`: 8-bit two's complement signed integers
* - `uint8`: 8-bit unsigned integers
* - `uint8c`: 8-bit unsigned integers clamped to `0-255`
* - `generic`: generic JavaScript values
*
* @param length - array length
* @param value - fill value
* @param dtype - data type (default: 'float64')
* @returns filled array
*
* @example
* var arr = ns.afull( 2, 1.0 );
* // returns <Float64Array>[ 1.0, 1.0 ]
*
* @example
* var arr = ns.afull( 2, 1.0, 'float32' );
* // returns <Float32Array>[ 1.0, 1.0 ]
*/
afull: typeof afull;
/**
* Creates a filled array having the same length and data type as a provided input array.
*
* The function supports the following data types:
*
* - `float64`: double-precision floating-point numbers (IEEE 754)
* - `float32`: single-precision floating-point numbers (IEEE 754)
* - `complex128`: double-precision complex floating-point numbers
* - `complex64`: single-precision complex floating-point numbers
* - `int32`: 32-bit two's complement signed integers
* - `uint32`: 32-bit unsigned integers
* - `int16`: 16-bit two's complement signed integers
* - `uint16`: 16-bit unsigned integers
* - `int8`: 8-bit two's complement signed integers
* - `uint8`: 8-bit unsigned integers
* - `uint8c`: 8-bit unsigned integers clamped to `0-255`
* - `generic`: generic JavaScript values
*
* @param x - input array from which to derive the output array length
* @param value - fill value
* @param dtype - data type
* @returns filled array
*
* @example
* var zeros = require( `@stdlib/array/zeros` );
*
* var x = zeros( 2, 'float64' );
* // returns <Float64Array>[ 0.0, 0.0 ]
*
* var y = ns.afullLike( x, 1.0 );
* // returns <Float64Array>[ 1.0, 1.0 ]
*
* @example
* var zeros = require( `@stdlib/array/zeros` );
*
* var x = zeros( 2, 'float64' );
* // returns <Float64Array>[ 0.0, 0.0 ]
*
* var y = ns.afullLike( x, 1.0, 'float32' );
* // returns <Float32Array>[ 1.0, 1.0 ]
*/
afullLike: typeof afullLike;
/**
* Generates a linearly spaced numeric array using a provided increment.
*
* @param x1 - first array value
* @param x2 - array element bound
* @param increment - increment (default: 1)
* @throws length of created array must be less than `4294967295` (`2**32 - 1`)
* @returns linearly spaced numeric array
*
* @example
* var arr = ns.incrspace( 0, 11, 2 );
* // returns [ 0, 2, 4, 6, 8, 10 ]
*/
incrspace: typeof incrspace;
/**
* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.
*/
Int8Array: typeof Int8Array;
/**
* Typed array constructor which returns a typed array representing an array of twos-complement 16-bit signed integers in the platform byte order.
*/
Int16Array: typeof Int16Array;
/**
* Typed array constructor which returns a typed array representing an array of twos-complement 32-bit signed integers in the platform byte order.
*/
Int32Array: typeof Int32Array;
/**
* Generates a linearly spaced array over a specified interval.
*
* @param start - start of interval
* @param stop - end of interval
* @param len - length of output array
* @param options - function options
* @param options.dtype - output array data type
* @param options.endpoint - `boolean` indicating whether to include the `stop` value in the output array
* @returns linearly spaced array
*
* @example
* var arr = ns.linspace( 0.0, 100.0, 6 );
* // returns <Float64Array>[ 0.0, 20.0, 40.0, 60.0, 80.0, 100.0 ]
*
* @example
* var Float32Array = require( `@stdlib/array/float32` );
*
* var arr = new Float32Array( 6 );
* var out = ns.linspace.assign( 0.0, 100.0, arr );
* // returns <Float32Array>[ 0.0, 20.0, 40.0, 60.0, 80.0, 100.0 ]
*
* var bool = ( arr === out );
* // returns true
*/
linspace: typeof linspace;
/**
* Generates a logarithmically spaced numeric array.
*
* @param a - exponent of start value
* @param b - exponent of end value
* @param len - length of output array (default: 10)
* @throws third argument must be a nonnegative integer
* @returns logarithmically spaced numeric array
*
* @example
* var arr = ns.logspace( 0, 2, 6 );
* // returns [ 1, ~2.5, ~6.31, ~15.85, ~39.81, 100 ]
*/
logspace: typeof logspace;
/**
* Returns the minimum array data type of the closest "kind" necessary for storing a provided scalar value.
*
* ## Notes
*
* - The function does *not* provide precision guarantees for non-integer-valued real numbers. In other words, the function returns the smallest possible floating-point (i.e., inexact) data type for storing numbers having decimals.
*
* @param value - scalar value
* @returns array data type
*
* @example
* var dt = ns.arrayMinDataType( 'beep' );
* // returns 'generic'
*/
arrayMinDataType: typeof arrayMinDataType;
/**
* Returns the next larger array data type of the same kind.
*
* ## Notes
*
* - If not provided a data type, the function returns a table.
* - If a data type does not have a next larger data type or the next larger type is not supported, the function returns `-1`.
* - If provided an unrecognized data type, the function returns `null`.
*
* @param dtype - array data type
* @returns next larger data type(s) or null
*
* @example
* var table = ns.arrayNextDataType();
* // returns {...}
*
* @example
* var dt = ns.arrayNextDataType( 'float32' );
* // returns 'float64'
*/
arrayNextDataType: typeof arrayNextDataType;
/**
* Creates an array filled with ones and having a specified length.
*
* The function recognizes the following data types:
*
* - `float64`: double-precision floating-point numbers (IEEE 754)
* - `float32`: single-precision floating-point numbers (IEEE 754)
* - `complex128`: double-precision complex floating-point numbers
* - `complex64`: single-precision complex floating-point numbers
* - `int32`: 32-bit two's complement signed integers
* - `uint32`: 32-bit unsigned integers
* - `int16`: 16-bit two's complement signed integers
* - `uint16`: 16-bit unsigned integers
* - `int8`: 8-bit two's complement signed integers
* - `uint8`: 8-bit unsigned integers
* - `uint8c`: 8-bit unsigned integers clamped to `0-255`
* - `generic`: generic JavaScript values
*
* @param length - array length
* @param dtype - data type (default: 'float64')
* @returns filled array
*
* @example
* var arr = ns.aones( 2 );
* // returns <Float64Array>[ 1.0, 1.0 ]
*
* @example
* var arr = ns.aones( 2, 'float32' );
* // returns <Float32Array>[ 1.0, 1.0 ]
*/
aones: typeof aones;
/**
* Creates an array filled with ones and having the same length and data type as a provided input array.
*
* The function supports the following data types:
*
* - `float64`: double-precision floating-point numbers (IEEE 754)
* - `float32`: single-precision floating-point numbers (IEEE 754)
* - `complex128`: double-precision complex floating-point numbers
* - `complex64`: single-precision complex floating-point numbers
* - `int32`: 32-bit two's complement signed integers
* - `uint32`: 32-bit unsigned integers
* - `int16`: 16-bit two's complement signed integers
* - `uint16`: 16-bit unsigned integers
* - `int8`: 8-bit two's complement signed integers
* - `uint8`: 8-bit unsigned integers
* - `uint8c`: 8-bit unsigned integers clamped to `0-255`
* - `generic`: generic JavaScript values
*
* @param x - input array from which to derive the output array length
* @param dtype - data type
* @returns filled array
*
* @example
* var zeros = require( `@stdlib/array/zeros` );
*
* var x = zeros( 2, 'float64' );
* // returns <Float64Array>[ 0.0, 0.0 ]
*
* var y = ns.aonesLike( x );
* // returns <Float64Array>[ 1.0, 1.0 ]
*
* @example
* var zeros = require( `@stdlib/array/zeros` );
*
* var x = zeros( 2, 'float64' );
* // returns <Float64Array>[ 0.0, 0.0 ]
*
* var y = ns.aonesLike( x, 'float32' );
* // returns <Float32Array>[ 1.0, 1.0 ]
*/
aonesLike: typeof aonesLike;
/**
* Returns an uninitialized typed array.
*
* ## Notes
*
* - Memory is **not** initialized.
* - Memory is lazily allocated.
* - If the function returns `null`, the function was unable to allocate a new typed array from the typed array pool (most likely due to insufficient memory).
*
* @param arg - an array length or an array-like object
* @param dtype - data type (default: 'float64')
* @returns typed array or null
*
* @example
* // Allocate an array of doubles:
* var arr = ns.typedarraypool( 5, 'float64' );
* // e.g., returns <Float64Array>[ 0.0, 0.0, 0.0, 0.0, 0.0 ]
*
* arr[ 0 ] = 3.14;
* arr[ 1 ] = 3.14;
*
* // ...
*
* // Free the allocated memory to be used in a future allocation:
* ns.typedarraypool.free( arr );
*/
typedarraypool: typeof typedarraypool;
/**
* Returns a type promotion table displaying array data types with the smallest size and closest "kind" to which array data types can be safely cast.
*
* @param dtype1 - array data type
* @param dtype2 - array data type
* @returns promotion rule table
*
* @example
* var table = ns.arrayPromotionRules();
* // returns {...}
*/
arrayPromotionRules: typeof arrayPromotionRules;
/**
* Revives a JSON-serialized typed array.
*
* @param key - key
* @param value - value
* @returns value or typed array
*
* @example
* var parseJSON = require( `@stdlib/utils/parse-json` );
*
* var str = '{"type":"Float64Array","data":[5,3]}';
*
* var arr = parseJSON( str, ns.reviveTypedArray );
* // returns <Float64Array>[ 5.0, 3.0 ]
*/
reviveTypedArray: typeof reviveTypedArray;
/**
* Returns a list of array data types to which a provided array data type can be safely cast.
*
* ## Notes
*
* - If not provided an array data type, the function returns a casting table.
* - If provided an unrecognized array data type, the function returns `null`.
*
* @param dtype - array data type
* @returns a casting table, a list of array data types, or null
*
* @example
* var table = ns.arraySafeCasts();
* // returns {...}
*
* @example
* var list = ns.arraySafeCasts( 'float32' );
* // returns [...]
*
* @example
* var list = ns.arraySafeCasts( 'float' );
* // returns null
*/
arraySafeCasts: typeof arraySafeCasts;
/**
* Returns a list of array data types to which a provided array data type can be safely cast or cast within the same "kind".
*
* ## Notes
*
* - If not provided an array data type, the function returns a casting table.
* - If provided an unrecognized array data type, the function returns `null`.
*
* @param dtype - array data type
* @returns a table, a list of array data types, or null
*
* @example
* var table = ns.arraySameKindCasts();
* // returns {...}
*
* @example
* var list = ns.arraySameKindCasts( 'float32' );
* // returns [...]
*
* @example
* var list = ns.arraySameKindCasts( 'float' );
* // returns null
*/
arraySameKindCasts: typeof arraySameKindCasts;
/**
* Determines (nested) array dimensions.
*
* @param arr - array
* @returns array shape
*
* @example
* var arr = [ [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8, 9 ] ];
*
* var shape = ns.arrayShape( arr );
* // returns [ 3, 3 ]
*
* @example
* var arr = [ [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8 ] ];
*
* var shape = ns.arrayShape( arr );
* // returns [ 3 ]
*
* @example
* var arr = [ [ 1, 2, 3 ], [ 4, 5, 6 ], null ];
*
* var shape = ns.arrayShape( arr );
* // returns [ 3 ]
*/
arrayShape: typeof arrayShape;
/**
* Constructor returning an object used to represent a generic, fixed-length raw binary data buffer which can be used to create views of shared memory.
*/
SharedArrayBuffer: typeof SharedArrayBuffer;
/**
* Returns an iterator which repeatedly iterates over each element in an array-like object.
*
* @param src - input value
* @param options - function options
* @param options.iter - number of iterations
* @param options.dir - iteration direction
* @param mapFcn - function to invoke for each iterated value
* @param thisArg - execution context
* @throws must provide valid options
* @returns iterator
*
* @example
* var opts = {
* 'dir': -1
* };
* var it = ns.circarray2iterator( [ 1, 2, 3, 4 ], opts );
* // returns <Object>
*
* var v = it.next().value;
* // returns 4
*
* v = it.next().value;
* // returns 3
*
* v = it.next().value;
* // returns 2
*/
circarray2iterator: typeof circarray2iterator;
/**
* Returns an iterator which iterates over each element in an array-like object.
*
* @param src - input value
* @param mapFc - function to invoke for each iterated value
* @param thisArg - execution context
* @returns iterator
*
* @example
* var iter = ns.array2iterator( [ 1, 2, 3, 4 ] );
*
* var v = iter.next().value;
* // returns 1
*
* v = iter.next().value;
* // returns 2
*
* v = iter.next().value;
* // returns 3
*
* // ...
*/
array2iterator: typeof array2iterator;
/**
* Returns an iterator which iterates from right to left over each element in an array-like object.
*
* ## Notes
*
* - For dynamic array resizing, the only behavior made intentionally consistent with iterating from left to right is when elements are pushed onto the beginning (end) of an array. In other words, iterating from left to right combined with `[].push()` is consistent with iterating from right to left combined with `[].unshift()`.
*
* @param src - input value
* @param mapFcn - function to invoke for each iterated value
* @param thisArg - execution context
* @returns iterator
*
* @example
* var iter = ns.array2iteratorRight( [ 1, 2, 3, 4 ] );
*
* var v = iter.next().value;
* // returns 4
*
* v = iter.next().value;
* // returns 3
*
* v = iter.next().value;
* // returns 2
*
* // ...
*/
array2iteratorRight: typeof array2iteratorRight;
/**
* Returns a JSON representation of a typed array.
*
* ## Notes
*
* - We build a JSON object representing a typed array similar to how Node.js `Buffer` objects are represented. See [Buffer][1].
*
* [1]: https://nodejs.org/api/buffer.html#buffer_buf_tojson
*
* @param arr - typed array to serialize
* @returns JSON representation
*
* @example
* var Float64Array = require( `@stdlib/array/float64` );
*
* var arr = new Float64Array( [ 5.0, 3.0 ] );
* var json = ns.typedarray2json( arr );
* // returns { 'type': 'Float64Array', 'data': [ 5.0, 3.0 ] }
*/
typedarray2json: typeof typedarray2json;
/**
* Returns an iterator which iterates over each element in a sparse array-like object.
*
* @param src - input value
* @param mapFcn - function to invoke for each iterated value
* @param thisArg - execution context
* @returns iterator
*
* @example
* var iter = ns.sparsearray2iterator( [ 1, , 3, 4 ] );
*
* var v = iter.next().value;
* // returns 1
*
* v = iter.next().value;
* // returns 3
*
* v = iter.next().value;
* // returns 4
*/
sparsearray2iterator: typeof sparsearray2iterator;
/**
* Returns an iterator which iterates from right to left over each element in a sparse array-like object.
*
* ## Notes
*
* - For dynamic array resizing, the only behavior made intentionally consistent with iterating from left to right is when elements are pushed onto the beginning (end) of an array. In other words, iterating from left to right combined with `[].push()` is consistent with iterating from right to left combined with `[].unshift()`.
*
* @param src - input value
* @param mapFcn - function to invoke for each iterated value
* @param thisArg - execution context
* @returns iterator
*
* @example
* var iter = ns.sparsearray2iteratorRight( [ 1, , 3, 4 ] );
*
* var v = iter.next().value;
* // returns 4
*