MCPcopy Create free account
hub / github.com/alignoth/alignoth / Ls

Function Ls

resources/vega.min.js:4943–4993  ·  view source on GitHub ↗
(t, e, n, r)

Source from the content-addressed store, hash-verified

4941 return ((i[0] += r), i);
4942 }
4943 function Ls(t, e, n, r) {
4944 const [i, o, a, s] = Cs(t, e, n, !0),
4945 u = i.length,
4946 l = Math.max(2, ~~(r * u)),
4947 c = new Float64Array(u),
4948 f = new Float64Array(u),
4949 h = new Float64Array(u).fill(1);
4950 for (let t = -1; ++t <= 2; ) {
4951 const e = [0, l - 1];
4952 for (let t = 0; t < u; ++t) {
4953 const n = i[t],
4954 r = e[0],
4955 a = e[1],
4956 s = n - i[r] > i[a] - n ? r : a;
4957 let u = 0,
4958 l = 0,
4959 d = 0,
4960 p = 0,
4961 g = 0;
4962 const m = 1 / Math.abs(i[s] - n || 1);
4963 for (let t = r; t <= a; ++t) {
4964 const e = i[t],
4965 r = o[t],
4966 a = Us(Math.abs(n - e) * m) * h[t],
4967 s = e * a;
4968 ((u += a), (l += s), (d += r * a), (p += r * s), (g += e * s));
4969 }
4970 const [y, v] = Ds(l / u, d / u, p / u, g / u);
4971 ((c[t] = y + v * n), (f[t] = Math.abs(o[t] - c[t])), qs(i, t + 1, e));
4972 }
4973 if (2 === t) break;
4974 const n = De(f);
4975 if (Math.abs(n) < 1e-12) break;
4976 for (let t, e, r = 0; r < u; ++r)
4977 ((t = f[r] / (6 * n)), (h[r] = t >= 1 ? 1e-12 : (e = 1 - t * t) * e));
4978 }
4979 return (function (t, e, n, r) {
4980 const i = t.length,
4981 o = [];
4982 let a,
4983 s = 0,
4984 u = 0,
4985 l = [];
4986 for (; s < i; ++s)
4987 ((a = t[s] + n),
4988 l[0] === a
4989 ? (l[1] += (e[s] - l[1]) / ++u)
4990 : ((u = 0), (l[1] += r), (l = [a, e[s]]), o.push(l)));
4991 return ((l[1] += r), o);
4992 })(i, c, a, s);
4993 }
4994 function Us(t) {
4995 return (t = 1 - t * t * t) * t * t;
4996 }

Callers 1

transformFunction · 0.70

Calls 5

CsFunction · 0.85
DsFunction · 0.85
qsFunction · 0.85
UsFunction · 0.70
DeFunction · 0.70

Tested by

no test coverage detected