@danielsimonjr/mathts-compat 0.2.10 → 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/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, subtract as subtract$1, multiply as multiply$1, divide as divide$1, pow as pow$1, sqrt as sqrt$1, abs as abs$1, exp as exp$1, log as log$1, sin as sin$1, cos as cos$1, tan as tan$1, sum as sum$1, mean as mean$1, min as min$1, max as max$1, gcd as gcd$1, lcm as lcm$1, round as round$1, floor as floor$1, ceil as ceil$1 } from '@danielsimonjr/mathts-functions';
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: typeof divide$1;
55
- declare const pow: typeof pow$1;
56
- declare const sqrt: typeof sqrt$1;
57
- declare const abs: typeof abs$1;
58
- declare const exp: typeof exp$1;
59
- declare const log: typeof log$1;
60
- declare const sin: typeof sin$1;
61
- declare const cos: typeof cos$1;
62
- declare const tan: typeof tan$1;
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: typeof sum$1;
68
- declare const mean: typeof mean$1;
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: typeof min$1;
73
- declare const max: typeof max$1;
74
- declare const gcd: typeof gcd$1;
75
- declare const lcm: typeof lcm$1;
76
- declare const round: typeof round$1;
77
- declare const floor: typeof floor$1;
78
- declare const ceil: typeof ceil$1;
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: typeof add$1;
147
- subtract: typeof subtract$1;
148
- multiply: typeof multiply$1;
149
- divide: typeof divide$1;
150
- pow: typeof pow$1;
151
- sqrt: typeof sqrt$1;
152
- abs: typeof abs$1;
153
- exp: typeof exp$1;
154
- log: typeof log$1;
155
- sin: typeof sin$1;
156
- cos: typeof cos$1;
157
- tan: typeof tan$1;
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: typeof sum$1;
163
- mean: typeof mean$1;
154
+ sum: typed_function.TypedFunction;
155
+ mean: typed_function.TypedFunction;
164
156
  std: typeof std;
165
157
  variance: typeof variance;
166
- min: typeof min$1;
167
- max: typeof max$1;
168
- gcd: typeof gcd$1;
169
- lcm: typeof lcm$1;
170
- round: typeof round$1;
171
- floor: typeof floor$1;
172
- ceil: typeof ceil$1;
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, config = {}) {
431
- const currentConfig = { ...defaultConfig, ...config };
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
- if (newConfig) {
439
- Object.assign(currentConfig, newConfig);
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.2.10",
3
+ "version": "0.3.0",
4
4
  "description": "mathjs compatibility layer for MathTS",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -24,9 +24,9 @@
24
24
  "build:prod": "tsup src/index.ts --format esm --dts --clean --minify --treeshake"
25
25
  },
26
26
  "dependencies": {
27
- "@danielsimonjr/mathts-core": "^0.5.0",
28
- "@danielsimonjr/mathts-functions": "^0.13.0",
29
- "@danielsimonjr/mathts-matrix": "^0.2.0",
27
+ "@danielsimonjr/mathts-core": "^0.6.0",
28
+ "@danielsimonjr/mathts-functions": "^0.14.0",
29
+ "@danielsimonjr/mathts-matrix": "^0.2.2",
30
30
  "@danielsimonjr/mathts-parallel": "^0.3.2"
31
31
  },
32
32
  "devDependencies": {