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

Function substitute

test/compute-engine/diophantine.test.ts:83–89  ·  view source on GitHub ↗

`x_i = base[i] + Σ_j coef[i][j]·params[j]`.

(sol: LinearSolution, params: bigint[])

Source from the content-addressed store, hash-verified

81
82/** `x_i = base[i] + Σ_j coef[i][j]·params[j]`. */
83function substitute(sol: LinearSolution, params: bigint[]): bigint[] {
84 return sol.base.map((b, i) => {
85 let v = b;
86 for (let j = 0; j < sol.nParams; j++) v += sol.coef[i][j] * params[j];
87 return v;
88 });
89}
90
91/** All `k`-tuples with every coordinate ranging over `[lo, hi]`. */
92function cartesianRange(k: number, lo: bigint, hi: bigint): bigint[][] {

Callers 1

expectFullLinearFamilyFunction · 0.70

Calls 1

mapMethod · 0.65

Tested by

no test coverage detected