Skip to content

Commit

Permalink
Implement zero preserving Array Vector functions by calling normal fu…
Browse files Browse the repository at this point in the history
…nctions
  • Loading branch information
GollokG committed Dec 19, 2024
1 parent 2c8901f commit 4411280
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,8 @@ module ArrayMatrix: AbstractMatrix =
let is_covered_by m1 m2 =
(*Performs a partial rref reduction to check if concatenating both matrices and afterwards normalizing them would yield a matrix <> m2 *)
(*Both input matrices must be in rref form!*)
let () = Printf.printf "Is m1 covered by m2?\n m1:\n%sm2:\n%s" (show m1) (show m2) in
let () = Printf.printf "is_covered_by m1: \n%s " (show m1) in

Check warning

Code scanning / Semgrep OSS

printing should be replaced with logging Warning

printing should be replaced with logging
let () = Printf.printf "is_covered_by m2 \n%s " (show m2) in

Check warning

Code scanning / Semgrep OSS

printing should be replaced with logging Warning

printing should be replaced with logging
if num_rows m1 > num_rows m2 then false else
let p2 = lazy (get_pivot_positions m2) in
try (
Expand Down
20 changes: 14 additions & 6 deletions src/cdomains/affineEquality/arrayImplementation/arrayVector.ml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ module ArrayVector: AbstractVector =

let is_zero_vec v = not (Array.exists (fun x -> x <>: A.zero) v)

let is_const_vec v = failwith "Never implemented!"
let is_const_vec v =
compare_length_with (filteri (fun i x -> (*Inefficient*)
compare_length_with v (i + 1) > 0 && x <>: A.zero) v) 1 = 0

let nth = Array.get

Expand Down Expand Up @@ -108,11 +110,17 @@ module ArrayVector: AbstractVector =
let find_opt f v =
failwith "Never implemented!"

let map_f_preserves_zero f v = failwith "Never implemented!"
let map2_f_preserves_zero f v1 v2 = failwith "Never implemented!"
let map_f_preserves_zero f v =
map f v

let mapi_f_preserves_zero f v = failwith "Never implemented!"
let map2i_f_preserves_zero f v v' = failwith "Never implemented!"
let map2_f_preserves_zero f v1 v2 =
map2 f v1 v2

let mapi_f_preserves_zero f v =
mapi f v

let map2i_f_preserves_zero f v v' =
map2i f v v'

let fold_left_f_preserves_zero f acc v =
failwith "Never implemented!"
Expand All @@ -133,5 +141,5 @@ module ArrayVector: AbstractVector =
failwith "Never implemented!"

let apply_with_c_f_preserves_zero f c v =
failwith "Never implemented!"
apply_with_c f c v
end

0 comments on commit 4411280

Please sign in to comment.