From f99f320118a84ec0c243ca3aeda40737e450e376 Mon Sep 17 00:00:00 2001 From: Michael Schwarz Date: Fri, 12 Jan 2024 12:53:45 +0100 Subject: [PATCH] Simplify --- src/cdomains/apron/affineEqualityDomain.apron.ml | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/cdomains/apron/affineEqualityDomain.apron.ml b/src/cdomains/apron/affineEqualityDomain.apron.ml index ce3f2592f4..bc1cfe41cf 100644 --- a/src/cdomains/apron/affineEqualityDomain.apron.ml +++ b/src/cdomains/apron/affineEqualityDomain.apron.ml @@ -680,19 +680,15 @@ struct let invariant t = let invariant m = - let earray = Lincons1.array_make t.env (Matrix.num_rows m) in - for i = 0 to (Lincons1.array_length earray -1) do + let one_constraint i = let row = Matrix.get_row m i in let coeff_vars = List.map (fun x -> Coeff.s_of_mpqf @@ Vector.nth row (Environment.dim_of_var t.env x), x) (vars t) in let cst = Coeff.s_of_mpqf @@ Vector.nth row (Vector.length row - 1) in - Lincons1.set_list (Lincons1.array_get earray i) coeff_vars (Some cst) - done; - let {lincons0_array; array_env}: Lincons1.earray = earray in - Array.enum lincons0_array - |> Enum.map (fun (lincons0: Lincons0.t) -> - Lincons1.{lincons0; env = array_env} - ) - |> List.of_enum + let e1 = Linexpr1.make t.env in + Linexpr1.set_list e1 coeff_vars (Some cst); + Lincons1.make e1 EQ + in + List.init (Matrix.num_rows m) (one_constraint) in BatOption.map_default invariant [] t.d