MCPcopy Create free account
hub / github.com/cortex-js/compute-engine / zeroQ

Function zeroQ

src/compute-engine/rubi/rubi-utils.ts:447–462  ·  view source on GitHub ↗
(d: Expression)

Source from the content-addressed store, hash-verified

445
446// module-level cache hooks, installed per top-level int() call by the
447// driver (see installCaches); fall back to uncached when absent
448let activeCaches: Ctx['caches'] | undefined;
449
450export function installCaches(caches: Ctx['caches']): void {
451 activeCaches = caches;
452}
453
454/** Snapshot the currently-installed caches so a re-entrant driver call can
455 * restore the outer call's warm caches after installing its own (see the
456 * native-rational fallback re-entry in driver.ts). */
457export function getActiveCaches(): Ctx['caches'] | undefined {
458 return activeCaches;
459}
460
461function safeSimplify(e: Expression): Expression {
462 if (leafCount(e) > SIMPLIFY_LEAF_CAP) return e;
463 const key = activeCaches ? e.toString() : '';
464 const cached = activeCaches?.simplify.get(key);
465 if (cached !== undefined) return cached;

Callers 15

intUncachedMethod · 0.90
trimZerosFunction · 0.85
polyDivideXFunction · 0.85
toExprFunction · 0.85
rubi-utils.tsFile · 0.85
eqNumFunction · 0.85
negFormQFunction · 0.85
monoClassesXFunction · 0.85
binomialPartsXFunction · 0.85
combineBinProductFunction · 0.85
trinomialPartsXFunction · 0.85
combineTriSumFunction · 0.85

Calls 8

isNumberFunction · 0.90
safeSimplifyFunction · 0.85
isSameMethod · 0.65
toStringMethod · 0.65
getMethod · 0.65
NMethod · 0.65
absMethod · 0.65
setMethod · 0.65

Tested by

no test coverage detected