Dense polynomial arrays¶
Use poly.dense for ascending coefficients.
Every computational function accepts max_steps= instead of the explicit
shared budget shown below. See array conventions for inference
and errors, or exact array algebra for worked examples.
Construction and interoperability¶
Array¶
struct Array[k: Int](Copyable, Movable, Iterable, Sized, _WithModulus, _Record)
An immutable polynomial; copies share its canonical coefficient buffer.
Parameters.
k: The inferred coefficient kind: 0 for ZZ, 1 for QQ, 2 for QQi, 3 for a prime field, 4 for AA, or 5 for QQbar.
Defined in src/poly/dense.mojo.
Array.IteratorType¶
comptime IteratorType[iterable_mut: Bool, //, iterable_origin: Origin[mut=iterable_mut]]: Iterator = _ArrayIterator[Self.k, ImmOrigin(iterable_origin)]
A borrowing iterator over the shared storage.
Parameters.
iterable_mut: Whether the borrowing origin is mutable.iterable_origin: The lifetime of the borrowed array.
Array.__init__¶
def __init__(out self, var core: DensePoly[_Ring[Self.k]], mut budget: Budget) raises PolyError
Take ownership of canonical storage; use asarray for coefficient inputs.
Arguments.
core: An owned canonical core polynomial in the array's variable layout and domain.budget: The caller-owned work allowance, shared through preparation and computation.
Raises.
PolyError: LIMIT on exhausted work, CAPACITY on unrepresentable sizes, or DOMAIN for incompatible input.
Array.to_list¶
def to_list(self, mut budget: Budget) raises PolyError -> List[_Scalar[Self.k]]
Return an independent mutable list, charging allocation and coefficient work.
Arguments.
budget: The caller-owned work allowance, shared through preparation and computation.
Returns. An independent mutable list in the current entry order.
Raises.
PolyError: LIMIT on exhausted work, CAPACITY on unrepresentable sizes, or DOMAIN for incompatible input.
Array.to_list¶
def to_list(self, *, max_steps: UInt64 = UInt64.MAX) raises PolyError -> List[_Scalar[Self.k]]
Return an independent mutable list, charging allocation and coefficient work.
Arguments.
max_steps: The complete call's work allowance; defaults to UInt64.MAX.
Returns. An independent mutable list in the current entry order.
Raises.
PolyError: LIMIT on exhausted work, CAPACITY on unrepresentable sizes, or DOMAIN for incompatible input.
Array.modulus¶
def modulus(self) -> UInt64
Return the retained prime modulus, or zero outside a prime field.
Returns. The prime modulus for modular data, or zero otherwise.
Array.domain¶
def domain(self) -> String
Return ZZ, QQ, QQi, GF(p), AA, or QQbar, including for an empty result.
Returns. ZZ, QQ, QQi, GF(p), AA, or QQbar, including for an empty result.
asarray¶
def asarray[I: Iterable](values: I, mut budget: Budget) raises PolyError -> Array[_Kind[_Element[I]]]
Normalize one pass over coefficients, or share an already prepared array.
Parameters.
I: The inferred input iterable type.
Arguments.
values: The coefficient sequence, sparse terms, or prepared array.budget: The caller-owned work allowance, shared through preparation and computation.
Returns. An immutable canonical polynomial that retains its exact domain and modulus.
Raises.
PolyError: LIMIT on exhausted work, CAPACITY on unrepresentable sizes, or DOMAIN for incompatible input.
Defined in src/poly/dense.mojo.
astype¶
def astype[dtype: AnyType, I: Iterable, Context: Copyable & Deinitable](values: I, mut budget: Budget, *, context: Context) raises PolyError -> NumericArray[_num._StoredDomain[dtype]]
Convert every coefficient to an explicit numerical type and precision.
Unlike asarray on a prepared array, this also converts within the same domain. Real destinations require exactly zero imaginary bounds; point destinations require certain rounding. Inputs remain unchanged.
Parameters.
dtype: Float, Complex, Ball, or ComplexBall.I: The inferred coefficient iterable type.Context: The matching explicit precision context.
Arguments.
values: Raw coefficients or a prepared dense array.budget: The shared conversion allowance.context: ArithmeticContext for Float, ComplexContext for Complex, or BallContext for balls.
Returns. An immutable array with rounded points or enclosing balls in the requested type.
Raises.
PolyError: DOMAIN for nonreal or uncertain point conversion, or LIMIT/CAPACITY.
Defined in src/poly/dense.mojo.
to_core¶
def to_core[I: Iterable](values: I, mut budget: Budget, *, variable: Int64 = 0) raises PolyError -> DensePoly[_Ring[_Kind[_Element[I]]]] where _Kind[_Element[I]] >= 0
Return an independent mutable core polynomial, optionally naming its variable.
Changing the returned core storage cannot affect a prepared input.
Parameters.
I: The inferred input iterable type.
Arguments.
values: The coefficient sequence, sparse terms, or prepared array.budget: The caller-owned work allowance, shared through preparation and computation.variable: The core variable ID assigned to the dense array; defaults to zero.
Returns. An independent mutable core polynomial with the requested variable IDs and the same exact domain.
Raises.
PolyError: LIMIT on exhausted work, CAPACITY on unrepresentable sizes, DOMAIN for invalid input, or UNSUPPORTED for a documented domain restriction.
Defined in src/poly/dense.mojo.
from_core¶
def from_core[C: CoefficientRing](values: DensePoly[C], mut budget: Budget) raises PolyError -> Array[_CoreKind[C]]
Validate and copy a core polynomial into the array's single unnamed variable.
Mutating either representation afterward leaves the other unchanged.
Checks core invariants and modular residues, then copies storage. Mutating the core afterwards cannot affect the result. Dense import normalizes the sole variable to zero. Sparse import rejects used IDs absent from the map and normalizes term order to lexicographic.
Parameters.
C: The supported core ring: ZZ, QQ, QQi, or ModInt.
Arguments.
values: The mutable core DensePoly to validate and copy.budget: The caller-owned work allowance, shared through preparation and computation.
Returns. An independent immutable array in the core coefficient domain, with normalized variable IDs.
Raises.
PolyError: LIMIT on exhausted work, CAPACITY on unrepresentable sizes, DOMAIN for invalid input, or UNSUPPORTED for a documented domain restriction.
Defined in src/poly/dense.mojo.
from_roots¶
def from_roots[I: Iterable](roots: I, mut budget: Budget) raises PolyError -> Array[_Kind[_Element[I]]]
Build the monic product of (x - root), including repeated and zero roots.
An empty typed sequence returns one in its domain. Empty modular input must retain field metadata, for example through a prepared empty modular array.
Parameters.
I: The inferred input iterable type.
Arguments.
roots: A finite iterable of exact roots; repeats and zeros are retained.budget: The caller-owned work allowance, shared through preparation and computation.
Returns. The monic product of linear factors, or one for an empty input.
Raises.
PolyError: LIMIT on exhausted work, CAPACITY on unrepresentable sizes, or DOMAIN for incompatible input.
Defined in src/poly/dense.mojo.
format¶
def format[I: Iterable](values: I, mut budget: Budget, *, variable: String = "x") raises PolyError -> String where (_Kind[_Element[I]] >= 0 and _Kind[_Element[I]] <= 3)
Display an exact polynomial with readable variable names.
Supports ZZ, QQ, QQi, and prime fields. Coefficients remain exact; terms appear in decreasing lexicographic order. This is display text, not an archive carrying domain or axis metadata.
Parameters.
I: The inferred input iterable.
Arguments.
values: Polynomial coefficients, terms, or a prepared exact array.budget: The shared work allowance.variable: The ASCII identifier used for the polynomial variable.
Returns. A named-variable expression, or 0 for the zero polynomial.
Raises.
PolyError: DOMAIN for invalid or duplicate names (i is reserved over QQi), LIMIT on exhaustion, or CAPACITY for excessive sizes.
Defined in src/poly/dense.mojo.
to_kernel_bytes¶
def to_kernel_bytes[I: Iterable](values: I, mut budget: Budget, *, variable: Int64 = 0) raises PolyError -> List[UInt8] where (_Kind[_Element[I]] >= 0 and _Kind[_Element[I]] <= 1)
Encode integer or rational coefficients as a canonical kernel literal.
Zero and one use separate kernel atoms and cannot be encoded here. For application archives, use poly.io instead.
Parameters.
I: The inferred input iterable.
Arguments.
values: Exact integer or rational polynomial input.budget: The shared work allowance.variable: The core variable ID used by the encoded polynomial.
Returns. Canonical little-endian kernel bytes, at most 1 MiB.
Raises.
PolyError: ENCODING for zero or one, DOMAIN for invalid maps, LIMIT on exhaustion, or CAPACITY beyond the kernel size ceiling.
Defined in src/poly/dense.mojo.
from_kernel_bytes¶
def from_kernel_bytes(data: Span[UInt8, _], mut budget: Budget, *, variable: Int64 = 0) raises PolyError -> Array[1]
Decode and validate a kernel literal into rational coefficient storage.
Malformed or noncanonical bytes are rejected, never silently repaired. The variable map supplies axis metadata absent from the wire format.
Arguments.
data: The kernel literal payload.budget: The shared work allowance.variable: The core variable ID used by the encoded polynomial.
Returns. A canonical polynomial over QQ with array axes starting at zero.
Raises.
PolyError: ENCODING for malformed bytes, DOMAIN for unmapped variables, LIMIT on exhaustion, or CAPACITY for excessive input or output size.
Defined in src/poly/dense.mojo.
Arithmetic and calculus¶
add¶
def add[A: Iterable, B: Iterable](a: A, b: B, mut budget: Budget) raises PolyError -> Array[_Join[_Kind[_Element[A]], _Kind[_Element[B]]]]
Add polynomials, promoting their coefficients together.
Parameters.
A: The first inferred iterable type.B: The second inferred iterable type.
Arguments.
a: The first polynomial.b: The second polynomial.budget: The caller-owned work allowance, shared through preparation and computation.
Returns. The canonical sum in the common exact domain.
Raises.
PolyError: LIMIT on exhausted work, CAPACITY on unrepresentable sizes, or DOMAIN for incompatible input.
Defined in src/poly/dense.mojo.
subtract¶
def subtract[A: Iterable, B: Iterable](a: A, b: B, mut budget: Budget) raises PolyError -> Array[_Join[_Kind[_Element[A]], _Kind[_Element[B]]]]
Subtract polynomials, promoting their coefficients together.
Parameters.
A: The first inferred iterable type.B: The second inferred iterable type.
Arguments.
a: The first polynomial.b: The second polynomial.budget: The caller-owned work allowance, shared through preparation and computation.
Returns. The canonical first polynomial minus the second.
Raises.
PolyError: LIMIT on exhausted work, CAPACITY on unrepresentable sizes, or DOMAIN for incompatible input.
Defined in src/poly/dense.mojo.
negative¶
def negative[I: Iterable](values: I, mut budget: Budget) raises PolyError -> Array[_Kind[_Element[I]]]
Negate every coefficient, preserving its exact domain.
Parameters.
I: The inferred input iterable type.
Arguments.
values: The coefficient sequence, sparse terms, or prepared array.budget: The caller-owned work allowance, shared through preparation and computation.
Returns. The polynomial with every coefficient negated.
Raises.
PolyError: LIMIT on exhausted work, CAPACITY on unrepresentable sizes, or DOMAIN for incompatible input.
Defined in src/poly/dense.mojo.
multiply¶
def multiply[A: Iterable, B: Iterable](a: A, b: B, mut budget: Budget) raises PolyError -> Array[_Join[_Kind[_Element[A]], _Kind[_Element[B]]]]
Multiply polynomials, promoting their coefficients together.
Parameters.
A: The first inferred iterable type.B: The second inferred iterable type.
Arguments.
a: The first polynomial.b: The second polynomial.budget: The caller-owned work allowance, shared through preparation and computation.
Returns. The canonical product in the common exact domain.
Raises.
PolyError: LIMIT on exhausted work, CAPACITY on unrepresentable sizes, or DOMAIN for incompatible input.
Defined in src/poly/dense.mojo.
divide¶
def divide[I: Iterable, S: Copyable & Deinitable](values: I, scalar: S, mut budget: Budget) raises PolyError -> Array[_FieldKind[_Join[_Kind[_Element[I]], _Kind[S]]]] where (_Kind[_Element[I]] >= 0 and _Kind[S] >= 0)
Divide every coefficient by a nonzero scalar.
Exact domains promote together; integer division returns rationals. Modular inputs must have the same prime. Inputs remain unchanged.
Parameters.
I: The inferred polynomial iterable.S: The scalar operand type.
Arguments.
values: Ascending coefficients or a prepared array.scalar: The scalar constant; division requires a nonzero value.budget: The shared work allowance, including conversion and storage.
Returns. A new polynomial in the common exact domain.
Raises.
PolyError: DOMAIN for incompatible scalars or zero divisors; LIMIT/CAPACITY on resource limits.
Defined in src/poly/dense.mojo.
power¶
def power[I: Iterable](values: I, exponent: Int, mut budget: Budget) raises PolyError -> Array[_Kind[_Element[I]]]
Raise a polynomial to a nonnegative power by repeated squaring.
Zero to power zero returns the constant one. Negative exponents raise DOMAIN.
Parameters.
I: The inferred input iterable type.
Arguments.
values: The coefficient sequence, sparse terms, or prepared array.exponent: A nonnegative integer exponent; zero returns one, including for a zero input.budget: The caller-owned work allowance, shared through preparation and computation.
Returns. The canonical power in the input domain.
Raises.
PolyError: LIMIT on exhausted work, CAPACITY on unrepresentable sizes, or DOMAIN for incompatible input.
Defined in src/poly/dense.mojo.
degree¶
def degree[I: Iterable](values: I, mut budget: Budget) raises PolyError -> Int
Return the highest nonzero power, or -1 for the zero polynomial.
Parameters.
I: The inferred input iterable type.
Arguments.
values: The coefficient sequence, sparse terms, or prepared array.budget: The caller-owned work allowance, shared through preparation and computation.
Returns. The degree, or -1 for the zero polynomial.
Raises.
PolyError: LIMIT on exhausted work, CAPACITY on unrepresentable sizes, or DOMAIN for incompatible input.
Defined in src/poly/dense.mojo.
derivative¶
def derivative[I: Iterable](values: I, mut budget: Budget) raises PolyError -> Array[_Kind[_Element[I]]]
Differentiate while preserving the inferred domain.
Parameters.
I: The inferred input iterable type.
Arguments.
values: The coefficient sequence, sparse terms, or prepared array.budget: The caller-owned work allowance, shared through preparation and computation.
Returns. The derivative, retaining the exact coefficient domain.
Raises.
PolyError: LIMIT on exhausted work, CAPACITY on unrepresentable sizes, or DOMAIN for incompatible input.
Defined in src/poly/dense.mojo.
integral¶
def integral[I: Iterable](values: I, mut budget: Budget) raises PolyError -> Array[_FieldKind[_Kind[_Element[I]]]]
Return the antiderivative with zero constant, promoting integers to rationals.
Other domains are retained. In a prime field, a nonzero coefficient that requires division by zero raises DOMAIN.
Parameters.
I: The inferred input iterable type.
Arguments.
values: The coefficient sequence, sparse terms, or prepared array.budget: The caller-owned work allowance, shared through preparation and computation.
Returns. The zero-constant antiderivative; integer coefficients promote to QQ.
Raises.
PolyError: LIMIT on exhausted work, CAPACITY on unrepresentable sizes, or DOMAIN for incompatible input.
Defined in src/poly/dense.mojo.
definite_integral¶
def definite_integral[I: Iterable, T: Copyable & Deinitable, U: Copyable & Deinitable](values: I, low: T, high: U, mut budget: Budget) raises PolyError -> _Scalar[_FieldKind[_Join[_Kind[_Element[I]], _Join[_Kind[T], _Kind[U]]]]]
Integrate between exact endpoints; integer inputs promote to QQ.
Integer coefficients and endpoints promote to QQ. In a prime field, a nonzero term needing a noninvertible antiderivative denominator raises DOMAIN. Sparse integration retains all axes, with exponent zero on the integrated axis.
Parameters.
I: The inferred input iterable type.T: The sequence's exact scalar type.U: The inferred type of the second exact scalar.
Arguments.
values: The coefficient sequence, sparse terms, or prepared array.low: The exact lower integration endpoint.high: The exact upper integration endpoint.budget: The caller-owned work allowance, shared through preparation and computation.
Returns. The exact endpoint difference of an antiderivative; a scalar for dense input or an array retaining the sparse power shape.
Raises.
PolyError: LIMIT on exhausted work, CAPACITY on unrepresentable sizes, DOMAIN for invalid input, or UNSUPPORTED for a documented domain restriction.
Defined in src/poly/dense.mojo.
compose¶
def compose[A: Iterable, B: Iterable](outer: A, inner: B, mut budget: Budget) raises PolyError -> Array[_Join[_Kind[_Element[A]], _Kind[_Element[B]]]]
Substitute the inner polynomial for x in the outer polynomial.
Parameters.
A: The first inferred iterable type.B: The second inferred iterable type.
Arguments.
outer: The polynomial whose variable is replaced.inner: The replacement polynomial.budget: The caller-owned work allowance, shared through preparation and computation.
Returns. The outer polynomial evaluated at the inner polynomial.
Raises.
PolyError: LIMIT on exhausted work, CAPACITY on unrepresentable sizes, or DOMAIN for incompatible input.
Defined in src/poly/dense.mojo.
affine_transform¶
def affine_transform[I: Iterable, T: Copyable & Deinitable, U: Copyable & Deinitable](values: I, scale: T, shift: U, mut budget: Budget) raises PolyError -> Array[_Join[_Kind[_Element[I]], _Join[_Kind[T], _Kind[U]]]]
Return p(scale*x + shift), promoting polynomial and scalars together.
Parameters.
I: The inferred input iterable type.T: The sequence's exact scalar type.U: The inferred type of the second exact scalar.
Arguments.
values: The coefficient sequence, sparse terms, or prepared array.scale: The exact multiplier of the selected variable.shift: The exact constant added to the scaled variable.budget: The caller-owned work allowance, shared through preparation and computation.
Returns. The polynomial with the selected variable replaced by scale*x + shift.
Raises.
PolyError: LIMIT on exhausted work, CAPACITY on unrepresentable sizes, DOMAIN for invalid input, or UNSUPPORTED for a documented domain restriction.
Defined in src/poly/dense.mojo.
taylor_shift¶
def taylor_shift[I: Iterable, T: Copyable & Deinitable](values: I, point: T, mut budget: Budget) raises PolyError -> Array[_Join[_Kind[_Element[I]], _Kind[T]]]
Return p(x + point) in the promoted exact ring.
Parameters.
I: The inferred input iterable type.T: The sequence's exact scalar type.
Arguments.
values: The coefficient sequence, sparse terms, or prepared array.point: An exact scalar for one variable, or a coordinate tuple in variable order.budget: The caller-owned work allowance, shared through preparation and computation.
Returns. The polynomial with the selected variable replaced by x + point.
Raises.
PolyError: LIMIT on exhausted work, CAPACITY on unrepresentable sizes, DOMAIN for invalid input, or UNSUPPORTED for a documented domain restriction.
Defined in src/poly/dense.mojo.
jet_evaluate¶
def jet_evaluate[I: Iterable, T: Copyable & Deinitable](values: I, point: T, order: Int, mut budget: Budget) raises PolyError -> Values[_Scalar[_Join[_Kind[_Element[I]], _Kind[T]]], _Join[_Kind[_Element[I]], _Kind[T]]]
Return order Taylor coefficients p^(j)(point)/j!, including trailing zeros.
This computes Taylor coefficients without dividing by factorials, so it also works in a finite field. A negative order raises DOMAIN.
Parameters.
I: The inferred input iterable type.T: The sequence's exact scalar type.
Arguments.
values: The coefficient sequence, sparse terms, or prepared array.point: An exact scalar for one variable, or a coordinate tuple in variable order.order: The number of Taylor coefficients to return, including trailing zeros; must be nonnegative.budget: The caller-owned work allowance, shared through preparation and computation.
Returns. A Values sequence of p^(j)(point)/j! for 0 <= j < order, including zeros. These are Hasse derivatives in a finite field.
Raises.
PolyError: LIMIT on exhausted work, CAPACITY on unrepresentable sizes, DOMAIN for invalid input, or UNSUPPORTED for a documented domain restriction.
Defined in src/poly/dense.mojo.
Exact algebra¶
divmod¶
def divmod[A: Iterable, B: Iterable](a: A, b: B, mut budget: Budget) raises PolyError -> Tuple[Array[_FieldKind[_Join[_Kind[_Element[A]], _Kind[_Element[B]]]]], Array[_FieldKind[_Join[_Kind[_Element[A]], _Kind[_Element[B]]]]]]
Return quotient and remainder, promoting integer inputs to QQ.
The remainder has degree below the divisor. A zero divisor raises DOMAIN.
Parameters.
A: The first inferred iterable type.B: The second inferred iterable type.
Arguments.
a: The first polynomial.b: The second polynomial.budget: The caller-owned work allowance, shared through preparation and computation.
Returns. A pair (quotient, remainder); integer coefficients promote to QQ.
Raises.
PolyError: LIMIT on exhausted work, CAPACITY on unrepresentable sizes, or DOMAIN for incompatible input.
Defined in src/poly/dense.mojo.
divide_exact¶
def divide_exact[A: Iterable, B: Iterable](a: A, b: B, mut budget: Budget) raises PolyError -> Optional[Array[_Join[_Kind[_Element[A]], _Kind[_Element[B]]]]]
Return a quotient in the inferred ring, or None when division is not exact.
Integer inputs stay in ZZ unless another operand widens the domain. Use divmod for field division or an explicit Rational coefficient to request QQ.
Parameters.
A: The first inferred iterable type.B: The second inferred iterable type.
Arguments.
a: The first polynomial.b: The second polynomial.budget: The caller-owned work allowance, shared through preparation and computation.
Returns. A quotient in the inferred coefficient ring, or None if that ring contains no exact quotient.
Raises.
PolyError: LIMIT on exhausted work, CAPACITY on unrepresentable sizes, DOMAIN for invalid input, or UNSUPPORTED for a documented domain restriction.
Defined in src/poly/dense.mojo.
pseudo_divmod¶
def pseudo_divmod[A: Iterable, B: Iterable](a: A, b: B, mut budget: Budget) raises PolyError -> Tuple[_Scalar[_Join[_Kind[_Element[A]], _Kind[_Element[B]]]], Array[_Join[_Kind[_Element[A]], _Kind[_Element[B]]]], Array[_Join[_Kind[_Element[A]], _Kind[_Element[B]]]]]
Return (scale, q, r) with scalea = qb + r without introducing fractions.
The remainder has smaller degree than the divisor. Sparse input must have one axis and is converted to dense storage; use a finite work limit for large sparse powers.
Parameters.
A: The first inferred iterable type.B: The second inferred iterable type.
Arguments.
a: The first polynomial.b: The second polynomial.budget: The caller-owned work allowance, shared through preparation and computation.
Returns. The tuple (scale, q, r), where scale = lc(b)*max(deg(a)-deg(b)+1, 0) and scalea = q*b + r.
Raises.
PolyError: LIMIT on exhausted work, CAPACITY on unrepresentable sizes, DOMAIN for invalid input, or UNSUPPORTED for a documented domain restriction.
Defined in src/poly/dense.mojo.
divide_many¶
def divide_many[A: Iterable, B: Iterable](values: A, divisors: B, mut budget: Budget) raises PolyError -> Tuple[List[Array[_FieldKind[_Join[_Kind[_Element[A]], _Kind[_Element[_Nested[B]]]]]]], Array[_FieldKind[_Join[_Kind[_Element[A]], _Kind[_Element[_Nested[B]]]]]]]
Return ordered quotients and a remainder; integer coefficients promote to QQ.
Sparse reduction uses lexicographic order with axis zero first. Changing divisor order can change quotients and remainder; this is not a Groebner-basis computation. An empty divisor collection returns no quotients and the promoted input as remainder. A zero divisor raises DOMAIN.
Parameters.
A: The first inferred iterable type.B: The second inferred iterable type.
Arguments.
values: The coefficient sequence, sparse terms, or prepared array.divisors: A finite iterable of polynomials of one Mojo input type, tried in the supplied order.budget: The caller-owned work allowance, shared through preparation and computation.
Returns. A quotient list in divisor order and a remainder, with input = sum(quotient_i * divisor_i) + remainder.
Raises.
PolyError: LIMIT on exhausted work, CAPACITY on unrepresentable sizes, DOMAIN for invalid input, or UNSUPPORTED for a documented domain restriction.
Defined in src/poly/dense.mojo.
content¶
def content[I: Iterable](values: I, mut budget: Budget) raises PolyError -> _Scalar[_Kind[_Element[I]]]
Return the normalized coefficient GCD.
Integer content is nonnegative. Field content is monic; a nonzero univariate field polynomial has content one. Zero has content zero.
Parameters.
I: The inferred input iterable type.
Arguments.
values: The coefficient sequence, sparse terms, or prepared array.budget: The caller-owned work allowance, shared through preparation and computation.
Returns. The normalized coefficient GCD; a scalar for dense input or a polynomial in the remaining sparse axes.
Raises.
PolyError: LIMIT on exhausted work, CAPACITY on unrepresentable sizes, DOMAIN for invalid input, or UNSUPPORTED for a documented domain restriction.
Defined in src/poly/dense.mojo.
primitive_part¶
def primitive_part[I: Iterable](values: I, mut budget: Budget) raises PolyError -> Array[_Kind[_Element[I]]]
Divide by the coefficient content, preserving the coefficient ring.
Parameters.
I: The inferred input iterable type.
Arguments.
values: The coefficient sequence, sparse terms, or prepared array.budget: The caller-owned work allowance, shared through preparation and computation.
Returns. The input divided by its content, or zero for a zero input.
Raises.
PolyError: LIMIT on exhausted work, CAPACITY on unrepresentable sizes, DOMAIN for invalid input, or UNSUPPORTED for a documented domain restriction.
Defined in src/poly/dense.mojo.
gcd¶
def gcd[A: Iterable, B: Iterable](a: A, b: B, mut budget: Budget) raises PolyError -> Array[_Join[_Kind[_Element[A]], _Kind[_Element[B]]]]
Return a positive-leading integer GCD or a monic field GCD.
Parameters.
A: The first inferred iterable type.B: The second inferred iterable type.
Arguments.
a: The first polynomial.b: The second polynomial.budget: The caller-owned work allowance, shared through preparation and computation.
Returns. The positive-leading integer GCD, including integer content, or the monic field GCD. GCD(0, 0) is zero.
Raises.
PolyError: LIMIT on exhausted work, CAPACITY on unrepresentable sizes, DOMAIN for invalid input, or UNSUPPORTED for a documented domain restriction.
Defined in src/poly/dense.mojo.
extended_gcd¶
def extended_gcd[A: Iterable, B: Iterable](a: A, b: B, mut budget: Budget) raises PolyError -> Tuple[Array[_FieldKind[_Join[_Kind[_Element[A]], _Kind[_Element[B]]]]], Array[_FieldKind[_Join[_Kind[_Element[A]], _Kind[_Element[B]]]]], Array[_FieldKind[_Join[_Kind[_Element[A]], _Kind[_Element[B]]]]]]
Return (g, u, v) with ua + vb = g; integer inputs promote to QQ.
Sparse input must have one axis and is converted to dense storage. For several variables, use gcd or the core certificate API.
Parameters.
A: The first inferred iterable type.B: The second inferred iterable type.
Arguments.
a: The first polynomial.b: The second polynomial.budget: The caller-owned work allowance, shared through preparation and computation.
Returns. The tuple (g, u, v) with ua + vb = g and monic nonzero g; integers promote to QQ.
Raises.
PolyError: LIMIT on exhausted work, CAPACITY on unrepresentable sizes, DOMAIN for invalid input, or UNSUPPORTED for a documented domain restriction.
Defined in src/poly/dense.mojo.
resultant¶
def resultant[A: Iterable, B: Iterable](a: A, b: B, mut budget: Budget) raises PolyError -> _Scalar[_Join[_Kind[_Element[A]], _Kind[_Element[B]]]]
Eliminate the variable using the Sylvester sign convention.
Two nonzero constants in the elimination variable raise DOMAIN; a zero operand returns zero. Sparse output retains the eliminated axis with exponent zero.
Parameters.
A: The first inferred iterable type.B: The second inferred iterable type.
Arguments.
a: The first polynomial.b: The second polynomial.budget: The caller-owned work allowance, shared through preparation and computation.
Returns. The Sylvester-convention resultant; a scalar for dense input or an array retaining the sparse power shape.
Raises.
PolyError: LIMIT on exhausted work, CAPACITY on unrepresentable sizes, DOMAIN for invalid input, or UNSUPPORTED for a documented domain restriction.
Defined in src/poly/dense.mojo.
subresultants¶
def subresultants[A: Iterable, B: Iterable](a: A, b: B, mut budget: Budget) raises PolyError -> List[Array[_Join[_Kind[_Element[A]], _Kind[_Element[B]]]]]
Return the indexed subresultants, retaining zero entries.
Parameters.
A: The first inferred iterable type.B: The second inferred iterable type.
Arguments.
a: The first polynomial.b: The second polynomial.budget: The caller-owned work allowance, shared through preparation and computation.
Returns. The list S_0 through S_(min(deg(a), deg(b))-1), including zeros; empty when the smaller degree is nonpositive.
Raises.
PolyError: LIMIT on exhausted work, CAPACITY on unrepresentable sizes, DOMAIN for invalid input, or UNSUPPORTED for a documented domain restriction.
Defined in src/poly/dense.mojo.
Factorization keeps the inferred domain. AA gives linear factors and
irreducible quadratics; QQbar gives linear factors. Both algebraic fields
require a univariate input; sparse tuple powers may include unused axes. See
algebraic factorization
for a complete example.
factor¶
def factor[I: Iterable](values: I, mut budget: Budget, *, seed: UInt64 = 0) raises PolyError -> Tuple[_Scalar[_Kind[_Element[I]]], List[Tuple[Array[_Kind[_Element[I]]], Int]]]
Return a scalar and irreducible factors with exact multiplicities.
ZZ factors are primitive with positive leading coefficient; factors over fields are monic. Zero and constants have no factors. Repeated factors retain their exact multiplicities, including inseparable prime-field inputs. Factors retain deterministic ordering. AA gives linear factors and quadratics with negative discriminant; QQbar gives linear factors. Algebraic factors sort by degree, then leading-to-constant coefficients (real component before imaginary component).
Parameters.
I: The inferred input iterable type.
Arguments.
values: The coefficient sequence, sparse terms, or prepared array.budget: The caller-owned work allowance, shared through preparation and computation.seed: The deterministic finite-field splitting seed; defaults to zero and is ignored outside finite fields.
Returns. The tuple (scalar, factors), where each entry is (irreducible polynomial, positive multiplicity) and their powered product times the scalar equals the input.
Raises.
PolyError: LIMIT on exhausted work, CAPACITY on unrepresentable sizes, DOMAIN for invalid input, or UNSUPPORTED for a documented domain restriction.
Defined in src/poly/dense.mojo.
squarefree¶
def squarefree[I: Iterable](values: I, mut budget: Budget) raises PolyError -> Tuple[_Scalar[_FieldKind[_Kind[_Element[I]]]], List[Tuple[Array[_FieldKind[_Kind[_Element[I]]]], Int]]]
Return the leading scalar and monic multiplicity blocks; integers promote to QQ.
Blocks group irreducible factors with the same multiplicity and need not themselves be irreducible. ZZ inputs promote to QQ; QQ, QQi and prime fields retain their domains. Zero and constants have no blocks. Prime-field decomposition includes inverse Frobenius when derivatives vanish.
Parameters.
I: The inferred input iterable type.
Arguments.
values: The coefficient sequence, sparse terms, or prepared array.budget: The caller-owned work allowance, shared through preparation and computation.
Returns. The tuple (leading scalar, blocks), where each entry is (monic block, positive multiplicity), ordered by multiplicity.
Raises.
PolyError: LIMIT on exhausted work, CAPACITY on unrepresentable sizes, DOMAIN for invalid input, or UNSUPPORTED for a documented domain restriction.
Defined in src/poly/dense.mojo.
Evaluation and interpolation¶
evaluate¶
def evaluate[I: Iterable, X: Copyable & Deinitable](values: I, x: X, mut budget: Budget) raises PolyError -> _Evaluation[I, X]
Evaluate at an exact scalar, retaining a full proof for algebraic values.
Parameters.
I: The inferred input iterable type.X: The inferred point or point-sequence type.
Arguments.
values: The coefficient sequence, sparse terms, or prepared array.x: The exact evaluation point.budget: The caller-owned work allowance, shared through preparation and computation.
Returns. The exact scalar after joint promotion, or an algebraic Real retaining evaluation evidence.
Raises.
PolyError: LIMIT on exhausted work, CAPACITY on unrepresentable sizes, or DOMAIN for incompatible input.
Defined in src/poly/dense.mojo.
evaluate_many¶
def evaluate_many[I: Iterable, X: Iterable](values: I, points: X, mut budget: Budget) raises PolyError -> Values[_Scalar[_Join[_Kind[_Element[I]], _Kind[_Element[X]]]], _Join[_Kind[_Element[I]], _Kind[_Element[X]]]]
Evaluate at each point in a one-dimensional iterable, preserving order and zeros.
The result is an immutable sequence of values. Coefficients and points promote together; the polynomial is prepared once for the whole call.
Parameters.
I: The inferred input iterable type.X: The inferred point or point-sequence type.
Arguments.
values: The coefficient sequence, sparse terms, or prepared array.points: A one-dimensional sequence of exact points, in output order.budget: The caller-owned work allowance, shared through preparation and computation.
Returns. An immutable Values sequence, preserving every input point and returned zero.
Raises.
PolyError: LIMIT on exhausted work, CAPACITY on unrepresentable sizes, or DOMAIN for incompatible input.
Defined in src/poly/dense.mojo.
interpolate¶
def interpolate[A: Iterable, B: Iterable](points: A, values: B, mut budget: Budget) raises PolyError -> Array[_FieldKind[_Join[_Kind[_Element[A]], _Kind[_Element[B]]]]]
Interpolate distinct nodes exactly; integer data promotes to QQ.
Nodes must be distinct and sample counts must match. Empty data returns zero; trailing zero samples are retained as constraints.
Parameters.
A: The first inferred iterable type.B: The second inferred iterable type.
Arguments.
points: A one-dimensional sequence of exact points, in output order.values: Exact samples in node order, including every zero.budget: The caller-owned work allowance, shared through preparation and computation.
Returns. The polynomial of degree below the node count matching every sample; integer data promotes to QQ.
Raises.
PolyError: LIMIT on exhausted work, CAPACITY on unrepresentable sizes, DOMAIN for invalid input, or UNSUPPORTED for a documented domain restriction.
Defined in src/poly/dense.mojo.
hermite_interpolate¶
def hermite_interpolate[A: Iterable, B: Iterable](points: A, jets: B, mut budget: Budget, *, derivatives: Bool = True) raises PolyError -> Array[_FieldKind[_Join[_Kind[_Element[A]], _Kind[_Element[_Nested[B]]]]]]
Interpolate value and consecutive derivative constraints at distinct nodes.
Node and jet counts must match, nodes must be distinct, and each jet must be nonempty. Raw derivatives in a finite field require invertible factorials; use derivatives=False for Taylor coefficients.
Parameters.
A: The first inferred iterable type.B: The second inferred iterable type.
Arguments.
points: A one-dimensional sequence of exact points, in output order.jets: One nonempty exact sequence per node, beginning with the value and followed by consecutive derivatives.budget: The caller-owned work allowance, shared through preparation and computation.derivatives: True interprets jets as raw derivatives; False interprets them as Taylor coefficients.
Returns. The polynomial of degree below the total constraint count matching every jet; integers promote to QQ.
Raises.
PolyError: LIMIT on exhausted work, CAPACITY on unrepresentable sizes, DOMAIN for invalid input, or UNSUPPORTED for a documented domain restriction.
Defined in src/poly/dense.mojo.
prepare_points¶
def prepare_points[I: Iterable](points: I, mut budget: Budget, *, interpolation: Bool = False) raises PolyError -> PointPlan[_FieldKind[_Kind[_Element[I]]]]
Prepare reusable evaluation nodes, optionally caching interpolation weights.
Repeated nodes are allowed for evaluation when interpolation=False; interpolation later rejects them. The plan fixes its field at preparation. Prepare it from wider-domain nodes when evaluating or interpolating wider-domain inputs. Copies share the product tree.
Parameters.
I: The inferred input iterable type.
Arguments.
points: A one-dimensional sequence of exact points, in output order.budget: The caller-owned work allowance, shared through preparation and computation.interpolation: Also cache inverse interpolation weights and reject duplicate nodes during preparation; defaults to False.
Returns. An immutable shared plan in the inferred field, with integer nodes promoted to QQ.
Raises.
PolyError: LIMIT on exhausted work, CAPACITY on unrepresentable sizes, DOMAIN for invalid input, or UNSUPPORTED for a documented domain restriction.
Defined in src/poly/dense.mojo.
PointPlan¶
struct PointPlan[k: Int](Copyable, Movable, _WithModulus)
Share an immutable product tree for repeated evaluation and interpolation.
Parameters.
k: The retained field kind: 1 for QQ, 2 for QQi, or 3 for a prime field.
Defined in src/poly/dense.mojo.
PointPlan.__init__¶
def __init__(out self, var core: MultipointPlan[Self._Field], ctx: _Ring[Self.k].Context, mut budget: Budget) raises PolyError
Own prepared storage; use prepare_points to infer its field from nodes.
Arguments.
core: The owned product tree in the plan's retained field.ctx: The prepared plan field context.budget: The caller-owned work allowance, shared through preparation and computation.
Raises.
PolyError: LIMIT on exhausted work, CAPACITY on unrepresentable sizes, DOMAIN for invalid input, or UNSUPPORTED for a documented domain restriction.
PointPlan.point_count¶
def point_count(self) -> Int
Return the number of nodes, including repetitions.
Returns. The number of nodes retained by the plan, including repeated nodes.
PointPlan.modulus¶
def modulus(self) -> UInt64
Return the prime modulus, or zero for characteristic-zero fields.
Returns. The prime modulus for modular data, or zero otherwise.
PointPlan.domain¶
def domain(self) -> String
Return the field retained by this plan.
Returns. QQ, QQi, or GF(p), including for an empty plan.
PointPlan.evaluate¶
def evaluate[I: Iterable](self, values: I, mut budget: Budget) raises PolyError -> Values[_Scalar[Self.k], Self.k]
Evaluate in node order; inputs must embed into the plan's fixed field.
Parameters.
I: The inferred input iterable type.
Arguments.
values: The polynomial coefficient sequence or prepared dense array.budget: The caller-owned work allowance, shared through preparation and computation.
Returns. A Values sequence in node order, including every zero, in the fixed plan field.
Raises.
PolyError: LIMIT on exhausted work, CAPACITY on unrepresentable sizes, DOMAIN for invalid input, or UNSUPPORTED for a documented domain restriction.
PointPlan.evaluate¶
def evaluate[I: Iterable](self, values: I, *, max_steps: UInt64 = UInt64.MAX) raises PolyError -> Values[_Scalar[Self.k], Self.k]
Evaluate a polynomial at the prepared nodes with an optional work limit.
Parameters.
I: The inferred input iterable type.
Arguments.
values: The polynomial coefficient sequence or prepared dense array.max_steps: The complete call's work allowance; defaults to UInt64.MAX.
Returns. A Values sequence in node order, including every zero, in the fixed plan field.
Raises.
PolyError: LIMIT on exhausted work, CAPACITY on unrepresentable sizes, DOMAIN for invalid input, or UNSUPPORTED for a documented domain restriction.
PointPlan.interpolate¶
def interpolate[I: Iterable](self, values: I, mut budget: Budget) raises PolyError -> Array[Self.k]
Interpolate samples in node order; repeated nodes raise DOMAIN.
Nodes must be distinct and sample counts must match. An empty plan with empty samples returns zero; trailing zero samples are retained as constraints.
Parameters.
I: The inferred input iterable type.
Arguments.
values: Exact samples in node order, including every zero.budget: The caller-owned work allowance, shared through preparation and computation.
Returns. The polynomial matching the samples in the plan's fixed field, with degree below the node count.
Raises.
PolyError: LIMIT on exhausted work, CAPACITY on unrepresentable sizes, DOMAIN for invalid input, or UNSUPPORTED for a documented domain restriction.
PointPlan.interpolate¶
def interpolate[I: Iterable](self, values: I, *, max_steps: UInt64 = UInt64.MAX) raises PolyError -> Array[Self.k]
Interpolate samples at the prepared nodes with an optional work limit.
Nodes must be distinct and sample counts must match. An empty plan with empty samples returns zero; trailing zero samples are retained as constraints.
Parameters.
I: The inferred input iterable type.
Arguments.
values: Exact samples in node order, including every zero.max_steps: The complete call's work allowance; defaults to UInt64.MAX.
Returns. The polynomial matching the samples in the plan's fixed field, with degree below the node count.
Raises.
PolyError: LIMIT on exhausted work, CAPACITY on unrepresentable sizes, DOMAIN for invalid input, or UNSUPPORTED for a documented domain restriction.
Roots and polynomial systems¶
See root workflows and the Gröbner and CAD tutorials for complete examples.
real_roots¶
def real_roots[I: Iterable](values: I, mut budget: Budget) raises PolyError -> _roots.ExactRoots
Find all distinct real roots as exact algebraic values.
Repeated roots appear once. Constants have no roots; the zero polynomial raises DOMAIN.
Parameters.
I: The inferred input type.
Arguments.
values: Ascending integer, rational, or algebraic.Real coefficients, or a prepared array.budget: The shared work allowance for preparation and computation.
Returns. An iterable of exact Real values in increasing order, with completeness evidence.
Raises.
PolyError: DOMAIN for incompatible input, UNSUPPORTED for an unavailable operation, or LIMIT/CAPACITY on resource limits.
Defined in src/poly/dense.mojo.
complex_roots¶
def complex_roots[I: Iterable](values: I, mut budget: Budget) raises PolyError -> _roots.ComplexRoots
Find every distinct exact complex root, with multiplicities.
Results use lexicographic real-part then imaginary-part order. Nonzero constants return no roots. Integer, rational, Gaussian-rational, AA, and QQbar coefficients are accepted; no numerical precision is needed.
Parameters.
I: The inferred input iterable type.
Arguments.
values: Ascending exact coefficients or a prepared dense array.budget: The shared work allowance, including preparation and verification.
Returns. Exact algebraic.Complex values with multiplicities and completeness evidence.
Raises.
PolyError: DOMAIN for zero or incompatible input, or LIMIT/CAPACITY on resource limits.
Defined in src/poly/dense.mojo.
root_between¶
def root_between[I: Iterable, L: Copyable & Deinitable, H: Copyable & Deinitable](values: I, low: L, high: H, mut budget: Budget) raises PolyError -> _algebraic.Real
Select the unique exact real root in an interval.
Parameters.
I: The inferred input type.L: The inferred input type.H: The inferred input type.
Arguments.
values: Ascending integer or rational coefficients.low: The lower nonroot endpoint, or an exact root if endpoints agree.high: The upper nonroot endpoint, or the same exact root.budget: The shared work allowance for preparation and computation.
Returns. An exact algebraic value with its root-selection witness.
Raises.
PolyError: DOMAIN for incompatible input, UNSUPPORTED for an unavailable operation, or LIMIT/CAPACITY on resource limits.
Defined in src/poly/dense.mojo.
count_roots¶
def count_roots[I: Iterable, L: Copyable & Deinitable, H: Copyable & Deinitable](values: I, low: L, high: H, mut budget: Budget) raises PolyError -> _Count[_Element[I], L, H]
Count distinct real roots between exact nonroot endpoints.
Parameters.
I: The inferred input type.L: The inferred input type.H: The inferred input type.
Arguments.
values: Ascending integer or rational coefficients.low: The lower rational or integer endpoint.high: The larger rational or integer endpoint.budget: The shared work allowance for preparation and computation.
Returns. A RootCount containing the count and its checkable certificate.
Raises.
PolyError: DOMAIN for incompatible input, UNSUPPORTED for an unavailable operation, or LIMIT/CAPACITY on resource limits.
Defined in src/poly/dense.mojo.
sturm_sequence¶
def sturm_sequence[I: Iterable](values: I, mut budget: Budget) raises PolyError -> _sturm.SturmPlan
Prepare a reusable rational Sturm chain for root and sign-variation queries.
Parameters.
I: The inferred polynomial iterable.
Arguments.
values: Nonzero polynomial coefficients over ZZ or QQ.budget: The shared preparation allowance.
Returns. An immutable plan retaining the polynomial, chain, and quotient witnesses.
Raises.
PolyError: DOMAIN for the zero polynomial, or LIMIT/CAPACITY.
Defined in src/poly/dense.mojo.
sign_on_interval¶
def sign_on_interval[I: Iterable, L: Copyable & Deinitable, H: Copyable & Deinitable](values: I, low: L, high: H, mut budget: Budget) raises PolyError -> Optional[Int]
Determine the strict sign throughout a closed exact interval.
Parameters.
I: The inferred input type.L: The inferred input type.H: The inferred input type.
Arguments.
values: Ascending integer or rational coefficients.low: The lower rational or integer endpoint.high: The upper rational or integer endpoint, possibly equal to low.budget: The shared work allowance for preparation and computation.
Returns. Positive or negative one if the interval is root-free; None if it contains a root, including either endpoint. The zero polynomial returns None.
Raises.
PolyError: DOMAIN for incompatible input, UNSUPPORTED for an unavailable operation, or LIMIT/CAPACITY on resource limits.
Defined in src/poly/dense.mojo.
real_root_cover¶
def real_root_cover[I: Iterable](values: I, mut budget: Budget, *, options: NumericOptions = NumericOptions(), complete_only: Bool = False) raises PolyError -> _RealCover[_Kind[_Element[I]]] where _Kind[_Element[I]] >= 0
Enclose real roots with explicit completeness and accuracy claims.
Counts are distinct real roots.
Parameters.
I: The inferred input type.
Arguments.
values: Exact ascending coefficients or a prepared array.budget: The shared work allowance for preparation and computation.options: Precision, width, subdivision, and isolation settings.complete_only: Raise unless all requested properties succeed.
Returns. The computed result, with its evidence retained.
Raises.
PolyError: DOMAIN for incompatible input, UNSUPPORTED for an unavailable operation, or LIMIT/CAPACITY on resource limits.
Defined in src/poly/dense.mojo.
complex_root_cover¶
def complex_root_cover[I: Iterable](values: I, mut budget: Budget, *, options: NumericOptions = NumericOptions(), complete_only: Bool = False) raises PolyError -> _ComplexCover[_Kind[_Element[I]]] where _Kind[_Element[I]] >= 0
Enclose complex roots with explicit completeness and accuracy claims.
Counts include multiplicity. Allow clusters with require_isolation=False for repeated roots.
Parameters.
I: The inferred input type.
Arguments.
values: Exact ascending coefficients or a prepared array.budget: The shared work allowance for preparation and computation.options: Precision, width, subdivision, and isolation settings.complete_only: Raise unless all requested properties succeed.
Returns. The computed result, with its evidence retained.
Raises.
PolyError: DOMAIN for incompatible input, UNSUPPORTED for an unavailable operation, or LIMIT/CAPACITY on resource limits.
Defined in src/poly/dense.mojo.
real_root_cover_to¶
def real_root_cover_to[I: Iterable, S: RealRootSink](values: I, mut sink: S, mut budget: Budget, *, options: NumericOptions = NumericOptions(), complete_only: Bool = False) raises PolyError -> RootStreamReceipt where _Kind[_Element[I]] >= 0
Stream real root witnesses without collecting the output.
Parameters.
I: The inferred input type.S: The inferred input type.
Arguments.
values: Exact ascending coefficients or a prepared array.sink: The consumer receiving owned witnesses under the same work budget.budget: The shared work allowance for preparation and computation.options: The requested precision and root-cover properties.complete_only: Raise unless all requested properties succeed.
Returns. A completion receipt; partial writes before an error are not a complete cover.
Raises.
PolyError: DOMAIN for incompatible input, UNSUPPORTED for an unavailable operation, or LIMIT/CAPACITY on resource limits.
Defined in src/poly/dense.mojo.
complex_root_cover_to¶
def complex_root_cover_to[I: Iterable, S: ComplexRootSink](values: I, mut sink: S, mut budget: Budget, *, options: NumericOptions = NumericOptions(), complete_only: Bool = False) raises PolyError -> RootStreamReceipt where _Kind[_Element[I]] >= 0
Stream complex root witnesses without collecting the output.
Parameters.
I: The inferred input type.S: The inferred input type.
Arguments.
values: Exact ascending coefficients or a prepared array.sink: The consumer receiving owned witnesses under the same work budget.budget: The shared work allowance for preparation and computation.options: The requested precision and root-cover properties.complete_only: Raise unless all requested properties succeed.
Returns. A completion receipt; partial writes before an error are not a complete cover.
Raises.
PolyError: DOMAIN for incompatible input, UNSUPPORTED for an unavailable operation, or LIMIT/CAPACITY on resource limits.
Defined in src/poly/dense.mojo.
real_root_checker¶
def real_root_checker[I: Iterable](values: I, mut budget: Budget, *, options: NumericOptions = NumericOptions()) raises PolyError -> _RealChecker[_Kind[_Element[I]]] where _Kind[_Element[I]] >= 0
Prepare independent incremental checking of a real root stream.
Parameters.
I: The inferred input type.
Arguments.
values: The exact input polynomial whose streamed evidence will be checked.budget: The shared work allowance for preparation and computation.options: The same options passed to the producer.
Returns. A streaming checker; call finish(receipt, budget) after successful production.
Raises.
PolyError: DOMAIN for incompatible input, UNSUPPORTED for an unavailable operation, or LIMIT/CAPACITY on resource limits.
Defined in src/poly/dense.mojo.
complex_root_checker¶
def complex_root_checker[I: Iterable](values: I, mut budget: Budget, *, options: NumericOptions = NumericOptions()) raises PolyError -> _ComplexChecker[_Kind[_Element[I]]] where _Kind[_Element[I]] >= 0
Prepare independent incremental checking of a complex root stream.
Parameters.
I: The inferred input type.
Arguments.
values: The exact input polynomial whose streamed evidence will be checked.budget: The shared work allowance for preparation and computation.options: The same options passed to the producer.
Returns. A streaming checker; call finish(receipt, budget) after successful production.
Raises.
PolyError: DOMAIN for incompatible input, UNSUPPORTED for an unavailable operation, or LIMIT/CAPACITY on resource limits.
Defined in src/poly/dense.mojo.
dumps¶
def dumps[I: Iterable](values: I, mut budget: Budget) raises PolyError -> String where _Kind[_Element[I]] >= 0
Write canonical versioned polynomial text.
AA and QQbar retain their exact root witnesses, which are validated on load. Arithmetic history is not serialized. Other exact domains keep their existing format.
Parameters.
I: The inferred input iterable type.
Arguments.
values: Input coefficients, sparse terms, or prepared values as required by this overload.budget: The shared work allowance, including preparation, computation, and result storage.
Returns. Canonical text including the final newline.
Raises.
PolyError: ENCODING for malformed or incompatible records, DOMAIN for invalid settings, or LIMIT/CAPACITY on resource limits.
Defined in src/poly/dense.mojo.
loads¶
def loads[T: Copyable & Deinitable](text: String, mut budget: Budget, *, modulus: UInt64 = 0) raises PolyError -> Array[_Kind[T]]
Read canonical text into an exact array; the scalar type selects the expected domain.
AA and QQbar retain their exact root witnesses, which are validated on load. Arithmetic history is not serialized. Other exact domains keep their existing format.
Parameters.
T: The scalar or batch item type.
Arguments.
text: One canonical versioned polynomial record.budget: The shared work allowance, including preparation, computation, and result storage.modulus: The expected prime modulus for ModInt records; zero outside that domain.
Returns. An exact array in the requested scalar domain.
Raises.
PolyError: ENCODING for malformed or incompatible records, DOMAIN for invalid settings, or LIMIT/CAPACITY on resource limits.
Defined in src/poly/dense.mojo.
dump¶
def dump[I: Iterable, S: PolynomialTextSink](values: I, mut sink: S, mut budget: Budget) raises PolyError where _Kind[_Element[I]] >= 0
Write canonical versioned polynomial text in bounded chunks.
AA and QQbar retain their exact root witnesses, which are validated on load. Arithmetic history is not serialized. Other exact domains keep their existing format.
Parameters.
I: The inferred input iterable type.S: The text transport implementation.
Arguments.
values: Input coefficients, sparse terms, or prepared values as required by this overload.sink: The destination for ordered text chunks.budget: The shared work allowance, including preparation, computation, and result storage.
Raises.
PolyError: ENCODING for malformed or incompatible records, DOMAIN for invalid settings, or LIMIT/CAPACITY on resource limits.
Defined in src/poly/dense.mojo.
load¶
def load[T: Copyable & Deinitable, S: PolynomialTextSource](var source: S, mut budget: Budget, *, modulus: UInt64 = 0, max_field_bytes: Int = 16777216) raises PolyError -> Array[_Kind[T]]
Read canonical text into an exact array; the scalar type selects the expected domain.
AA and QQbar retain their exact root witnesses, which are validated on load. Arithmetic history is not serialized. Other exact domains keep their existing format.
Parameters.
T: The scalar or batch item type.S: The text transport implementation.
Arguments.
source: An owned source of arbitrary text chunks.budget: The shared work allowance, including preparation, computation, and result storage.modulus: The expected prime modulus for ModInt records; zero outside that domain.max_field_bytes: Maximum bytes in one input field; defaults to 16 MiB.
Returns. An exact array decoded from the text stream.
Raises.
PolyError: ENCODING for malformed or incompatible records, DOMAIN for invalid settings, or LIMIT/CAPACITY on resource limits.
Defined in src/poly/dense.mojo.
loads_numeric¶
def loads_numeric[T: Copyable & Deinitable](text: String, mut budget: Budget) raises PolyError -> NumericArray[_num._StoredDomain[T]]
Restore stored numerical values exactly; subsequent arithmetic takes an explicit context.
Parameters.
T: The scalar or batch item type.
Arguments.
text: One canonical versioned polynomial record.budget: The shared work allowance, including preparation, computation, and result storage.
Returns. A numerical array preserving the encoded scalar precision and enclosures.
Raises.
PolyError: ENCODING for malformed or incompatible records, DOMAIN for invalid settings, or LIMIT/CAPACITY on resource limits.
Defined in src/poly/dense.mojo.
degree_bound¶
def degree_bound[D: NumericDomain](values: NumericArray[D], mut budget: Budget) raises PolyError -> Int
Return the stored degree bound.
Parameters.
D: The APN numerical domain associated with the stored scalars.
Arguments.
values: Input coefficients, sparse terms, or prepared values as required by this overload.budget: The shared work allowance, including preparation, computation, and result storage.
Returns. The largest possible degree, or minus one for zero.
Raises.
PolyError: DOMAIN for invalid or incompatible input, or LIMIT/CAPACITY on resource limits.
Defined in src/poly/dense.mojo.
certified_degree¶
def certified_degree[D: NumericDomain](values: NumericArray[D], mut budget: Budget) raises PolyError -> Optional[Int]
Return a common degree for every represented polynomial, or None when uncertain.
Parameters.
D: The APN numerical domain associated with the stored scalars.
Arguments.
values: Input coefficients, sparse terms, or prepared values as required by this overload.budget: The shared work allowance, including preparation, computation, and result storage.
Returns. A common degree for every represented polynomial, or None if uncertain.
Raises.
PolyError: DOMAIN for invalid or incompatible input, or LIMIT/CAPACITY on resource limits.
Defined in src/poly/dense.mojo.
enclose¶
def enclose[I: Iterable, X: Copyable & Deinitable](values: I, point: X, mut budget: Budget, *, context: BallContext) raises PolyError -> _evaluation.Enclosure[_Ring[_Kind[_Element[I]]], _evaluation._Domain[_Element[I], X], False, False] where _Kind[_Element[I]] >= 0
Evaluate with an independently checkable enclosure.
Inputs remain unchanged. Exact algebraic coefficients and points retain root witnesses for independent conversion checks. Adaptive calls refine exact algebraic coefficients while preserving supplied numerical uncertainty.
Parameters.
I: Inferred from the input types.X: Inferred from the input types.
Arguments.
values: Coefficients, terms, or a prepared value.point: A scalar for one variable, or a tuple in sparse axis order.budget: The shared work allowance.context: Explicit output precision and rounding or enclosure settings.
Returns. An enclosing value with the original inputs, proof trace, and any requested accuracy outcome.
Raises.
PolyError: DOMAIN for invalid input, or LIMIT/CAPACITY on resource limits.
Defined in src/poly/dense.mojo.
adaptive_evaluate¶
def adaptive_evaluate[I: Iterable, X: Copyable & Deinitable](values: I, point: X, mut budget: Budget, *, options: NumericOptions) raises PolyError -> _evaluation.Enclosure[_Ring[_Kind[_Element[I]]], _evaluation._Domain[_Element[I], X], False, False] where _Kind[_Element[I]] >= 0
Evaluate with an independently checkable enclosure and a requested accuracy.
Inputs remain unchanged. Exact algebraic coefficients and points retain root witnesses for independent conversion checks. Adaptive calls refine exact algebraic coefficients while preserving supplied numerical uncertainty.
Parameters.
I: Inferred from the input types.X: Inferred from the input types.
Arguments.
values: Coefficients, terms, or a prepared value.point: A scalar for one variable, or a tuple in sparse axis order.budget: The shared work allowance.options: Initial and maximum precision, and absolute or relative width targets.
Returns. An enclosing value with the original inputs, proof trace, and any requested accuracy outcome.
Raises.
PolyError: DOMAIN for invalid input, or LIMIT/CAPACITY on resource limits.
Defined in src/poly/dense.mojo.
NumericDivision¶
@fieldwise_init
struct NumericDivision[D: NumericDomain](Copyable, Movable)
Quotient, remainder, and independently checkable residual or family bounds.
Parameters.
D: The numerical coefficient domain.
Defined in src/poly/dense.mojo.
NumericDivision.evidence¶
def evidence(self) -> ref[ImmOrigin(origin_of(self._proof[]))] NumericDivisionResult[Self.D]
Borrow the division result and its residual evidence.
Returns. Immutable core quotient, remainder, residual and family witnesses.
NumericDivision.quotient¶
def quotient(self, mut budget: Budget) raises PolyError -> NumericArray[Self.D]
Copy the numerical quotient from the retained division result.
Arguments.
budget: The shared work allowance.
Returns. An independent numerical coefficient array.
Raises.
PolyError: DOMAIN for invalid input, or LIMIT/CAPACITY on resource limits.
NumericDivision.quotient¶
def quotient(self, *, max_steps: UInt64 = UInt64.MAX) raises PolyError -> NumericArray[Self.D]
Copy the numerical quotient from the retained division result.
Arguments.
max_steps: The complete call's work allowance.
Returns. An independent numerical coefficient array.
Raises.
PolyError: DOMAIN for invalid input, or LIMIT/CAPACITY on resource limits.
NumericDivision.remainder¶
def remainder(self, mut budget: Budget) raises PolyError -> NumericArray[Self.D]
Copy the numerical remainder from the retained division result.
Arguments.
budget: The shared work allowance.
Returns. An independent numerical coefficient array.
Raises.
PolyError: DOMAIN for invalid input, or LIMIT/CAPACITY on resource limits.
NumericDivision.remainder¶
def remainder(self, *, max_steps: UInt64 = UInt64.MAX) raises PolyError -> NumericArray[Self.D]
Copy the numerical remainder from the retained division result.
Arguments.
max_steps: The complete call's work allowance.
Returns. An independent numerical coefficient array.
Raises.
PolyError: DOMAIN for invalid input, or LIMIT/CAPACITY on resource limits.
divide_checked¶
def divide_checked[D: NumericDomain](a: NumericArray[D], b: NumericArray[D], mut budget: Budget, *, context: D.Context) raises PolyError -> NumericDivision[D]
Divide numerical arrays and retain residual or uniform-family evidence.
Parameters.
D: The numerical coefficient domain.
Arguments.
a: The first prepared value.b: The second prepared value.budget: The shared work allowance.context: Explicit output precision and rounding or enclosure settings.
Returns. A division result retaining both operands, residual bounds, and any uniform-family evidence.
Raises.
PolyError: DOMAIN for invalid input, or LIMIT/CAPACITY on resource limits.
Defined in src/poly/dense.mojo.
check_division¶
def check_division[D: NumericDomain](result: NumericDivision[D], mut budget: Budget) raises PolyError -> Bool
Verify numerical division against its original operands.
Parameters.
D: The numerical coefficient domain.
Arguments.
result: The result and its retained evidence.budget: The shared work allowance.
Returns. Whether the evidence is valid.
Raises.
PolyError: DOMAIN for invalid input, or LIMIT/CAPACITY on resource limits.
Defined in src/poly/dense.mojo.
Retained exact evidence¶
See checked exact results for functional accessors and the precise claim each checker establishes.
gcd_checked¶
def gcd_checked[A: Iterable, B: Iterable](a: A, b: B, mut budget: Budget) raises PolyError -> _exact.Result[_Join[_Kind[_Element[A]], _Kind[_Element[B]]], Int, False, GcdResult[_Ring[_Join[_Kind[_Element[A]], _Kind[_Element[B]]]]]]
Compute a GCD and retain independent maximality evidence.
Independent checking proves greatest-common-divisor status up to a unit; the producer returns the usual normalized representative.
Parameters.
A: Inferred from the input types unless explicitly supplied.B: Inferred from the input types unless explicitly supplied.
Arguments.
a: The first polynomial.b: The second polynomial.budget: The shared work allowance, including preparation and output storage.
Returns. A retained GCD with maximality evidence for exact.value and exact.check.
Raises.
PolyError: DOMAIN for incompatible input, UNSUPPORTED for an unavailable coefficient domain, or LIMIT/CAPACITY on resource limits.
Defined in src/poly/dense.mojo.
coprimality¶
def coprimality[A: Iterable, B: Iterable](a: A, b: B, mut budget: Budget) raises PolyError -> Optional[_exact.Result[_Join[_Kind[_Element[A]], _Kind[_Element[B]]], Int, False, CoprimalityCertificate[_Ring[_Join[_Kind[_Element[A]], _Kind[_Element[B]]]]]]]
Produce a coprimality witness when the inputs have no common nonunit factor.
None means the producer did not establish coprimality.
Parameters.
A: Inferred from the input types unless explicitly supplied.B: Inferred from the input types unless explicitly supplied.
Arguments.
a: The first polynomial.b: The second polynomial.budget: The shared work allowance, including preparation and output storage.
Returns. A retained result for exact.check, or None for an unsuccessful coprimality request.
Raises.
PolyError: DOMAIN for incompatible input, UNSUPPORTED for an unavailable coefficient domain, or LIMIT/CAPACITY on resource limits.
Defined in src/poly/dense.mojo.
resultant_checked¶
def resultant_checked[A: Iterable, B: Iterable](a: A, b: B, mut budget: Budget) raises PolyError -> _exact.Result[_Join[_Kind[_Element[A]], _Kind[_Element[B]]], Int, False, ResultantResult[_Ring[_Join[_Kind[_Element[A]], _Kind[_Element[B]]]]]]
Compute a resultant and retain its ideal-membership identity.
The checker proves ua + vb = result; it does not independently prove the determinant definition of the resultant.
Parameters.
A: Inferred from the input types unless explicitly supplied.B: Inferred from the input types unless explicitly supplied.
Arguments.
a: The first polynomial.b: The second polynomial.budget: The shared work allowance, including preparation and output storage.
Returns. A retained resultant with an ideal-membership identity for exact.value and exact.check.
Raises.
PolyError: DOMAIN for incompatible input, UNSUPPORTED for an unavailable coefficient domain, or LIMIT/CAPACITY on resource limits.
Defined in src/poly/dense.mojo.
resultant_certified¶
def resultant_certified[A: Iterable, B: Iterable](a: A, b: B, mut budget: Budget) raises PolyError -> _exact.Result[_FieldKind[_Join[_Kind[_Element[A]], _Kind[_Element[B]]]], Int, False, _exact._Determinant[_FieldKind[_Join[_Kind[_Element[A]], _Kind[_Element[B]]]]]]
Compute an exact resultant with a complete determinant certificate.
Integer coefficients promote to rationals. exact.check verifies the Sylvester determinant transcript; exact.value returns its constant coefficient array.
Parameters.
A: Inferred from the input types unless explicitly supplied.B: Inferred from the input types unless explicitly supplied.
Arguments.
a: The first polynomial.b: The second polynomial.budget: The shared work allowance, including preparation and output storage.
Returns. A retained exact resultant and determinant evidence for exact.value and exact.check.
Raises.
PolyError: DOMAIN for incompatible input, UNSUPPORTED for an unavailable coefficient domain, or LIMIT/CAPACITY on resource limits.
Defined in src/poly/dense.mojo.
divide_many_checked¶
def divide_many_checked[A: Iterable, B: Iterable](values: A, divisors: B, mut budget: Budget) raises PolyError -> _exact.Result[_FieldKind[_Join[_Kind[_Element[A]], _Kind[_Element[_Nested[B]]]]], Int, False, ListDivision[_Ring[_FieldKind[_Join[_Kind[_Element[A]], _Kind[_Element[_Nested[B]]]]]]]]
Divide by ordered polynomials and retain the exact recomposition identity.
Sparse reduction uses lexicographic order with axis zero first. Changing divisor order can change quotients and remainder; this is not a Groebner-basis computation. An empty divisor collection returns no quotients and the promoted input as remainder. A zero divisor raises DOMAIN.
Parameters.
A: The first inferred iterable type.B: The second inferred iterable type.
Arguments.
values: The coefficient sequence, sparse terms, or prepared array.divisors: A finite iterable of polynomials of one Mojo input type, tried in the supplied order.budget: The caller-owned work allowance, shared through preparation and computation.
Returns. A retained result for exact.quotients, exact.remainder and exact.check; the check establishes the identity, not a unique reduced remainder.
Raises.
PolyError: LIMIT on exhausted work, CAPACITY on unrepresentable sizes, DOMAIN for invalid input, or UNSUPPORTED for a documented domain restriction.
Defined in src/poly/dense.mojo.
factor_checked¶
def factor_checked[I: Iterable](values: I, mut budget: Budget, *, seed: UInt64 = 0) raises PolyError -> _exact.Result[_Kind[_Element[I]], Int, False, Factorization[_Ring[_Kind[_Element[I]]]]]
Factor the polynomial and retain independently checkable evidence.
exact.check verifies recomposition. Over AA and QQbar it also verifies monicity, ordering, distinct factors, and irreducibility by degree and negative real quadratic discriminants. Other coefficient domains retain the product-only claim.
Parameters.
I: Inferred from the input types unless explicitly supplied.
Arguments.
values: Input coefficients, sparse terms, or a prepared array.budget: The shared work allowance, including preparation and output storage.seed: The deterministic finite-field factorization seed.
Returns. A retained factorization for exact.unit, exact.factors and exact.check.
Raises.
PolyError: DOMAIN for incompatible input, UNSUPPORTED for an unavailable coefficient domain, or LIMIT/CAPACITY on resource limits.
Defined in src/poly/dense.mojo.
squarefree_checked¶
def squarefree_checked[I: Iterable](values: I, mut budget: Budget) raises PolyError -> _exact.Result[_FieldKind[_Kind[_Element[I]]], Int, False, SquarefreeDecomposition[_Ring[_FieldKind[_Kind[_Element[I]]]]]]
Decompose by multiplicity and retain the product identity.
The checker verifies recomposition. It does not certify irreducibility or squarefreeness of the factors.
Parameters.
I: Inferred from the input types unless explicitly supplied.
Arguments.
values: Input coefficients, sparse terms, or a prepared array.budget: The shared work allowance, including preparation and output storage.
Returns. A retained factorization for exact.unit, exact.factors and exact.check.
Raises.
PolyError: DOMAIN for incompatible input, UNSUPPORTED for an unavailable coefficient domain, or LIMIT/CAPACITY on resource limits.
Defined in src/poly/dense.mojo.
interpolate_checked¶
def interpolate_checked[A: Iterable, B: Iterable](points: A, values: B, mut budget: Budget) raises PolyError -> _exact.Result[_FieldKind[_Join[_Kind[_Element[A]], _Kind[_Element[B]]]], Int, False, _exact._Interpolation[_Ring[_FieldKind[_Join[_Kind[_Element[A]], _Kind[_Element[B]]]]]]]
Interpolate distinct nodes exactly; integer data promotes to QQ.
Nodes must be distinct and sample counts must match. Empty data returns zero; trailing zero samples are retained as constraints.
Parameters.
A: The first inferred iterable type.B: The second inferred iterable type.
Arguments.
points: A one-dimensional sequence of exact points, in output order.values: Exact samples in node order, including every zero.budget: The caller-owned work allowance, shared through preparation and computation.
Returns. A retained interpolant and its constraints for exact.value and exact.check.
Raises.
PolyError: LIMIT on exhausted work, CAPACITY on unrepresentable sizes, DOMAIN for invalid input, or UNSUPPORTED for a documented domain restriction.
Defined in src/poly/dense.mojo.
hermite_interpolate_checked¶
def hermite_interpolate_checked[A: Iterable, B: Iterable](points: A, jets: B, mut budget: Budget, *, derivatives: Bool = True) raises PolyError -> _exact.Result[_FieldKind[_Join[_Kind[_Element[A]], _Kind[_Element[_Nested[B]]]]], Int, False, _exact._Interpolation[_Ring[_FieldKind[_Join[_Kind[_Element[A]], _Kind[_Element[_Nested[B]]]]]]]]
Interpolate value and consecutive derivative constraints at distinct nodes.
Node and jet counts must match, nodes must be distinct, and each jet must be nonempty. Raw derivatives in a finite field require invertible factorials; use derivatives=False for Taylor coefficients.
Parameters.
A: The first inferred iterable type.B: The second inferred iterable type.
Arguments.
points: A one-dimensional sequence of exact points, in output order.jets: One nonempty exact sequence per node, beginning with the value and followed by consecutive derivatives.budget: The caller-owned work allowance, shared through preparation and computation.derivatives: True interprets jets as raw derivatives; False interprets them as Taylor coefficients.
Returns. A retained interpolant and all Hermite constraints for exact.value and exact.check.
Raises.
PolyError: LIMIT on exhausted work, CAPACITY on unrepresentable sizes, DOMAIN for invalid input, or UNSUPPORTED for a documented domain restriction.
Defined in src/poly/dense.mojo.
Incremental enclosure and numerical transport¶
enclose_stream¶
def enclose_stream[I: Iterable, X: Copyable & Deinitable](values: I, point: X, mut budget: Budget, *, context: BallContext) raises PolyError -> _evaluation._Stream[_Ring[_Kind[_Element[I]]], _evaluation._Domain[_Element[I], X], False, False, False, _evaluation._IsAlgebraic[X]] where _Kind[_Element[I]] >= 0
Prepare an enclosure producer that emits one witness event at a time.
Use the same inputs and context for producer and checker. Algebraic inputs are refined automatically at the requested precision, with root evidence before the arithmetic events. The receipt alone does not certify evaluation.
Parameters.
I: Inferred from the input types.X: Inferred from the input types.
Arguments.
values: Coefficients, terms, or a prepared value.point: A scalar for one variable, or a tuple in sparse axis order.budget: The shared work allowance.context: Explicit output precision and rounding or enclosure settings.
Returns. A producer owning its evaluation state without retaining emitted witnesses.
Raises.
PolyError: DOMAIN for invalid input, or LIMIT/CAPACITY on resource limits.
Defined in src/poly/dense.mojo.
enclose_checker¶
def enclose_checker[I: Iterable, X: Copyable & Deinitable](values: I, point: X, mut budget: Budget, *, context: BallContext) raises PolyError -> _evaluation._Stream[_Ring[_Kind[_Element[I]]], _evaluation._Domain[_Element[I], X], False, False, True, _evaluation._IsAlgebraic[X]] where _Kind[_Element[I]] >= 0
Prepare independent incremental enclosure checking.
Use the same inputs and context for producer and checker. Algebraic inputs are refined automatically at the requested precision, with root evidence before the arithmetic events. The receipt alone does not certify evaluation.
Parameters.
I: Inferred from the input types.X: Inferred from the input types.
Arguments.
values: Coefficients, terms, or a prepared value.point: A scalar for one variable, or a tuple in sparse axis order.budget: The shared work allowance.context: Explicit output precision and rounding or enclosure settings.
Returns. A checker accepting events in order and validating the completion receipt.
Raises.
PolyError: DOMAIN for invalid input, or LIMIT/CAPACITY on resource limits.
Defined in src/poly/dense.mojo.
load_numeric¶
def load_numeric[T: Copyable & Deinitable, S: PolynomialTextSource](var source: S, mut budget: Budget, *, max_field_bytes: Int = 16777216) raises PolyError -> NumericArray[_num._StoredDomain[T]]
Restore stored numerical values exactly; subsequent arithmetic takes an explicit context.
Parameters.
T: The expected numerical scalar type.S: The text source type.
Arguments.
source: The owned text source, consumed through end of input.budget: The shared work allowance, including preparation, computation, and result storage.max_field_bytes: Positive maximum encoded field size in bytes.
Returns. A numerical array preserving the encoded scalar precision and enclosures.
Raises.
PolyError: ENCODING for malformed or incompatible records, DOMAIN for invalid settings, or LIMIT/CAPACITY on resource limits.
Defined in src/poly/dense.mojo.
complex_roots_to¶
def complex_roots_to[I: Iterable, S: _roots.ExactComplexRootSink](values: I, mut sink: S, mut budget: Budget) raises PolyError -> _roots.ExactComplexRootReceipt
Stream exact complex roots with multiplicities and a completion receipt.
Parameters.
I: The inferred coefficient iterable.S: The event consumer type.
Arguments.
values: Exact coefficients or terms over ZZ, QQ, QQi, AA, or QQbar.sink: A consumer of owned ExactComplexRootEvent values.budget: The shared preparation, production, and checking allowance.
Returns. A receipt to verify with checker.finish. Events follow deterministic factor and coordinate traversal order, which need not be sorted. Output witnesses are not collected; algebraic working state is retained.
Raises.
PolyError: DOMAIN for zero or invalid input, consumer failures, or LIMIT/CAPACITY on resource limits. Partial streams are not complete results.
Defined in src/poly/dense.mojo.
complex_roots_checker¶
def complex_roots_checker[I: Iterable](values: I, mut budget: Budget) raises PolyError -> _roots.ExactComplexRootChecker
Prepare independent incremental checking of exact complex roots.
Parameters.
I: The inferred coefficient iterable.
Arguments.
values: Exact coefficients or terms over ZZ, QQ, QQi, AA, or QQbar.budget: The shared preparation, production, and checking allowance.
Returns. A checker accepting root events; finish verifies complete reconstruction.
Raises.
PolyError: DOMAIN for zero or invalid input, consumer failures, or LIMIT/CAPACITY on resource limits. Partial streams are not complete results.
Defined in src/poly/dense.mojo.