pub fn rational_dot(
left: &[BigRational],
right: &[BigRational],
) -> Result<BigRational, LaError>exact only.Expand description
Compute an exact dot product of borrowed, runtime-length rational slices.
This exact-feature adapter has no length limit, including LP objective
vectors longer than the square-matrix dispatch limit. It checks lengths
before inspecting coefficients, then validates all left denominators followed
by all right denominators. Raw unreduced and negative-denominator values are
accepted as mathematical quotients. Each product is canonicalized before
exact accumulation; the result has a positive denominator and lowest terms.
Two empty slices return canonical zero.
No input vector or operand is cloned, and no binary64 intermediate is used.
Integer products, rational reduction, and accumulation allocate as needed.
Prepared fixed-size inputs should use RationalVector::dot, which reuses
their canonical representation without repeating input validation.
§Errors
Returns LaError::DimensionMismatch for unequal lengths, or
LaError::NonFinite with input origin and a
NonFiniteLocation::VectorOperandEntry for the first zero denominator.
§Examples
use la_stack::prelude::*;
let objective = vec![BigRational::new(1.into(), 3.into()); 22];
let solution = vec![BigRational::from_integer(3.into()); 22];
assert_eq!(rational_dot(&objective, &solution)?, BigRational::from_integer(22.into()));