Skip to content

Commit 1fa998f

Browse files
committed
Remove deprecated _with functions from Vector and Matrix interface
1 parent 2e80b94 commit 1fa998f

File tree

6 files changed

+4
-111
lines changed

6 files changed

+4
-111
lines changed

src/cdomains/affineEquality/arrayImplementation/arrayMatrix.ml

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -265,13 +265,13 @@ module ArrayMatrix: AbstractMatrix =
265265
(*m must be in rref form and contain the same num of cols as v*)
266266
(*If m is empty then v is simply normalized and returned*)
267267
(*let v = V.to_array v in
268-
if is_empty m then
268+
if is_empty m then
269269
match Array.findi (fun x -> x <>: A.zero) v with
270270
| exception Not_found -> None
271271
| i -> if i = Array.length v - 1 then None else
272272
let v_i = v.(i) in
273273
Array.iteri (fun j x -> v.(j) <- x /: v_i) v; Some (init_with_vec @@ V.of_array v)
274-
else
274+
else
275275
let pivot_elements = get_pivot_positions m in
276276
rref_vec_helper m pivot_elements v*)
277277
normalize @@ append_row m v
@@ -355,10 +355,7 @@ module ArrayMatrix: AbstractMatrix =
355355
m.(i) <- V.to_array @@ f (V.of_array m.(i)) (V.nth v i)
356356
done
357357

358-
(* Deprecated
359-
let map2 f m v =
360-
let f' x y = V.to_array @@ f (V.of_array x) y in Array.map2 f' m (V.to_array v)
361-
*)
358+
let map2_with f m v = Timing.wrap "map2_with" (map2_with f m) v
362359

363360
let map2 f m v =
364361
let () = Printf.printf "Before map2 we have m:\n%s\n" (show m) in
@@ -367,8 +364,6 @@ module ArrayMatrix: AbstractMatrix =
367364
let () = Printf.printf "After map2 we have m:\n%s\n" (show m') in
368365
m'
369366

370-
let map2_with f m v = Timing.wrap "map2_with" (map2_with f m) v
371-
372367
let map2i_with f m v =
373368
if num_rows m = V.length v then
374369
Array.iter2i (fun i x y -> m.(i) <- V.to_array @@ f i (V.of_array x) y) m (V.to_array v)
@@ -379,12 +374,6 @@ module ArrayMatrix: AbstractMatrix =
379374

380375
let map2i_with f m v = Timing.wrap "map2i_with" (map2i_with f m) v
381376

382-
(* Deprecated
383-
let map2i f m v =
384-
let f' x (i,y) = V.to_array @@ f i (V.of_array x) y in
385-
let range_array = Array.init (V.length v) Fun.id in
386-
Array.map2 f' m (Array.combine range_array (V.to_array v))
387-
*)
388377
let map2i f m v =
389378
let () = Printf.printf "Before map2i m:\n%sv:%s\n" (show m) (V.show v) in
390379
let m' = copy m in

src/cdomains/affineEquality/arrayImplementation/arrayVector.ml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,23 +63,15 @@ module ArrayVector: AbstractVector =
6363
let f' i = uncurry (f i) in
6464
Array.mapi f' (Array.combine v1 v2) (* TODO: iter2i? *)
6565

66-
let map2i_with f v1 v2 = Array.iter2i (fun i x y -> v1.(i) <- f i x y) v1 v2
67-
6866
let find2i f v1 v2 =
6967
Array.findi (uncurry f) (Array.combine v1 v2) (* TODO: iter2i? *)
7068

7169
let to_array v = v
7270

7371
let of_array v = v
7472

75-
let apply_with_c_with f c v = Array.modify (fun x -> f x c) v
76-
77-
let rev_with v = Array.rev_in_place v
78-
7973
let rev v = Array.rev v
8074

81-
let map_with f v = Array.modify f v
82-
8375
let map f v = Array.map f v
8476

8577
let map2_with f v1 v2 = Array.iter2i (fun i x y -> v1.(i) <- f x y) v1 v2

src/cdomains/affineEquality/matrix.ml

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -33,36 +33,22 @@ sig
3333

3434
val reduce_col: t -> int -> t
3535

36-
val reduce_col_with: t -> int -> unit
37-
3836
val normalize: t -> t Option.t (*Gauss-Jordan Elimination to get matrix in reduced row echelon form (rref) + deletion of zero rows. None matrix has no solution*)
3937

40-
val normalize_with: t -> bool
41-
4238
val rref_vec: t -> vec -> t Option.t (* added to remove side effects in affineEqualityDomain*)
4339

44-
val rref_vec_with: t -> vec -> t Option.t
45-
4640
val rref_matrix: t -> t -> t Option.t (* this as well *)
4741

48-
val rref_matrix_with: t -> t -> t Option.t
49-
5042
val find_opt: (vec -> bool) -> t -> vec option
5143

5244
val map2: (vec -> num -> vec) -> t -> vec -> t
5345

54-
val map2_with: (vec -> num -> vec) -> t -> vec -> unit
55-
5646
val map2: (vec -> num -> vec) -> t -> vec -> t (* why is this here twice??*)
5747

5848
val map2i: (int -> vec-> num -> vec) -> t -> vec -> t
5949

60-
val map2i_with: (int -> vec -> num -> vec) -> t -> vec -> unit
61-
6250
val set_col: t -> vec -> int -> t
6351

64-
val set_col_with: t -> vec -> int -> t
65-
6652
val init_with_vec: vec -> t
6753

6854
val remove_zero_rows: t -> t

src/cdomains/affineEquality/sparseImplementation/listMatrix.ml

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -307,36 +307,4 @@ module ListMatrix: AbstractMatrix =
307307
let map2 f m v =
308308
let vector_length = V.length v in
309309
List.mapi (fun index row -> if index < vector_length then f row (V.nth v index) else row ) m
310-
311-
312-
(* ------------------------- Deprecated ------------------------*)
313-
314-
let rref_vec_with m v =
315-
(*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.*)
316-
(*m must be in rref form and contain the same num of cols as v*)
317-
(*If m is empty then v is simply normalized and returned*)
318-
failwith "deprecated"
319-
320-
let rref_with m =
321-
failwith "deprecated"
322-
323-
let reduce_col_with m j =
324-
failwith "deprecated"
325-
326-
let normalize_with m =
327-
failwith "deprecated"
328-
329-
let set_col_with m new_col n =
330-
failwith "deprecated"
331-
332-
let map2_with f m v =
333-
failwith "deprecated"
334-
335-
let map2i_with f m v =
336-
failwith "deprecated"
337-
338-
let rref_matrix_with m1 m2 =
339-
(*Similar to rref_vec_with but takes two matrices instead.*)
340-
(*ToDo Could become inefficient for large matrices since pivot_elements are always recalculated + many row additions*)
341-
failwith "deprecated"
342310
end

src/cdomains/affineEquality/sparseImplementation/sparseVector.ml

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -270,29 +270,4 @@ module SparseVector: AbstractVector =
270270
| x :: xs -> (A.to_string x) ^ " " ^ (list_str xs)
271271
in
272272
"["^list_str t^"\n"
273-
274-
(* ------------------- Deprecated ------------------- *)
275-
let mapi_with f v =
276-
failwith "mapi_with deprecated"
277-
278-
let map2i_with f v v' =
279-
failwith "map2i_with deprecated"
280-
281-
282-
let rev_with v =
283-
failwith "rev_with deprecated"
284-
285-
let map_with f v =
286-
failwith "map_with deprecated"
287-
288-
289-
let map2_with f v v' =
290-
failwith "map2_with deprecated"
291-
292-
let apply_with_c_with f m v =
293-
failwith "apply_with_c_with deprecated"
294-
295-
let set_nth_with f n num = (
296-
failwith "set_nth_with deprecated")
297-
298273
end

src/cdomains/affineEquality/vector.ml

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ sig
1616

1717
val set_nth: t -> int -> num -> t
1818

19-
val set_nth_with: t -> int -> num -> unit
20-
2119
val insert_val_at: int -> num -> t -> t
2220

2321
val map_f_preserves_zero: (num -> num) -> t -> t
@@ -32,8 +30,6 @@ sig
3230

3331
val apply_with_c_f_preserves_zero: (num -> num -> num) -> num -> t -> t
3432

35-
val apply_with_c_with: (num -> num -> num) -> num -> t -> unit
36-
3733
val zero_vec: int -> t
3834

3935
val is_zero_vec: t -> bool
@@ -44,8 +40,6 @@ sig
4440

4541
val map2: (num -> num -> num) -> t -> t -> t
4642

47-
val map2_with: (num -> num -> num) -> t -> t -> unit
48-
4943
val findi: (num -> bool) -> t -> int
5044

5145
(* Returns optional tuple of position and value which was found*)
@@ -57,8 +51,6 @@ sig
5751

5852
val map: (num -> num) -> t -> t
5953

60-
val map_with: (num -> num) -> t -> unit
61-
6254
val map: (num -> num) -> t -> t
6355

6456
val compare_length_with: t -> int -> int
@@ -74,21 +66,12 @@ sig
7466
val exists: (num -> bool) -> t -> bool
7567

7668
val exists2: (num -> num -> bool) -> t -> t -> bool
77-
7869
val rev: t -> t
79-
80-
val rev_with: t -> unit
81-
82-
val rev: t -> t
83-
70+
8471
val map2i: (int -> num -> num -> num) -> t -> t -> t
8572

86-
val map2i_with: (int -> num -> num -> num) -> t -> t -> unit
87-
8873
val mapi: (int -> num -> num) -> t -> t
8974

90-
val mapi_with: (int -> num -> num) -> t -> unit
91-
9275
val mapi: (int -> num -> num) -> t -> t
9376

9477
val find2i: (num -> num -> bool) -> t -> t -> int

0 commit comments

Comments
 (0)