Module dispatch

Module dispatch 

Source
Expand description

Unified polynomial dispatch layer

Auto-routes Expression to optimal Poly<T> implementation based on coefficient type. Converts ONCE at entry → stays numeric → converts ONCE at exit.

§Architecture

  1. Analyze coefficient types in Expression
  2. Route to optimal implementation:
    • All integers → IntPoly (fastest path)
    • Any rationals → RationalPoly (field operations)
    • Multivariate → symbolic fallback
  3. Convert result back to Expression ONCE

§Example

use mathhook_core::{expr, symbol};
use mathhook_core::core::polynomial::dispatch::polynomial_gcd;

let x = symbol!(x);
let p1 = expr!((x^2) - 1);
let p2 = expr!(x - 1);
let gcd = polynomial_gcd(&p1, &p2, &x);

Functions§

polynomial_div
Unified polynomial division with automatic type routing
polynomial_gcd
Unified polynomial GCD with automatic type routing
polynomial_quo
Unified polynomial quotient with automatic type routing
polynomial_rem
Unified polynomial remainder with automatic type routing