ziko 1.4.0 → 1.5.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/dist/ziko.cjs +348 -90
- package/dist/ziko.js +348 -90
- package/dist/ziko.min.js +2 -2
- package/dist/ziko.mjs +321 -91
- package/package.json +1 -1
- package/src/dom/components/for/index.js +17 -0
- package/src/dom/components/index.js +2 -1
- package/src/dom/constructors/UIElement.js +8 -1
- package/src/math/complex/index.d.ts +207 -30
- package/src/math/functions/arithmetic/index.d.ts +95 -0
- package/src/math/functions/conversions/index.d.ts +101 -0
- package/src/math/functions/index.d.ts +97 -90
- package/src/math/functions/logic/index.d.ts +50 -8
- package/src/math/functions/logic/index.js +1 -1
- package/src/math/functions/mapfun/index.d.ts +46 -80
- package/src/math/functions/mapfun/index.d.ts.txt +162 -0
- package/src/math/functions/signal/index.d.ts +146 -0
- package/src/math/functions/stats/index.js +33 -33
- package/src/math/functions/ufunc/index.d.ts +96 -0
- package/src/math/functions/utils/index.d.ts +118 -1
- package/src/math/index.d.ts +4 -0
- package/src/math/index.js +1 -16
- package/src/math/random/index.d.ts +162 -0
- package/src/math/random/index.js +4 -4
- package/src/math/stats/accum/index.d.ts +43 -0
- package/src/math/stats/average/index.d.ts +123 -0
- package/src/math/stats/index.d.ts +5 -0
- package/src/math/stats/percentile/index.d.ts +66 -0
- package/src/math/stats/rolling/index.d.ts +47 -0
- package/src/math/stats/variability/index.d.ts +93 -0
- package/src/math/index.d.ts.txt +0 -5
|
@@ -1,54 +1,231 @@
|
|
|
1
|
+
import type { Matrix } from "../matrix/index.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Represents a complex number.
|
|
5
|
+
*
|
|
6
|
+
* A complex number is represented as:
|
|
7
|
+
* a + bi
|
|
8
|
+
*/
|
|
1
9
|
export declare class Complex {
|
|
2
10
|
a: number;
|
|
3
11
|
b: number;
|
|
4
12
|
|
|
5
13
|
constructor(a?: number, b?: number);
|
|
6
14
|
constructor(c: Complex);
|
|
7
|
-
constructor(
|
|
8
|
-
{ a: number; b: number }
|
|
9
|
-
{ a: number; z: number }
|
|
10
|
-
{ a: number; phi: number }
|
|
11
|
-
{ b: number; z: number }
|
|
12
|
-
{ b: number; phi: number }
|
|
13
|
-
{ z: number; phi: number }
|
|
15
|
+
constructor(value:
|
|
16
|
+
| { a: number; b: number }
|
|
17
|
+
| { a: number; z: number }
|
|
18
|
+
| { a: number; phi: number }
|
|
19
|
+
| { b: number; z: number }
|
|
20
|
+
| { b: number; phi: number }
|
|
21
|
+
| { z: number; phi: number }
|
|
14
22
|
);
|
|
15
|
-
constructor();
|
|
16
23
|
|
|
24
|
+
/**
|
|
25
|
+
* Used by mapfun to identify complex values.
|
|
26
|
+
*/
|
|
27
|
+
readonly __mapfun__: boolean;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Checks whether this value is a Complex instance.
|
|
31
|
+
*/
|
|
17
32
|
isComplex(): true;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Converts the complex number to a string.
|
|
36
|
+
*/
|
|
18
37
|
toString(): string;
|
|
19
|
-
|
|
20
|
-
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Serializes the complex number.
|
|
41
|
+
*/
|
|
42
|
+
serialize(): string;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Deserializes a serialized complex number.
|
|
46
|
+
*/
|
|
47
|
+
static deserialize(json: string | object): Complex | TypeError;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Rounds real and imaginary parts.
|
|
51
|
+
*
|
|
52
|
+
* @param n Number of decimal digits.
|
|
53
|
+
*/
|
|
54
|
+
toFixed(n: number): this;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Formats real and imaginary parts with precision.
|
|
58
|
+
*
|
|
59
|
+
* @param n Number of significant digits.
|
|
60
|
+
*/
|
|
61
|
+
toPrecision(n: number): this;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Creates a copy of this complex number.
|
|
65
|
+
*/
|
|
66
|
+
clone(): Complex;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Magnitude of the complex number.
|
|
70
|
+
*/
|
|
21
71
|
readonly z: number;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Phase angle in radians.
|
|
75
|
+
*/
|
|
22
76
|
readonly phi: number;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Complex conjugate.
|
|
80
|
+
*/
|
|
23
81
|
readonly conj: Complex;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Multiplicative inverse.
|
|
85
|
+
*/
|
|
24
86
|
readonly inv: Complex;
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Exponential representation [magnitude, phase].
|
|
90
|
+
*/
|
|
91
|
+
readonly expo: [number, number];
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Adds complex numbers.
|
|
95
|
+
*/
|
|
96
|
+
add(...c: (number | Complex)[]): this;
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Subtracts complex numbers.
|
|
100
|
+
*/
|
|
101
|
+
sub(...c: (number | Complex)[]): this;
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Multiplies complex numbers.
|
|
105
|
+
*/
|
|
106
|
+
mul(...c: (number | Complex)[]): this;
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Divides complex numbers.
|
|
110
|
+
*/
|
|
111
|
+
div(...c: (number | Complex)[]): this;
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Computes modulo.
|
|
115
|
+
*/
|
|
116
|
+
modulo(...c: (number | Complex)[]): this;
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Raises the complex number to a power.
|
|
120
|
+
*/
|
|
121
|
+
pow(...c: (number | Complex)[]): this;
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Calculates the nth root.
|
|
125
|
+
*/
|
|
126
|
+
nthr(n?: number): Complex;
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Square root.
|
|
130
|
+
*/
|
|
25
131
|
readonly sqrt: Complex;
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Cube root.
|
|
135
|
+
*/
|
|
26
136
|
readonly cbrt: Complex;
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Complex logarithm.
|
|
140
|
+
*/
|
|
27
141
|
readonly log: Complex;
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Complex cosine.
|
|
145
|
+
*/
|
|
28
146
|
readonly cos: Complex;
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Complex sine.
|
|
150
|
+
*/
|
|
29
151
|
readonly sin: Complex;
|
|
30
|
-
readonly tan: Complex;
|
|
31
|
-
expo: [number, number];
|
|
32
152
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
pow(n: number): this;
|
|
38
|
-
nthr(n?: number): Complex;
|
|
153
|
+
/**
|
|
154
|
+
* Complex tangent.
|
|
155
|
+
*/
|
|
156
|
+
readonly tan: Complex;
|
|
39
157
|
|
|
158
|
+
/**
|
|
159
|
+
* Returns zero complex.
|
|
160
|
+
*/
|
|
40
161
|
static zero(): Complex;
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
static
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Creates a complex number from polar coordinates.
|
|
165
|
+
*
|
|
166
|
+
* @param z Magnitude.
|
|
167
|
+
* @param phi Angle in radians.
|
|
168
|
+
*/
|
|
169
|
+
static fromPolar(
|
|
170
|
+
z: number,
|
|
171
|
+
phi: number
|
|
172
|
+
): Complex;
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Creates FFT twiddle factor.
|
|
176
|
+
*/
|
|
177
|
+
static twiddle(
|
|
178
|
+
K: number,
|
|
179
|
+
N: number
|
|
180
|
+
): Complex;
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Generates random complex numbers.
|
|
184
|
+
*/
|
|
185
|
+
static readonly random: {
|
|
186
|
+
int(
|
|
187
|
+
a?: number,
|
|
188
|
+
b?: number
|
|
189
|
+
): Complex;
|
|
190
|
+
|
|
191
|
+
float(
|
|
192
|
+
a?: number,
|
|
193
|
+
b?: number
|
|
194
|
+
): Complex;
|
|
195
|
+
};
|
|
49
196
|
}
|
|
50
197
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Creates a complex number.
|
|
201
|
+
*/
|
|
202
|
+
export declare function complex(
|
|
203
|
+
a?: number,
|
|
204
|
+
b?: number
|
|
205
|
+
): Complex;
|
|
206
|
+
|
|
207
|
+
export declare function complex(
|
|
208
|
+
a: Complex
|
|
209
|
+
): Complex;
|
|
210
|
+
|
|
211
|
+
export declare function complex(
|
|
212
|
+
a: object
|
|
213
|
+
): Complex;
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* Creates arrays of complex numbers from two arrays.
|
|
218
|
+
*/
|
|
219
|
+
export declare function complex(
|
|
220
|
+
a: number[] | ArrayLike<number>,
|
|
221
|
+
b: number[] | ArrayLike<number>
|
|
222
|
+
): Complex[];
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* Creates a complex matrix by combining two matrices.
|
|
227
|
+
*/
|
|
228
|
+
export declare function complex(
|
|
229
|
+
a: Matrix,
|
|
230
|
+
b: Matrix
|
|
231
|
+
): Matrix;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Arithmetic operation compatible with numbers,
|
|
3
|
+
* complex numbers, and matrix-like objects.
|
|
4
|
+
*/
|
|
5
|
+
export type ArithmeticValue = number | ComplexLike | MatrixLike;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Minimal interface for complex number objects.
|
|
9
|
+
*/
|
|
10
|
+
export interface ComplexLike {
|
|
11
|
+
isComplex(): boolean;
|
|
12
|
+
|
|
13
|
+
clone(): this;
|
|
14
|
+
|
|
15
|
+
add(value: number | ComplexLike): this;
|
|
16
|
+
sub(value: number | ComplexLike): this;
|
|
17
|
+
mul(value: number | ComplexLike): this;
|
|
18
|
+
div(value: number | ComplexLike): this;
|
|
19
|
+
modulo(value: number | ComplexLike): this;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Minimal interface for matrix objects.
|
|
24
|
+
*/
|
|
25
|
+
export interface MatrixLike {
|
|
26
|
+
rows: number;
|
|
27
|
+
cols: number;
|
|
28
|
+
|
|
29
|
+
isMatrix(): boolean;
|
|
30
|
+
|
|
31
|
+
clone(): this;
|
|
32
|
+
|
|
33
|
+
add(value: ArithmeticValue): this;
|
|
34
|
+
sub(value: ArithmeticValue): this;
|
|
35
|
+
mul(value: ArithmeticValue): this;
|
|
36
|
+
div(value: ArithmeticValue): this;
|
|
37
|
+
modulo(value: ArithmeticValue): this;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Adds values together.
|
|
42
|
+
*
|
|
43
|
+
* Supports numbers, complex numbers, and matrices.
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* add(1, 2, 3) // 6
|
|
47
|
+
*/
|
|
48
|
+
export declare function add<T extends ArithmeticValue>(
|
|
49
|
+
a: T,
|
|
50
|
+
...b: ArithmeticValue[]
|
|
51
|
+
): T;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Subtracts values sequentially.
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* sub(10, 2, 3) // 5
|
|
58
|
+
*/
|
|
59
|
+
export declare function sub<T extends ArithmeticValue>(
|
|
60
|
+
a: T,
|
|
61
|
+
...b: ArithmeticValue[]
|
|
62
|
+
): T;
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Multiplies values sequentially.
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* mul(2, 3, 4) // 24
|
|
69
|
+
*/
|
|
70
|
+
export declare function mul<T extends ArithmeticValue>(
|
|
71
|
+
a: T,
|
|
72
|
+
...b: ArithmeticValue[]
|
|
73
|
+
): T;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Divides values sequentially.
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* div(20, 2, 5) // 2
|
|
80
|
+
*/
|
|
81
|
+
export declare function div<T extends ArithmeticValue>(
|
|
82
|
+
a: T,
|
|
83
|
+
...b: ArithmeticValue[]
|
|
84
|
+
): T;
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Calculates modulo sequentially.
|
|
88
|
+
*
|
|
89
|
+
* @example
|
|
90
|
+
* modulo(20, 6) // 2
|
|
91
|
+
*/
|
|
92
|
+
export declare function modulo<T extends ArithmeticValue>(
|
|
93
|
+
a: T,
|
|
94
|
+
...b: ArithmeticValue[]
|
|
95
|
+
): T;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Converts a value from one numerical base to another.
|
|
3
|
+
*
|
|
4
|
+
* Supported bases are between 2 and 36.
|
|
5
|
+
*
|
|
6
|
+
* @param value Value to convert.
|
|
7
|
+
* @param fromBase Source base.
|
|
8
|
+
* @param toBase Target base.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* base2base("1010", 2, 10) // "10"
|
|
12
|
+
*/
|
|
13
|
+
export declare function base2base(
|
|
14
|
+
value: string | number,
|
|
15
|
+
fromBase: number,
|
|
16
|
+
toBase: number
|
|
17
|
+
): string;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Converts binary values to octal.
|
|
21
|
+
*/
|
|
22
|
+
export declare function bin2oct(
|
|
23
|
+
...x: (string | number)[]
|
|
24
|
+
): string[];
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Converts binary values to decimal.
|
|
28
|
+
*/
|
|
29
|
+
export declare function bin2dec(
|
|
30
|
+
...x: (string | number)[]
|
|
31
|
+
): string[];
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Converts binary values to hexadecimal.
|
|
35
|
+
*/
|
|
36
|
+
export declare function bin2hex(
|
|
37
|
+
...x: (string | number)[]
|
|
38
|
+
): string[];
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Converts octal values to binary.
|
|
42
|
+
*/
|
|
43
|
+
export declare function oct2bin(
|
|
44
|
+
...x: (string | number)[]
|
|
45
|
+
): string[];
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Converts octal values to decimal.
|
|
49
|
+
*/
|
|
50
|
+
export declare function oct2dec(
|
|
51
|
+
...x: (string | number)[]
|
|
52
|
+
): string[];
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Converts octal values to hexadecimal.
|
|
56
|
+
*/
|
|
57
|
+
export declare function oct2hex(
|
|
58
|
+
...x: (string | number)[]
|
|
59
|
+
): string[];
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Converts decimal values to binary.
|
|
63
|
+
*/
|
|
64
|
+
export declare function dec2bin(
|
|
65
|
+
...x: (string | number)[]
|
|
66
|
+
): string[];
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Converts decimal values to octal.
|
|
70
|
+
*/
|
|
71
|
+
export declare function dec2oct(
|
|
72
|
+
...x: (string | number)[]
|
|
73
|
+
): string[];
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Converts decimal values to hexadecimal.
|
|
77
|
+
*/
|
|
78
|
+
export declare function dec2hex(
|
|
79
|
+
...x: (string | number)[]
|
|
80
|
+
): string[];
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Converts hexadecimal values to binary.
|
|
84
|
+
*/
|
|
85
|
+
export declare function hex2bin(
|
|
86
|
+
...x: (string | number)[]
|
|
87
|
+
): string[];
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Converts hexadecimal values to octal.
|
|
91
|
+
*/
|
|
92
|
+
export declare function hex2oct(
|
|
93
|
+
...x: (string | number)[]
|
|
94
|
+
): string[];
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Converts hexadecimal values to decimal.
|
|
98
|
+
*/
|
|
99
|
+
export declare function hex2dec(
|
|
100
|
+
...x: (string | number)[]
|
|
101
|
+
): string[];
|