Brunobkr/llama.cpp_AlgMor24_github
ΩFFFΣLLIa • llama.cpp • AlgMor24 ██████╗ ███████╗███████╗███████╗██╗ ██╗ ██╗ █████╗ ██╔═══██╗██╔════╝██╔════╝██╔════╝██║ ██║ ██║██╔══██╗ ██║ ██║█████╗ █████╗ █████╗ ██║ ██║ ██║███████║ ██║ ██║██╔══╝ ██╔══╝ ██╔══╝ ██║ ██║ ██║██╔══██║ ╚██████╔╝██║ ██║ ███████╗███████╗███████╗██║██║ ██║ ╚═════╝ ╚═╝ ╚═╝ ╚══════╝╚══════╝╚══════╝╚═╝╚═╝ ╚═╝ High-Performance LLM / VLM Inference & Autonomous Agentic Ecosystem… See the full description on the dataset page: https://huggingface.co/datasets/Brunobkr/llama.cpp_AlgMor24_github.
03.1k
1// https://d3js.org v7.9.0 Copyright 2010-2023 Mike Bostock2(function (global, factory) {3typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :4typeof define === 'function' && define.amd ? define(['exports'], factory) :5(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.d3 = global.d3 || {}));6})(this, (function (exports) { 'use strict';7 8var version = "7.9.0";9 10function ascending$3(a, b) {11 return a == null || b == null ? NaN : a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;12}13 14function descending$2(a, b) {15 return a == null || b == null ? NaN16 : b < a ? -117 : b > a ? 118 : b >= a ? 019 : NaN;20}21 22function bisector(f) {23 let compare1, compare2, delta;24 25 // If an accessor is specified, promote it to a comparator. In this case we26 // can test whether the search value is (self-) comparable. We can’t do this27 // for a comparator (except for specific, known comparators) because we can’t28 // tell if the comparator is symmetric, and an asymmetric comparator can’t be29 // used to test whether a single value is comparable.30 if (f.length !== 2) {31 compare1 = ascending$3;32 compare2 = (d, x) => ascending$3(f(d), x);33 delta = (d, x) => f(d) - x;34 } else {35 compare1 = f === ascending$3 || f === descending$2 ? f : zero$1;36 compare2 = f;37 delta = f;38 }39 40 function left(a, x, lo = 0, hi = a.length) {41 if (lo < hi) {42 if (compare1(x, x) !== 0) return hi;43 do {44 const mid = (lo + hi) >>> 1;45 if (compare2(a[mid], x) < 0) lo = mid + 1;46 else hi = mid;47 } while (lo < hi);48 }49 return lo;50 }51 52 function right(a, x, lo = 0, hi = a.length) {53 if (lo < hi) {54 if (compare1(x, x) !== 0) return hi;55 do {56 const mid = (lo + hi) >>> 1;57 if (compare2(a[mid], x) <= 0) lo = mid + 1;58 else hi = mid;59 } while (lo < hi);60 }61 return lo;62 }63 64 function center(a, x, lo = 0, hi = a.length) {65 const i = left(a, x, lo, hi - 1);66 return i > lo && delta(a[i - 1], x) > -delta(a[i], x) ? i - 1 : i;67 }68 69 return {left, center, right};70}71 72function zero$1() {73 return 0;74}75 76function number$3(x) {77 return x === null ? NaN : +x;78}79 80function* numbers(values, valueof) {81 if (valueof === undefined) {82 for (let value of values) {83 if (value != null && (value = +value) >= value) {84 yield value;85 }86 }87 } else {88 let index = -1;89 for (let value of values) {90 if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) {91 yield value;92 }93 }94 }95}96 97const ascendingBisect = bisector(ascending$3);98const bisectRight = ascendingBisect.right;99const bisectLeft = ascendingBisect.left;100const bisectCenter = bisector(number$3).center;101var bisect = bisectRight;102 103function blur(values, r) {104 if (!((r = +r) >= 0)) throw new RangeError("invalid r");105 let length = values.length;106 if (!((length = Math.floor(length)) >= 0)) throw new RangeError("invalid length");107 if (!length || !r) return values;108 const blur = blurf(r);109 const temp = values.slice();110 blur(values, temp, 0, length, 1);111 blur(temp, values, 0, length, 1);112 blur(values, temp, 0, length, 1);113 return values;114}115 116const blur2 = Blur2(blurf);117 118const blurImage = Blur2(blurfImage);119 120function Blur2(blur) {121 return function(data, rx, ry = rx) {122 if (!((rx = +rx) >= 0)) throw new RangeError("invalid rx");123 if (!((ry = +ry) >= 0)) throw new RangeError("invalid ry");124 let {data: values, width, height} = data;125 if (!((width = Math.floor(width)) >= 0)) throw new RangeError("invalid width");126 if (!((height = Math.floor(height !== undefined ? height : values.length / width)) >= 0)) throw new RangeError("invalid height");127 if (!width || !height || (!rx && !ry)) return data;128 const blurx = rx && blur(rx);129 const blury = ry && blur(ry);130 const temp = values.slice();131 if (blurx && blury) {132 blurh(blurx, temp, values, width, height);133 blurh(blurx, values, temp, width, height);134 blurh(blurx, temp, values, width, height);135 blurv(blury, values, temp, width, height);136 blurv(blury, temp, values, width, height);137 blurv(blury, values, temp, width, height);138 } else if (blurx) {139 blurh(blurx, values, temp, width, height);140 blurh(blurx, temp, values, width, height);141 blurh(blurx, values, temp, width, height);142 } else if (blury) {143 blurv(blury, values, temp, width, height);144 blurv(blury, temp, values, width, height);145 blurv(blury, values, temp, width, height);146 }147 return data;148 };149}150 151function blurh(blur, T, S, w, h) {152 for (let y = 0, n = w * h; y < n;) {153 blur(T, S, y, y += w, 1);154 }155}156 157function blurv(blur, T, S, w, h) {158 for (let x = 0, n = w * h; x < w; ++x) {159 blur(T, S, x, x + n, w);160 }161}162 163function blurfImage(radius) {164 const blur = blurf(radius);165 return (T, S, start, stop, step) => {166 start <<= 2, stop <<= 2, step <<= 2;167 blur(T, S, start + 0, stop + 0, step);168 blur(T, S, start + 1, stop + 1, step);169 blur(T, S, start + 2, stop + 2, step);170 blur(T, S, start + 3, stop + 3, step);171 };172}173 174// Given a target array T, a source array S, sets each value T[i] to the average175// of {S[i - r], …, S[i], …, S[i + r]}, where r = ⌊radius⌋, start <= i < stop,176// for each i, i + step, i + 2 * step, etc., and where S[j] is clamped between177// S[start] (inclusive) and S[stop] (exclusive). If the given radius is not an178// integer, S[i - r - 1] and S[i + r + 1] are added to the sum, each weighted179// according to r - ⌊radius⌋.180function blurf(radius) {181 const radius0 = Math.floor(radius);182 if (radius0 === radius) return bluri(radius);183 const t = radius - radius0;184 const w = 2 * radius + 1;185 return (T, S, start, stop, step) => { // stop must be aligned!186 if (!((stop -= step) >= start)) return; // inclusive stop187 let sum = radius0 * S[start];188 const s0 = step * radius0;189 const s1 = s0 + step;190 for (let i = start, j = start + s0; i < j; i += step) {191 sum += S[Math.min(stop, i)];192 }193 for (let i = start, j = stop; i <= j; i += step) {194 sum += S[Math.min(stop, i + s0)];195 T[i] = (sum + t * (S[Math.max(start, i - s1)] + S[Math.min(stop, i + s1)])) / w;196 sum -= S[Math.max(start, i - s0)];197 }198 };199}200 201// Like blurf, but optimized for integer radius.202function bluri(radius) {203 const w = 2 * radius + 1;204 return (T, S, start, stop, step) => { // stop must be aligned!205 if (!((stop -= step) >= start)) return; // inclusive stop206 let sum = radius * S[start];207 const s = step * radius;208 for (let i = start, j = start + s; i < j; i += step) {209 sum += S[Math.min(stop, i)];210 }211 for (let i = start, j = stop; i <= j; i += step) {212 sum += S[Math.min(stop, i + s)];213 T[i] = sum / w;214 sum -= S[Math.max(start, i - s)];215 }216 };217}218 219function count$1(values, valueof) {220 let count = 0;221 if (valueof === undefined) {222 for (let value of values) {223 if (value != null && (value = +value) >= value) {224 ++count;225 }226 }227 } else {228 let index = -1;229 for (let value of values) {230 if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) {231 ++count;232 }233 }234 }235 return count;236}237 238function length$3(array) {239 return array.length | 0;240}241 242function empty$2(length) {243 return !(length > 0);244}245 246function arrayify(values) {247 return typeof values !== "object" || "length" in values ? values : Array.from(values);248}249 250function reducer(reduce) {251 return values => reduce(...values);252}253 254function cross$2(...values) {255 const reduce = typeof values[values.length - 1] === "function" && reducer(values.pop());256 values = values.map(arrayify);257 const lengths = values.map(length$3);258 const j = values.length - 1;259 const index = new Array(j + 1).fill(0);260 const product = [];261 if (j < 0 || lengths.some(empty$2)) return product;262 while (true) {263 product.push(index.map((j, i) => values[i][j]));264 let i = j;265 while (++index[i] === lengths[i]) {266 if (i === 0) return reduce ? product.map(reduce) : product;267 index[i--] = 0;268 }269 }270}271 272function cumsum(values, valueof) {273 var sum = 0, index = 0;274 return Float64Array.from(values, valueof === undefined275 ? v => (sum += +v || 0)276 : v => (sum += +valueof(v, index++, values) || 0));277}278 279function variance(values, valueof) {280 let count = 0;281 let delta;282 let mean = 0;283 let sum = 0;284 if (valueof === undefined) {285 for (let value of values) {286 if (value != null && (value = +value) >= value) {287 delta = value - mean;288 mean += delta / ++count;289 sum += delta * (value - mean);290 }291 }292 } else {293 let index = -1;294 for (let value of values) {295 if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) {296 delta = value - mean;297 mean += delta / ++count;298 sum += delta * (value - mean);299 }300 }301 }302 if (count > 1) return sum / (count - 1);303}304 305function deviation(values, valueof) {306 const v = variance(values, valueof);307 return v ? Math.sqrt(v) : v;308}309 310function extent$1(values, valueof) {311 let min;312 let max;313 if (valueof === undefined) {314 for (const value of values) {315 if (value != null) {316 if (min === undefined) {317 if (value >= value) min = max = value;318 } else {319 if (min > value) min = value;320 if (max < value) max = value;321 }322 }323 }324 } else {325 let index = -1;326 for (let value of values) {327 if ((value = valueof(value, ++index, values)) != null) {328 if (min === undefined) {329 if (value >= value) min = max = value;330 } else {331 if (min > value) min = value;332 if (max < value) max = value;333 }334 }335 }336 }337 return [min, max];338}339 340// https://github.com/python/cpython/blob/a74eea238f5baba15797e2e8b570d153bc8690a7/Modules/mathmodule.c#L1423341class Adder {342 constructor() {343 this._partials = new Float64Array(32);344 this._n = 0;345 }346 add(x) {347 const p = this._partials;348 let i = 0;349 for (let j = 0; j < this._n && j < 32; j++) {350 const y = p[j],351 hi = x + y,352 lo = Math.abs(x) < Math.abs(y) ? x - (hi - y) : y - (hi - x);353 if (lo) p[i++] = lo;354 x = hi;355 }356 p[i] = x;357 this._n = i + 1;358 return this;359 }360 valueOf() {361 const p = this._partials;362 let n = this._n, x, y, lo, hi = 0;363 if (n > 0) {364 hi = p[--n];365 while (n > 0) {366 x = hi;367 y = p[--n];368 hi = x + y;369 lo = y - (hi - x);370 if (lo) break;371 }372 if (n > 0 && ((lo < 0 && p[n - 1] < 0) || (lo > 0 && p[n - 1] > 0))) {373 y = lo * 2;374 x = hi + y;375 if (y == x - hi) hi = x;376 }377 }378 return hi;379 }380}381 382function fsum(values, valueof) {383 const adder = new Adder();384 if (valueof === undefined) {385 for (let value of values) {386 if (value = +value) {387 adder.add(value);388 }389 }390 } else {391 let index = -1;392 for (let value of values) {393 if (value = +valueof(value, ++index, values)) {394 adder.add(value);395 }396 }397 }398 return +adder;399}400 401function fcumsum(values, valueof) {402 const adder = new Adder();403 let index = -1;404 return Float64Array.from(values, valueof === undefined405 ? v => adder.add(+v || 0)406 : v => adder.add(+valueof(v, ++index, values) || 0)407 );408}409 410class InternMap extends Map {411 constructor(entries, key = keyof) {412 super();413 Object.defineProperties(this, {_intern: {value: new Map()}, _key: {value: key}});414 if (entries != null) for (const [key, value] of entries) this.set(key, value);415 }416 get(key) {417 return super.get(intern_get(this, key));418 }419 has(key) {420 return super.has(intern_get(this, key));421 }422 set(key, value) {423 return super.set(intern_set(this, key), value);424 }425 delete(key) {426 return super.delete(intern_delete(this, key));427 }428}429 430class InternSet extends Set {431 constructor(values, key = keyof) {432 super();433 Object.defineProperties(this, {_intern: {value: new Map()}, _key: {value: key}});434 if (values != null) for (const value of values) this.add(value);435 }436 has(value) {437 return super.has(intern_get(this, value));438 }439 add(value) {440 return super.add(intern_set(this, value));441 }442 delete(value) {443 return super.delete(intern_delete(this, value));444 }445}446 447function intern_get({_intern, _key}, value) {448 const key = _key(value);449 return _intern.has(key) ? _intern.get(key) : value;450}451 452function intern_set({_intern, _key}, value) {453 const key = _key(value);454 if (_intern.has(key)) return _intern.get(key);455 _intern.set(key, value);456 return value;457}458 459function intern_delete({_intern, _key}, value) {460 const key = _key(value);461 if (_intern.has(key)) {462 value = _intern.get(key);463 _intern.delete(key);464 }465 return value;466}467 468function keyof(value) {469 return value !== null && typeof value === "object" ? value.valueOf() : value;470}471 472function identity$9(x) {473 return x;474}475 476function group(values, ...keys) {477 return nest(values, identity$9, identity$9, keys);478}479 480function groups(values, ...keys) {481 return nest(values, Array.from, identity$9, keys);482}483 484function flatten$1(groups, keys) {485 for (let i = 1, n = keys.length; i < n; ++i) {486 groups = groups.flatMap(g => g.pop().map(([key, value]) => [...g, key, value]));487 }488 return groups;489}490 491function flatGroup(values, ...keys) {492 return flatten$1(groups(values, ...keys), keys);493}494 495function flatRollup(values, reduce, ...keys) {496 return flatten$1(rollups(values, reduce, ...keys), keys);497}498 499function rollup(values, reduce, ...keys) {500 return nest(values, identity$9, reduce, keys);501}502 503function rollups(values, reduce, ...keys) {504 return nest(values, Array.from, reduce, keys);505}506 507function index$4(values, ...keys) {508 return nest(values, identity$9, unique, keys);509}510 511function indexes(values, ...keys) {512 return nest(values, Array.from, unique, keys);513}514 515function unique(values) {516 if (values.length !== 1) throw new Error("duplicate key");517 return values[0];518}519 520function nest(values, map, reduce, keys) {521 return (function regroup(values, i) {522 if (i >= keys.length) return reduce(values);523 const groups = new InternMap();524 const keyof = keys[i++];525 let index = -1;526 for (const value of values) {527 const key = keyof(value, ++index, values);528 const group = groups.get(key);529 if (group) group.push(value);530 else groups.set(key, [value]);531 }532 for (const [key, values] of groups) {533 groups.set(key, regroup(values, i));534 }535 return map(groups);536 })(values, 0);537}538 539function permute(source, keys) {540 return Array.from(keys, key => source[key]);541}542 543function sort(values, ...F) {544 if (typeof values[Symbol.iterator] !== "function") throw new TypeError("values is not iterable");545 values = Array.from(values);546 let [f] = F;547 if ((f && f.length !== 2) || F.length > 1) {548 const index = Uint32Array.from(values, (d, i) => i);549 if (F.length > 1) {550 F = F.map(f => values.map(f));551 index.sort((i, j) => {552 for (const f of F) {553 const c = ascendingDefined(f[i], f[j]);554 if (c) return c;555 }556 });557 } else {558 f = values.map(f);559 index.sort((i, j) => ascendingDefined(f[i], f[j]));560 }561 return permute(values, index);562 }563 return values.sort(compareDefined(f));564}565 566function compareDefined(compare = ascending$3) {567 if (compare === ascending$3) return ascendingDefined;568 if (typeof compare !== "function") throw new TypeError("compare is not a function");569 return (a, b) => {570 const x = compare(a, b);571 if (x || x === 0) return x;572 return (compare(b, b) === 0) - (compare(a, a) === 0);573 };574}575 576function ascendingDefined(a, b) {577 return (a == null || !(a >= a)) - (b == null || !(b >= b)) || (a < b ? -1 : a > b ? 1 : 0);578}579 580function groupSort(values, reduce, key) {581 return (reduce.length !== 2582 ? sort(rollup(values, reduce, key), (([ak, av], [bk, bv]) => ascending$3(av, bv) || ascending$3(ak, bk)))583 : sort(group(values, key), (([ak, av], [bk, bv]) => reduce(av, bv) || ascending$3(ak, bk))))584 .map(([key]) => key);585}586 587var array$5 = Array.prototype;588 589var slice$3 = array$5.slice;590 591function constant$b(x) {592 return () => x;593}594 595const e10 = Math.sqrt(50),596 e5 = Math.sqrt(10),597 e2 = Math.sqrt(2);598 599function tickSpec(start, stop, count) {600 const step = (stop - start) / Math.max(0, count),601 power = Math.floor(Math.log10(step)),602 error = step / Math.pow(10, power),603 factor = error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1;604 let i1, i2, inc;605 if (power < 0) {606 inc = Math.pow(10, -power) / factor;607 i1 = Math.round(start * inc);608 i2 = Math.round(stop * inc);609 if (i1 / inc < start) ++i1;610 if (i2 / inc > stop) --i2;611 inc = -inc;612 } else {613 inc = Math.pow(10, power) * factor;614 i1 = Math.round(start / inc);615 i2 = Math.round(stop / inc);616 if (i1 * inc < start) ++i1;617 if (i2 * inc > stop) --i2;618 }619 if (i2 < i1 && 0.5 <= count && count < 2) return tickSpec(start, stop, count * 2);620 return [i1, i2, inc];621}622 623function ticks(start, stop, count) {624 stop = +stop, start = +start, count = +count;625 if (!(count > 0)) return [];626 if (start === stop) return [start];627 const reverse = stop < start, [i1, i2, inc] = reverse ? tickSpec(stop, start, count) : tickSpec(start, stop, count);628 if (!(i2 >= i1)) return [];629 const n = i2 - i1 + 1, ticks = new Array(n);630 if (reverse) {631 if (inc < 0) for (let i = 0; i < n; ++i) ticks[i] = (i2 - i) / -inc;632 else for (let i = 0; i < n; ++i) ticks[i] = (i2 - i) * inc;633 } else {634 if (inc < 0) for (let i = 0; i < n; ++i) ticks[i] = (i1 + i) / -inc;635 else for (let i = 0; i < n; ++i) ticks[i] = (i1 + i) * inc;636 }637 return ticks;638}639 640function tickIncrement(start, stop, count) {641 stop = +stop, start = +start, count = +count;642 return tickSpec(start, stop, count)[2];643}644 645function tickStep(start, stop, count) {646 stop = +stop, start = +start, count = +count;647 const reverse = stop < start, inc = reverse ? tickIncrement(stop, start, count) : tickIncrement(start, stop, count);648 return (reverse ? -1 : 1) * (inc < 0 ? 1 / -inc : inc);649}650 651function nice$1(start, stop, count) {652 let prestep;653 while (true) {654 const step = tickIncrement(start, stop, count);655 if (step === prestep || step === 0 || !isFinite(step)) {656 return [start, stop];657 } else if (step > 0) {658 start = Math.floor(start / step) * step;659 stop = Math.ceil(stop / step) * step;660 } else if (step < 0) {661 start = Math.ceil(start * step) / step;662 stop = Math.floor(stop * step) / step;663 }664 prestep = step;665 }666}667 668function thresholdSturges(values) {669 return Math.max(1, Math.ceil(Math.log(count$1(values)) / Math.LN2) + 1);670}671 672function bin() {673 var value = identity$9,674 domain = extent$1,675 threshold = thresholdSturges;676 677 function histogram(data) {678 if (!Array.isArray(data)) data = Array.from(data);679 680 var i,681 n = data.length,682 x,683 step,684 values = new Array(n);685 686 for (i = 0; i < n; ++i) {687 values[i] = value(data[i], i, data);688 }689 690 var xz = domain(values),691 x0 = xz[0],692 x1 = xz[1],693 tz = threshold(values, x0, x1);694 695 // Convert number of thresholds into uniform thresholds, and nice the696 // default domain accordingly.697 if (!Array.isArray(tz)) {698 const max = x1, tn = +tz;699 if (domain === extent$1) [x0, x1] = nice$1(x0, x1, tn);700 tz = ticks(x0, x1, tn);701 702 // If the domain is aligned with the first tick (which it will by703 // default), then we can use quantization rather than bisection to bin704 // values, which is substantially faster.705 if (tz[0] <= x0) step = tickIncrement(x0, x1, tn);706 707 // If the last threshold is coincident with the domain’s upper bound, the708 // last bin will be zero-width. If the default domain is used, and this709 // last threshold is coincident with the maximum input value, we can710 // extend the niced upper bound by one tick to ensure uniform bin widths;711 // otherwise, we simply remove the last threshold. Note that we don’t712 // coerce values or the domain to numbers, and thus must be careful to713 // compare order (>=) rather than strict equality (===)!714 if (tz[tz.length - 1] >= x1) {715 if (max >= x1 && domain === extent$1) {716 const step = tickIncrement(x0, x1, tn);717 if (isFinite(step)) {718 if (step > 0) {719 x1 = (Math.floor(x1 / step) + 1) * step;720 } else if (step < 0) {721 x1 = (Math.ceil(x1 * -step) + 1) / -step;722 }723 }724 } else {725 tz.pop();726 }727 }728 }729 730 // Remove any thresholds outside the domain.731 // Be careful not to mutate an array owned by the user!732 var m = tz.length, a = 0, b = m;733 while (tz[a] <= x0) ++a;734 while (tz[b - 1] > x1) --b;735 if (a || b < m) tz = tz.slice(a, b), m = b - a;736 737 var bins = new Array(m + 1),738 bin;739 740 // Initialize bins.741 for (i = 0; i <= m; ++i) {742 bin = bins[i] = [];743 bin.x0 = i > 0 ? tz[i - 1] : x0;744 bin.x1 = i < m ? tz[i] : x1;745 }746 747 // Assign data to bins by value, ignoring any outside the domain.748 if (isFinite(step)) {749 if (step > 0) {750 for (i = 0; i < n; ++i) {751 if ((x = values[i]) != null && x0 <= x && x <= x1) {752 bins[Math.min(m, Math.floor((x - x0) / step))].push(data[i]);753 }754 }755 } else if (step < 0) {756 for (i = 0; i < n; ++i) {757 if ((x = values[i]) != null && x0 <= x && x <= x1) {758 const j = Math.floor((x0 - x) * step);759 bins[Math.min(m, j + (tz[j] <= x))].push(data[i]); // handle off-by-one due to rounding760 }761 }762 }763 } else {764 for (i = 0; i < n; ++i) {765 if ((x = values[i]) != null && x0 <= x && x <= x1) {766 bins[bisect(tz, x, 0, m)].push(data[i]);767 }768 }769 }770 771 return bins;772 }773 774 histogram.value = function(_) {775 return arguments.length ? (value = typeof _ === "function" ? _ : constant$b(_), histogram) : value;776 };777 778 histogram.domain = function(_) {779 return arguments.length ? (domain = typeof _ === "function" ? _ : constant$b([_[0], _[1]]), histogram) : domain;780 };781 782 histogram.thresholds = function(_) {783 return arguments.length ? (threshold = typeof _ === "function" ? _ : constant$b(Array.isArray(_) ? slice$3.call(_) : _), histogram) : threshold;784 };785 786 return histogram;787}788 789function max$3(values, valueof) {790 let max;791 if (valueof === undefined) {792 for (const value of values) {793 if (value != null794 && (max < value || (max === undefined && value >= value))) {795 max = value;796 }797 }798 } else {799 let index = -1;800 for (let value of values) {801 if ((value = valueof(value, ++index, values)) != null802 && (max < value || (max === undefined && value >= value))) {803 max = value;804 }805 }806 }807 return max;808}809 810function maxIndex(values, valueof) {811 let max;812 let maxIndex = -1;813 let index = -1;814 if (valueof === undefined) {815 for (const value of values) {816 ++index;817 if (value != null818 && (max < value || (max === undefined && value >= value))) {819 max = value, maxIndex = index;820 }821 }822 } else {823 for (let value of values) {824 if ((value = valueof(value, ++index, values)) != null825 && (max < value || (max === undefined && value >= value))) {826 max = value, maxIndex = index;827 }828 }829 }830 return maxIndex;831}832 833function min$2(values, valueof) {834 let min;835 if (valueof === undefined) {836 for (const value of values) {837 if (value != null838 && (min > value || (min === undefined && value >= value))) {839 min = value;840 }841 }842 } else {843 let index = -1;844 for (let value of values) {845 if ((value = valueof(value, ++index, values)) != null846 && (min > value || (min === undefined && value >= value))) {847 min = value;848 }849 }850 }851 return min;852}853 854function minIndex(values, valueof) {855 let min;856 let minIndex = -1;857 let index = -1;858 if (valueof === undefined) {859 for (const value of values) {860 ++index;861 if (value != null862 && (min > value || (min === undefined && value >= value))) {863 min = value, minIndex = index;864 }865 }866 } else {867 for (let value of values) {868 if ((value = valueof(value, ++index, values)) != null869 && (min > value || (min === undefined && value >= value))) {870 min = value, minIndex = index;871 }872 }873 }874 return minIndex;875}876 877// Based on https://github.com/mourner/quickselect878// ISC license, Copyright 2018 Vladimir Agafonkin.879function quickselect(array, k, left = 0, right = Infinity, compare) {880 k = Math.floor(k);881 left = Math.floor(Math.max(0, left));882 right = Math.floor(Math.min(array.length - 1, right));883 884 if (!(left <= k && k <= right)) return array;885 886 compare = compare === undefined ? ascendingDefined : compareDefined(compare);887 888 while (right > left) {889 if (right - left > 600) {890 const n = right - left + 1;891 const m = k - left + 1;892 const z = Math.log(n);893 const s = 0.5 * Math.exp(2 * z / 3);894 const sd = 0.5 * Math.sqrt(z * s * (n - s) / n) * (m - n / 2 < 0 ? -1 : 1);895 const newLeft = Math.max(left, Math.floor(k - m * s / n + sd));896 const newRight = Math.min(right, Math.floor(k + (n - m) * s / n + sd));897 quickselect(array, k, newLeft, newRight, compare);898 }899 900 const t = array[k];901 let i = left;902 let j = right;903 904 swap$1(array, left, k);905 if (compare(array[right], t) > 0) swap$1(array, left, right);906 907 while (i < j) {908 swap$1(array, i, j), ++i, --j;909 while (compare(array[i], t) < 0) ++i;910 while (compare(array[j], t) > 0) --j;911 }912 913 if (compare(array[left], t) === 0) swap$1(array, left, j);914 else ++j, swap$1(array, j, right);915 916 if (j <= k) left = j + 1;917 if (k <= j) right = j - 1;918 }919 920 return array;921}922 923function swap$1(array, i, j) {924 const t = array[i];925 array[i] = array[j];926 array[j] = t;927}928 929function greatest(values, compare = ascending$3) {930 let max;931 let defined = false;932 if (compare.length === 1) {933 let maxValue;934 for (const element of values) {935 const value = compare(element);936 if (defined937 ? ascending$3(value, maxValue) > 0938 : ascending$3(value, value) === 0) {939 max = element;940 maxValue = value;941 defined = true;942 }943 }944 } else {945 for (const value of values) {946 if (defined947 ? compare(value, max) > 0948 : compare(value, value) === 0) {949 max = value;950 defined = true;951 }952 }953 }954 return max;955}956 957function quantile$1(values, p, valueof) {958 values = Float64Array.from(numbers(values, valueof));959 if (!(n = values.length) || isNaN(p = +p)) return;960 if (p <= 0 || n < 2) return min$2(values);961 if (p >= 1) return max$3(values);962 var n,963 i = (n - 1) * p,964 i0 = Math.floor(i),965 value0 = max$3(quickselect(values, i0).subarray(0, i0 + 1)),966 value1 = min$2(values.subarray(i0 + 1));967 return value0 + (value1 - value0) * (i - i0);968}969 970function quantileSorted(values, p, valueof = number$3) {971 if (!(n = values.length) || isNaN(p = +p)) return;972 if (p <= 0 || n < 2) return +valueof(values[0], 0, values);973 if (p >= 1) return +valueof(values[n - 1], n - 1, values);974 var n,975 i = (n - 1) * p,976 i0 = Math.floor(i),977 value0 = +valueof(values[i0], i0, values),978 value1 = +valueof(values[i0 + 1], i0 + 1, values);979 return value0 + (value1 - value0) * (i - i0);980}981 982function quantileIndex(values, p, valueof = number$3) {983 if (isNaN(p = +p)) return;984 numbers = Float64Array.from(values, (_, i) => number$3(valueof(values[i], i, values)));985 if (p <= 0) return minIndex(numbers);986 if (p >= 1) return maxIndex(numbers);987 var numbers,988 index = Uint32Array.from(values, (_, i) => i),989 j = numbers.length - 1,990 i = Math.floor(j * p);991 quickselect(index, i, 0, j, (i, j) => ascendingDefined(numbers[i], numbers[j]));992 i = greatest(index.subarray(0, i + 1), (i) => numbers[i]);993 return i >= 0 ? i : -1;994}995 996function thresholdFreedmanDiaconis(values, min, max) {997 const c = count$1(values), d = quantile$1(values, 0.75) - quantile$1(values, 0.25);998 return c && d ? Math.ceil((max - min) / (2 * d * Math.pow(c, -1 / 3))) : 1;999}1000 1001function thresholdScott(values, min, max) {1002 const c = count$1(values), d = deviation(values);1003 return c && d ? Math.ceil((max - min) * Math.cbrt(c) / (3.49 * d)) : 1;1004}1005 1006function mean(values, valueof) {1007 let count = 0;1008 let sum = 0;1009 if (valueof === undefined) {1010 for (let value of values) {1011 if (value != null && (value = +value) >= value) {1012 ++count, sum += value;1013 }1014 }1015 } else {1016 let index = -1;1017 for (let value of values) {1018 if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) {1019 ++count, sum += value;1020 }1021 }1022 }1023 if (count) return sum / count;1024}1025 1026function median(values, valueof) {1027 return quantile$1(values, 0.5, valueof);1028}1029 1030function medianIndex(values, valueof) {1031 return quantileIndex(values, 0.5, valueof);1032}1033 1034function* flatten(arrays) {1035 for (const array of arrays) {1036 yield* array;1037 }1038}1039 1040function merge(arrays) {1041 return Array.from(flatten(arrays));1042}1043 1044function mode(values, valueof) {1045 const counts = new InternMap();1046 if (valueof === undefined) {1047 for (let value of values) {1048 if (value != null && value >= value) {1049 counts.set(value, (counts.get(value) || 0) + 1);1050 }1051 }1052 } else {1053 let index = -1;1054 for (let value of values) {1055 if ((value = valueof(value, ++index, values)) != null && value >= value) {1056 counts.set(value, (counts.get(value) || 0) + 1);1057 }1058 }1059 }1060 let modeValue;1061 let modeCount = 0;1062 for (const [value, count] of counts) {1063 if (count > modeCount) {1064 modeCount = count;1065 modeValue = value;1066 }1067 }1068 return modeValue;1069}1070 1071function pairs(values, pairof = pair) {1072 const pairs = [];1073 let previous;1074 let first = false;1075 for (const value of values) {1076 if (first) pairs.push(pairof(previous, value));1077 previous = value;1078 first = true;1079 }1080 return pairs;1081}1082 1083function pair(a, b) {1084 return [a, b];1085}1086 1087function range$2(start, stop, step) {1088 start = +start, stop = +stop, step = (n = arguments.length) < 2 ? (stop = start, start = 0, 1) : n < 3 ? 1 : +step;1089 1090 var i = -1,1091 n = Math.max(0, Math.ceil((stop - start) / step)) | 0,1092 range = new Array(n);1093 1094 while (++i < n) {1095 range[i] = start + i * step;1096 }1097 1098 return range;1099}1100 1101function rank(values, valueof = ascending$3) {1102 if (typeof values[Symbol.iterator] !== "function") throw new TypeError("values is not iterable");1103 let V = Array.from(values);1104 const R = new Float64Array(V.length);1105 if (valueof.length !== 2) V = V.map(valueof), valueof = ascending$3;1106 const compareIndex = (i, j) => valueof(V[i], V[j]);1107 let k, r;1108 values = Uint32Array.from(V, (_, i) => i);1109 // Risky chaining due to Safari 14 https://github.com/d3/d3-array/issues/1231110 values.sort(valueof === ascending$3 ? (i, j) => ascendingDefined(V[i], V[j]) : compareDefined(compareIndex));1111 values.forEach((j, i) => {1112 const c = compareIndex(j, k === undefined ? j : k);1113 if (c >= 0) {1114 if (k === undefined || c > 0) k = j, r = i;1115 R[j] = r;1116 } else {1117 R[j] = NaN;1118 }1119 });1120 return R;1121}1122 1123function least(values, compare = ascending$3) {1124 let min;1125 let defined = false;1126 if (compare.length === 1) {1127 let minValue;1128 for (const element of values) {1129 const value = compare(element);1130 if (defined1131 ? ascending$3(value, minValue) < 01132 : ascending$3(value, value) === 0) {1133 min = element;1134 minValue = value;1135 defined = true;1136 }1137 }1138 } else {1139 for (const value of values) {1140 if (defined1141 ? compare(value, min) < 01142 : compare(value, value) === 0) {1143 min = value;1144 defined = true;1145 }1146 }1147 }1148 return min;1149}1150 1151function leastIndex(values, compare = ascending$3) {1152 if (compare.length === 1) return minIndex(values, compare);1153 let minValue;1154 let min = -1;1155 let index = -1;1156 for (const value of values) {1157 ++index;1158 if (min < 01159 ? compare(value, value) === 01160 : compare(value, minValue) < 0) {1161 minValue = value;1162 min = index;1163 }1164 }1165 return min;1166}1167 1168function greatestIndex(values, compare = ascending$3) {1169 if (compare.length === 1) return maxIndex(values, compare);1170 let maxValue;1171 let max = -1;1172 let index = -1;1173 for (const value of values) {1174 ++index;1175 if (max < 01176 ? compare(value, value) === 01177 : compare(value, maxValue) > 0) {1178 maxValue = value;1179 max = index;1180 }1181 }1182 return max;1183}1184 1185function scan(values, compare) {1186 const index = leastIndex(values, compare);1187 return index < 0 ? undefined : index;1188}1189 1190var shuffle$1 = shuffler(Math.random);1191 1192function shuffler(random) {1193 return function shuffle(array, i0 = 0, i1 = array.length) {1194 let m = i1 - (i0 = +i0);1195 while (m) {1196 const i = random() * m-- | 0, t = array[m + i0];1197 array[m + i0] = array[i + i0];1198 array[i + i0] = t;1199 }1200 return array;