@danielsimonjr/mathts-compat 0.2.11 → 0.3.1
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/index.d.ts +41 -49
- package/dist/index.js +11 -6
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,19 +1,11 @@
|
|
|
1
|
+
import * as typed_function from 'typed-function';
|
|
1
2
|
import { Complex, Fraction, BigNumber } from '@danielsimonjr/mathts-core';
|
|
2
3
|
export { BIGNUMBER_E, BIGNUMBER_ONE, BIGNUMBER_PI, BIGNUMBER_ZERO, BigNumber, COMPLEX_ONE, COMPLEX_ZERO, Complex, FRACTION_ONE, FRACTION_ZERO, Fraction, I } from '@danielsimonjr/mathts-core';
|
|
3
|
-
import { add as add$1,
|
|
4
|
+
import { add as add$1, multiply as multiply$1, subtract as subtract$1 } from '@danielsimonjr/mathts-functions';
|
|
4
5
|
import { DenseMatrix, SparseMatrix } from '@danielsimonjr/mathts-matrix';
|
|
5
6
|
export { DenseMatrix, SparseMatrix } from '@danielsimonjr/mathts-matrix';
|
|
6
7
|
export { computePool } from '@danielsimonjr/mathts-parallel';
|
|
7
8
|
|
|
8
|
-
/**
|
|
9
|
-
* mathjs Compatibility Shims
|
|
10
|
-
*
|
|
11
|
-
* Provides mathjs-compatible API wrappers around MathTS functions.
|
|
12
|
-
* This allows gradual migration from mathjs to MathTS.
|
|
13
|
-
*
|
|
14
|
-
* @packageDocumentation
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
9
|
/**
|
|
18
10
|
* Create a complex number (mathjs-compatible)
|
|
19
11
|
* @example
|
|
@@ -51,31 +43,31 @@ declare function sparse(data?: number[][]): SparseMatrix;
|
|
|
51
43
|
declare const add: typeof add$1;
|
|
52
44
|
declare const subtract: typeof subtract$1;
|
|
53
45
|
declare const multiply: typeof multiply$1;
|
|
54
|
-
declare const divide:
|
|
55
|
-
declare const pow:
|
|
56
|
-
declare const sqrt:
|
|
57
|
-
declare const abs:
|
|
58
|
-
declare const exp:
|
|
59
|
-
declare const log:
|
|
60
|
-
declare const sin:
|
|
61
|
-
declare const cos:
|
|
62
|
-
declare const tan:
|
|
46
|
+
declare const divide: typed_function.TypedFunction;
|
|
47
|
+
declare const pow: typed_function.TypedFunction;
|
|
48
|
+
declare const sqrt: typed_function.TypedFunction;
|
|
49
|
+
declare const abs: typed_function.TypedFunction;
|
|
50
|
+
declare const exp: typed_function.TypedFunction;
|
|
51
|
+
declare const log: typed_function.TypedFunction;
|
|
52
|
+
declare const sin: typed_function.TypedFunction;
|
|
53
|
+
declare const cos: typed_function.TypedFunction;
|
|
54
|
+
declare const tan: typed_function.TypedFunction;
|
|
63
55
|
declare function asin(x: number): number;
|
|
64
56
|
declare function acos(x: number): number;
|
|
65
57
|
declare function atan(x: number): number;
|
|
66
58
|
declare function atan2(y: number, x: number): number;
|
|
67
|
-
declare const sum:
|
|
68
|
-
declare const mean:
|
|
59
|
+
declare const sum: typed_function.TypedFunction;
|
|
60
|
+
declare const mean: typed_function.TypedFunction;
|
|
69
61
|
type Normalization = 'unbiased' | 'uncorrected' | 'biased';
|
|
70
62
|
declare function variance(data: unknown, normalization?: Normalization): number;
|
|
71
63
|
declare function std(data: unknown, normalization?: Normalization): number;
|
|
72
|
-
declare const min:
|
|
73
|
-
declare const max:
|
|
74
|
-
declare const gcd:
|
|
75
|
-
declare const lcm:
|
|
76
|
-
declare const round:
|
|
77
|
-
declare const floor:
|
|
78
|
-
declare const ceil:
|
|
64
|
+
declare const min: typed_function.TypedFunction;
|
|
65
|
+
declare const max: typed_function.TypedFunction;
|
|
66
|
+
declare const gcd: typed_function.TypedFunction;
|
|
67
|
+
declare const lcm: typed_function.TypedFunction;
|
|
68
|
+
declare const round: typed_function.TypedFunction;
|
|
69
|
+
declare const floor: typed_function.TypedFunction;
|
|
70
|
+
declare const ceil: typed_function.TypedFunction;
|
|
79
71
|
/**
|
|
80
72
|
* Complex conjugate (mathjs-compatible)
|
|
81
73
|
*/
|
|
@@ -143,33 +135,33 @@ declare const shims: {
|
|
|
143
135
|
bignumber: typeof bignumber;
|
|
144
136
|
matrix: typeof matrix;
|
|
145
137
|
sparse: typeof sparse;
|
|
146
|
-
add:
|
|
147
|
-
subtract:
|
|
148
|
-
multiply:
|
|
149
|
-
divide:
|
|
150
|
-
pow:
|
|
151
|
-
sqrt:
|
|
152
|
-
abs:
|
|
153
|
-
exp:
|
|
154
|
-
log:
|
|
155
|
-
sin:
|
|
156
|
-
cos:
|
|
157
|
-
tan:
|
|
138
|
+
add: typed_function.TypedFunction;
|
|
139
|
+
subtract: typed_function.TypedFunction;
|
|
140
|
+
multiply: typed_function.TypedFunction;
|
|
141
|
+
divide: typed_function.TypedFunction;
|
|
142
|
+
pow: typed_function.TypedFunction;
|
|
143
|
+
sqrt: typed_function.TypedFunction;
|
|
144
|
+
abs: typed_function.TypedFunction;
|
|
145
|
+
exp: typed_function.TypedFunction;
|
|
146
|
+
log: typed_function.TypedFunction;
|
|
147
|
+
sin: typed_function.TypedFunction;
|
|
148
|
+
cos: typed_function.TypedFunction;
|
|
149
|
+
tan: typed_function.TypedFunction;
|
|
158
150
|
asin: typeof asin;
|
|
159
151
|
acos: typeof acos;
|
|
160
152
|
atan: typeof atan;
|
|
161
153
|
atan2: typeof atan2;
|
|
162
|
-
sum:
|
|
163
|
-
mean:
|
|
154
|
+
sum: typed_function.TypedFunction;
|
|
155
|
+
mean: typed_function.TypedFunction;
|
|
164
156
|
std: typeof std;
|
|
165
157
|
variance: typeof variance;
|
|
166
|
-
min:
|
|
167
|
-
max:
|
|
168
|
-
gcd:
|
|
169
|
-
lcm:
|
|
170
|
-
round:
|
|
171
|
-
floor:
|
|
172
|
-
ceil:
|
|
158
|
+
min: typed_function.TypedFunction;
|
|
159
|
+
max: typed_function.TypedFunction;
|
|
160
|
+
gcd: typed_function.TypedFunction;
|
|
161
|
+
lcm: typed_function.TypedFunction;
|
|
162
|
+
round: typed_function.TypedFunction;
|
|
163
|
+
floor: typed_function.TypedFunction;
|
|
164
|
+
ceil: typed_function.TypedFunction;
|
|
173
165
|
conj: typeof conj;
|
|
174
166
|
re: typeof re;
|
|
175
167
|
im: typeof im;
|
package/dist/index.js
CHANGED
|
@@ -427,17 +427,22 @@ var defaultConfig = {
|
|
|
427
427
|
epsilon: 1e-12,
|
|
428
428
|
randomSeed: null
|
|
429
429
|
};
|
|
430
|
-
function create(factories = all,
|
|
431
|
-
const currentConfig = { ...defaultConfig, ...
|
|
430
|
+
function create(factories = all, config2 = {}) {
|
|
431
|
+
const currentConfig = { ...defaultConfig, ...config2 };
|
|
432
|
+
if (Object.keys(config2).length > 0) {
|
|
433
|
+
mathFunctions.config(config2);
|
|
434
|
+
}
|
|
432
435
|
const instance = {
|
|
433
436
|
// Full @danielsimonjr/mathts-functions namespace — det, integrate, eigs,
|
|
434
437
|
// simplify, and the rest. The compat-specific shims below overlay it.
|
|
435
438
|
...factories,
|
|
436
|
-
// Configuration
|
|
439
|
+
// Configuration — forwards to the shared functions runtime config so it
|
|
440
|
+
// actually DRIVES behavior (e.g. `config({ matrix: 'Array' })` changes the
|
|
441
|
+
// return type of matrix-producing ops). `currentConfig` mirrors it for the
|
|
442
|
+
// read path and seeds the functions config with this instance's overrides.
|
|
437
443
|
config: (newConfig) => {
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
}
|
|
444
|
+
const merged = mathFunctions.config(newConfig);
|
|
445
|
+
Object.assign(currentConfig, merged);
|
|
441
446
|
return { ...currentConfig };
|
|
442
447
|
},
|
|
443
448
|
// Type creation
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@danielsimonjr/mathts-compat",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "mathjs compatibility layer for MathTS",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@danielsimonjr/mathts-core": "^0.6.0",
|
|
28
|
-
"@danielsimonjr/mathts-functions": "^0.
|
|
28
|
+
"@danielsimonjr/mathts-functions": "^0.15.0",
|
|
29
29
|
"@danielsimonjr/mathts-matrix": "^0.2.2",
|
|
30
30
|
"@danielsimonjr/mathts-parallel": "^0.3.2"
|
|
31
31
|
},
|