pub fn split_linear<'a>(
arena: &'a ExprArena,
id: ExprId,
) -> (LinearTerms<'a>, Vec<SignedExpr>)Expand description
Split an expression into its linear part and a nonlinear residual. The
returned (LinearTerms, Vec<SignedExpr>) satisfies
value(id) == sum_i coef_i * var_i + constant + sum_j (-1)^neg_j value(id_j)The residual is empty when the whole expression is linear and otherwise
lists the remaining nonlinear summands (each a pre-existing arena node,
optionally negated). LinearTerms may have empty coeffs and
constant == 0.0 when the whole expression is purely nonlinear.
As with extract_linear, call LinearTerms::into_owned before retaining
the linear terms independently of arena.