Skip to content

Commit

Permalink
Bugfix Matrix.map2i without side effects (different length lists)
Browse files Browse the repository at this point in the history
  • Loading branch information
GollokG committed Nov 21, 2024
1 parent af2fc0f commit 5ce5ee8
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions src/cdomains/vectorMatrix.ml
Original file line number Diff line number Diff line change
Expand Up @@ -456,11 +456,8 @@ module ArrayMatrix: AbstractMatrix =
m'

let del_cols m cols = timing_wrap "del_cols" (del_cols m) cols

let map2i f m v =
let f' x (i,y) = V.to_array @@ f i (V.of_array x) y in
let range_array = Array.init (V.length v) Fun.id in
Array.map2 f' m (Array.combine range_array (V.to_array v))



let remove_zero_rows m =
Array.filter (fun x -> Array.exists (fun y -> y <>: A.zero) x) m
Expand Down Expand Up @@ -661,6 +658,18 @@ module ArrayMatrix: AbstractMatrix =
done

let map2i_with f m v = timing_wrap "map2i_with" (map2i_with f m) v


(* Deprecated
let map2i f m v =
let f' x (i,y) = V.to_array @@ f i (V.of_array x) y in
let range_array = Array.init (V.length v) Fun.id in
Array.map2 f' m (Array.combine range_array (V.to_array v))
*)
let map2i f m v =
let m' = copy m in
map2i_with f m' v;
m'
end


Expand Down

0 comments on commit 5ce5ee8

Please sign in to comment.