Skip to content

Commit 6ae9bf1

Browse files
committed
Remove prints in ArrayMatrix
1 parent 93463f2 commit 6ae9bf1

File tree

2 files changed

+5
-28
lines changed

2 files changed

+5
-28
lines changed

src/analyses/apron/affineEqualityAnalysis.apron.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ let spec_module: (module MCPSpec) Lazy.t =
1919
let module Priv = (val RelationPriv.get_priv ()) in
2020
let module Spec =
2121
struct
22-
include SpecFunctor (Priv) (AD) (RelationPrecCompareUtil.DummyUtil)
22+
include SpecFunctor (Priv) (AD_A) (RelationPrecCompareUtil.DummyUtil)
2323
let name () = "affeq"
2424
end
2525
in

src/cdomains/affineEquality/arrayImplementation/arrayMatrix.ml

Lines changed: 4 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ module ArrayMatrix: AbstractMatrix =
3939
let copy m = Timing.wrap "copy" (copy) m
4040

4141
let add_empty_columns m cols =
42-
let () = Printf.printf "Before add_empty_columns m:\n%sindices: %s\n" (show m) (Array.fold_right (fun x s -> (Int.to_string x) ^ "," ^ s) cols "") in
4342
Array.modifyi (+) cols;
4443
let nnc = Array.length cols in
4544
if is_empty m || nnc = 0 then m else
@@ -52,7 +51,6 @@ module ArrayMatrix: AbstractMatrix =
5251
m'.(i).(j + !offset) <- m.(i).(j);
5352
done
5453
done;
55-
let () = Printf.printf "After add_empty_columns m:\n%s\n" (show m') in
5654
m'
5755

5856
let add_empty_columns m cols = Timing.wrap "add_empty_cols" (add_empty_columns m) cols
@@ -70,7 +68,6 @@ module ArrayMatrix: AbstractMatrix =
7068
V.of_array m.(n)
7169

7270
let remove_row m n =
73-
let () = Printf.printf "Before remove_row %i of m:\n%s\n" n (show m) in
7471
let new_matrix = Array.make_matrix (num_rows m - 1) (num_cols m) A.zero in
7572
if not @@ is_empty new_matrix then
7673
if n = 0 then
@@ -81,7 +78,6 @@ module ArrayMatrix: AbstractMatrix =
8178
Array.blit m (n + 1) new_matrix n (num_rows new_matrix - n)); new_matrix
8279

8380
let get_col m n =
84-
(*let () = Printf.printf "get_col %i of m:\n%s\n%s\n" n (show m) (V.show (V.of_array @@ Array.init (Array.length m) (fun i -> m.(i).(n)))) in*)
8581
V.of_array @@ Array.init (Array.length m) (fun i -> m.(i).(n))
8682

8783
let get_col m n = Timing.wrap "get_col" (get_col m) n
@@ -90,13 +86,11 @@ module ArrayMatrix: AbstractMatrix =
9086
for i = 0 to num_rows m - 1 do
9187
m.(i).(n) <- V.nth new_col i
9288
done;
93-
let () = Printf.printf "After set_col m:\n%s\n" (show m) in
9489
m
9590

9691
let set_col_with m new_col n = Timing.wrap "set_col" (set_col_with m new_col) n
9792

9893
let set_col m new_col n =
99-
let () = Printf.printf "Before set_col m:\n%s\n" (show m) in
10094
let copy = copy m in
10195
set_col_with copy new_col n
10296

@@ -123,10 +117,8 @@ module ArrayMatrix: AbstractMatrix =
123117

124118
let reduce_col_with m j = Timing.wrap "reduce_col_with" (reduce_col_with m) j
125119
let reduce_col m j =
126-
let () = Printf.printf "Before reduce_col %i of m:\n%s\n" j (show m) in
127120
let copy = copy m in
128121
reduce_col_with copy j;
129-
let () = Printf.printf "After reduce_col %i of m:\n%s\n" j (show copy) in
130122
copy
131123

132124
let del_col m j =
@@ -138,7 +130,6 @@ module ArrayMatrix: AbstractMatrix =
138130

139131
let del_cols m cols =
140132
let n_c = Array.length cols in
141-
let () = Printf.printf "Before del_cols cols_length=%i \nm:\n%s\n" n_c (show m) in
142133
if n_c = 0 || is_empty m then m
143134
else
144135
let m_r, m_c = num_rows m, num_cols m in
@@ -210,7 +201,6 @@ module ArrayMatrix: AbstractMatrix =
210201

211202

212203
let reduce_col_with_vec m j v =
213-
let () = Printf.printf "Before reduce_col_with_vec %i with vec %s of m:\n%s\n" j (V.show (V.of_array v)) (show m) in
214204
for i = 0 to num_rows m - 1 do
215205
if m.(i).(j) <>: A.zero then
216206
let beta = m.(i).(j) /: v.(j) in
@@ -253,12 +243,9 @@ module ArrayMatrix: AbstractMatrix =
253243

254244
let normalize m =
255245
let copy = copy m in
256-
let () = Printf.printf "Before normalizing we have m:\n%s" (show m) in
257246
if normalize_with copy then
258-
let () = Printf.printf "After normalizing we have m:\n%s" (show copy) in
259247
Some copy
260248
else
261-
let () = Printf.printf "No normalization" in
262249
None
263250
let rref_vec_with m v =
264251
(*This function yields the same result as appending vector v to m and normalizing it afterwards would. However, it is usually faster than performing those ops manually.*)
@@ -279,13 +266,11 @@ module ArrayMatrix: AbstractMatrix =
279266
let rref_vec_with m v = Timing.wrap "rref_vec_with" (rref_vec_with m) v
280267

281268
let rref_vec m v = (* !! There was another rref_vec function that has been renamed to rref_vec_helper !!*)
282-
let () = Printf.printf "Before rref_vec we have m:\n%sv: %s\n" (show m) (V.show v) in
283269
let m' = copy m in
284270
let v' = V.copy v in
285271
match rref_vec_with m' v' with
286-
| Some res -> let () = Printf.printf "After rref_vec, before removing zero rows, we have m:\n%s\n" (show res) in
287-
Some (remove_zero_rows res)
288-
| None -> let () = Printf.printf "After rref_vec there is no normalization\n" in None
272+
| Some res -> Some (remove_zero_rows res)
273+
| None -> None
289274

290275
let rref_matrix_with m1 m2 =
291276
(*Similar to rref_vec_with but takes two matrices instead.*)
@@ -308,18 +293,15 @@ module ArrayMatrix: AbstractMatrix =
308293
let rref_matrix_with m1 m2 = Timing.wrap "rref_matrix_with" (rref_matrix_with m1) m2
309294

310295
let rref_matrix m1 m2 =
311-
let () = Printf.printf "Before rref_matrix m1 m2\nm1: %s\nm2: %s\n" (show m1) (show m2) in
312296
let m1' = copy m1 in
313297
let m2' = copy m2 in
314298
match rref_matrix_with m1' m2' with
315-
| Some m -> let () = Printf.printf "After rref_matrix m:\n %s\n" (show m) in Some m
316-
| None -> let () = Printf.printf "No normalization for rref_matrix found" in None
299+
| Some m -> Some m
300+
| None -> None
317301

318302
let is_covered_by m1 m2 =
319303
(*Performs a partial rref reduction to check if concatenating both matrices and afterwards normalizing them would yield a matrix <> m2 *)
320304
(*Both input matrices must be in rref form!*)
321-
let () = Printf.printf "is_covered_by m1: \n%s " (show m1) in
322-
let () = Printf.printf "is_covered_by m2 \n%s " (show m2) in
323305
if num_rows m1 > num_rows m2 then false else
324306
let p2 = lazy (get_pivot_positions m2) in
325307
try (
@@ -337,7 +319,6 @@ module ArrayMatrix: AbstractMatrix =
337319
if m1_i. (num_cols m1 - 1) <>: A.zero then
338320
raise Stdlib.Exit
339321
done;
340-
(*let () = Printf.printf "m1: %sand m2: %s return true in is_covered_by.\n" (show m1') (show m2') in*)
341322
true
342323
)
343324
with Stdlib.Exit -> false;;
@@ -359,10 +340,8 @@ module ArrayMatrix: AbstractMatrix =
359340
let map2_with f m v = Timing.wrap "map2_with" (map2_with f m) v
360341

361342
let map2 f m v =
362-
let () = Printf.printf "Before map2 we have m:\n%s\n" (show m) in
363343
let m' = copy m in
364344
map2_with f m' v;
365-
let () = Printf.printf "After map2 we have m:\n%s\n" (show m') in
366345
m'
367346

368347
let map2i_with f m v =
@@ -376,10 +355,8 @@ module ArrayMatrix: AbstractMatrix =
376355
let map2i_with f m v = Timing.wrap "map2i_with" (map2i_with f m) v
377356

378357
let map2i f m v =
379-
let () = Printf.printf "Before map2i m:\n%sv:%s\n" (show m) (V.show v) in
380358
let m' = copy m in
381359
map2i_with f m' v;
382-
let () = Printf.printf "After map2i m:\n%s\n" (show m') in
383360
m'
384361

385362
let swap_rows m j k =

0 commit comments

Comments
 (0)