From 00a6119c8071450016ca3e8cd0afe2823d6853cc Mon Sep 17 00:00:00 2001 From: Danny Willems Date: Tue, 17 Dec 2024 16:44:35 +0100 Subject: [PATCH] mvpoly/monomials: allow to artificially increase the degree --- mvpoly/src/monomials.rs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/mvpoly/src/monomials.rs b/mvpoly/src/monomials.rs index 67d3127403..e08be206fa 100644 --- a/mvpoly/src/monomials.rs +++ b/mvpoly/src/monomials.rs @@ -554,12 +554,19 @@ impl From for Sparse } } -impl From> - for Result, String> +impl + From> for Result, String> { - fn from(poly: Sparse) -> Result, String> { + fn from(poly: Sparse) -> Result, String> { if M < N { - return Err("The number of variables must be greater than N".to_string()); + return Err(format!( + "The final number of variables {M} must be greater than {N}" + )); + } + if D_PRIME < D { + return Err(format!( + "The final degree {D_PRIME} must be greater than initial degree {D}" + )); } let mut monomials = HashMap::new(); poly.monomials.iter().for_each(|(exponents, coeff)| {