@danielsimonjr/mathts-functions 0.43.2 → 0.44.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 +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +723 -61
- package/dist/numeric/control-equations.d.ts +18 -6
- package/dist/numeric/control-equations.d.ts.map +1 -1
- package/dist/signal/fir-smoothing.d.ts +12 -8
- package/dist/signal/fir-smoothing.d.ts.map +1 -1
- package/dist/signal/iir-design.d.ts +15 -6
- package/dist/signal/iir-design.d.ts.map +1 -1
- package/dist/signal/remez-exchange.d.ts +28 -0
- package/dist/signal/remez-exchange.d.ts.map +1 -0
- package/dist/type/unit/physicalConstants.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -87,6 +87,7 @@ export { rfft, irfft, fftshift, ifftshift, fftfreq, rfftfreq, fftn } from './sig
|
|
|
87
87
|
export { cheby1, cheby2, ellip, sosfilt, zpk2sos, bilinear, buttord } from './signal/iir-design.js';
|
|
88
88
|
export { firwinBandpass, firls, remez, savgol, wiener, deconvolve, } from './signal/fir-smoothing.js';
|
|
89
89
|
export type { DeconvolveResult } from './signal/fir-smoothing.js';
|
|
90
|
+
export type { RemezType } from './signal/remez-exchange.js';
|
|
90
91
|
export { idwt, wavedec, waverec, cwt } from './signal/wavelets.js';
|
|
91
92
|
export { findPeaks, peakWidths, csd, coherence, stft, istft, decimate, } from './signal/spectral-peaks.js';
|
|
92
93
|
export type { FindPeaksOptions, CsdOptions, StftOptions, StftResult, } from './signal/spectral-peaks.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,cAAc,kBAAkB,CAAC;AAKjC,cAAc,gBAAgB,CAAC;AAG/B,cAAc,sBAAsB,CAAC;AACrC,OA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|
-
const
|
|
20447
|
+
const TWOPI2 = 6.283185307179586;
|
|
20448
20448
|
const LOGPI = 1.1447298858494002;
|
|
20449
20449
|
const REFLECTION = 0.1;
|
|
20450
20450
|
if (n.isNaN()) {
|
|
@@ -20454,7 +20454,7 @@ var createLgamma = /* @__PURE__ */ factory(
|
|
|
20454
20454
|
} else if (n.re >= SMALL_RE || Math.abs(n.im) >= SMALL_IM) {
|
|
20455
20455
|
return lgammaStirling(n);
|
|
20456
20456
|
} else if (n.re <= REFLECTION) {
|
|
20457
|
-
const tmp = copysign(
|
|
20457
|
+
const tmp = copysign(TWOPI2, n.im) * Math.floor(0.5 * n.re + 0.25);
|
|
20458
20458
|
const a = n.mul(Math.PI).sin().log();
|
|
20459
20459
|
const b = lgammaComplex2(new Complex13(1 - n.re, -n.im));
|
|
20460
20460
|
return new Complex13(LOGPI, tmp).sub(a).sub(b);
|
|
@@ -41006,27 +41006,27 @@ var createReducedPlanckConstant = /* @__PURE__ */ unitFactory(
|
|
|
41006
41006
|
);
|
|
41007
41007
|
var createMagneticConstant = /* @__PURE__ */ unitFactory(
|
|
41008
41008
|
"magneticConstant",
|
|
41009
|
-
"1.
|
|
41009
|
+
"1.25663706127e-6",
|
|
41010
41010
|
"N A^-2"
|
|
41011
41011
|
);
|
|
41012
41012
|
var createElectricConstant = /* @__PURE__ */ unitFactory(
|
|
41013
41013
|
"electricConstant",
|
|
41014
|
-
"8.
|
|
41014
|
+
"8.8541878188e-12",
|
|
41015
41015
|
"F m^-1"
|
|
41016
41016
|
);
|
|
41017
41017
|
var createVacuumImpedance = /* @__PURE__ */ unitFactory(
|
|
41018
41018
|
"vacuumImpedance",
|
|
41019
|
-
"376.
|
|
41019
|
+
"376.730313412",
|
|
41020
41020
|
"ohm"
|
|
41021
41021
|
);
|
|
41022
41022
|
var createCoulomb = /* @__PURE__ */ unitFactory(
|
|
41023
41023
|
"coulomb",
|
|
41024
|
-
"8.
|
|
41024
|
+
"8.987551786170797e9",
|
|
41025
41025
|
"N m^2 C^-2"
|
|
41026
41026
|
);
|
|
41027
41027
|
var createCoulombConstant = /* @__PURE__ */ unitFactory(
|
|
41028
41028
|
"coulombConstant",
|
|
41029
|
-
"8.
|
|
41029
|
+
"8.987551786170797e9",
|
|
41030
41030
|
"N m^2 C^-2"
|
|
41031
41031
|
);
|
|
41032
41032
|
var createElementaryCharge = /* @__PURE__ */ unitFactory(
|
|
@@ -41036,7 +41036,7 @@ var createElementaryCharge = /* @__PURE__ */ unitFactory(
|
|
|
41036
41036
|
);
|
|
41037
41037
|
var createBohrMagneton = /* @__PURE__ */ unitFactory(
|
|
41038
41038
|
"bohrMagneton",
|
|
41039
|
-
"9.
|
|
41039
|
+
"9.2740100657e-24",
|
|
41040
41040
|
"J T^-1"
|
|
41041
41041
|
);
|
|
41042
41042
|
var createConductanceQuantum = /* @__PURE__ */ unitFactory(
|
|
@@ -41056,7 +41056,7 @@ var createMagneticFluxQuantum = /* @__PURE__ */ unitFactory(
|
|
|
41056
41056
|
);
|
|
41057
41057
|
var createNuclearMagneton = /* @__PURE__ */ unitFactory(
|
|
41058
41058
|
"nuclearMagneton",
|
|
41059
|
-
"5.
|
|
41059
|
+
"5.0507837393e-27",
|
|
41060
41060
|
"J T^-1"
|
|
41061
41061
|
);
|
|
41062
41062
|
var createKlitzing = /* @__PURE__ */ unitFactory("klitzing", "25812.807459304513", "ohm");
|
|
@@ -41065,15 +41065,15 @@ var createJosephson = /* @__PURE__ */ unitFactory(
|
|
|
41065
41065
|
"4.835978484169836e14 Hz V",
|
|
41066
41066
|
"Hz V^-1"
|
|
41067
41067
|
);
|
|
41068
|
-
var createBohrRadius = /* @__PURE__ */ unitFactory("bohrRadius", "5.
|
|
41068
|
+
var createBohrRadius = /* @__PURE__ */ unitFactory("bohrRadius", "5.29177210544e-11", "m");
|
|
41069
41069
|
var createClassicalElectronRadius = /* @__PURE__ */ unitFactory(
|
|
41070
41070
|
"classicalElectronRadius",
|
|
41071
|
-
"2.
|
|
41071
|
+
"2.8179403205e-15",
|
|
41072
41072
|
"m"
|
|
41073
41073
|
);
|
|
41074
41074
|
var createElectronMass = /* @__PURE__ */ unitFactory(
|
|
41075
41075
|
"electronMass",
|
|
41076
|
-
"9.
|
|
41076
|
+
"9.1093837139e-31",
|
|
41077
41077
|
"kg"
|
|
41078
41078
|
);
|
|
41079
41079
|
var createFermiCoupling = /* @__PURE__ */ unitFactory(
|
|
@@ -41081,43 +41081,43 @@ var createFermiCoupling = /* @__PURE__ */ unitFactory(
|
|
|
41081
41081
|
"1.1663787e-5",
|
|
41082
41082
|
"GeV^-2"
|
|
41083
41083
|
);
|
|
41084
|
-
var createFineStructure = numberFactory("fineStructure", 0.
|
|
41084
|
+
var createFineStructure = numberFactory("fineStructure", 0.0072973525643);
|
|
41085
41085
|
var createHartreeEnergy = /* @__PURE__ */ unitFactory(
|
|
41086
41086
|
"hartreeEnergy",
|
|
41087
|
-
"4.
|
|
41087
|
+
"4.359744722206e-18",
|
|
41088
41088
|
"J"
|
|
41089
41089
|
);
|
|
41090
41090
|
var createProtonMass = /* @__PURE__ */ unitFactory(
|
|
41091
41091
|
"protonMass",
|
|
41092
|
-
"1.
|
|
41092
|
+
"1.67262192595e-27",
|
|
41093
41093
|
"kg"
|
|
41094
41094
|
);
|
|
41095
41095
|
var createDeuteronMass = /* @__PURE__ */ unitFactory(
|
|
41096
41096
|
"deuteronMass",
|
|
41097
|
-
"3.
|
|
41097
|
+
"3.3435837768e-27",
|
|
41098
41098
|
"kg"
|
|
41099
41099
|
);
|
|
41100
41100
|
var createNeutronMass = /* @__PURE__ */ unitFactory(
|
|
41101
41101
|
"neutronMass",
|
|
41102
|
-
"1.
|
|
41102
|
+
"1.67492750056e-27",
|
|
41103
41103
|
"kg"
|
|
41104
41104
|
);
|
|
41105
41105
|
var createQuantumOfCirculation = /* @__PURE__ */ unitFactory(
|
|
41106
41106
|
"quantumOfCirculation",
|
|
41107
|
-
"3.
|
|
41107
|
+
"3.6369475467e-4",
|
|
41108
41108
|
"m^2 s^-1"
|
|
41109
41109
|
);
|
|
41110
|
-
var createRydberg = /* @__PURE__ */ unitFactory("rydberg", "10973731.
|
|
41110
|
+
var createRydberg = /* @__PURE__ */ unitFactory("rydberg", "10973731.568157", "m^-1");
|
|
41111
41111
|
var createThomsonCrossSection = /* @__PURE__ */ unitFactory(
|
|
41112
41112
|
"thomsonCrossSection",
|
|
41113
|
-
"6.
|
|
41113
|
+
"6.6524587051e-29",
|
|
41114
41114
|
"m^2"
|
|
41115
41115
|
);
|
|
41116
|
-
var createWeakMixingAngle = numberFactory("weakMixingAngle", 0.
|
|
41116
|
+
var createWeakMixingAngle = numberFactory("weakMixingAngle", 0.22305);
|
|
41117
41117
|
var createEfimovFactor = numberFactory("efimovFactor", 22.7);
|
|
41118
41118
|
var createAtomicMass = /* @__PURE__ */ unitFactory(
|
|
41119
41119
|
"atomicMass",
|
|
41120
|
-
"1.
|
|
41120
|
+
"1.66053906892e-27",
|
|
41121
41121
|
"kg"
|
|
41122
41122
|
);
|
|
41123
41123
|
var createAvogadro = /* @__PURE__ */ unitFactory("avogadro", "6.02214076e23", "mol^-1");
|
|
@@ -41152,7 +41152,7 @@ var createMolarVolume = /* @__PURE__ */ unitFactory(
|
|
|
41152
41152
|
"0.022413969545014137",
|
|
41153
41153
|
"m^3 mol^-1"
|
|
41154
41154
|
);
|
|
41155
|
-
var createSackurTetrode = numberFactory("sackurTetrode", -1.
|
|
41155
|
+
var createSackurTetrode = numberFactory("sackurTetrode", -1.16487052149);
|
|
41156
41156
|
var createSecondRadiation = /* @__PURE__ */ unitFactory(
|
|
41157
41157
|
"secondRadiation",
|
|
41158
41158
|
"0.014387768775039337",
|
|
@@ -41160,36 +41160,36 @@ var createSecondRadiation = /* @__PURE__ */ unitFactory(
|
|
|
41160
41160
|
);
|
|
41161
41161
|
var createStefanBoltzmann = /* @__PURE__ */ unitFactory(
|
|
41162
41162
|
"stefanBoltzmann",
|
|
41163
|
-
"5.
|
|
41163
|
+
"5.6703744191844314e-8",
|
|
41164
41164
|
"W m^-2 K^-4"
|
|
41165
41165
|
);
|
|
41166
41166
|
var createWienDisplacement = /* @__PURE__ */ unitFactory(
|
|
41167
41167
|
"wienDisplacement",
|
|
41168
|
-
"2.
|
|
41168
|
+
"2.8977719551851727e-3",
|
|
41169
41169
|
"m K"
|
|
41170
41170
|
);
|
|
41171
41171
|
var createMolarMass = /* @__PURE__ */ unitFactory(
|
|
41172
41172
|
"molarMass",
|
|
41173
|
-
"
|
|
41173
|
+
"1.00000000105e-3",
|
|
41174
41174
|
"kg mol^-1"
|
|
41175
41175
|
);
|
|
41176
41176
|
var createMolarMassC12 = /* @__PURE__ */ unitFactory(
|
|
41177
41177
|
"molarMassC12",
|
|
41178
|
-
"
|
|
41178
|
+
"12.0000000126e-3",
|
|
41179
41179
|
"kg mol^-1"
|
|
41180
41180
|
);
|
|
41181
41181
|
var createGravity = /* @__PURE__ */ unitFactory("gravity", "9.80665", "m s^-2");
|
|
41182
41182
|
var createPlanckLength = /* @__PURE__ */ unitFactory("planckLength", "1.616255e-35", "m");
|
|
41183
|
-
var createPlanckMass = /* @__PURE__ */ unitFactory("planckMass", "2.
|
|
41184
|
-
var createPlanckTime = /* @__PURE__ */ unitFactory("planckTime", "5.
|
|
41183
|
+
var createPlanckMass = /* @__PURE__ */ unitFactory("planckMass", "2.176434e-8", "kg");
|
|
41184
|
+
var createPlanckTime = /* @__PURE__ */ unitFactory("planckTime", "5.391247e-44", "s");
|
|
41185
41185
|
var createPlanckCharge = /* @__PURE__ */ unitFactory(
|
|
41186
41186
|
"planckCharge",
|
|
41187
|
-
"1.
|
|
41187
|
+
"1.8755460384151476e-18",
|
|
41188
41188
|
"C"
|
|
41189
41189
|
);
|
|
41190
41190
|
var createPlanckTemperature = /* @__PURE__ */ unitFactory(
|
|
41191
41191
|
"planckTemperature",
|
|
41192
|
-
"1.
|
|
41192
|
+
"1.416784e+32",
|
|
41193
41193
|
"K"
|
|
41194
41194
|
);
|
|
41195
41195
|
function unitFactory(name254, valueStr, unitStr) {
|
|
@@ -48860,20 +48860,156 @@ function bilinear(bIn, aIn, fs) {
|
|
|
48860
48860
|
const a0 = aDesc[0];
|
|
48861
48861
|
return { b: bDesc.map((v) => v / a0), a: aDesc.map((v) => v / a0) };
|
|
48862
48862
|
}
|
|
48863
|
+
function bandStopObj(wp, ind, passb, stopb, gpass, gstop) {
|
|
48864
|
+
const passbC = [passb[0], passb[1]];
|
|
48865
|
+
passbC[ind] = wp;
|
|
48866
|
+
const nat0 = stopb[0] * (passbC[0] - passbC[1]) / (stopb[0] * stopb[0] - passbC[0] * passbC[1]);
|
|
48867
|
+
const nat1 = stopb[1] * (passbC[0] - passbC[1]) / (stopb[1] * stopb[1] - passbC[0] * passbC[1]);
|
|
48868
|
+
const nat = Math.min(Math.abs(nat0), Math.abs(nat1));
|
|
48869
|
+
const GSTOP = Math.pow(10, 0.1 * Math.abs(gstop));
|
|
48870
|
+
const GPASS = Math.pow(10, 0.1 * Math.abs(gpass));
|
|
48871
|
+
return Math.log10((GSTOP - 1) / (GPASS - 1)) / (2 * Math.log10(nat));
|
|
48872
|
+
}
|
|
48873
|
+
function fminbound(f, x1, x2) {
|
|
48874
|
+
const xatol = 1e-5;
|
|
48875
|
+
const maxfun = 500;
|
|
48876
|
+
const sqrtEps = Math.sqrt(22e-17);
|
|
48877
|
+
const goldenMean = 0.5 * (3 - Math.sqrt(5));
|
|
48878
|
+
const sign3 = (v) => v > 0 ? 1 : v < 0 ? -1 : 0;
|
|
48879
|
+
let a = x1;
|
|
48880
|
+
let b = x2;
|
|
48881
|
+
let fulc = a + goldenMean * (b - a);
|
|
48882
|
+
let nfc = fulc;
|
|
48883
|
+
let xf = fulc;
|
|
48884
|
+
let rat = 0;
|
|
48885
|
+
let e = 0;
|
|
48886
|
+
let x = xf;
|
|
48887
|
+
let fx = f(x);
|
|
48888
|
+
let num2 = 1;
|
|
48889
|
+
let fu = Infinity;
|
|
48890
|
+
let ffulc = fx;
|
|
48891
|
+
let fnfc = fx;
|
|
48892
|
+
let xm = 0.5 * (a + b);
|
|
48893
|
+
let tol1 = sqrtEps * Math.abs(xf) + xatol / 3;
|
|
48894
|
+
let tol2 = 2 * tol1;
|
|
48895
|
+
while (Math.abs(xf - xm) > tol2 - 0.5 * (b - a)) {
|
|
48896
|
+
let golden = true;
|
|
48897
|
+
if (Math.abs(e) > tol1) {
|
|
48898
|
+
golden = false;
|
|
48899
|
+
let r = (xf - nfc) * (fx - ffulc);
|
|
48900
|
+
let q = (xf - fulc) * (fx - fnfc);
|
|
48901
|
+
let p = (xf - fulc) * q - (xf - nfc) * r;
|
|
48902
|
+
q = 2 * (q - r);
|
|
48903
|
+
if (q > 0) p = -p;
|
|
48904
|
+
q = Math.abs(q);
|
|
48905
|
+
r = e;
|
|
48906
|
+
e = rat;
|
|
48907
|
+
if (Math.abs(p) < Math.abs(0.5 * q * r) && p > q * (a - xf) && p < q * (b - xf)) {
|
|
48908
|
+
rat = p / q;
|
|
48909
|
+
x = xf + rat;
|
|
48910
|
+
if (x - a < tol2 || b - x < tol2) {
|
|
48911
|
+
const si2 = sign3(xm - xf) + (xm - xf === 0 ? 1 : 0);
|
|
48912
|
+
rat = tol1 * si2;
|
|
48913
|
+
}
|
|
48914
|
+
} else {
|
|
48915
|
+
golden = true;
|
|
48916
|
+
}
|
|
48917
|
+
}
|
|
48918
|
+
if (golden) {
|
|
48919
|
+
e = xf >= xm ? a - xf : b - xf;
|
|
48920
|
+
rat = goldenMean * e;
|
|
48921
|
+
}
|
|
48922
|
+
const si = sign3(rat) + (rat === 0 ? 1 : 0);
|
|
48923
|
+
x = xf + si * Math.max(Math.abs(rat), tol1);
|
|
48924
|
+
fu = f(x);
|
|
48925
|
+
num2 += 1;
|
|
48926
|
+
if (fu <= fx) {
|
|
48927
|
+
if (x >= xf) a = xf;
|
|
48928
|
+
else b = xf;
|
|
48929
|
+
fulc = nfc;
|
|
48930
|
+
ffulc = fnfc;
|
|
48931
|
+
nfc = xf;
|
|
48932
|
+
fnfc = fx;
|
|
48933
|
+
xf = x;
|
|
48934
|
+
fx = fu;
|
|
48935
|
+
} else {
|
|
48936
|
+
if (x < xf) a = x;
|
|
48937
|
+
else b = x;
|
|
48938
|
+
if (fu <= fnfc || nfc === xf) {
|
|
48939
|
+
fulc = nfc;
|
|
48940
|
+
ffulc = fnfc;
|
|
48941
|
+
nfc = x;
|
|
48942
|
+
fnfc = fu;
|
|
48943
|
+
} else if (fu <= ffulc || fulc === xf || fulc === nfc) {
|
|
48944
|
+
fulc = x;
|
|
48945
|
+
ffulc = fu;
|
|
48946
|
+
}
|
|
48947
|
+
}
|
|
48948
|
+
xm = 0.5 * (a + b);
|
|
48949
|
+
tol1 = sqrtEps * Math.abs(xf) + xatol / 3;
|
|
48950
|
+
tol2 = 2 * tol1;
|
|
48951
|
+
if (num2 >= maxfun) break;
|
|
48952
|
+
}
|
|
48953
|
+
return xf;
|
|
48954
|
+
}
|
|
48863
48955
|
function buttord(wp, ws, gpass, gstop) {
|
|
48864
|
-
|
|
48865
|
-
|
|
48866
|
-
if (
|
|
48867
|
-
|
|
48868
|
-
|
|
48869
|
-
|
|
48870
|
-
|
|
48956
|
+
const wpArr = typeof wp === "number" ? [wp] : [wp[0], wp[1]];
|
|
48957
|
+
const wsArr = typeof ws === "number" ? [ws] : [ws[0], ws[1]];
|
|
48958
|
+
if (wpArr.length !== wsArr.length)
|
|
48959
|
+
throw new Error("buttord: wp and ws must both be scalars or both be [low, high] pairs");
|
|
48960
|
+
for (const v of [...wpArr, ...wsArr])
|
|
48961
|
+
if (!(v > 0 && v < 1)) throw new Error("buttord: all edge frequencies must satisfy 0 < f < 1");
|
|
48962
|
+
let filterType = 2 * (wpArr.length - 1) + 1;
|
|
48963
|
+
if (wpArr[0] >= wsArr[0]) filterType += 1;
|
|
48964
|
+
const passb = wpArr.map((f) => Math.tan(Math.PI * f / 2));
|
|
48965
|
+
const stopb = wsArr.map((f) => Math.tan(Math.PI * f / 2));
|
|
48871
48966
|
const GSTOP = Math.pow(10, 0.1 * Math.abs(gstop));
|
|
48872
48967
|
const GPASS = Math.pow(10, 0.1 * Math.abs(gpass));
|
|
48968
|
+
let nat;
|
|
48969
|
+
if (filterType === 1) {
|
|
48970
|
+
nat = stopb[0] / passb[0];
|
|
48971
|
+
} else if (filterType === 2) {
|
|
48972
|
+
nat = passb[0] / stopb[0];
|
|
48973
|
+
} else if (filterType === 3) {
|
|
48974
|
+
const sb = [stopb[0], stopb[1]];
|
|
48975
|
+
const pb0 = [passb[0], passb[1]];
|
|
48976
|
+
const wp0 = fminbound(
|
|
48977
|
+
(v) => bandStopObj(v, 0, pb0, sb, gpass, gstop),
|
|
48978
|
+
passb[0],
|
|
48979
|
+
stopb[0] - 1e-12
|
|
48980
|
+
);
|
|
48981
|
+
const wp1 = fminbound(
|
|
48982
|
+
(v) => bandStopObj(v, 1, pb0, sb, gpass, gstop),
|
|
48983
|
+
stopb[1] + 1e-12,
|
|
48984
|
+
passb[1]
|
|
48985
|
+
);
|
|
48986
|
+
passb[0] = wp0;
|
|
48987
|
+
passb[1] = wp1;
|
|
48988
|
+
const nat0 = stopb[0] * (passb[0] - passb[1]) / (stopb[0] * stopb[0] - passb[0] * passb[1]);
|
|
48989
|
+
const nat1 = stopb[1] * (passb[0] - passb[1]) / (stopb[1] * stopb[1] - passb[0] * passb[1]);
|
|
48990
|
+
nat = Math.min(Math.abs(nat0), Math.abs(nat1));
|
|
48991
|
+
} else {
|
|
48992
|
+
const nat0 = (stopb[0] * stopb[0] - passb[0] * passb[1]) / (stopb[0] * (passb[0] - passb[1]));
|
|
48993
|
+
const nat1 = (stopb[1] * stopb[1] - passb[0] * passb[1]) / (stopb[1] * (passb[0] - passb[1]));
|
|
48994
|
+
nat = Math.min(Math.abs(nat0), Math.abs(nat1));
|
|
48995
|
+
}
|
|
48873
48996
|
const N = Math.ceil(Math.log10((GSTOP - 1) / (GPASS - 1)) / (2 * Math.log10(nat)));
|
|
48874
48997
|
const W0 = Math.pow(GPASS - 1, -1 / (2 * N));
|
|
48875
|
-
const
|
|
48876
|
-
return { N, Wn:
|
|
48998
|
+
const toDigital = (WN) => Math.atan(WN) * 2 / Math.PI;
|
|
48999
|
+
if (filterType === 1) return { N, Wn: toDigital(W0 * passb[0]) };
|
|
49000
|
+
if (filterType === 2) return { N, Wn: toDigital(passb[0] / W0) };
|
|
49001
|
+
if (filterType === 3) {
|
|
49002
|
+
const discr = Math.sqrt(Math.pow(passb[1] - passb[0], 2) + 4 * W0 * W0 * passb[0] * passb[1]);
|
|
49003
|
+
const wn0 = (passb[1] - passb[0] + discr) / (2 * W0);
|
|
49004
|
+
const wn1 = (passb[1] - passb[0] - discr) / (2 * W0);
|
|
49005
|
+
const sorted2 = [Math.abs(wn0), Math.abs(wn1)].sort((x, y) => x - y);
|
|
49006
|
+
return { N, Wn: [toDigital(sorted2[0]), toDigital(sorted2[1])] };
|
|
49007
|
+
}
|
|
49008
|
+
const w0s = [-W0, W0].map(
|
|
49009
|
+
(s) => -s * ((passb[1] - passb[0]) / 2) + Math.sqrt(s * s / 4 * Math.pow(passb[1] - passb[0], 2) + passb[0] * passb[1])
|
|
49010
|
+
);
|
|
49011
|
+
const sorted = w0s.map(Math.abs).sort((x, y) => x - y);
|
|
49012
|
+
return { N, Wn: [toDigital(sorted[0]), toDigital(sorted[1])] };
|
|
48877
49013
|
}
|
|
48878
49014
|
function toComplex(x) {
|
|
48879
49015
|
return x instanceof Complex12 ? x : new Complex12(x, 0);
|
|
@@ -48978,6 +49114,551 @@ function convDirect(x, h, mode2 = "full") {
|
|
|
48978
49114
|
}
|
|
48979
49115
|
}
|
|
48980
49116
|
|
|
49117
|
+
// src/signal/remez-exchange.ts
|
|
49118
|
+
var PI = Math.PI;
|
|
49119
|
+
var TWOPI = 2 * Math.PI;
|
|
49120
|
+
function lagrangeInterp2(k, n, m, x) {
|
|
49121
|
+
let retval = 1;
|
|
49122
|
+
const q = x[k];
|
|
49123
|
+
for (let l = 1; l <= m; l++) {
|
|
49124
|
+
for (let j = l; j <= n; j += m) {
|
|
49125
|
+
if (j !== k) retval *= 2 * (q - x[j]);
|
|
49126
|
+
}
|
|
49127
|
+
}
|
|
49128
|
+
return 1 / retval;
|
|
49129
|
+
}
|
|
49130
|
+
function freqEval(k, n, grid, x, y, ad) {
|
|
49131
|
+
let d = 0;
|
|
49132
|
+
let p = 0;
|
|
49133
|
+
const xf = Math.cos(TWOPI * grid[k]);
|
|
49134
|
+
for (let j = 1; j <= n; j++) {
|
|
49135
|
+
const c = ad[j] / (xf - x[j]);
|
|
49136
|
+
d += c;
|
|
49137
|
+
p += c * y[j];
|
|
49138
|
+
}
|
|
49139
|
+
return p / d;
|
|
49140
|
+
}
|
|
49141
|
+
function eff(freq, fx, lband, jtype) {
|
|
49142
|
+
return jtype !== 2 ? fx[lband] : fx[lband] * freq;
|
|
49143
|
+
}
|
|
49144
|
+
function wate(freq, fx, wtx, lband, jtype) {
|
|
49145
|
+
if (jtype !== 2) return wtx[lband];
|
|
49146
|
+
if (fx[lband] >= 1e-4) return wtx[lband] / freq;
|
|
49147
|
+
return wtx[lband];
|
|
49148
|
+
}
|
|
49149
|
+
function remezCore(des, grid, edge, wt, ngrid, nbands, iext, alpha, nfcns, itrmax) {
|
|
49150
|
+
const size2 = ngrid + 2 * nfcns + 8;
|
|
49151
|
+
const a = new Array(size2).fill(0);
|
|
49152
|
+
const p = new Array(size2).fill(0);
|
|
49153
|
+
const q = new Array(size2).fill(0);
|
|
49154
|
+
const ad = new Array(size2).fill(0);
|
|
49155
|
+
const x = new Array(size2).fill(0);
|
|
49156
|
+
const y = new Array(size2).fill(0);
|
|
49157
|
+
let devl = -1;
|
|
49158
|
+
const nz = nfcns + 1;
|
|
49159
|
+
const nzz = nfcns + 2;
|
|
49160
|
+
let niter = 0;
|
|
49161
|
+
let dev = 0;
|
|
49162
|
+
let comp = 0;
|
|
49163
|
+
let ynz = 0;
|
|
49164
|
+
let y1 = 0;
|
|
49165
|
+
let jchnge = 0;
|
|
49166
|
+
let k1 = 0;
|
|
49167
|
+
let knz = 0;
|
|
49168
|
+
let klow = 0;
|
|
49169
|
+
let nut = 0;
|
|
49170
|
+
let nut1 = 0;
|
|
49171
|
+
let nu = 0;
|
|
49172
|
+
let j = 0;
|
|
49173
|
+
let l = 0;
|
|
49174
|
+
let kup = 0;
|
|
49175
|
+
let luck = 0;
|
|
49176
|
+
let err = 0;
|
|
49177
|
+
let state = 100;
|
|
49178
|
+
let done = false;
|
|
49179
|
+
let failed = false;
|
|
49180
|
+
outer: for (; ; ) {
|
|
49181
|
+
switch (state) {
|
|
49182
|
+
case 100: {
|
|
49183
|
+
iext[nzz] = ngrid + 1;
|
|
49184
|
+
++niter;
|
|
49185
|
+
if (niter > itrmax) {
|
|
49186
|
+
done = true;
|
|
49187
|
+
break outer;
|
|
49188
|
+
}
|
|
49189
|
+
for (j = 1; j <= nz; j++) x[j] = Math.cos(grid[iext[j]] * TWOPI);
|
|
49190
|
+
const jet = Math.floor((nfcns - 1) / 15) + 1;
|
|
49191
|
+
for (j = 1; j <= nz; j++) ad[j] = lagrangeInterp2(j, nz, jet, x);
|
|
49192
|
+
let dnum = 0;
|
|
49193
|
+
let dden2 = 0;
|
|
49194
|
+
let ksign = 1;
|
|
49195
|
+
for (j = 1; j <= nz; j++) {
|
|
49196
|
+
l = iext[j];
|
|
49197
|
+
dnum += ad[j] * des[l];
|
|
49198
|
+
dden2 += ksign * ad[j] / wt[l];
|
|
49199
|
+
ksign = -ksign;
|
|
49200
|
+
}
|
|
49201
|
+
dev = dnum / dden2;
|
|
49202
|
+
nu = 1;
|
|
49203
|
+
if (dev > 0) nu = -1;
|
|
49204
|
+
dev = -nu * dev;
|
|
49205
|
+
ksign = nu;
|
|
49206
|
+
for (j = 1; j <= nz; j++) {
|
|
49207
|
+
l = iext[j];
|
|
49208
|
+
y[j] = des[l] + ksign * dev / wt[l];
|
|
49209
|
+
ksign = -ksign;
|
|
49210
|
+
}
|
|
49211
|
+
if (dev <= devl) {
|
|
49212
|
+
failed = true;
|
|
49213
|
+
break outer;
|
|
49214
|
+
}
|
|
49215
|
+
devl = dev;
|
|
49216
|
+
jchnge = 0;
|
|
49217
|
+
k1 = iext[1];
|
|
49218
|
+
knz = iext[nz];
|
|
49219
|
+
klow = 0;
|
|
49220
|
+
nut = -nu;
|
|
49221
|
+
j = 1;
|
|
49222
|
+
state = 200;
|
|
49223
|
+
continue;
|
|
49224
|
+
}
|
|
49225
|
+
case 200: {
|
|
49226
|
+
if (j === nzz) ynz = comp;
|
|
49227
|
+
if (j >= nzz) {
|
|
49228
|
+
state = 300;
|
|
49229
|
+
continue;
|
|
49230
|
+
}
|
|
49231
|
+
kup = iext[j + 1];
|
|
49232
|
+
l = iext[j] + 1;
|
|
49233
|
+
nut = -nut;
|
|
49234
|
+
if (j === 2) y1 = comp;
|
|
49235
|
+
comp = dev;
|
|
49236
|
+
if (l >= kup) {
|
|
49237
|
+
state = 220;
|
|
49238
|
+
continue;
|
|
49239
|
+
}
|
|
49240
|
+
err = (freqEval(l, nz, grid, x, y, ad) - des[l]) * wt[l];
|
|
49241
|
+
if (nut * err - comp <= 0) {
|
|
49242
|
+
state = 220;
|
|
49243
|
+
continue;
|
|
49244
|
+
}
|
|
49245
|
+
comp = nut * err;
|
|
49246
|
+
state = 210;
|
|
49247
|
+
continue;
|
|
49248
|
+
}
|
|
49249
|
+
case 210: {
|
|
49250
|
+
if (++l >= kup) {
|
|
49251
|
+
state = 215;
|
|
49252
|
+
continue;
|
|
49253
|
+
}
|
|
49254
|
+
err = (freqEval(l, nz, grid, x, y, ad) - des[l]) * wt[l];
|
|
49255
|
+
if (nut * err - comp <= 0) {
|
|
49256
|
+
state = 215;
|
|
49257
|
+
continue;
|
|
49258
|
+
}
|
|
49259
|
+
comp = nut * err;
|
|
49260
|
+
state = 210;
|
|
49261
|
+
continue;
|
|
49262
|
+
}
|
|
49263
|
+
case 215: {
|
|
49264
|
+
iext[j++] = l - 1;
|
|
49265
|
+
klow = l - 1;
|
|
49266
|
+
++jchnge;
|
|
49267
|
+
state = 200;
|
|
49268
|
+
continue;
|
|
49269
|
+
}
|
|
49270
|
+
case 220: {
|
|
49271
|
+
--l;
|
|
49272
|
+
state = 225;
|
|
49273
|
+
continue;
|
|
49274
|
+
}
|
|
49275
|
+
case 225: {
|
|
49276
|
+
if (--l <= klow) {
|
|
49277
|
+
state = 250;
|
|
49278
|
+
continue;
|
|
49279
|
+
}
|
|
49280
|
+
err = (freqEval(l, nz, grid, x, y, ad) - des[l]) * wt[l];
|
|
49281
|
+
if (nut * err - comp > 0) {
|
|
49282
|
+
state = 230;
|
|
49283
|
+
continue;
|
|
49284
|
+
}
|
|
49285
|
+
if (jchnge <= 0) {
|
|
49286
|
+
state = 225;
|
|
49287
|
+
continue;
|
|
49288
|
+
}
|
|
49289
|
+
state = 260;
|
|
49290
|
+
continue;
|
|
49291
|
+
}
|
|
49292
|
+
case 230: {
|
|
49293
|
+
comp = nut * err;
|
|
49294
|
+
state = 235;
|
|
49295
|
+
continue;
|
|
49296
|
+
}
|
|
49297
|
+
case 235: {
|
|
49298
|
+
if (--l <= klow) {
|
|
49299
|
+
state = 240;
|
|
49300
|
+
continue;
|
|
49301
|
+
}
|
|
49302
|
+
err = (freqEval(l, nz, grid, x, y, ad) - des[l]) * wt[l];
|
|
49303
|
+
if (nut * err - comp <= 0) {
|
|
49304
|
+
state = 240;
|
|
49305
|
+
continue;
|
|
49306
|
+
}
|
|
49307
|
+
comp = nut * err;
|
|
49308
|
+
state = 235;
|
|
49309
|
+
continue;
|
|
49310
|
+
}
|
|
49311
|
+
case 240: {
|
|
49312
|
+
klow = iext[j];
|
|
49313
|
+
iext[j] = l + 1;
|
|
49314
|
+
++j;
|
|
49315
|
+
++jchnge;
|
|
49316
|
+
state = 200;
|
|
49317
|
+
continue;
|
|
49318
|
+
}
|
|
49319
|
+
case 250: {
|
|
49320
|
+
l = iext[j] + 1;
|
|
49321
|
+
if (jchnge > 0) {
|
|
49322
|
+
state = 215;
|
|
49323
|
+
continue;
|
|
49324
|
+
}
|
|
49325
|
+
state = 255;
|
|
49326
|
+
continue;
|
|
49327
|
+
}
|
|
49328
|
+
case 255: {
|
|
49329
|
+
if (++l >= kup) {
|
|
49330
|
+
state = 260;
|
|
49331
|
+
continue;
|
|
49332
|
+
}
|
|
49333
|
+
err = (freqEval(l, nz, grid, x, y, ad) - des[l]) * wt[l];
|
|
49334
|
+
if (nut * err - comp <= 0) {
|
|
49335
|
+
state = 255;
|
|
49336
|
+
continue;
|
|
49337
|
+
}
|
|
49338
|
+
comp = nut * err;
|
|
49339
|
+
state = 210;
|
|
49340
|
+
continue;
|
|
49341
|
+
}
|
|
49342
|
+
case 260: {
|
|
49343
|
+
klow = iext[j++];
|
|
49344
|
+
state = 200;
|
|
49345
|
+
continue;
|
|
49346
|
+
}
|
|
49347
|
+
case 300: {
|
|
49348
|
+
if (j > nzz) {
|
|
49349
|
+
state = 320;
|
|
49350
|
+
continue;
|
|
49351
|
+
}
|
|
49352
|
+
if (k1 > iext[1]) k1 = iext[1];
|
|
49353
|
+
if (knz < iext[nz]) knz = iext[nz];
|
|
49354
|
+
nut1 = nut;
|
|
49355
|
+
nut = -nu;
|
|
49356
|
+
l = 0;
|
|
49357
|
+
kup = k1;
|
|
49358
|
+
comp = ynz * 1.00001;
|
|
49359
|
+
luck = 1;
|
|
49360
|
+
state = 310;
|
|
49361
|
+
continue;
|
|
49362
|
+
}
|
|
49363
|
+
case 310: {
|
|
49364
|
+
if (++l >= kup) {
|
|
49365
|
+
state = 315;
|
|
49366
|
+
continue;
|
|
49367
|
+
}
|
|
49368
|
+
err = (freqEval(l, nz, grid, x, y, ad) - des[l]) * wt[l];
|
|
49369
|
+
if (nut * err - comp <= 0) {
|
|
49370
|
+
state = 310;
|
|
49371
|
+
continue;
|
|
49372
|
+
}
|
|
49373
|
+
comp = nut * err;
|
|
49374
|
+
j = nzz;
|
|
49375
|
+
state = 210;
|
|
49376
|
+
continue;
|
|
49377
|
+
}
|
|
49378
|
+
case 315: {
|
|
49379
|
+
luck = 6;
|
|
49380
|
+
state = 325;
|
|
49381
|
+
continue;
|
|
49382
|
+
}
|
|
49383
|
+
case 320: {
|
|
49384
|
+
if (luck > 9) {
|
|
49385
|
+
state = 350;
|
|
49386
|
+
continue;
|
|
49387
|
+
}
|
|
49388
|
+
if (comp > y1) y1 = comp;
|
|
49389
|
+
k1 = iext[nzz];
|
|
49390
|
+
state = 325;
|
|
49391
|
+
continue;
|
|
49392
|
+
}
|
|
49393
|
+
case 325: {
|
|
49394
|
+
l = ngrid + 1;
|
|
49395
|
+
klow = knz;
|
|
49396
|
+
nut = -nut1;
|
|
49397
|
+
comp = y1 * 1.00001;
|
|
49398
|
+
state = 330;
|
|
49399
|
+
continue;
|
|
49400
|
+
}
|
|
49401
|
+
case 330: {
|
|
49402
|
+
if (--l <= klow) {
|
|
49403
|
+
state = 340;
|
|
49404
|
+
continue;
|
|
49405
|
+
}
|
|
49406
|
+
err = (freqEval(l, nz, grid, x, y, ad) - des[l]) * wt[l];
|
|
49407
|
+
if (nut * err - comp <= 0) {
|
|
49408
|
+
state = 330;
|
|
49409
|
+
continue;
|
|
49410
|
+
}
|
|
49411
|
+
j = nzz;
|
|
49412
|
+
comp = nut * err;
|
|
49413
|
+
luck = luck + 10;
|
|
49414
|
+
state = 235;
|
|
49415
|
+
continue;
|
|
49416
|
+
}
|
|
49417
|
+
case 340: {
|
|
49418
|
+
if (luck === 6) {
|
|
49419
|
+
state = 370;
|
|
49420
|
+
continue;
|
|
49421
|
+
}
|
|
49422
|
+
for (j = 1; j <= nfcns; j++) iext[nzz - j] = iext[nz - j];
|
|
49423
|
+
iext[1] = k1;
|
|
49424
|
+
state = 100;
|
|
49425
|
+
continue;
|
|
49426
|
+
}
|
|
49427
|
+
case 350: {
|
|
49428
|
+
const kn = iext[nzz];
|
|
49429
|
+
for (j = 1; j <= nfcns; j++) iext[j] = iext[j + 1];
|
|
49430
|
+
iext[nz] = kn;
|
|
49431
|
+
state = 100;
|
|
49432
|
+
continue;
|
|
49433
|
+
}
|
|
49434
|
+
case 370: {
|
|
49435
|
+
if (jchnge > 0) {
|
|
49436
|
+
state = 100;
|
|
49437
|
+
continue;
|
|
49438
|
+
}
|
|
49439
|
+
done = true;
|
|
49440
|
+
break outer;
|
|
49441
|
+
}
|
|
49442
|
+
default:
|
|
49443
|
+
break outer;
|
|
49444
|
+
}
|
|
49445
|
+
}
|
|
49446
|
+
if (failed) return { status: -1, dev, niter };
|
|
49447
|
+
if (!done) return { status: -1, dev, niter };
|
|
49448
|
+
const nm1 = nfcns - 1;
|
|
49449
|
+
const fsh = 1e-6;
|
|
49450
|
+
const gtemp = grid[1];
|
|
49451
|
+
x[nzz] = -2;
|
|
49452
|
+
const cn = 2 * nfcns - 1;
|
|
49453
|
+
const delf = 1 / cn;
|
|
49454
|
+
l = 1;
|
|
49455
|
+
let kkk = 0;
|
|
49456
|
+
if (edge[1] === 0 && edge[2 * nbands] === 0.5) kkk = 1;
|
|
49457
|
+
if (nfcns <= 3) kkk = 1;
|
|
49458
|
+
let aa = 0;
|
|
49459
|
+
let bb = 0;
|
|
49460
|
+
if (kkk !== 1) {
|
|
49461
|
+
const dtemp = Math.cos(TWOPI * grid[1]);
|
|
49462
|
+
const dnum = Math.cos(TWOPI * grid[ngrid]);
|
|
49463
|
+
aa = 2 / (dtemp - dnum);
|
|
49464
|
+
bb = -(dtemp + dnum) / (dtemp - dnum);
|
|
49465
|
+
}
|
|
49466
|
+
for (j = 1; j <= nfcns; j++) {
|
|
49467
|
+
let ft = (j - 1) * delf;
|
|
49468
|
+
let xt = Math.cos(TWOPI * ft);
|
|
49469
|
+
if (kkk !== 1) {
|
|
49470
|
+
xt = (xt - bb) / aa;
|
|
49471
|
+
ft = Math.acos(xt) / TWOPI;
|
|
49472
|
+
}
|
|
49473
|
+
let assigned = false;
|
|
49474
|
+
for (; ; ) {
|
|
49475
|
+
const xe = x[l];
|
|
49476
|
+
if (xt > xe) {
|
|
49477
|
+
if (xt - xe < fsh) {
|
|
49478
|
+
a[j] = y[l];
|
|
49479
|
+
assigned = true;
|
|
49480
|
+
break;
|
|
49481
|
+
}
|
|
49482
|
+
grid[1] = ft;
|
|
49483
|
+
a[j] = freqEval(1, nz, grid, x, y, ad);
|
|
49484
|
+
assigned = true;
|
|
49485
|
+
break;
|
|
49486
|
+
}
|
|
49487
|
+
if (xe - xt < fsh) {
|
|
49488
|
+
a[j] = y[l];
|
|
49489
|
+
assigned = true;
|
|
49490
|
+
break;
|
|
49491
|
+
}
|
|
49492
|
+
++l;
|
|
49493
|
+
}
|
|
49494
|
+
if (assigned && l > 1) l = l - 1;
|
|
49495
|
+
}
|
|
49496
|
+
grid[1] = gtemp;
|
|
49497
|
+
const dden = TWOPI / cn;
|
|
49498
|
+
for (j = 1; j <= nfcns; j++) {
|
|
49499
|
+
let dtemp = 0;
|
|
49500
|
+
const dnum = (j - 1) * dden;
|
|
49501
|
+
if (nm1 >= 1) {
|
|
49502
|
+
for (let k = 1; k <= nm1; k++) dtemp += a[k + 1] * Math.cos(dnum * k);
|
|
49503
|
+
}
|
|
49504
|
+
alpha[j] = 2 * dtemp + a[1];
|
|
49505
|
+
}
|
|
49506
|
+
for (j = 2; j <= nfcns; j++) alpha[j] *= 2 / cn;
|
|
49507
|
+
alpha[1] /= cn;
|
|
49508
|
+
if (kkk !== 1) {
|
|
49509
|
+
p[1] = 2 * alpha[nfcns] * bb + alpha[nm1];
|
|
49510
|
+
p[2] = 2 * aa * alpha[nfcns];
|
|
49511
|
+
q[1] = alpha[nfcns - 2] - alpha[nfcns];
|
|
49512
|
+
for (j = 2; j <= nm1; j++) {
|
|
49513
|
+
if (j >= nm1) {
|
|
49514
|
+
aa *= 0.5;
|
|
49515
|
+
bb *= 0.5;
|
|
49516
|
+
}
|
|
49517
|
+
p[j + 1] = 0;
|
|
49518
|
+
for (let k = 1; k <= j; k++) {
|
|
49519
|
+
a[k] = p[k];
|
|
49520
|
+
p[k] = 2 * bb * a[k];
|
|
49521
|
+
}
|
|
49522
|
+
p[2] += a[1] * 2 * aa;
|
|
49523
|
+
const jm1 = j - 1;
|
|
49524
|
+
for (let k = 1; k <= jm1; k++) p[k] += q[k] + aa * a[k + 1];
|
|
49525
|
+
const jp1 = j + 1;
|
|
49526
|
+
for (let k = 3; k <= jp1; k++) p[k] += aa * a[k - 1];
|
|
49527
|
+
if (j !== nm1) {
|
|
49528
|
+
for (let k = 1; k <= j; k++) q[k] = -a[k];
|
|
49529
|
+
q[1] += alpha[nfcns - 1 - j];
|
|
49530
|
+
}
|
|
49531
|
+
}
|
|
49532
|
+
for (j = 1; j <= nfcns; j++) alpha[j] = p[j];
|
|
49533
|
+
}
|
|
49534
|
+
if (nfcns <= 3) {
|
|
49535
|
+
alpha[nfcns + 1] = 0;
|
|
49536
|
+
alpha[nfcns + 2] = 0;
|
|
49537
|
+
}
|
|
49538
|
+
return { status: 0, dev, niter };
|
|
49539
|
+
}
|
|
49540
|
+
function remezExchange(numtaps, bands, desired, weight, type = "bandpass", maxiter = 25, gridDensity = 16) {
|
|
49541
|
+
if (!Number.isInteger(numtaps) || numtaps < 1)
|
|
49542
|
+
throw new Error("remez: numtaps must be a positive integer");
|
|
49543
|
+
if (bands.length < 2 || bands.length % 2 !== 0)
|
|
49544
|
+
throw new Error("remez: bands must be a non-empty list of band-edge pairs");
|
|
49545
|
+
const numbands = bands.length / 2;
|
|
49546
|
+
if (desired.length !== numbands)
|
|
49547
|
+
throw new Error("remez: desired must have length bands.length / 2 (one value per band)");
|
|
49548
|
+
const w = weight ?? new Array(numbands).fill(1);
|
|
49549
|
+
if (w.length !== numbands)
|
|
49550
|
+
throw new Error("remez: weight must have length bands.length / 2 (one value per band)");
|
|
49551
|
+
for (let i = 0; i < bands.length; i++) {
|
|
49552
|
+
if (!(bands[i] >= 0 && bands[i] <= 0.5))
|
|
49553
|
+
throw new Error("remez: band edges must be in [0, 0.5] (fs = 1, 0.5 = Nyquist)");
|
|
49554
|
+
if (i > 0 && bands[i] < bands[i - 1])
|
|
49555
|
+
throw new Error("remez: bands must be monotonically non-decreasing");
|
|
49556
|
+
}
|
|
49557
|
+
const jtype = type === "bandpass" ? 1 : type === "differentiator" ? 2 : 3;
|
|
49558
|
+
const edge = [0, ...bands];
|
|
49559
|
+
const fx = [0, ...desired];
|
|
49560
|
+
const wtx = [0, ...w];
|
|
49561
|
+
const dimsize = Math.ceil(numtaps / 2 + 2);
|
|
49562
|
+
const wrksize = gridDensity * dimsize;
|
|
49563
|
+
const neg = jtype === 1 ? 0 : 1;
|
|
49564
|
+
const nodd = numtaps % 2;
|
|
49565
|
+
let nfcns = Math.floor(numtaps / 2);
|
|
49566
|
+
if (nodd === 1 && neg === 0) nfcns += 1;
|
|
49567
|
+
const des = new Array(wrksize + 2).fill(0);
|
|
49568
|
+
const grid = new Array(wrksize + 2).fill(0);
|
|
49569
|
+
const wt = new Array(wrksize + 2).fill(0);
|
|
49570
|
+
const alpha = new Array(dimsize + 3).fill(0);
|
|
49571
|
+
const iext = new Array(dimsize + 3).fill(0);
|
|
49572
|
+
let delf = gridDensity * nfcns;
|
|
49573
|
+
delf = 0.5 / delf;
|
|
49574
|
+
grid[1] = edge[1];
|
|
49575
|
+
if (neg !== 0 && edge[1] < delf) grid[1] = delf;
|
|
49576
|
+
let j = 1;
|
|
49577
|
+
let l = 1;
|
|
49578
|
+
let lband = 1;
|
|
49579
|
+
for (; ; ) {
|
|
49580
|
+
const fup = edge[l + 1];
|
|
49581
|
+
for (; ; ) {
|
|
49582
|
+
const temp2 = grid[j];
|
|
49583
|
+
des[j] = eff(temp2, fx, lband, jtype);
|
|
49584
|
+
wt[j] = wate(temp2, fx, wtx, lband, jtype);
|
|
49585
|
+
if (++j > wrksize) throw new Error("remez: grid too dense / too many points");
|
|
49586
|
+
grid[j] = temp2 + delf;
|
|
49587
|
+
if (grid[j] > fup) break;
|
|
49588
|
+
}
|
|
49589
|
+
grid[j - 1] = fup;
|
|
49590
|
+
des[j - 1] = eff(fup, fx, lband, jtype);
|
|
49591
|
+
wt[j - 1] = wate(fup, fx, wtx, lband, jtype);
|
|
49592
|
+
++lband;
|
|
49593
|
+
l += 2;
|
|
49594
|
+
if (lband > numbands) break;
|
|
49595
|
+
grid[j] = edge[l];
|
|
49596
|
+
}
|
|
49597
|
+
let ngrid = j - 1;
|
|
49598
|
+
if (neg === nodd && grid[ngrid] > 0.5 - delf) --ngrid;
|
|
49599
|
+
if (ngrid < nfcns + 1)
|
|
49600
|
+
throw new Error("remez: band too narrow for the requested numtaps (grid underflow)");
|
|
49601
|
+
if (neg <= 0) {
|
|
49602
|
+
if (nodd !== 1) {
|
|
49603
|
+
for (j = 1; j <= ngrid; j++) {
|
|
49604
|
+
const change = Math.cos(PI * grid[j]);
|
|
49605
|
+
des[j] = des[j] / change;
|
|
49606
|
+
wt[j] = wt[j] * change;
|
|
49607
|
+
}
|
|
49608
|
+
}
|
|
49609
|
+
} else {
|
|
49610
|
+
if (nodd !== 1) {
|
|
49611
|
+
for (j = 1; j <= ngrid; j++) {
|
|
49612
|
+
const change = Math.sin(PI * grid[j]);
|
|
49613
|
+
des[j] = des[j] / change;
|
|
49614
|
+
wt[j] = wt[j] * change;
|
|
49615
|
+
}
|
|
49616
|
+
} else {
|
|
49617
|
+
for (j = 1; j <= ngrid; j++) {
|
|
49618
|
+
const change = Math.sin(TWOPI * grid[j]);
|
|
49619
|
+
des[j] = des[j] / change;
|
|
49620
|
+
wt[j] = wt[j] * change;
|
|
49621
|
+
}
|
|
49622
|
+
}
|
|
49623
|
+
}
|
|
49624
|
+
const temp = (ngrid - 1) / nfcns;
|
|
49625
|
+
for (j = 1; j <= nfcns; j++) iext[j] = Math.floor((j - 1) * temp) + 1;
|
|
49626
|
+
iext[nfcns + 1] = ngrid;
|
|
49627
|
+
const res = remezCore(des, grid, edge, wt, ngrid, numbands, iext, alpha, nfcns, maxiter);
|
|
49628
|
+
if (res.status < 0) throw new Error("remez: Remez exchange failed to converge");
|
|
49629
|
+
const h = new Array(numtaps + 1).fill(0);
|
|
49630
|
+
const nz = nfcns + 1;
|
|
49631
|
+
const nm1 = nfcns - 1;
|
|
49632
|
+
if (neg <= 0) {
|
|
49633
|
+
if (nodd !== 0) {
|
|
49634
|
+
for (j = 1; j <= nm1; j++) h[j] = 0.5 * alpha[nz - j];
|
|
49635
|
+
h[nfcns] = alpha[1];
|
|
49636
|
+
} else {
|
|
49637
|
+
h[1] = 0.25 * alpha[nfcns];
|
|
49638
|
+
for (j = 2; j <= nm1; j++) h[j] = 0.25 * (alpha[nz - j] + alpha[nfcns + 2 - j]);
|
|
49639
|
+
h[nfcns] = 0.5 * alpha[1] + 0.25 * alpha[2];
|
|
49640
|
+
}
|
|
49641
|
+
} else {
|
|
49642
|
+
if (nodd !== 0) {
|
|
49643
|
+
h[1] = 0.25 * alpha[nfcns];
|
|
49644
|
+
h[2] = 0.25 * alpha[nm1];
|
|
49645
|
+
for (j = 3; j <= nm1; j++) h[j] = 0.25 * (alpha[nz - j] - alpha[nfcns + 3 - j]);
|
|
49646
|
+
h[nfcns] = 0.5 * alpha[1] - 0.25 * alpha[3];
|
|
49647
|
+
h[nz] = 0;
|
|
49648
|
+
} else {
|
|
49649
|
+
h[1] = 0.25 * alpha[nfcns];
|
|
49650
|
+
for (j = 2; j <= nm1; j++) h[j] = 0.25 * (alpha[nz - j] - alpha[nfcns + 2 - j]);
|
|
49651
|
+
h[nfcns] = 0.5 * alpha[1] - 0.25 * alpha[2];
|
|
49652
|
+
}
|
|
49653
|
+
}
|
|
49654
|
+
for (j = 1; j <= nfcns; j++) {
|
|
49655
|
+
const k = numtaps + 1 - j;
|
|
49656
|
+
h[k] = neg === 0 ? h[j] : -h[j];
|
|
49657
|
+
}
|
|
49658
|
+
if (neg === 1 && nodd === 1) h[nz] = 0;
|
|
49659
|
+
return h.slice(1);
|
|
49660
|
+
}
|
|
49661
|
+
|
|
48981
49662
|
// src/signal/fir-smoothing.ts
|
|
48982
49663
|
var arr9 = (x) => Array.isArray(x) ? x : Array.from(x);
|
|
48983
49664
|
function solveLinearSystem(Ain, bin2) {
|
|
@@ -49179,11 +49860,6 @@ function solveWeightedBasis(basis, pts, weights) {
|
|
|
49179
49860
|
}
|
|
49180
49861
|
return solveLinearSystem(A, b);
|
|
49181
49862
|
}
|
|
49182
|
-
function evalBasis(basis, coeffs, w) {
|
|
49183
|
-
let s = 0;
|
|
49184
|
-
for (let k = 0; k < basis.nBasis; k++) s += coeffs[k] * basis.phi(k, w);
|
|
49185
|
-
return s;
|
|
49186
|
-
}
|
|
49187
49863
|
function firls(numtaps, bands, desired) {
|
|
49188
49864
|
validateBandsDesired(numtaps, bands, desired);
|
|
49189
49865
|
const basis = makeBasis(numtaps);
|
|
@@ -49195,22 +49871,8 @@ function firls(numtaps, bands, desired) {
|
|
|
49195
49871
|
);
|
|
49196
49872
|
return coeffsToTaps(numtaps, basis, coeffs);
|
|
49197
49873
|
}
|
|
49198
|
-
function remez(numtaps, bands, desired) {
|
|
49199
|
-
|
|
49200
|
-
const basis = makeBasis(numtaps);
|
|
49201
|
-
const pts = sampleBands(bands, desired);
|
|
49202
|
-
let weights = pts.map(() => 1);
|
|
49203
|
-
let coeffs = solveWeightedBasis(basis, pts, weights);
|
|
49204
|
-
const ITERATIONS = 15;
|
|
49205
|
-
for (let iter = 1; iter < ITERATIONS; iter++) {
|
|
49206
|
-
const errs = pts.map((pt) => Math.abs(evalBasis(basis, coeffs, pt.w) - pt.D));
|
|
49207
|
-
const maxErr = Math.max(...errs, 1e-12);
|
|
49208
|
-
const reweighted = weights.map((wgt, i) => wgt * Math.pow(errs[i] / maxErr + 1e-6, 0.5));
|
|
49209
|
-
const meanW = reweighted.reduce((a, b) => a + b, 0) / reweighted.length;
|
|
49210
|
-
weights = reweighted.map((wgt) => wgt / meanW);
|
|
49211
|
-
coeffs = solveWeightedBasis(basis, pts, weights);
|
|
49212
|
-
}
|
|
49213
|
-
return coeffsToTaps(numtaps, basis, coeffs);
|
|
49874
|
+
function remez(numtaps, bands, desired, weight, type = "bandpass") {
|
|
49875
|
+
return remezExchange(numtaps, bands, desired, weight, type);
|
|
49214
49876
|
}
|
|
49215
49877
|
|
|
49216
49878
|
// src/signal/wavelets.ts
|
|
@@ -11,15 +11,27 @@
|
|
|
11
11
|
* - {@link care} — continuous algebraic Riccati equation
|
|
12
12
|
* `AᵀX + XA − X B R⁻¹ Bᵀ X + Q = 0`, solved via the **matrix sign
|
|
13
13
|
* function** applied to the Hamiltonian `H = [[A, −BR⁻¹Bᵀ], [−Q, −Aᵀ]]`.
|
|
14
|
-
* This
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* stabilizing initial gain that a Kleinman/Newton iteration would
|
|
18
|
-
* require (the natural starting point `X₀ = 0` is not stabilizing for
|
|
19
|
-
* e.g. the classic double-integrator `A = [[0,1],[0,0]]`, which is only
|
|
14
|
+
* This needs no stabilizing initial gain that a Kleinman/Newton iteration
|
|
15
|
+
* would require (the natural starting point `X₀ = 0` is not stabilizing
|
|
16
|
+
* for e.g. the classic double-integrator `A = [[0,1],[0,0]]`, which is only
|
|
20
17
|
* marginally stable). The sign-function Newton iteration converges
|
|
21
18
|
* unconditionally (given the standard stabilizability/detectability
|
|
22
19
|
* assumptions) directly from `H` itself.
|
|
20
|
+
*
|
|
21
|
+
* The classical alternative is the **Hamiltonian-eigenvector** construction
|
|
22
|
+
* (eigendecompose `H`, take the stable invariant subspace `U=[U₁;U₂]`,
|
|
23
|
+
* `X = U₂U₁⁻¹`). Since `matrix`'s `eig` gained complex eigenvectors
|
|
24
|
+
* (`vectorsIm`, 2026-07-16) that path IS now implementable — but it was
|
|
25
|
+
* prototyped and **measured against the sign function** (2026-07-18) and
|
|
26
|
+
* found strictly **less** accurate on every corpus case, with the gap
|
|
27
|
+
* widening on ill-conditioned Hamiltonians (near-uncontrollable /
|
|
28
|
+
* lightly-damped: Riccati residual ~1e-10..1e-13 for the eigenvector path
|
|
29
|
+
* vs ~1e-13..1e-14 for the sign function). Eigenvector-basis subspace
|
|
30
|
+
* extraction is the numerically inferior classical method (ill-conditioned
|
|
31
|
+
* eigenvectors near defectiveness), which is why LAPACK/scipy use ordered
|
|
32
|
+
* Schur, not eigenvectors. The self-contained sign-function method is
|
|
33
|
+
* therefore retained. (`funm`/`cosm`/`sinm` likewise use eigen*values*,
|
|
34
|
+
* not eigenvectors — see `matrix-functions.ts`.)
|
|
23
35
|
* - {@link dare} — discrete algebraic Riccati equation
|
|
24
36
|
* `AᵀXA − X − AᵀXB(R + BᵀXB)⁻¹BᵀXA + Q = 0`, solved via the
|
|
25
37
|
* **structure-preserving doubling algorithm** (SDA), the discrete-time
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"control-equations.d.ts","sourceRoot":"","sources":["../../src/numeric/control-equations.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"control-equations.d.ts","sourceRoot":"","sources":["../../src/numeric/control-equations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AAuJH;;;;;;;;;;GAUG;AACH,wBAAgB,KAAK,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,GAAG,MAAM,EAAE,EAAE,CAgB9D;AASD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,GAAG,MAAM,EAAE,EAAE,CA6C3F;AAMD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,GAAG,MAAM,EAAE,EAAE,CA+B3F"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type RemezType } from './remez-exchange.js';
|
|
1
2
|
type Vec = readonly number[] | Float64Array;
|
|
2
3
|
/** Polynomial/deconvolution division result: `signal = conv(divisor, quotient) + remainder`. */
|
|
3
4
|
export interface DeconvolveResult {
|
|
@@ -49,14 +50,17 @@ export declare function wiener(x: Vec, mysize?: number): number[];
|
|
|
49
50
|
*/
|
|
50
51
|
export declare function firls(numtaps: number, bands: readonly number[], desired: readonly number[]): number[];
|
|
51
52
|
/**
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
* with
|
|
57
|
-
*
|
|
58
|
-
*
|
|
53
|
+
* Optimal equiripple FIR design (`scipy.signal.remez`) via the exact
|
|
54
|
+
* Parks-McClellan / Remez exchange algorithm (delegates to `remezExchange`).
|
|
55
|
+
*
|
|
56
|
+
* **Convention note:** unlike `firls` above (which follows `scipy.signal.firls`
|
|
57
|
+
* with `1 = Nyquist` and one `desired` value per band *edge*), `remez` follows
|
|
58
|
+
* `scipy.signal.remez` exactly: band edges are normalized to `[0, 0.5]`
|
|
59
|
+
* (`fs = 1`, `0.5 = Nyquist`), and `desired`/`weight` carry one value per band
|
|
60
|
+
* (length `bands.length / 2`). `type` is `'bandpass'` (symmetric, the default),
|
|
61
|
+
* `'differentiator'`, or `'hilbert'` (antisymmetric). Coefficients match
|
|
62
|
+
* `scipy.signal.remez` to machine precision.
|
|
59
63
|
*/
|
|
60
|
-
export declare function remez(numtaps: number, bands: readonly number[], desired: readonly number[]): number[];
|
|
64
|
+
export declare function remez(numtaps: number, bands: readonly number[], desired: readonly number[], weight?: readonly number[], type?: RemezType): number[];
|
|
61
65
|
export {};
|
|
62
66
|
//# sourceMappingURL=fir-smoothing.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fir-smoothing.d.ts","sourceRoot":"","sources":["../../src/signal/fir-smooth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CAEV"}
|
|
@@ -63,17 +63,26 @@ export declare function bilinear(bIn: Vec, aIn: Vec, fs: number): {
|
|
|
63
63
|
a: number[];
|
|
64
64
|
};
|
|
65
65
|
/**
|
|
66
|
-
* Minimum Butterworth filter order
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
* Nyquist (0..1); `gpass`/`gstop` are in dB.
|
|
70
|
-
* `
|
|
71
|
-
*
|
|
66
|
+
* Minimum Butterworth filter order and the corresponding natural frequency
|
|
67
|
+
* `Wn` (the "3 dB" frequency) meeting a passband/stopband spec, for a digital
|
|
68
|
+
* lowpass, highpass, bandpass, or bandstop filter. Frequencies are normalized
|
|
69
|
+
* to Nyquist (`0..1`); `gpass`/`gstop` are in dB. For lowpass/highpass, `wp`
|
|
70
|
+
* and `ws` are scalars and `Wn` is a scalar; for bandpass/bandstop, `wp` and
|
|
71
|
+
* `ws` are `[low, high]` pairs and `Wn` is the `[low, high]` natural-frequency
|
|
72
|
+
* array. Matches `scipy.signal.buttord(wp, ws, gpass, gstop)`.
|
|
73
|
+
*
|
|
74
|
+
* Filter type follows scipy: scalar `wp < ws` → lowpass, `wp > ws` → highpass;
|
|
75
|
+
* array with `wp[0] > ws[0]` (passband inside stopband) → bandpass, `wp[0] <
|
|
76
|
+
* ws[0]` (stopband inside passband) → bandstop.
|
|
72
77
|
*/
|
|
73
78
|
export declare function buttord(wp: number, ws: number, gpass: number, gstop: number): {
|
|
74
79
|
N: number;
|
|
75
80
|
Wn: number;
|
|
76
81
|
};
|
|
82
|
+
export declare function buttord(wp: readonly [number, number], ws: readonly [number, number], gpass: number, gstop: number): {
|
|
83
|
+
N: number;
|
|
84
|
+
Wn: [number, number];
|
|
85
|
+
};
|
|
77
86
|
type ZpkRoot = number | Complex;
|
|
78
87
|
/**
|
|
79
88
|
* Group zeros/poles/gain into cascaded second-order sections:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"iir-design.d.ts","sourceRoot":"","sources":["../../src/signal/iir-design.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D;;;;;;;;;;;;GAYG;AACH,wBAAgB,OAAO,CACrB,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,GACZ;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC;AAC7B,wBAAgB,OAAO,CACrB,EAAE,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,EAC7B,EAAE,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,EAC7B,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,GACZ;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,CAAC;AAkFvC,KAAK,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC;AAoDhC;;;;;;;GAOG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,SAAS,OAAO,EAAE,EAAE,CAAC,EAAE,SAAS,OAAO,EAAE,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,CAmB3F;AAED;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,GAAG,EAAE,SAAS,CAAC,SAAS,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,GAAG,GAAG,MAAM,EAAE,CAS7E"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Exact Parks-McClellan (Remez exchange) optimal equiripple FIR design.
|
|
3
|
+
*
|
|
4
|
+
* This is a faithful TypeScript port of the classic McClellan-Parks-Rabiner
|
|
5
|
+
* FORTRAN program (via Erik Kvaleberg's `remez.c`), the same code SciPy wraps
|
|
6
|
+
* in `scipy.signal.remez` (`_sigtoolsmodule.cc`: `pre_remez` + `remez`). It
|
|
7
|
+
* replaces the earlier Lawson-IRLS approximation. Conventions match SciPy
|
|
8
|
+
* exactly: band edges are normalized to `[0, 0.5]` (`fs = 1`, `0.5 = Nyquist`),
|
|
9
|
+
* `desired`/`weight` carry one value per band (length `bands.length / 2`), and
|
|
10
|
+
* `type` is `'bandpass'` (symmetric), `'differentiator'`, or `'hilbert'`
|
|
11
|
+
* (antisymmetric). Coefficients are pinned against `scipy.signal.remez` in
|
|
12
|
+
* `functions/tests/remez-pm.test.ts`.
|
|
13
|
+
*
|
|
14
|
+
* The port preserves the original's 1-based array indexing and control flow
|
|
15
|
+
* (the extremal-search `goto` block is expressed as a small state machine) so
|
|
16
|
+
* that it reproduces SciPy's discrete-grid extremal selection bit-for-bit.
|
|
17
|
+
*/
|
|
18
|
+
export type RemezType = 'bandpass' | 'differentiator' | 'hilbert';
|
|
19
|
+
/**
|
|
20
|
+
* Optimal equiripple FIR design (`scipy.signal.remez`) via the exact
|
|
21
|
+
* Parks-McClellan / Remez exchange algorithm. `bands` is a flat list of band
|
|
22
|
+
* edges normalized to `[0, 0.5]` (`fs = 1`, `0.5 = Nyquist`); `desired` and
|
|
23
|
+
* `weight` carry one value per band (`bands.length / 2` entries). `type`
|
|
24
|
+
* selects the linear-phase family (`'bandpass'` symmetric; `'differentiator'`
|
|
25
|
+
* and `'hilbert'` antisymmetric). Returns `numtaps` FIR coefficients.
|
|
26
|
+
*/
|
|
27
|
+
export declare function remezExchange(numtaps: number, bands: readonly number[], desired: readonly number[], weight?: readonly number[], type?: RemezType, maxiter?: number, gridDensity?: number): number[];
|
|
28
|
+
//# sourceMappingURL=remez-exchange.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remez-exchange.d.ts","sourceRoot":"","sources":["../../src/signal/remez-exchange.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAKH,MAAM,MAAM,SAAS,GAAG,UAAU,GAAG,gBAAgB,GAAG,SAAS,CAAC;AAgelE;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAC3B,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,SAAS,MAAM,EAAE,EACxB,OAAO,EAAE,SAAS,MAAM,EAAE,EAC1B,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,EAC1B,IAAI,GAAE,SAAsB,EAC5B,OAAO,SAAK,EACZ,WAAW,SAAK,GACf,MAAM,EAAE,CA4IV"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"physicalConstants.d.ts","sourceRoot":"","sources":["../../../src/type/unit/physicalConstants.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,KAAK,OAAO,MAAM,YAAY,CAAC;AAEtC;;GAEG;AACH,UAAU,oBAAoB;IAC5B,KAAK,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;CACvC;AAED;;GAEG;AACH,UAAU,SAAS;IACjB,KAAK,KAAK,EAAE,MAAM,GAAG,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,YAAY,CAAC;CAC3D;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,OAAO,CAAC;CACpB;AAED;;GAEG;AACH,UAAU,uBAAuB;IAC/B,MAAM,EAAE,YAAY,CAAC;IACrB,IAAI,EAAE,SAAS,CAAC;IAChB,SAAS,EAAE,oBAAoB,CAAC;CACjC;AAED;;GAEG;AACH,UAAU,yBAAyB;IACjC,MAAM,EAAE,YAAY,CAAC;IACrB,SAAS,EAAE,oBAAoB,CAAC;CACjC;
|
|
1
|
+
{"version":3,"file":"physicalConstants.d.ts","sourceRoot":"","sources":["../../../src/type/unit/physicalConstants.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,KAAK,OAAO,MAAM,YAAY,CAAC;AAEtC;;GAEG;AACH,UAAU,oBAAoB;IAC5B,KAAK,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;CACvC;AAED;;GAEG;AACH,UAAU,SAA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