3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-28 11:25:51 +00:00

Sparse matrix kernel (#6035)

* Subtle bug in kernel computation

Coefficient was being passed by reference and, therefore, was
being changed indirectly.

In the process, updated the code to be more generic to avoid rational
computation in the middle of matrix manipulation.

* sparse_matrix: fixed handling of 0 in add_var() and add()

particularly in add_var(), without the fix the user is responsible for checking
coefficients for 0.
This commit is contained in:
Arie Gurfinkel 2022-05-13 17:30:35 -07:00 committed by GitHub
parent 6f7be77e2b
commit 7f62fa2b66
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 57 additions and 51 deletions

View file

@ -299,6 +299,7 @@ namespace simplex {
template<typename Ext>
void sparse_matrix<Ext>::add_var(row dst, numeral const& n, var_t v) {
if (m.is_zero(n)) return;
_row& r = m_rows[dst.id()];
column& c = m_columns[v];
unsigned r_idx;
@ -317,6 +318,7 @@ namespace simplex {
*/
template<typename Ext>
void sparse_matrix<Ext>::add(row row1, numeral const& n, row row2) {
if (m.is_zero(n)) return;
m_stats.m_add_rows++;
_row & r1 = m_rows[row1.id()];