Limit

it.grypho.scala.leonardo.core.Limit
enum Limit(val default: Long)

One configurable work or size budget (F_0124): a cap on how much one call may compute before it declines rather than answer.

A budget, never a tolerance. Each bounds time or memory: a basis's size, an iteration count, a problem's dimension. None decides what counts as numerically zero, so raising one can only let a slow case finish, never make an answer less certain: every answer it guards is still certified by its own method. The tolerances stay fixed and relative; the one a caller legitimately sets, the certificate's, comes from Environment.precision.

The default is the value the library has always used, measured for the browser REPL where a frozen tab cannot be interrupted (the inventory is in DesignNotes.md, F_0124). A library caller with time to spare raises it through Environment.withLimit. Each case is named after the published constant it backs (optimize.MaxQpVariables is Limit.MaxQpVariables.default), so the two cannot disagree.

Value parameters

default

the value used unless an Environment overrides it

Attributes

Graph
Supertypes
trait Enum
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Members list

Type members

Enum entries

case MaxArxOrderWork extends Limit

The work an ARX order search may spend (F_0301): the sum over the grid of each candidate's r·c² for its r×c regressor matrix, checked before any fit. Measured on 2000 samples and the grid 0..8 × 1..8 × 0..2 (216 candidates, 3.6·10⁷), JVM / Node: noisy data 0.9–4.0 / 3.3–3.8 s, noise-free data (75 candidates exactly dependent) 0.5–0.7 / 2.3 s; so the cap, about half of it, is ~2 s on Node.

The work an ARX order search may spend (F_0301): the sum over the grid of each candidate's r·c² for its r×c regressor matrix, checked before any fit. Measured on 2000 samples and the grid 0..8 × 1..8 × 0..2 (216 candidates, 3.6·10⁷), JVM / Node: noisy data 0.9–4.0 / 3.3–3.8 s, noise-free data (75 candidates exactly dependent) 0.5–0.7 / 2.3 s; so the cap, about half of it, is ~2 s on Node.

Attributes

Inner iterations of one augmented-Lagrangian round.

Inner iterations of one augmented-Lagrangian round.

Attributes

case MaxAugLagRounds extends Limit

Augmented-Lagrangian rounds of nlp.

Augmented-Lagrangian rounds of nlp.

Attributes

case MaxConvExactWork extends Limit

The products n·m an exact conv may form (F_0144): sums of fractions grow their denominators, so the cost per product grows with the length. Measured on distinct denominators: at the cap, 200 × 200, 0.42 s on Node and 92 ms on the JVM; 300 × 300, 1.9 s and 0.70 s; 1000 × 1000, 170 s and 29 s.

The products n·m an exact conv may form (F_0144): sums of fractions grow their denominators, so the cost per product grows with the length. Measured on distinct denominators: at the cap, 200 × 200, 0.42 s on Node and 92 ms on the JVM; 300 × 300, 1.9 s and 0.70 s; 1000 × 1000, 170 s and 29 s.

Attributes

case MaxConvWork extends Limit

The products n·m a floating-point conv may form (F_0144), set by Node: at the cap, 5000 × 5000, 0.78 s there against 32 ms on the JVM; 10⁸ took 4.1 s on Node and 194 ms on the JVM. The output's own size is MaxMatrixCells.

The products n·m a floating-point conv may form (F_0144), set by Node: at the cap, 5000 × 5000, 0.78 s there against 32 ms on the JVM; 10⁸ took 4.1 s on Node and 194 ms on the JVM. The output's own size is MaxMatrixCells.

Attributes

Variables convex examines (it checks 2ⁿ principal minors).

Variables convex examines (it checks 2ⁿ principal minors).

Attributes

case MaxDenseDim extends Limit

One dimension of eye, zeros and ones.

One dimension of eye, zeros and ones.

Attributes

Objective evaluations minimizeDerivativeFree may spend (F_0302): a count, not a time, since each evaluation is the caller's cost (a closed-loop simulation, say) and the method's own work per evaluation is a few arithmetic operations per variable.

Objective evaluations minimizeDerivativeFree may spend (F_0302): a count, not a time, since each evaluation is the caller's cost (a closed-loop simulation, say) and the method's own work per evaluation is a few arithmetic operations per variable.

Attributes

case MaxDerivativeNodes extends Limit

Nodes one derivative may have on the series engine's fallback path.

Nodes one derivative may have on the series engine's fallback path.

Attributes

case MaxDftLength extends Limit

The length of a dft/idft, by the direct N² sum; DftTest bounds the time at it. Measured at the cap (F_0179): Node alone 1.52–1.68 s, Node under the full sbt test 2.87–7.56 s, the JVM under the full run 0.58–1.30 s.

The length of a dft/idft, by the direct N² sum; DftTest bounds the time at it. Measured at the cap (F_0179): Node alone 1.52–1.68 s, Node under the full sbt test 2.87–7.56 s, the JVM under the full run 0.58–1.30 s.

Attributes

case MaxDlsimWork extends Limit

Multiply-adds of one dlsim.

Multiply-adds of one dlsim.

Attributes

case MaxDrawCount extends Limit

Draws of one draw.

Draws of one draw.

Attributes

case MaxEliminationSteps extends Limit

Steps, case splits included, of eliminate.

Steps, case splits included, of eliminate.

Attributes

case MaxExactFactorial extends Limit

The largest n whose factorial or multifactorial is computed exactly.

The largest n whose factorial or multifactorial is computed exactly.

Attributes

case MaxExactOperandBits extends Limit

The bits an exact + − × ÷ result may reach, estimated from the unreduced numerator and denominator the operation builds (core.exactResultBits, F_0256) before the BigInt work (F_0248; pow has its own, MaxExactPowerBits). A share link could double an operand per line, b := a*a, c := b*b, and nothing held it. Measured on integers, JVM / Node: two 2¹⁹-bit operands multiply in 0.24 / 0.78 s, two 2²⁰-bit ones in 1.0 / 2.8 s.

The bits an exact + − × ÷ result may reach, estimated from the unreduced numerator and denominator the operation builds (core.exactResultBits, F_0256) before the BigInt work (F_0248; pow has its own, MaxExactPowerBits). A share link could double an operand per line, b := a*a, c := b*b, and nothing held it. Measured on integers, JVM / Node: two 2¹⁹-bit operands multiply in 0.24 / 0.78 s, two 2²⁰-bit ones in 1.0 / 2.8 s.

Attributes

case MaxExactPowerBits extends Limit

Bits an exact rational power's operand may reach, estimated before it is computed.

Bits an exact rational power's operand may reach, estimated before it is computed.

Attributes

The gcd reduction an exact fraction's result may cost, estimated as bits(n)·bits(d) of the unreduced n/d the operation builds (F_0248, per operation since F_0256: a quotient's denominator holds the divisor's numerator); a kernel over an exact field (variance, det, inv, ...) is held to it for all its operations together (F_0264). The reduction, not the product, is what costs: measured, JVM / Node, a product or sum of two fractions with 2¹⁴-bit parts takes 0.04–0.10 / 0.23–0.28 s, 2¹⁵-bit parts (the cap) 0.15–0.29 / 0.88–1.13 s, 2¹⁶-bit parts 0.55 / 3.6 s and 2¹⁸-bit parts 8.3 / 64 s, where two 2¹⁸-bit integers take 0.03 / 0.15 s. An integer's denominator is one bit, so integers are held by size alone.

The gcd reduction an exact fraction's result may cost, estimated as bits(n)·bits(d) of the unreduced n/d the operation builds (F_0248, per operation since F_0256: a quotient's denominator holds the divisor's numerator); a kernel over an exact field (variance, det, inv, ...) is held to it for all its operations together (F_0264). The reduction, not the product, is what costs: measured, JVM / Node, a product or sum of two fractions with 2¹⁴-bit parts takes 0.04–0.10 / 0.23–0.28 s, 2¹⁵-bit parts (the cap) 0.15–0.29 / 0.88–1.13 s, 2¹⁶-bit parts 0.55 / 3.6 s and 2¹⁸-bit parts 8.3 / 64 s, where two 2¹⁸-bit integers take 0.03 / 0.15 s. An integer's denominator is one bit, so integers are held by size alone.

Attributes

case MaxExactRootWork extends Limit

Work the exact tier's real-root isolation may spend on one polynomial (F_0343), in word products: every BigInt product of the Sturm sequence's construction and of its evaluation at a dyadic point is charged the product of its operands' sizes in 64-bit words. Measured (2026-11-12) at 2–25 ns a unit on the JVM and 60–165 ns on Node, so the cap is about 0.8 s there at worst and 0.1 s on the JVM. Inside it: a dense polynomial of degree 12 with 30-bit coefficients (4.3·10⁶), twelve linear factors x − k/7ᵏ (1.3·10⁶), six cubics multiplied out (2.1·10⁶), three roots 10⁻²⁰ apart (5.6·10⁴). Past it: a dense degree 16 (5.4·10⁷, 4.1 s on Node), 24 linear factors (1.5·10⁷, 1.7 s).

Work the exact tier's real-root isolation may spend on one polynomial (F_0343), in word products: every BigInt product of the Sturm sequence's construction and of its evaluation at a dyadic point is charged the product of its operands' sizes in 64-bit words. Measured (2026-11-12) at 2–25 ns a unit on the JVM and 60–165 ns on Node, so the cap is about 0.8 s there at worst and 0.1 s on the JVM. Inside it: a dense polynomial of degree 12 with 30-bit coefficients (4.3·10⁶), twelve linear factors x − k/7ᵏ (1.3·10⁶), six cubics multiplied out (2.1·10⁶), three roots 10⁻²⁰ apart (5.6·10⁴). Past it: a dense degree 16 (5.4·10⁷, 4.1 s on Node), 24 linear factors (1.5·10⁷, 1.7 s).

Attributes

The largest index of an exact sequence term: fib, binom, catalan, harmonic.

The largest index of an exact sequence term: fib, binom, catalan, harmonic.

Attributes

The vectorised dimension p·q of a linear matrix equation solve reduces over the rationals (F_0178): Gauss–Jordan on the Kronecker system fills in large fractions. Measured on dense integer k×k Sylvester equations: at 36 (k = 6) 0.62 s on the JVM and 1.0 s on Node, at 64 2.0 s and 7.0 s, at 100 10.5 s and 55.6 s. Past it an exact equation stays unevaluated.

The vectorised dimension p·q of a linear matrix equation solve reduces over the rationals (F_0178): Gauss–Jordan on the Kronecker system fills in large fractions. Measured on dense integer k×k Sylvester equations: at 36 (k = 6) 0.62 s on the JVM and 1.0 s on Node, at 64 2.0 s and 7.0 s, at 100 10.5 s and 55.6 s. Past it an exact equation stays unevaluated.

Attributes

case MaxExpandPower extends Limit

The largest integer power expand multiplies out.

The largest integer power expand multiplies out.

Attributes

case MaxExpandWork extends Limit

Term pairs one multiplication inside expand may form.

Term pairs one multiplication inside expand may form.

Attributes

case MaxFourierOrder extends Limit

The order of a Fourier series.

The order of a Fourier series.

Attributes

case MaxGroebnerBasis extends Limit

Elements a Gröbner basis may reach.

Elements a Gröbner basis may reach.

Attributes

The widest coefficient, in bits, a Gröbner reduction may write.

The widest coefficient, in bits, a Gröbner reduction may write.

Attributes

case MaxGroebnerDegree extends Limit

Total degree a Gröbner basis element may reach.

Total degree a Gröbner basis element may reach.

Attributes

S-polynomial reductions of one Gröbner basis.

S-polynomial reductions of one Gröbner basis.

Attributes

case MaxHopitalSteps extends Limit

L'Hôpital steps a limit may take.

L'Hôpital steps a limit may take.

Attributes

case MaxIntervalPower extends Limit

The largest integer exponent an interval is raised to.

The largest integer exponent an interval is raised to.

Attributes

case MaxJordanOrder extends Limit

The order of a matrix whose exact Jordan form jordan computes over the rationals (F_0176); past it an exact matrix takes the numeric path. Measured on dense integer matrices LJL⁻¹ with entries up to ±9 and several blocks: Node 67 ms at 16, 0.74 s at 20, 2.45 s at 24 and 17.8 s at 32; the JVM 0.67 s at 20 and 4.4 s at 32.

The order of a matrix whose exact Jordan form jordan computes over the rationals (F_0176); past it an exact matrix takes the numeric path. Measured on dense integer matrices LJL⁻¹ with entries up to ±9 and several blocks: Node 67 ms at 16, 0.74 s at 20, 2.45 s at 24 and 17.8 s at 32; the JVM 0.67 s at 20 and 4.4 s at 32.

Attributes

case MaxKKTInequalities extends Limit

Inequalities kktPoints enumerates active sets over (2ᵐ of them).

Inequalities kktPoints enumerates active sets over (2ᵐ of them).

Attributes

case MaxKleeneTableVars extends Limit

Variables of a three-valued truth table (3ⁿ rows).

Variables of a three-valued truth table (3ⁿ rows).

Attributes

case MaxLpBits extends Limit

The widest coefficient, in bits, an exact simplex pivot may write.

The widest coefficient, in bits, an exact simplex pivot may write.

Attributes

case MaxLpConstraints extends Limit

Constraints of an exact linear program.

Constraints of an exact linear program.

Attributes

case MaxLpPivots extends Limit

Simplex pivots before an LP declines.

Simplex pivots before an LP declines.

Attributes

case MaxLpVariables extends Limit

Variables of an exact linear program.

Variables of an exact linear program.

Attributes

case MaxLpWork extends Limit

The arithmetic an exact linear program may do, in the units optimize.MaxLpWork defines (F_0115).

The arithmetic an exact linear program may do, in the units optimize.MaxLpWork defines (F_0115).

Attributes

case MaxLsqIterations extends Limit

Levenberg–Marquardt iterations of lsqfit.

Levenberg–Marquardt iterations of lsqfit.

Attributes

case MaxLsqWork extends Limit

m·n² of a least-squares fit: its residuals times its parameters squared.

m·n² of a least-squares fit: its residuals times its parameters squared.

Attributes

case MaxMatrixCells extends Limit

Cells an assembled matrix may have: block operations, mpcMatrices, dlsim's outputs.

Cells an assembled matrix may have: block operations, mpcMatrices, dlsim's outputs.

Attributes

case MaxMinimiseVars extends Limit

Atoms a minimal two-level form (mindnf/mincnf) may range over (F_0325): the table has 2ⁿ rows and Quine–McCluskey's prime implicants number up to about 3ⁿ/n. Capped at 15 whatever the value: a cube packs into one Int as mask << n | value. The default is that maximum because the work budget, not the atom count, is what bounds the time: measured on the JVM and Node at 6, 8, 10, 12, 14 and 15 atoms, for a random function (densities 0.2, 0.5, 0.8), parity, majority and weight-mod-3, a run at 15 atoms either finished or declined within the default work budget in 0.2–1.6 s on Node (JVM 0.2–1.0 s); a parity function of 15 atoms (16 384 primes, no merging) takes 0.2 s.

Atoms a minimal two-level form (mindnf/mincnf) may range over (F_0325): the table has 2ⁿ rows and Quine–McCluskey's prime implicants number up to about 3ⁿ/n. Capped at 15 whatever the value: a cube packs into one Int as mask << n | value. The default is that maximum because the work budget, not the atom count, is what bounds the time: measured on the JVM and Node at 6, 8, 10, 12, 14 and 15 atoms, for a random function (densities 0.2, 0.5, 0.8), parity, majority and weight-mod-3, a run at 15 atoms either finished or declined within the default work budget in 0.2–1.6 s on Node (JVM 0.2–1.0 s); a parity function of 15 atoms (16 384 primes, no merging) takes 0.2 s.

Attributes

case MaxMinimiseWork extends Limit

Work a minimal-form search may spend (F_0325): the formula's evaluation (one pass per row), merge checks (n per cube per level), the cells of the cover table, the canonical sort, and branch-and-bound nodes weighted by the rows they still hold and the candidates they scan. Choosing a minimum cover of the primes is NP-hard, so this is what stops a cyclic core. Measured, a unit costs 30–100 ns on the JVM and 100–300 ns on Node: ten million units took 0.3–1.0 s on the JVM and 0.4–3.0 s on Node across those shapes, the worst a random 8-atom function (about 3 s on Node, and not finished: its 1103 minimal covers need 3·10⁷ units on the JVM, 2.2 s there). The cap, half of ten million, is about 1.5 s on Node at worst; parity, majority and weight-mod-3 functions of 15 atoms finish well inside it, and a random function of 6 atoms uses under 10⁵.

Work a minimal-form search may spend (F_0325): the formula's evaluation (one pass per row), merge checks (n per cube per level), the cells of the cover table, the canonical sort, and branch-and-bound nodes weighted by the rows they still hold and the candidates they scan. Choosing a minimum cover of the primes is NP-hard, so this is what stops a cyclic core. Measured, a unit costs 30–100 ns on the JVM and 100–300 ns on Node: ten million units took 0.3–1.0 s on the JVM and 0.4–3.0 s on Node across those shapes, the worst a random 8-atom function (about 3 s on Node, and not finished: its 1103 minimal covers need 3·10⁷ units on the JVM, 2.2 s there). The cap, half of ten million, is about 1.5 s on Node at worst; parity, majority and weight-mod-3 functions of 15 atoms finish well inside it, and a random function of 6 atoms uses under 10⁵.

Attributes

Iterations of minimize.

Iterations of minimize.

Attributes

Variables of a minimize (F_0216), the nlp cap: BFGS keeps an n×n matrix and every iteration evaluates n gradient trees, Newton n² Hessian cells. Measured on Σ(xᵢ − cᵢ)² + ¼Σxᵢxᵢ₊₁ from 0 (13–44 iterations), JVM / Node: at 100, pbfgs 82 / 329 ms, gd 52 / 305 ms, newton 0.32 / 1.7 s; at 200, pbfgs 0.34 / 1.4 s; at 400, 2.5 / 8.9 s.

Variables of a minimize (F_0216), the nlp cap: BFGS keeps an n×n matrix and every iteration evaluates n gradient trees, Newton n² Hessian cells. Measured on Σ(xᵢ − cᵢ)² + ¼Σxᵢxᵢ₊₁ from 0 (13–44 iterations), JVM / Node: at 100, pbfgs 82 / 329 ms, gd 52 / 305 ms, newton 0.32 / 1.7 s; at 200, pbfgs 0.34 / 1.4 s; at 400, 2.5 / 8.9 s.

Attributes

case MaxMpcHorizon extends Limit

The prediction horizon of mpcMatrices.

The prediction horizon of mpcMatrices.

Attributes

case MaxNlpIterations extends Limit

SQP iterations of nlp.

SQP iterations of nlp.

Attributes

case MaxNlpVariables extends Limit

Variables of a nonlinear program.

Variables of a nonlinear program.

Attributes

Clauses a CNF or DNF may reach while distributing.

Clauses a CNF or DNF may reach while distributing.

Attributes

case MaxNsolveIterations extends Limit

Dogleg steps nsolve may take, rejected ones included (F_0319). Measured on the suite: the hydraulics and Broyden's tridiagonal system converge in 4, the circle in 5, Powell's badly scaled function in 43 from (0, 1) at precision 10; 200 is between four and five times the slowest.

Dogleg steps nsolve may take, rejected ones included (F_0319). Measured on the suite: the hydraulics and Broyden's tridiagonal system converge in 4, the circle in 5, Powell's badly scaled function in 43 from (0, 1) at precision 10; 200 is between four and five times the slowest.

Attributes

case MaxNumericRoots extends Limit

Roots solve's numeric fallback keeps.

Roots solve's numeric fallback keeps.

Attributes

case MaxOdeSteps extends Limit

Runge–Kutta steps of one ODE solve, scalar or vector.

Runge–Kutta steps of one ODE solve, scalar or vector.

Attributes

case MaxPrbsLength extends Limit

Terms of one prbs.

Terms of one prbs.

Attributes

case MaxQpConstraints extends Limit

Constraint rows, bounds included, a QP may have.

Constraint rows, bounds included, a QP may have.

Attributes

case MaxQpIterations extends Limit

Iterations of either QP method before it declines.

Iterations of either QP method before it declines.

Attributes

case MaxQpVariables extends Limit

Variables a QP may have.

Variables a QP may have.

Attributes

Integrand evaluations a definite integral's adaptive Simpson may spend before it declines (F_0281): a pole the domain analysis cannot see (sec(x)^2 across π/2) never certifies, and this is what stops it, shared by every integral nested in the outermost one and spent by both certifying runs. A tree-evaluated sample is charged 40 and a nested integral's setup 200 (scalar.QuadratureWork). Measured at the cap, JVM / Node, the slowest declines: an expensive tree-evaluated integrand (a 50-term sum per sample) 0.46 / 0.67 s, compiled abs(sin(1000x)) over [0, 100] 0.40 / 0.11 s, a nested integral 0.02 / 0.06 s; a pole stops at its panels' rounding first (< 0.05 s). At a charge of 1 per tree sample the first took 2.1 / 22 s.

Integrand evaluations a definite integral's adaptive Simpson may spend before it declines (F_0281): a pole the domain analysis cannot see (sec(x)^2 across π/2) never certifies, and this is what stops it, shared by every integral nested in the outermost one and spent by both certifying runs. A tree-evaluated sample is charged 40 and a nested integral's setup 200 (scalar.QuadratureWork). Measured at the cap, JVM / Node, the slowest declines: an expensive tree-evaluated integrand (a 50-term sum per sample) 0.46 / 0.67 s, compiled abs(sin(1000x)) over [0, 100] 0.40 / 0.11 s, a nested integral 0.02 / 0.06 s; a pole stops at its panels' rounding first (< 0.05 s). At a charge of 1 per tree sample the first took 2.1 / 22 s.

Attributes

case MaxRiccatiOrder extends Limit

The state (and output) dimension of the Riccati family.

The state (and output) dimension of the Riccati family.

Attributes

case MaxStaircasePieces extends Limit

Pieces a definite integral of a staircase is split into at the jumps of its integer parts (F_0340): each piece is a definite integral of its own. Measured cold (a fresh variable per case, so no memo table helps) over [0, 999], 999 pieces, JVM / Node: floor(x) 0.36 / 0.12 s, exp(-x/100)*floor(x) 0.85 / 0.33 s, exp(-x/100)*mod(x, 1) 0.37 / 0.44 s, the exact x^2*floor(x) 0.48 / 0.61 s.

Pieces a definite integral of a staircase is split into at the jumps of its integer parts (F_0340): each piece is a definite integral of its own. Measured cold (a fresh variable per case, so no memo table helps) over [0, 999], 999 pieces, JVM / Node: floor(x) 0.36 / 0.12 s, exp(-x/100)*floor(x) 0.85 / 0.33 s, exp(-x/100)*mod(x, 1) 0.37 / 0.44 s, the exact x^2*floor(x) 0.48 / 0.61 s.

Attributes

case MaxSvdWork extends Limit

max(m, n)·min(m, n)² of one singular value decomposition.

max(m, n)·min(m, n)² of one singular value decomposition.

Attributes

case MaxSymbolicDim extends Limit

The order of a symbolic matrix whose det and inv expand by cofactors (n! terms).

The order of a symbolic matrix whose det and inv expand by cofactors (n! terms).

Attributes

case MaxTabulateTerms extends Limit

Terms of one tabulate, sum or product.

Terms of one tabulate, sum or product.

Attributes

case MaxTaylorOrder extends Limit

The order of a Taylor, Laurent or Padé expansion (m + n for the last two).

The order of a Taylor, Laurent or Padé expansion (m + n for the last two).

Attributes

case MaxTrajectoryRows extends Limit

Rows of one odeSolve trajectory.

Rows of one odeSolve trajectory.

Attributes

case MaxTruthTableVars extends Limit

Variables of a boolean truth table (2ⁿ rows).

Variables of a boolean truth table (2ⁿ rows).

Attributes

case MaxVectorizedSize extends Limit

The vectorised dimension of a linear matrix equation solve reduces by Kronecker products.

The vectorised dimension of a linear matrix equation solve reduces by Kronecker products.

Attributes