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
1import {makeSpan, makeVList} from "../../buildCommon";2import * as html from "../../buildHTML";3import {isCharacterBox} from "../../utils";4import type {StyleInterface} from "../../Style";5import type Options from "../../Options";6import type {DomSpan, SymbolNode} from "../../domTree";7import type {AnyParseNode} from "../../parseNode";8import {makeEm} from "../../units";9 10// For an operator with limits, assemble the base, sup, and sub into a span.11 12export const assembleSupSub = (13 base: DomSpan | SymbolNode,14 supGroup: AnyParseNode | null | undefined,15 subGroup: AnyParseNode | null | undefined,16 options: Options,17 style: StyleInterface,18 slant: number,19 baseShift: number,20): DomSpan => {21 base = makeSpan([], [base]);22 const subIsSingleCharacter = subGroup && isCharacterBox(subGroup);23 let sub;24 let sup;25 // We manually have to handle the superscripts and subscripts. This,26 // aside from the kern calculations, is copied from supsub.27 if (supGroup) {28 const elem = html.buildGroup(29 supGroup, options.havingStyle(style.sup()), options);30 31 sup = {32 elem,33 kern: Math.max(34 options.fontMetrics().bigOpSpacing1,35 options.fontMetrics().bigOpSpacing3 - elem.depth),36 };37 }38 39 if (subGroup) {40 const elem = html.buildGroup(41 subGroup, options.havingStyle(style.sub()), options);42 43 sub = {44 elem,45 kern: Math.max(46 options.fontMetrics().bigOpSpacing2,47 options.fontMetrics().bigOpSpacing4 - elem.height),48 };49 }50 51 // Build the final group as a vlist of the possible subscript, base,52 // and possible superscript.53 let finalGroup;54 if (sup && sub) {55 const bottom = options.fontMetrics().bigOpSpacing5 +56 sub.elem.height + sub.elem.depth +57 sub.kern +58 base.depth + baseShift;59 60 finalGroup = makeVList({61 positionType: "bottom",62 positionData: bottom,63 children: [64 {type: "kern", size: options.fontMetrics().bigOpSpacing5},65 {type: "elem", elem: sub.elem, marginLeft: makeEm(-slant)},66 {type: "kern", size: sub.kern},67 {type: "elem", elem: base},68 {type: "kern", size: sup.kern},69 {type: "elem", elem: sup.elem, marginLeft: makeEm(slant)},70 {type: "kern", size: options.fontMetrics().bigOpSpacing5},71 ],72 }, options);73 } else if (sub) {74 const top = base.height - baseShift;75 76 // Shift the limits by the slant of the symbol. Note77 // that we are supposed to shift the limits by 1/2 of the slant,78 // but since we are centering the limits adding a full slant of79 // margin will shift by 1/2 that.80 finalGroup = makeVList({81 positionType: "top",82 positionData: top,83 children: [84 {type: "kern", size: options.fontMetrics().bigOpSpacing5},85 {type: "elem", elem: sub.elem, marginLeft: makeEm(-slant)},86 {type: "kern", size: sub.kern},87 {type: "elem", elem: base},88 ],89 }, options);90 } else if (sup) {91 const bottom = base.depth + baseShift;92 93 finalGroup = makeVList({94 positionType: "bottom",95 positionData: bottom,96 children: [97 {type: "elem", elem: base},98 {type: "kern", size: sup.kern},99 {type: "elem", elem: sup.elem, marginLeft: makeEm(slant)},100 {type: "kern", size: options.fontMetrics().bigOpSpacing5},101 ],102 }, options);103 } else {104 // This case probably shouldn't occur (this would mean the105 // supsub was sending us a group with no superscript or106 // subscript) but be safe.107 return base;108 }109 110 const parts = [finalGroup];111 if (sub && slant !== 0 && !subIsSingleCharacter) {112 // A negative margin-left was applied to the lower limit.113 // Avoid an overlap by placing a spacer on the left on the group.114 const spacer = makeSpan(["mspace"], [], options);115 spacer.style.marginRight = makeEm(slant);116 parts.unshift(spacer);117 }118 return makeSpan(["mop", "op-limits"], parts, options);119};120 