@danielsimonjr/mathts-functions 0.38.0 → 0.39.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.js CHANGED
@@ -3636,9 +3636,9 @@ function applyWindowDispatch(samples, windowName) {
3636
3636
  const wasm = getWasm();
3637
3637
  if (wasm && isAsWasm(wasm)) {
3638
3638
  try {
3639
- const out = withAsF64(wasm, [samples], (mod2, [h]) => {
3640
- mod2["apply_window_f64"](h, wt);
3641
- return asReadReturnedF64(mod2, h);
3639
+ const out = withAsF64(wasm, [samples], (mod3, [h]) => {
3640
+ mod3["apply_window_f64"](h, wt);
3641
+ return asReadReturnedF64(mod3, h);
3642
3642
  });
3643
3643
  if (out && out.length === samples.length) {
3644
3644
  samples.set(out);
@@ -3659,9 +3659,9 @@ function welchPSDDispatch(samples, frameLength, overlap, windowName) {
3659
3659
  const out = withAsF64(
3660
3660
  wasm,
3661
3661
  [samples],
3662
- (mod2, [h]) => asReadReturnedF64(
3663
- mod2,
3664
- mod2["welch_psd_f64"](
3662
+ (mod3, [h]) => asReadReturnedF64(
3663
+ mod3,
3664
+ mod3["welch_psd_f64"](
3665
3665
  h,
3666
3666
  frameLength,
3667
3667
  overlap,
@@ -3685,9 +3685,9 @@ function bartlettPSDDispatch(samples, frameLength) {
3685
3685
  const out = withAsF64(
3686
3686
  wasm,
3687
3687
  [samples],
3688
- (mod2, [h]) => asReadReturnedF64(
3689
- mod2,
3690
- mod2["bartlett_psd_f64"](h, frameLength)
3688
+ (mod3, [h]) => asReadReturnedF64(
3689
+ mod3,
3690
+ mod3["bartlett_psd_f64"](h, frameLength)
3691
3691
  )
3692
3692
  );
3693
3693
  if (out && out.length > 0) return out;
@@ -3706,7 +3706,7 @@ function goertzelDispatch(samples, targetFreq, sampleRate) {
3706
3706
  const r = withAsF64(
3707
3707
  wasm,
3708
3708
  [samples],
3709
- (mod2, [h]) => mod2["goertzel_f64"](
3709
+ (mod3, [h]) => mod3["goertzel_f64"](
3710
3710
  h,
3711
3711
  targetFreq,
3712
3712
  sampleRate
@@ -3728,9 +3728,9 @@ function chirpZTransformDispatch(samples, m, phiStartRe, phiStartIm, phiStepRe,
3728
3728
  const interleaved = withAsF64(
3729
3729
  wasm,
3730
3730
  [samples],
3731
- (mod2, [h]) => asReadReturnedF64(
3732
- mod2,
3733
- mod2["chirp_z_transform_f64"](h, m, phiStartRe, phiStartIm, phiStepRe, phiStepIm)
3731
+ (mod3, [h]) => asReadReturnedF64(
3732
+ mod3,
3733
+ mod3["chirp_z_transform_f64"](h, m, phiStartRe, phiStartIm, phiStepRe, phiStepIm)
3734
3734
  )
3735
3735
  );
3736
3736
  if (interleaved && interleaved.length === 2 * m) {
@@ -3749,6 +3749,139 @@ function chirpZTransformDispatch(samples, m, phiStartRe, phiStartIm, phiStepRe,
3749
3749
  return chirpZTransformJS(samples, m, phiStartRe, phiStartIm, phiStepRe, phiStepIm);
3750
3750
  }
3751
3751
 
3752
+ // src/signal/wavelet-filters.ts
3753
+ var DEC_LO_TABLE = {
3754
+ haar: [0.7071067811865476, 0.7071067811865476],
3755
+ db1: [0.7071067811865476, 0.7071067811865476],
3756
+ db2: [-0.12940952255126037, 0.2241438680420134, 0.8365163037378079, 0.48296291314453416],
3757
+ db3: [
3758
+ 0.03522629188570953,
3759
+ -0.08544127388202666,
3760
+ -0.13501102001025458,
3761
+ 0.45987750211849154,
3762
+ 0.8068915093110925,
3763
+ 0.33267055295008263
3764
+ ],
3765
+ db4: [
3766
+ -0.010597401785069032,
3767
+ 0.0328830116668852,
3768
+ 0.030841381835560764,
3769
+ -0.18703481171909309,
3770
+ -0.027983769416859854,
3771
+ 0.6308807679298589,
3772
+ 0.7148465705529157,
3773
+ 0.2303778133088965
3774
+ ],
3775
+ sym2: [-0.12940952255092145, 0.22414386804185735, 0.836516303737469, 0.48296291314469025],
3776
+ sym3: [
3777
+ 0.035226291882100656,
3778
+ -0.08544127388224149,
3779
+ -0.13501102001039084,
3780
+ 0.4598775021193313,
3781
+ 0.8068915093133388,
3782
+ 0.3326705529509569
3783
+ ],
3784
+ sym4: [
3785
+ -0.07576571478927333,
3786
+ -0.02963552764599851,
3787
+ 0.49761866763201545,
3788
+ 0.8037387518059161,
3789
+ 0.29785779560527736,
3790
+ -0.09921954357684722,
3791
+ -0.012603967262037833,
3792
+ 0.0322231006040427
3793
+ ],
3794
+ coif1: [
3795
+ -0.015655728135791993,
3796
+ -0.07273261951252645,
3797
+ 0.3848648468648578,
3798
+ 0.8525720202116004,
3799
+ 0.3378976624574818,
3800
+ -0.07273261951252645
3801
+ ],
3802
+ coif2: [
3803
+ -720549445520347e-18,
3804
+ -0.0018232088709110323,
3805
+ 0.005611434819368834,
3806
+ 0.02368017194684777,
3807
+ -0.05943441864643109,
3808
+ -0.07648859907828076,
3809
+ 0.4170051844232391,
3810
+ 0.8127236354494135,
3811
+ 0.3861100668227629,
3812
+ -0.0673725547237256,
3813
+ -0.04146493678687178,
3814
+ 0.01638733646320364
3815
+ ]
3816
+ };
3817
+ var SUPPORTED_WAVELETS = Object.keys(DEC_LO_TABLE);
3818
+ function getWaveletFilters(wavelet) {
3819
+ const decLo = DEC_LO_TABLE[wavelet];
3820
+ if (!decLo) {
3821
+ throw new Error(
3822
+ `unsupported wavelet "${wavelet}". Supported families: ${SUPPORTED_WAVELETS.join(", ")}`
3823
+ );
3824
+ }
3825
+ const L = decLo.length;
3826
+ const decHi = new Array(L);
3827
+ for (let k = 0; k < L; k++) {
3828
+ decHi[k] = (k % 2 === 0 ? -1 : 1) * decLo[L - 1 - k];
3829
+ }
3830
+ const recLo = decLo.slice().reverse();
3831
+ const recHi = decHi.slice().reverse();
3832
+ return { decLo, decHi, recLo, recHi };
3833
+ }
3834
+ function mod2(a, m) {
3835
+ const r = a % m;
3836
+ return r < 0 ? r + m : r;
3837
+ }
3838
+ function dwtPeriodization(x, wavelet) {
3839
+ const n = x.length;
3840
+ if (n < 2) throw new Error("signal must have at least 2 samples");
3841
+ const { decLo, decHi } = getWaveletFilters(wavelet);
3842
+ const L = decLo.length;
3843
+ const offset = Math.floor(L / 2);
3844
+ const half = Math.ceil(n / 2);
3845
+ const approx = new Array(half);
3846
+ const detail = new Array(half);
3847
+ for (let i = 0; i < half; i++) {
3848
+ let sa = 0;
3849
+ let sd = 0;
3850
+ for (let k = 0; k < L; k++) {
3851
+ const idx = mod2(2 * i - k + offset, n);
3852
+ const xi = x[idx];
3853
+ sa += decLo[k] * xi;
3854
+ sd += decHi[k] * xi;
3855
+ }
3856
+ approx[i] = sa;
3857
+ detail[i] = sd;
3858
+ }
3859
+ return { approx, detail };
3860
+ }
3861
+ function idwtPeriodization(approx, detail, wavelet) {
3862
+ if (approx.length !== detail.length) {
3863
+ throw new Error("approx and detail must have equal length");
3864
+ }
3865
+ const { recLo, recHi } = getWaveletFilters(wavelet);
3866
+ const half = approx.length;
3867
+ const n = half * 2;
3868
+ const L = recLo.length;
3869
+ const shift = Math.floor(L / 2) - 1;
3870
+ const x = new Array(n);
3871
+ for (let m = 0; m < n; m++) {
3872
+ let s = 0;
3873
+ for (let k = 0; k < L; k++) {
3874
+ const idx = mod2(m - k + shift, n);
3875
+ if (idx % 2 === 0) {
3876
+ const j = idx / 2;
3877
+ s += recLo[k] * approx[j] + recHi[k] * detail[j];
3878
+ }
3879
+ }
3880
+ x[m] = s;
3881
+ }
3882
+ return x;
3883
+ }
3884
+
3752
3885
  // src/typed/signal.ts
3753
3886
  var WASM_THRESHOLD = 64;
3754
3887
  function isPowerOf22(n) {
@@ -4182,7 +4315,11 @@ function dwt(x, wavelet = "haar") {
4182
4315
  }
4183
4316
  return { approx, detail };
4184
4317
  } else {
4185
- throw new Error(`dwt: unsupported wavelet "${wavelet}"`);
4318
+ try {
4319
+ return dwtPeriodization(x, wavelet);
4320
+ } catch (err) {
4321
+ throw new Error(`dwt: ${err instanceof Error ? err.message : String(err)}`);
4322
+ }
4186
4323
  }
4187
4324
  }
4188
4325
  async function fft2d(x) {
@@ -4737,9 +4874,9 @@ function runBinaryBitwiseWasm(op, a, b) {
4737
4874
  const n = a.length;
4738
4875
  const names = BINARY_OPS[op];
4739
4876
  try {
4740
- return withAsI32(wasm, [a, b, new Int32Array(n)], (mod2, [ha, hb, hr]) => {
4741
- mod2[names.as](ha, hb, hr);
4742
- return asReadReturnedI32(mod2, hr);
4877
+ return withAsI32(wasm, [a, b, new Int32Array(n)], (mod3, [ha, hb, hr]) => {
4878
+ mod3[names.as](ha, hb, hr);
4879
+ return asReadReturnedI32(mod3, hr);
4743
4880
  });
4744
4881
  } catch {
4745
4882
  return null;
@@ -4751,9 +4888,9 @@ function runUnaryBitwiseWasm(op, a) {
4751
4888
  const n = a.length;
4752
4889
  const names = UNARY_OPS[op];
4753
4890
  try {
4754
- return withAsI32(wasm, [a, new Int32Array(n)], (mod2, [ha, hr]) => {
4755
- mod2[names.as](ha, hr);
4756
- return asReadReturnedI32(mod2, hr);
4891
+ return withAsI32(wasm, [a, new Int32Array(n)], (mod3, [ha, hr]) => {
4892
+ mod3[names.as](ha, hr);
4893
+ return asReadReturnedI32(mod3, hr);
4757
4894
  });
4758
4895
  } catch {
4759
4896
  return null;
@@ -6479,7 +6616,7 @@ function besselOrderDispatch(order, xs, asName, js) {
6479
6616
  const out = withAsF64(
6480
6617
  wasm,
6481
6618
  [xs],
6482
- (mod2, [h]) => asReadReturnedF64(mod2, mod2[asName](order, h))
6619
+ (mod3, [h]) => asReadReturnedF64(mod3, mod3[asName](order, h))
6483
6620
  );
6484
6621
  if (out) return out;
6485
6622
  } catch {
@@ -6741,7 +6878,7 @@ function multiArrayDispatch(name254, inputs, js) {
6741
6878
  const out = withAsF64(
6742
6879
  wasm,
6743
6880
  inputs,
6744
- (mod2, headers) => asReadReturnedF64(mod2, mod2[name254](...headers))
6881
+ (mod3, headers) => asReadReturnedF64(mod3, mod3[name254](...headers))
6745
6882
  );
6746
6883
  if (out) return out;
6747
6884
  } catch {
@@ -9162,7 +9299,7 @@ function polyMulDispatch(a, b) {
9162
9299
  const out = withAsF64(
9163
9300
  wasm,
9164
9301
  [a, b],
9165
- (mod2, [ha, hb]) => asReadReturnedF64(mod2, mod2["poly_mul_f64"](ha, hb))
9302
+ (mod3, [ha, hb]) => asReadReturnedF64(mod3, mod3["poly_mul_f64"](ha, hb))
9166
9303
  );
9167
9304
  if (out) return out;
9168
9305
  } catch {
@@ -9181,9 +9318,9 @@ function polyDivModDispatch(num2, den) {
9181
9318
  const flat = withAsF64(
9182
9319
  wasm,
9183
9320
  [num2, den],
9184
- (mod2, [hn, hd]) => asReadReturnedF64(
9185
- mod2,
9186
- mod2["poly_div_mod_f64"](hn, hd)
9321
+ (mod3, [hn, hd]) => asReadReturnedF64(
9322
+ mod3,
9323
+ mod3["poly_div_mod_f64"](hn, hd)
9187
9324
  )
9188
9325
  );
9189
9326
  if (flat) {
@@ -9284,7 +9421,7 @@ function resultantDispatch(p, q) {
9284
9421
  const r = withAsF64(
9285
9422
  wasm,
9286
9423
  [p, q],
9287
- (mod2, [hp, hq]) => mod2["poly_resultant_f64"](hp, hq)
9424
+ (mod3, [hp, hq]) => mod3["poly_resultant_f64"](hp, hq)
9288
9425
  );
9289
9426
  if (r !== null) return r;
9290
9427
  } catch {
@@ -9302,7 +9439,7 @@ function discriminantDispatch(p) {
9302
9439
  const r = withAsF64(
9303
9440
  wasm,
9304
9441
  [p],
9305
- (mod2, [hp]) => mod2["poly_discriminant_f64"](hp)
9442
+ (mod3, [hp]) => mod3["poly_discriminant_f64"](hp)
9306
9443
  );
9307
9444
  if (r !== null) return r;
9308
9445
  } catch {
@@ -9415,9 +9552,9 @@ function fitDispatch(xs, ys, degree2, asName, jsFallback) {
9415
9552
  const out = withAsF64(
9416
9553
  wasm,
9417
9554
  [xs, ys],
9418
- (mod2, [hx, hy]) => asReadReturnedF64(
9419
- mod2,
9420
- mod2[asName](hx, hy, degree2)
9555
+ (mod3, [hx, hy]) => asReadReturnedF64(
9556
+ mod3,
9557
+ mod3[asName](hx, hy, degree2)
9421
9558
  )
9422
9559
  );
9423
9560
  if (out && out.length === degree2 + 1 && out.every((v) => Number.isFinite(v))) {
@@ -10948,9 +11085,9 @@ function tridiagSolveDispatch(diag2, lower, upper, rhs) {
10948
11085
  const result = withAsF64(
10949
11086
  wasm,
10950
11087
  [diag2, lower, upper, rhs],
10951
- (mod2, [hd, hl, hu, hr]) => asReadReturnedF64(
10952
- mod2,
10953
- mod2["tridiag_solve_f64"](
11088
+ (mod3, [hd, hl, hu, hr]) => asReadReturnedF64(
11089
+ mod3,
11090
+ mod3["tridiag_solve_f64"](
10954
11091
  hd,
10955
11092
  hl,
10956
11093
  hu,
@@ -10989,9 +11126,9 @@ function dividedDifferenceDispatch(xs, ys) {
10989
11126
  const result = withAsF64(
10990
11127
  wasm,
10991
11128
  [xs, ys],
10992
- (mod2, [hx, hy]) => asReadReturnedF64(
10993
- mod2,
10994
- mod2["divided_difference_f64"](hx, hy)
11129
+ (mod3, [hx, hy]) => asReadReturnedF64(
11130
+ mod3,
11131
+ mod3["divided_difference_f64"](hx, hy)
10995
11132
  )
10996
11133
  );
10997
11134
  if (result && result.length === n) return result;
@@ -28446,7 +28583,7 @@ var createGcd = /* @__PURE__ */ factory(
28446
28583
  DenseMatrix: DenseMatrix6,
28447
28584
  concat: concat3
28448
28585
  }) => {
28449
- const mod2 = createMod({
28586
+ const mod3 = createMod({
28450
28587
  typed: typed3,
28451
28588
  config: config2,
28452
28589
  round: round2,
@@ -28532,7 +28669,7 @@ var createGcd = /* @__PURE__ */ factory(
28532
28669
  }
28533
28670
  let r;
28534
28671
  while (b !== 0) {
28535
- r = mod2(a, b);
28672
+ r = mod3(a, b);
28536
28673
  a = b;
28537
28674
  b = r;
28538
28675
  }
@@ -28544,7 +28681,7 @@ var createGcd = /* @__PURE__ */ factory(
28544
28681
  }
28545
28682
  const zero = new BigNumber9(0);
28546
28683
  while (!b.isZero()) {
28547
- const r = mod2(a, b);
28684
+ const r = mod3(a, b);
28548
28685
  a = b;
28549
28686
  b = r;
28550
28687
  }
@@ -30315,7 +30452,7 @@ var createInvmod = /* @__PURE__ */ factory(
30315
30452
  xgcd: xgcd2,
30316
30453
  equal: equal2,
30317
30454
  smaller: smaller2,
30318
- mod: mod2,
30455
+ mod: mod3,
30319
30456
  add: add3,
30320
30457
  isInteger: isInteger3
30321
30458
  }) => {
@@ -30326,13 +30463,13 @@ var createInvmod = /* @__PURE__ */ factory(
30326
30463
  function invmod2(a, b) {
30327
30464
  if (!isInteger3(a) || !isInteger3(b))
30328
30465
  throw new Error("Parameters in function invmod must be integer numbers");
30329
- a = mod2(a, b);
30466
+ a = mod3(a, b);
30330
30467
  if (equal2(b, 0)) throw new Error("Divisor must be non zero");
30331
30468
  const res = xgcd2(a, b);
30332
30469
  const resVal = res.valueOf();
30333
30470
  const [gcd2, invValue] = resVal;
30334
30471
  if (!equal2(gcd2, 1)) return NaN;
30335
- let inv3 = mod2(invValue, b);
30472
+ let inv3 = mod3(invValue, b);
30336
30473
  if (smaller2(inv3, 0)) inv3 = add3(inv3, b);
30337
30474
  return inv3;
30338
30475
  }
@@ -44817,20 +44954,20 @@ function stirlingS1(n, k) {
44817
44954
  }
44818
44955
  return s[n][k];
44819
44956
  }
44820
- function modPowBig(base, exp2, mod2) {
44821
- let b = (base % mod2 + mod2) % mod2;
44957
+ function modPowBig(base, exp2, mod3) {
44958
+ let b = (base % mod3 + mod3) % mod3;
44822
44959
  let e = exp2;
44823
44960
  let result = 1n;
44824
44961
  while (e > 0n) {
44825
- if (e & 1n) result = result * b % mod2;
44826
- b = b * b % mod2;
44962
+ if (e & 1n) result = result * b % mod3;
44963
+ b = b * b % mod3;
44827
44964
  e >>= 1n;
44828
44965
  }
44829
44966
  return result;
44830
44967
  }
44831
- function modInverseBig(a, mod2) {
44968
+ function modInverseBig(a, mod3) {
44832
44969
  let oldR = a;
44833
- let r = mod2;
44970
+ let r = mod3;
44834
44971
  let oldS = 1n;
44835
44972
  let s = 0n;
44836
44973
  while (r !== 0n) {
@@ -44838,7 +44975,7 @@ function modInverseBig(a, mod2) {
44838
44975
  [oldR, r] = [r, oldR - q * r];
44839
44976
  [oldS, s] = [s, oldS - q * s];
44840
44977
  }
44841
- return (oldS % mod2 + mod2) % mod2;
44978
+ return (oldS % mod3 + mod3) % mod3;
44842
44979
  }
44843
44980
  function discreteLog(g, h, p) {
44844
44981
  if (!Number.isInteger(g) || !Number.isInteger(h) || !Number.isInteger(p) || p < 2) {
@@ -46716,6 +46853,12 @@ import { eig as eig3 } from "@danielsimonjr/mathts-matrix";
46716
46853
  function cSub(a, b) {
46717
46854
  return { re: a.re - b.re, im: a.im - b.im };
46718
46855
  }
46856
+ function cAdd(a, b) {
46857
+ return { re: a.re + b.re, im: a.im + b.im };
46858
+ }
46859
+ function cScale(a, s) {
46860
+ return { re: a.re * s, im: a.im * s };
46861
+ }
46719
46862
  function cMul(a, b) {
46720
46863
  return { re: a.re * b.re - a.im * b.im, im: a.re * b.im + a.im * b.re };
46721
46864
  }
@@ -46732,6 +46875,11 @@ function cZeros(n) {
46732
46875
  im: Array.from({ length: n }, () => new Array(n).fill(0))
46733
46876
  };
46734
46877
  }
46878
+ function cIdentity(n) {
46879
+ const m = cZeros(n);
46880
+ for (let i = 0; i < n; i++) m.re[i][i] = 1;
46881
+ return m;
46882
+ }
46735
46883
  function cFromReal(A) {
46736
46884
  const n = A.length;
46737
46885
  return {
@@ -46798,7 +46946,81 @@ function isDiagonal(A, n) {
46798
46946
  }
46799
46947
  return true;
46800
46948
  }
46801
- function funm(A, f) {
46949
+ function clusterEigenvalues(values, tol) {
46950
+ const acc = [];
46951
+ for (const v of values) {
46952
+ let placed = false;
46953
+ for (const c of acc) {
46954
+ const rep = { re: c.sumRe / c.count, im: c.sumIm / c.count };
46955
+ if (cAbs(cSub(v, rep)) < tol) {
46956
+ c.sumRe += v.re;
46957
+ c.sumIm += v.im;
46958
+ c.count += 1;
46959
+ placed = true;
46960
+ break;
46961
+ }
46962
+ }
46963
+ if (!placed) acc.push({ sumRe: v.re, sumIm: v.im, count: 1 });
46964
+ }
46965
+ return acc.map((c) => ({
46966
+ value: { re: c.sumRe / c.count, im: c.sumIm / c.count },
46967
+ count: c.count
46968
+ }));
46969
+ }
46970
+ function factorialNum(k) {
46971
+ let r = 1;
46972
+ for (let i = 2; i <= k; i++) r *= i;
46973
+ return r;
46974
+ }
46975
+ function numericalDerivative2(f, z, order) {
46976
+ const at = (dx) => f({ re: z.re + dx, im: z.im });
46977
+ switch (order) {
46978
+ case 1: {
46979
+ const h = 1e-6;
46980
+ return cScale(cSub(at(h), at(-h)), 1 / (2 * h));
46981
+ }
46982
+ case 2: {
46983
+ const h = 1e-4;
46984
+ const t = cSub(cAdd(at(h), at(-h)), cScale(at(0), 2));
46985
+ return cScale(t, 1 / (h * h));
46986
+ }
46987
+ case 3: {
46988
+ const h = 1e-3;
46989
+ const t = cSub(cAdd(at(2 * h), cScale(at(-h), 2)), cAdd(cScale(at(h), 2), at(-2 * h)));
46990
+ return cScale(t, 1 / (2 * h * h * h));
46991
+ }
46992
+ case 4: {
46993
+ const h = 0.01;
46994
+ let t = at(2 * h);
46995
+ t = cSub(t, cScale(at(h), 4));
46996
+ t = cAdd(t, cScale(at(0), 6));
46997
+ t = cSub(t, cScale(at(-h), 4));
46998
+ t = cAdd(t, at(-2 * h));
46999
+ return cScale(t, 1 / (h * h * h * h));
47000
+ }
47001
+ default:
47002
+ throw new Error(
47003
+ `funm: numerical derivatives of order ${order} are not supported (eigenvalue multiplicity ${order + 1} exceeds the finite-difference stencils); supply analytic derivatives via the fDerivs argument (fDerivs[k] = f^(k+1))`
47004
+ );
47005
+ }
47006
+ }
47007
+ function taylorCoeffs(f, fDerivs, z, maxOrder) {
47008
+ const coeffs = [f(z)];
47009
+ for (let L = 1; L <= maxOrder; L++) {
47010
+ const deriv = fDerivs && fDerivs.length >= L ? fDerivs[L - 1](z) : numericalDerivative2(f, z, L);
47011
+ coeffs.push(cScale(deriv, 1 / factorialNum(L)));
47012
+ }
47013
+ return coeffs;
47014
+ }
47015
+ function cIsFinite(M) {
47016
+ for (let i = 0; i < M.re.length; i++) {
47017
+ for (let j = 0; j < M.re.length; j++) {
47018
+ if (!Number.isFinite(M.re[i][j]) || !Number.isFinite(M.im[i][j])) return false;
47019
+ }
47020
+ }
47021
+ return true;
47022
+ }
47023
+ function funm(A, f, fDerivs) {
46802
47024
  const n = A.length;
46803
47025
  if (n === 0) return { re: [], im: [] };
46804
47026
  for (const row2 of A) {
@@ -46816,29 +47038,59 @@ function funm(A, f) {
46816
47038
  const { values } = eig3(A, { computeVectors: false });
46817
47039
  const maxAbs = values.reduce((m, v) => Math.max(m, cAbs(v)), 0);
46818
47040
  const tol = EIGENVALUE_DISTINCT_REL_TOL * Math.max(1, maxAbs);
46819
- for (let i = 0; i < n; i++) {
46820
- for (let j = i + 1; j < n; j++) {
46821
- if (cAbs(cSub(values[i], values[j])) < tol) {
46822
- throw new Error(
46823
- "funm: matrix has repeated (or numerically indistinguishable) eigenvalues and is not diagonal \u2014 defective/non-diagonalizable matrices are not supported (Schur-Parlett block recurrence not yet implemented)"
46824
- );
47041
+ const clusters = clusterEigenvalues(values, tol);
47042
+ if (clusters.length === n) {
47043
+ const F2 = cZeros(n);
47044
+ for (let i = 0; i < n; i++) {
47045
+ const lambdaI = values[i];
47046
+ let numerator = cFromReal(A);
47047
+ let denom = { re: 1, im: 0 };
47048
+ let first = true;
47049
+ for (let j = 0; j < n; j++) {
47050
+ if (j === i) continue;
47051
+ const factor2 = cShiftedReal(A, values[j]);
47052
+ numerator = first ? factor2 : cMatMul(numerator, factor2);
47053
+ first = false;
47054
+ denom = cMul(denom, cSub(lambdaI, values[j]));
46825
47055
  }
47056
+ cAccumulate(F2, f(lambdaI), cMatScalarDiv(numerator, denom));
46826
47057
  }
47058
+ return F2;
46827
47059
  }
46828
- const F = cZeros(n);
46829
- for (let i = 0; i < n; i++) {
46830
- const lambdaI = values[i];
46831
- let numerator = cFromReal(A);
46832
- let denom = { re: 1, im: 0 };
46833
- let first = true;
46834
- for (let j = 0; j < n; j++) {
46835
- if (j === i) continue;
46836
- const factor2 = cShiftedReal(A, values[j]);
46837
- numerator = first ? factor2 : cMatMul(numerator, factor2);
46838
- first = false;
46839
- denom = cMul(denom, cSub(lambdaI, values[j]));
47060
+ const nodes = [];
47061
+ const clusterIdx = [];
47062
+ const taylor2 = clusters.map(
47063
+ (c) => taylorCoeffs(f, fDerivs, c.value, c.count - 1)
47064
+ );
47065
+ clusters.forEach((c, ci) => {
47066
+ for (let r = 0; r < c.count; r++) {
47067
+ nodes.push(c.value);
47068
+ clusterIdx.push(ci);
46840
47069
  }
46841
- cAccumulate(F, f(lambdaI), cMatScalarDiv(numerator, denom));
47070
+ });
47071
+ const dd = Array.from({ length: n }, () => new Array(n));
47072
+ for (let i = 0; i < n; i++) dd[i][i] = taylor2[clusterIdx[i]][0];
47073
+ for (let L = 1; L < n; L++) {
47074
+ for (let i = 0; i + L < n; i++) {
47075
+ const j = i + L;
47076
+ if (clusterIdx[i] === clusterIdx[j]) {
47077
+ dd[i][j] = taylor2[clusterIdx[i]][L];
47078
+ } else {
47079
+ dd[i][j] = cDiv(cSub(dd[i + 1][j], dd[i][j - 1]), cSub(nodes[j], nodes[i]));
47080
+ }
47081
+ }
47082
+ }
47083
+ const F = cZeros(n);
47084
+ let P2 = cIdentity(n);
47085
+ cAccumulate(F, dd[0][0], P2);
47086
+ for (let k = 1; k < n; k++) {
47087
+ P2 = cMatMul(P2, cShiftedReal(A, nodes[k - 1]));
47088
+ cAccumulate(F, dd[0][k], P2);
47089
+ }
47090
+ if (!cIsFinite(F)) {
47091
+ throw new Error(
47092
+ "funm: result is non-finite \u2014 f (or one of its derivatives) is singular at a repeated eigenvalue (e.g. sqrt/log at 0), so the matrix function is undefined there"
47093
+ );
46842
47094
  }
46843
47095
  return F;
46844
47096
  }
@@ -46854,11 +47106,17 @@ function complexSin(z) {
46854
47106
  im: Math.cos(z.re) * Math.sinh(z.im)
46855
47107
  };
46856
47108
  }
47109
+ function trigDerivs(base, n) {
47110
+ return Array.from({ length: Math.max(0, n - 1) }, (_unused, k) => {
47111
+ const shift = (k + 1) * Math.PI / 2;
47112
+ return (z) => base({ re: z.re + shift, im: z.im });
47113
+ });
47114
+ }
46857
47115
  function cosm(A) {
46858
- return funm(A, complexCos);
47116
+ return funm(A, complexCos, trigDerivs(complexCos, A.length));
46859
47117
  }
46860
47118
  function sinm(A) {
46861
- return funm(A, complexSin);
47119
+ return funm(A, complexSin, trigDerivs(complexSin, A.length));
46862
47120
  }
46863
47121
 
46864
47122
  // src/numeric/control-equations.ts
@@ -48658,17 +48916,17 @@ function filtfilt(b, a, x) {
48658
48916
  ).y.reverse();
48659
48917
  return back.slice(pad, pad + n);
48660
48918
  }
48661
- var cAdd = (p, q) => p.add(q);
48919
+ var cAdd2 = (p, q) => p.add(q);
48662
48920
  var cSub2 = (p, q) => p.sub(q);
48663
48921
  var cMul2 = (p, q) => p.multiply(q);
48664
48922
  var cDiv2 = (p, q) => p.divide(q);
48665
- var cScale = (p, s) => cMul2(p, new Complex11(s, 0));
48923
+ var cScale2 = (p, s) => cMul2(p, new Complex11(s, 0));
48666
48924
  function polyFromRoots(roots) {
48667
48925
  let c = [new Complex11(1, 0)];
48668
48926
  for (const r of roots) {
48669
48927
  const next = Array.from({ length: c.length + 1 }, () => new Complex11(0, 0));
48670
48928
  for (let i = 0; i < c.length; i++) {
48671
- next[i] = cAdd(next[i], c[i]);
48929
+ next[i] = cAdd2(next[i], c[i]);
48672
48930
  next[i + 1] = cSub2(next[i + 1], cMul2(c[i], r));
48673
48931
  }
48674
48932
  c = next;
@@ -48683,8 +48941,8 @@ function relativeDegree(z, p) {
48683
48941
  function lp2lpZpk(z, p, k, wo) {
48684
48942
  const degree2 = relativeDegree(z, p);
48685
48943
  return {
48686
- z: z.map((zv) => cScale(zv, wo)),
48687
- p: p.map((pv) => cScale(pv, wo)),
48944
+ z: z.map((zv) => cScale2(zv, wo)),
48945
+ p: p.map((pv) => cScale2(pv, wo)),
48688
48946
  k: k * Math.pow(wo, degree2)
48689
48947
  };
48690
48948
  }
@@ -48703,8 +48961,8 @@ function lp2bpZpk(z, p, k, wo, bw) {
48703
48961
  const degree2 = relativeDegree(z, p);
48704
48962
  const wo2 = new Complex11(wo * wo, 0);
48705
48963
  const shift = (roots) => {
48706
- const lp = roots.map((r) => cScale(r, bw / 2));
48707
- const plus = lp.map((r) => cAdd(r, cSub2(cMul2(r, r), wo2).sqrt()));
48964
+ const lp = roots.map((r) => cScale2(r, bw / 2));
48965
+ const plus = lp.map((r) => cAdd2(r, cSub2(cMul2(r, r), wo2).sqrt()));
48708
48966
  const minus = lp.map((r) => cSub2(r, cSub2(cMul2(r, r), wo2).sqrt()));
48709
48967
  return plus.concat(minus);
48710
48968
  };
@@ -48718,7 +48976,7 @@ function lp2bsZpk(z, p, k, wo, bw) {
48718
48976
  const bw2 = new Complex11(bw / 2, 0);
48719
48977
  const shift = (roots) => {
48720
48978
  const hp = roots.map((r) => cDiv2(bw2, r));
48721
- const plus = hp.map((r) => cAdd(r, cSub2(cMul2(r, r), wo2).sqrt()));
48979
+ const plus = hp.map((r) => cAdd2(r, cSub2(cMul2(r, r), wo2).sqrt()));
48722
48980
  const minus = hp.map((r) => cSub2(r, cSub2(cMul2(r, r), wo2).sqrt()));
48723
48981
  return plus.concat(minus);
48724
48982
  };
@@ -48734,7 +48992,7 @@ function lp2bsZpk(z, p, k, wo, bw) {
48734
48992
  function bilinearZpk(z, p, k, fs) {
48735
48993
  const degree2 = relativeDegree(z, p);
48736
48994
  const fs2 = new Complex11(2 * fs, 0);
48737
- const zZ = z.map((zv) => cDiv2(cAdd(fs2, zv), cSub2(fs2, zv)));
48995
+ const zZ = z.map((zv) => cDiv2(cAdd2(fs2, zv), cSub2(fs2, zv)));
48738
48996
  for (let i = 0; i < degree2; i++) zZ.push(new Complex11(-1, 0));
48739
48997
  let prodZ = new Complex11(1, 0);
48740
48998
  for (const zv of z) prodZ = cMul2(prodZ, cSub2(fs2, zv));
@@ -48742,7 +49000,7 @@ function bilinearZpk(z, p, k, fs) {
48742
49000
  for (const pv of p) prodP = cMul2(prodP, cSub2(fs2, pv));
48743
49001
  return {
48744
49002
  z: zZ,
48745
- p: p.map((pv) => cDiv2(cAdd(fs2, pv), cSub2(fs2, pv))),
49003
+ p: p.map((pv) => cDiv2(cAdd2(fs2, pv), cSub2(fs2, pv))),
48746
49004
  k: k * cDiv2(prodZ, prodP).re
48747
49005
  };
48748
49006
  }
@@ -49008,10 +49266,10 @@ function arcJacSn(w, m) {
49008
49266
  let wn = w;
49009
49267
  for (let i = 0; i < ks.length - 1; i++) {
49010
49268
  const knext = ks[i + 1];
49011
- const comp = complementComplex(cScale(wn, ks[i]));
49012
- wn = cDiv2(cScale(wn, 2), cMul2(new Complex12(1 + knext, 0), new Complex12(1, 0).add(comp)));
49269
+ const comp = complementComplex(cScale2(wn, ks[i]));
49270
+ wn = cDiv2(cScale2(wn, 2), cMul2(new Complex12(1 + knext, 0), new Complex12(1, 0).add(comp)));
49013
49271
  }
49014
- return cScale(cScale(wn.asin(), 2 / Math.PI), K);
49272
+ return cScale2(cScale2(wn.asin(), 2 / Math.PI), K);
49015
49273
  }
49016
49274
  function arcJacSc1(w, m) {
49017
49275
  const z = arcJacSn(new Complex12(0, w), m);
@@ -49570,20 +49828,11 @@ function remez(numtaps, bands, desired) {
49570
49828
 
49571
49829
  // src/signal/wavelets.ts
49572
49830
  function idwt(approx, detail, wavelet = "haar") {
49573
- if (wavelet !== "haar" && wavelet !== "db1") {
49574
- throw new Error(`idwt: unsupported wavelet "${wavelet}"`);
49575
- }
49576
- if (approx.length !== detail.length) {
49577
- throw new Error("idwt: approx and detail must have equal length");
49578
- }
49579
- const half = approx.length;
49580
- const s = 1 / Math.SQRT2;
49581
- const x = new Array(half * 2);
49582
- for (let i = 0; i < half; i++) {
49583
- x[2 * i] = s * (approx[i] + detail[i]);
49584
- x[2 * i + 1] = s * (approx[i] - detail[i]);
49831
+ try {
49832
+ return idwtPeriodization(approx, detail, wavelet);
49833
+ } catch (err) {
49834
+ throw new Error(`idwt: ${err instanceof Error ? err.message : String(err)}`);
49585
49835
  }
49586
- return x;
49587
49836
  }
49588
49837
  function wavedec(x, wavelet = "haar", level = 1) {
49589
49838
  if (!Number.isInteger(level) || level < 1) {
@@ -24,13 +24,23 @@
24
24
  * any polynomial or entire function `f` (cos, sin, sqrt, exp, log, …)
25
25
  * whenever the spectrum is simple.
26
26
  *
27
- * Limitation (documented, not yet implemented): matrices with repeated (or
28
- * numerically indistinguishable) eigenvalues that are NOT diagonal — i.e.
29
- * genuinely defective/non-diagonalizable matrices, or diagonalizable
30
- * matrices with a repeated eigenvalue and off-diagonal structure are not
31
- * supported; `funm` throws rather than silently return a wrong answer. A
32
- * full Schur-Parlett block recurrence (Higham 2008 Ch. 9) would lift this
33
- * restriction; that is future work, not required by the current call sites.
27
+ * Defective / repeated-eigenvalue matrices (confluent Hermite interpolation):
28
+ * - When eigenvalues repeat (or cluster within `EIGENVALUE_DISTINCT_REL_TOL`),
29
+ * `f(A)` depends on `f` AND its derivatives at each repeated eigenvalue —
30
+ * for a Jordan block `J = λI + N` (N nilpotent, `N^s = 0`),
31
+ * f(J) = Σ_{k=0}^{s-1} f^(k)(λ)/k! · N^k.
32
+ * `funm` builds the confluent node list (each distinct eigenvalue repeated
33
+ * to its multiplicity) and evaluates the Newton divided-difference form
34
+ * f(A) = Σ_k f[z_0,…,z_k] · Π_{i<k}(A − z_i I),
35
+ * where a run of equal nodes contributes the Taylor coefficient
36
+ * `f^(L)(z)/L!`. This subsumes the simple-spectrum Lagrange path.
37
+ * - Derivatives of `f` come from the optional `fDerivs` argument
38
+ * (`fDerivs[k] = f^(k+1)`, machine precision — wired for `cosm`/`sinm`) or,
39
+ * when omitted, from finite-difference stencils (~1e-6 accuracy).
40
+ * - `funm` throws (rather than return a wrong/`NaN` answer) only when `f` or a
41
+ * derivative is genuinely singular at a repeated eigenvalue (e.g.
42
+ * `sqrt`/`log` at 0) or when a needed numerical derivative order exceeds the
43
+ * built-in stencils (multiplicity > 5 with no analytic derivatives).
34
44
  *
35
45
  * @packageDocumentation
36
46
  */
@@ -50,25 +60,40 @@ export type ScalarComplexFunction = (z: ComplexValue) => ComplexValue;
50
60
  * Evaluate the matrix function `f(A)` for a square real matrix `A`, returning
51
61
  * a complex matrix `{re, im}`.
52
62
  *
53
- * Supports diagonal matrices unconditionally (exact, elementwise), and
54
- * general diagonalizable matrices whose eigenvalues are pairwise distinct
55
- * (Lagrange-Sylvester interpolation on the spectrum — see module docs).
56
- * Throws for matrices with repeated or numerically indistinguishable
57
- * eigenvalues that are not diagonal (defective / non-diagonalizable case;
58
- * not yet supported see module docs for the Schur-Parlett follow-up).
63
+ * Supports:
64
+ * - diagonal matrices unconditionally (exact, elementwise);
65
+ * - diagonalizable matrices with pairwise-distinct eigenvalues
66
+ * (Lagrange-Sylvester interpolation the fast simple-spectrum branch);
67
+ * - defective / non-diagonalizable matrices with repeated (or numerically
68
+ * clustered) eigenvalues, via **confluent Hermite interpolation** (Newton
69
+ * divided differences over repeated eigenvalue nodes). A matrix function of
70
+ * a defective matrix depends on `f` AND its derivatives at each repeated
71
+ * eigenvalue (for a Jordan block `J = λI + N`, `f(J) = Σ_k f^(k)(λ)/k! · N^k`),
72
+ * so this branch needs derivatives of `f`: pass them analytically via
73
+ * `fDerivs` for machine precision, or they are approximated numerically.
74
+ *
75
+ * Throws (rather than return a wrong/`NaN` answer) when `f` or its derivatives
76
+ * are singular at a repeated eigenvalue (e.g. `sqrt`/`log` at 0), or when a
77
+ * needed numerical derivative order exceeds the built-in stencils.
59
78
  *
60
79
  * @param A - Square real matrix, as a plain 2-D array.
61
- * @param f - Scalar function to apply to each eigenvalue, e.g. `cos`, `sin`,
80
+ * @param f - Scalar function to apply to the spectrum, e.g. `cos`, `sin`,
62
81
  * `sqrt`, `exp`, `log`, extended to complex arguments.
82
+ * @param fDerivs - Optional analytic derivatives of `f`: `fDerivs[k]` is
83
+ * `f^(k+1)`. Needed only for defective matrices; when omitted, derivatives
84
+ * are computed by finite differences (~1e-6 accuracy). Additive and
85
+ * non-breaking — distinct-spectrum inputs never consult it.
63
86
  * @returns `{ re, im }` — the (possibly complex) matrix `f(A)`.
64
87
  */
65
- export declare function funm(A: number[][], f: ScalarComplexFunction): ComplexMatrix;
88
+ export declare function funm(A: number[][], f: ScalarComplexFunction, fDerivs?: ScalarComplexFunction[]): ComplexMatrix;
66
89
  /** Complex cosine: `cos(z) = cos(re)cosh(im) - i sin(re)sinh(im)`. */
67
90
  export declare function complexCos(z: ComplexValue): ComplexValue;
68
91
  /** Complex sine: `sin(z) = sin(re)cosh(im) + i cos(re)sinh(im)`. */
69
92
  export declare function complexSin(z: ComplexValue): ComplexValue;
70
- /** Matrix cosine `cos(A)`, via {@link funm} with {@link complexCos}. */
93
+ /** Matrix cosine `cos(A)`, via {@link funm} with {@link complexCos}. Passes
94
+ * exact analytic derivatives so defective matrices are machine-precise. */
71
95
  export declare function cosm(A: number[][]): ComplexMatrix;
72
- /** Matrix sine `sin(A)`, via {@link funm} with {@link complexSin}. */
96
+ /** Matrix sine `sin(A)`, via {@link funm} with {@link complexSin}. Passes
97
+ * exact analytic derivatives so defective matrices are machine-precise. */
73
98
  export declare function sinm(A: number[][]): ComplexMatrix;
74
99
  //# sourceMappingURL=matrix-functions.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"matrix-functions.d.ts","sourceRoot":"","sources":["../../src/numeric/matrix-functions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAIH,mDAAmD;AACnD,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,mFAAmF;AACnF,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,EAAE,EAAE,CAAC;IACf,EAAE,EAAE,MAAM,EAAE,EAAE,CAAC;CAChB;AAED,uEAAuE;AACvE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,CAAC,EAAE,YAAY,GAAG,YAAY,CAKxD;AAED,oEAAoE;AACpE,wBAAgB,UAAU,CAAC,CAAC,EAAE,YAAY,GAAG,YAAY,CAKxD;AAeD;2EAC2E;AAC3E,wBAAgB,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,GAAG,aAAa,CAEjD;AAED;2EAC2E;AAC3E,wBAAgB,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,GAAG,aAAa,CAEjD"}
@@ -0,0 +1,72 @@
1
+ /**
2
+ * Orthogonal wavelet filter table + a general periodization-boundary filter
3
+ * bank, shared by `dwt` (`../typed/signal.ts`) and `idwt`/`wavedec`/`waverec`
4
+ * (`./wavelets.ts`). This module is a dependency-free leaf: it must not
5
+ * import from `typed/signal.ts` (which imports `dwt` derivatives) to avoid a
6
+ * cycle.
7
+ *
8
+ * Each wavelet is stored as its decomposition low-pass filter (`dec_lo`),
9
+ * pinned bit-for-bit against PyWavelets 1.8.0 (`pywt.Wavelet(name).dec_lo`).
10
+ * The other three orthogonal filters are derived by the standard QMF
11
+ * relations (verified against pywt's `dec_hi`/`rec_lo`/`rec_hi` for every
12
+ * entry below, tolerance 1e-14):
13
+ *
14
+ * dec_hi[k] = -(-1)^k * dec_lo[L-1-k] (alternating flip of the reverse)
15
+ * rec_lo = reverse(dec_lo)
16
+ * rec_hi = reverse(dec_hi)
17
+ *
18
+ * Boundary mode is **periodization** (matches `pywt.dwt(..., mode='periodization')`
19
+ * exactly, bit-for-bit, verified against pywt for signal lengths 8/15/16/32):
20
+ * treating the signal as circularly periodic yields exactly `ceil(N/2)`
21
+ * coefficients per band and admits an exact analytic inverse. The phase
22
+ * alignment (derived empirically against pywt, then verified across many
23
+ * filter lengths and signal lengths) is:
24
+ *
25
+ * analysis: cA[n] = sum_k decLo[k] * x[(2n - k + floor(L/2)) mod N]
26
+ * cD[n] = sum_k decHi[k] * x[(2n - k + floor(L/2)) mod N]
27
+ * synthesis: x[m] = sum_k recLo[k] * cA[j] + recHi[k] * cD[j]
28
+ * where idx = mod(m - k + floor(L/2) - 1, N), only when idx is
29
+ * even (j = idx / 2) — odd idx contributes zero (upsampling).
30
+ *
31
+ * @packageDocumentation
32
+ */
33
+ /** Wavelet names supported by `dwt`/`idwt`/`wavedec`/`waverec`. */
34
+ export declare const SUPPORTED_WAVELETS: readonly string[];
35
+ /** The four orthogonal filters for a wavelet family. */
36
+ export interface WaveletFilters {
37
+ decLo: number[];
38
+ decHi: number[];
39
+ recLo: number[];
40
+ recHi: number[];
41
+ }
42
+ /**
43
+ * Looks up (and derives) the four orthogonal filters for `wavelet`.
44
+ *
45
+ * @throws if `wavelet` is not one of `SUPPORTED_WAVELETS`.
46
+ */
47
+ export declare function getWaveletFilters(wavelet: string): WaveletFilters;
48
+ /**
49
+ * Single-level DWT via a general orthogonal filter bank with periodization
50
+ * boundary handling. Matches `pywt.dwt(x, wavelet, mode='periodization')`
51
+ * bit-for-bit for every supported family.
52
+ *
53
+ * @param x - Input signal (length >= 2)
54
+ * @param wavelet - One of `SUPPORTED_WAVELETS`
55
+ * @returns `{ approx, detail }`, each of length `ceil(x.length / 2)`
56
+ */
57
+ export declare function dwtPeriodization(x: number[], wavelet: string): {
58
+ approx: number[];
59
+ detail: number[];
60
+ };
61
+ /**
62
+ * Inverse single-level DWT (periodization boundary), the exact analytic
63
+ * inverse of `dwtPeriodization`. Matches
64
+ * `pywt.idwt(approx, detail, wavelet, mode='periodization')` bit-for-bit.
65
+ *
66
+ * @param approx - Approximation (low-pass) coefficients
67
+ * @param detail - Detail (high-pass) coefficients, same length as `approx`
68
+ * @param wavelet - One of `SUPPORTED_WAVELETS`
69
+ * @returns Reconstructed signal, length `2 * approx.length`
70
+ */
71
+ export declare function idwtPeriodization(approx: number[], detail: number[], wavelet: string): number[];
72
+ //# sourceMappingURL=wavelet-filters.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wavelet-filters.d.ts","sourceRoot":"","sources":["../../src/signal/wavelet-filters.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAmCH,mEAAmE;AACnE,eAAO,MAAM,kBAAkB,EAAE,SAAS,MAAM,EAA8B,CAAC;AAE/E,wDAAwD;AACxD,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,cAAc,CAejE;AAQD;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAC9B,CAAC,EAAE,MAAM,EAAE,EACX,OAAO,EAAE,MAAM,GACd;IAAE,MAAM,EAAE,MAAM,EAAE,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAE,CAwBxC;AAED;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAwB/F"}
@@ -2,23 +2,24 @@
2
2
  * Phase 6 Task 4 — inverse DWT, multilevel wavedec/waverec (perfect
3
3
  * reconstruction), and the continuous wavelet transform (CWT).
4
4
  *
5
- * `idwt`/`wavedec`/`waverec` must invert the existing `dwt` (`../typed/signal.ts`)
6
- * exactly, so they match its Haar convention bit-for-bit: analysis filters
7
- * scaled by `s = 1/sqrt(2)`, `approx[i] = s*(x[2i]+x[2i+1])`,
8
- * `detail[i] = s*(x[2i]-x[2i+1])`. Haar's synthesis (reconstruction) filters
9
- * are the time-reverse of its analysis filters — for a symmetric 2-tap filter
10
- * that reversal is a no-op, so the closed-form inverse below is exact:
11
- * `x[2i] = s*(approx[i]+detail[i])`, `x[2i+1] = s*(approx[i]-detail[i])`.
5
+ * `idwt` inverts `dwt` (`../typed/signal.ts`) via the shared periodization
6
+ * filter bank in `./wavelet-filters.ts`, which supports the full family list
7
+ * (`SUPPORTED_WAVELETS`: haar, db1-4, sym2-4, coif1-2) and matches
8
+ * `pywt.idwt(..., mode='periodization')` bit-for-bit. For Haar/db1 this is
9
+ * verified equivalent to the earlier hardcoded closed-form 2-tap inverse
10
+ * (`x[2i] = s*(approx[i]+detail[i])`, `x[2i+1] = s*(approx[i]-detail[i])`,
11
+ * `s = 1/sqrt(2)`) no behavior change for existing callers.
12
12
  *
13
13
  * @packageDocumentation
14
14
  */
15
15
  /**
16
- * Inverse single-level discrete wavelet transform. Upsamples `approx`/`detail`
17
- * and combines them with the Haar synthesis filters, exactly inverting `dwt`.
16
+ * Inverse single-level discrete wavelet transform (periodization boundary).
17
+ * Exactly inverts `dwt` for every wavelet in `SUPPORTED_WAVELETS`
18
+ * (`./wavelet-filters.ts`): haar, db1-4, sym2-4, coif1-2.
18
19
  *
19
20
  * @param approx - Approximation (low-pass) coefficients
20
21
  * @param detail - Detail (high-pass) coefficients, same length as `approx`
21
- * @param wavelet - Wavelet name (currently only 'haar'/'db1', matching `dwt`)
22
+ * @param wavelet - Wavelet name (default 'haar'); see `SUPPORTED_WAVELETS`
22
23
  * @returns Reconstructed signal, length `2 * approx.length`
23
24
  */
24
25
  export declare function idwt(approx: number[], detail: number[], wavelet?: string): number[];
@@ -27,7 +28,8 @@ export declare function idwt(approx: number[], detail: number[], wavelet?: strin
27
28
  * approximation coefficients.
28
29
  *
29
30
  * @param x - Input signal
30
- * @param wavelet - Wavelet name (passed through to `dwt`)
31
+ * @param wavelet - Wavelet name (passed through to `dwt`); see
32
+ * `SUPPORTED_WAVELETS` in `./wavelet-filters.ts`
31
33
  * @param level - Number of decomposition levels (>= 1)
32
34
  * @returns `[cA_level, cD_level, cD_{level-1}, ..., cD_1]` (pywt order)
33
35
  */
@@ -1 +1 @@
1
- {"version":3,"file":"wavelets.d.ts","sourceRoot":"","sources":["../../src/signal/wavelets.ts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EAAE,MAAM,EAAE,EAAE,OAAO,GAAE,MAAiB,GAAG,MAAM,EAAE,EAAE,CAYzF"}
@@ -125,10 +125,17 @@ export declare function dst(x: number[]): number[];
125
125
  */
126
126
  export declare function idst(X: number[]): number[];
127
127
  /**
128
- * Discrete wavelet transform using Haar wavelet.
128
+ * Single-level discrete wavelet transform (periodization boundary).
129
129
  *
130
- * @param x - Input signal (length must be power of 2)
131
- * @param wavelet - Wavelet name (currently only 'haar')
130
+ * Haar/db1 use a dedicated closed-form (and WASM-accelerated) 2-tap path.
131
+ * All other supported families (db2-4, sym2-4, coif1-2) route through the
132
+ * general orthogonal filter bank in `../signal/wavelet-filters.ts`, which is
133
+ * verified to reproduce this same Haar/db1 result bit-for-bit and to match
134
+ * `pywt.dwt(..., mode='periodization')` for every family.
135
+ *
136
+ * @param x - Input signal (length >= 2)
137
+ * @param wavelet - Wavelet name; see `SUPPORTED_WAVELETS` in
138
+ * `../signal/wavelet-filters.ts` for the full list
132
139
  * @returns { approx: number[], detail: number[] }
133
140
  */
134
141
  export declare function dwt(x: number[], wavelet?: string): {
@@ -1 +1 @@
1
- {"version":3,"file":"signal.d.ts","sourceRoot":"","sources":["../../src/typed/signal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAOH,OAAO,EACL,mBAAmB,EAOpB,MAAM,+BAA+B,CAAC;AAWvC,0CAA0C;AAC1C,KAAK,GAAG,GAAG,MAAM,CAAC;AAElB,4BAA4B;AAC5B,KAAK,GAAG,GAAG,MAAM,CAAC;AAgJlB;;;;GAIG;AACH,eAAO,MAAM,WAAW,wCAiDtB,CAAC;AAEH;;;;;GAKG;AACH,eAAO,MAAM,YAAY,wCAqBvB,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,oBAAoB,wCAwB/B,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,gBAAgB,wCAoB3B,CAAC;AAMH;;;;GAIG;AACH,eAAO,MAAM,YAAY,wCAmEvB,CAAC;AAEH;;GA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E,GAAG,EAAE,MAAM,EAAE,CAAC;IAAC,WAAW,EAAE,MAAM,EAAE,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,CAS/D;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,MAAM,EAAE,GAAG,YAAY,EAC/B,IAAI,CAAC,EAAE;IAAE,IAAI,CAAC,EAAE,GAAG,CAAC;IAAC,CAAC,CAAC,EAAE,GAAG,CAAA;CAAE,GAC7B;IAAE,GAAG,EAAE,MAAM,EAAE,CAAC;IAAC,WAAW,EAAE,MAAM,EAAE,CAAA;CAAE,CAwC1C;AAED;;;;;;;;;GASG;AACH,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,YAAY,EAAE,UAAU,EAAE,GAAG,EAAE,UAAU,EAAE,GAAG,GAAG,GAAG,CAG/F;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,MAAM,EAAE,GAAG,YAAY,EAC/B,CAAC,EAAE,GAAG,EACN,QAAQ,GAAE,GAAO,EACjB,OAAO,GAAE,GAA2E,GACnF;IAAE,EAAE,EAAE,YAAY,CAAC;IAAC,EAAE,EAAE,YAAY,CAAA;CAAE,CAUxC;AAED;;GAEG;AACH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsCvB,CAAC;AAEF;;GAEG;AACH,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC,CAEtD;AAED;;GAEG;AACH,wBAAsB,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC,CAErD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danielsimonjr/mathts-functions",
3
- "version": "0.38.0",
3
+ "version": "0.39.0",
4
4
  "description": "Mathematical functions for MathTS - arithmetic, algebra, trigonometry, statistics, and more",
5
5
  "author": "Daniel Simon Jr.",
6
6
  "license": "MIT",