API reference

Numerical coefficient arrays

Pass context= to dense.asarray or sparse.asarray to select numerical arithmetic. The tutorial explains conversion, rounding, enclosure, and degree uncertainty. Computational calls accept a shared Budget or max_steps=; contexts remain explicit in arithmetic.

The dense and sparse references include numerical overloads beside their exact counterparts. Numerical array storage is exposed as dense.NumericArray and sparse.NumericArray.

DenseArray

struct DenseArray[D: NumericDomain](Copyable, Movable, Iterable, Sized, _Record)

An immutable numerical polynomial with shared canonical storage.

Parameters.

  • D: The APN numerical domain associated with the stored scalars.

Defined in src/poly/_numeric.mojo.

DenseArray.IteratorType

comptime IteratorType[iterable_mut: Bool, //, iterable_origin: Origin[mut=iterable_mut]]: Iterator = _DenseArrayIterator[Self.D, ImmOrigin(iterable_origin)]

Borrow the canonical numerical entries.

Parameters.

  • iterable_mut: Whether the borrowing source origin allows mutation.
  • iterable_origin: The lifetime of the borrowed source.

Returns. The borrowing iterator type.

DenseArray.__init__

def __init__(out self, var core: NumericDensePoly[Self.D], mut budget: Budget) raises PolyError

Take canonical storage; construct user values through asarray.

Arguments.

  • core: Owned canonical core storage.
  • budget: The shared work allowance, including preparation, computation, and result storage.

Raises.

  • PolyError: DOMAIN for invalid or incompatible input, or LIMIT/CAPACITY on resource limits.

DenseArray.to_list

def to_list(self, mut budget: Budget) raises PolyError -> List[Self.D.Scalar]

Copy numerical entries into an independent mutable list.

Arguments.

  • budget: The shared work allowance, including preparation, computation, and result storage.

Returns. An independent mutable list of entries.

Raises.

  • PolyError: DOMAIN for invalid or incompatible input, or LIMIT/CAPACITY on resource limits.

DenseArray.to_list

def to_list(self, *, max_steps: UInt64 = UInt64.MAX) raises PolyError -> List[Self.D.Scalar]

Materialize independent numerical entries with one work allowance.

Arguments.

  • max_steps: The complete call's work allowance; defaults to UInt64.MAX.

Returns. An independent mutable list of entries.

Raises.

  • PolyError: DOMAIN for invalid or incompatible input, or LIMIT/CAPACITY on resource limits.

SparseArray

struct SparseArray[P: Copyable & Deinitable, D: NumericDomain](Copyable, Movable, Iterable, Sized, _Record)

An immutable numerical polynomial with shared canonical storage.

Parameters.

  • P: The sparse power shape or retained source array type, inferred from the input.
  • D: The APN numerical domain associated with the stored scalars.

Defined in src/poly/_numeric.mojo.

SparseArray.IteratorType

comptime IteratorType[iterable_mut: Bool, //, iterable_origin: Origin[mut=iterable_mut]]: Iterator = _SparseArrayIterator[Self.P, Self.D, ImmOrigin(iterable_origin)]

Borrow the canonical numerical entries.

Parameters.

  • iterable_mut: Whether the borrowing source origin allows mutation.
  • iterable_origin: The lifetime of the borrowed source.

Returns. The borrowing iterator type.

SparseArray.__init__

def __init__(out self, var core: NumericSparsePoly[Self.D], mut budget: Budget) raises PolyError

Take canonical storage; construct user values through asarray.

Arguments.

  • core: Owned canonical core storage.
  • budget: The shared work allowance, including preparation, computation, and result storage.

Raises.

  • PolyError: DOMAIN for invalid or incompatible input, or LIMIT/CAPACITY on resource limits.

SparseArray.to_list

def to_list(self, mut budget: Budget) raises PolyError -> List[Tuple[Self.P, Self.D.Scalar]]

Copy numerical entries into an independent mutable list.

Arguments.

  • budget: The shared work allowance, including preparation, computation, and result storage.

Returns. An independent mutable list of entries.

Raises.

  • PolyError: DOMAIN for invalid or incompatible input, or LIMIT/CAPACITY on resource limits.

SparseArray.to_list

def to_list(self, *, max_steps: UInt64 = UInt64.MAX) raises PolyError -> List[Tuple[Self.P, Self.D.Scalar]]

Materialize independent numerical entries with one work allowance.

Arguments.

  • max_steps: The complete call's work allowance; defaults to UInt64.MAX.

Returns. An independent mutable list of entries.

Raises.

  • PolyError: DOMAIN for invalid or incompatible input, or LIMIT/CAPACITY on resource limits.

For method signatures, see dense arrays and sparse arrays. Root covers, diagnostics, and polishing are described in the root reference.

Values

struct Values[D: NumericDomain](Copyable, Movable, Iterable, Sized)

An immutable sequence from numerical samples, retaining every zero.

Parameters.

  • D: The numerical scalar domain.

Defined in src/poly/_numeric.mojo.

Values.IteratorType

comptime IteratorType[iterable_mut: Bool, //, iterable_origin: Origin[mut=iterable_mut]]: Iterator = _ValuesIterator[Self.D, 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.

Values.__init__

def __init__(out self, var values: List[Self.D.Scalar], mut budget: Budget) raises PolyError

Take ownership of values and their already validated numerical domain.

Arguments.

  • values: The numerical values in their original order.
  • 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.

Values.to_list

def to_list(self, mut budget: Budget) raises PolyError -> List[Self.D.Scalar]

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.

Values.to_list

def to_list(self, *, max_steps: UInt64 = UInt64.MAX) raises PolyError -> List[Self.D.Scalar]

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.

For checked fixed and adaptive evaluation, see evaluation results.