File tree Expand file tree Collapse file tree 1 file changed +9
-9
lines changed
src/cdomains/affineEquality/sparseImplementation Expand file tree Collapse file tree 1 file changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -193,6 +193,15 @@ module ListMatrix: AbstractMatrix =
193193 if affeq_rows_are_valid m' then Some m' else None (* TODO: We can check this for each row, using the helper function row_is_invalid *)
194194
195195
196+ (* This function return a tuple of row index and pivot position (column) in m *)
197+ (* TODO: maybe we could use a Hashmap instead of a list? *)
198+ let get_pivot_positions (m : t ) : (int * int) list =
199+ List. rev @@ List. fold_lefti (
200+ fun acc i row -> match V. find_first_non_zero row with
201+ | None -> acc
202+ | Some (pivot_col , _ ) -> (i, pivot_col) :: acc
203+ ) [] m
204+
196205 let assert_rref m =
197206 let pivot_l = get_pivot_positions m in
198207 let rec validate m i =
@@ -212,15 +221,6 @@ module ListMatrix: AbstractMatrix =
212221 in if validate_vec pivot_l then validate vs (i+ 1 ) else raise (Invalid_argument " Matrix not in rref: pivot column not empty!" )
213222 in validate m 0
214223
215- (* This function return a tuple of row index and pivot position (column) in m *)
216- (* TODO: maybe we could use a Hashmap instead of a list? *)
217- let get_pivot_positions (m : t ) : (int * int) list =
218- List. rev @@ List. fold_lefti (
219- fun acc i row -> match V. find_first_non_zero row with
220- | None -> acc
221- | Some (pivot_col , _ ) -> (i, pivot_col) :: acc
222- ) [] m
223-
224224 (* Sets the jth column to zero by subtracting multiples of v *)
225225 let reduce_col_with_vec m j v =
226226 let pivot_element = V. nth v j in
You can’t perform that action at this time.
0 commit comments