mirror of
https://github.com/Z3Prover/z3
synced 2025-08-12 06:00:53 +00:00
replace lean to lp
Signed-off-by: Lev Nachmanson <levnach@microsoft.com>
This commit is contained in:
parent
db0a3f4358
commit
d41c65a4f9
72 changed files with 1334 additions and 1213 deletions
|
@ -33,7 +33,7 @@ square_dense_submatrix<T, X>::square_dense_submatrix (sparse_matrix<T, X> *paren
|
|||
unsigned row = parent_matrix->adjust_row(i);
|
||||
for (auto & iv : parent_matrix->get_row_values(row)) {
|
||||
unsigned j = parent_matrix->adjust_column_inverse(iv.m_index);
|
||||
SASSERT(j>= m_index_start);
|
||||
lp_assert(j>= m_index_start);
|
||||
m_v[row_offset + j] = iv.m_value;
|
||||
}
|
||||
row_offset += m_dim;
|
||||
|
@ -58,7 +58,7 @@ template <typename T, typename X> void square_dense_submatrix<T, X>::init(sparse
|
|||
template <typename T, typename X> int square_dense_submatrix<T, X>::find_pivot_column_in_row(unsigned i) const {
|
||||
int j = -1;
|
||||
T max = zero_of_type<T>();
|
||||
SASSERT(i >= m_index_start);
|
||||
lp_assert(i >= m_index_start);
|
||||
unsigned row_start = (i - m_index_start) * m_dim;
|
||||
for (unsigned k = i; k < m_parent->dimension(); k++) {
|
||||
unsigned col = adjust_column(k); // this is where the column is in the row
|
||||
|
@ -79,14 +79,14 @@ template <typename T, typename X> void square_dense_submatrix<T, X>::pivot(un
|
|||
}
|
||||
|
||||
template <typename T, typename X> void square_dense_submatrix<T, X>::pivot_row_to_row(unsigned i, unsigned row, lp_settings & settings) {
|
||||
SASSERT(i < row);
|
||||
lp_assert(i < row);
|
||||
unsigned pj = adjust_column(i); // the pivot column
|
||||
unsigned pjd = pj - m_index_start;
|
||||
unsigned pivot_row_offset = (i-m_index_start)*m_dim;
|
||||
T pivot = m_v[pivot_row_offset + pjd];
|
||||
unsigned row_offset= (row-m_index_start)*m_dim;
|
||||
T m = m_v[row_offset + pjd];
|
||||
SASSERT(!is_zero(pivot));
|
||||
lp_assert(!is_zero(pivot));
|
||||
m_v[row_offset + pjd] = -m * pivot; // creating L matrix
|
||||
for (unsigned j = m_index_start; j < m_parent->dimension(); j++) {
|
||||
if (j == pj) {
|
||||
|
@ -109,7 +109,7 @@ template <typename T, typename X> void square_dense_submatrix<T, X>::divide_r
|
|||
unsigned pj = adjust_column(i); // the pivot column
|
||||
unsigned irow_offset = (i - m_index_start) * m_dim;
|
||||
T pivot = m_v[irow_offset + pj - m_index_start];
|
||||
SASSERT(!is_zero(pivot));
|
||||
lp_assert(!is_zero(pivot));
|
||||
for (unsigned k = m_index_start; k < m_parent->dimension(); k++) {
|
||||
if (k == pj){
|
||||
m_v[irow_offset++] = one_of_type<T>() / pivot; // creating the L matrix diagonal
|
||||
|
@ -173,7 +173,7 @@ template <typename T, typename X> void square_dense_submatrix<T, X>::push_new
|
|||
template <typename T, typename X>
|
||||
template <typename L>
|
||||
L square_dense_submatrix<T, X>::row_by_vector_product(unsigned i, const vector<L> & v) {
|
||||
SASSERT(i >= m_index_start);
|
||||
lp_assert(i >= m_index_start);
|
||||
|
||||
unsigned row_in_subm = i - m_index_start;
|
||||
unsigned row_offset = row_in_subm * m_dim;
|
||||
|
@ -186,7 +186,7 @@ L square_dense_submatrix<T, X>::row_by_vector_product(unsigned i, const vector<L
|
|||
template <typename T, typename X>
|
||||
template <typename L>
|
||||
L square_dense_submatrix<T, X>::column_by_vector_product(unsigned j, const vector<L> & v) {
|
||||
SASSERT(j >= m_index_start);
|
||||
lp_assert(j >= m_index_start);
|
||||
|
||||
unsigned offset = j - m_index_start;
|
||||
L r = zero_of_type<L>();
|
||||
|
@ -197,7 +197,7 @@ L square_dense_submatrix<T, X>::column_by_vector_product(unsigned j, const vecto
|
|||
template <typename T, typename X>
|
||||
template <typename L>
|
||||
L square_dense_submatrix<T, X>::row_by_indexed_vector_product(unsigned i, const indexed_vector<L> & v) {
|
||||
SASSERT(i >= m_index_start);
|
||||
lp_assert(i >= m_index_start);
|
||||
|
||||
unsigned row_in_subm = i - m_index_start;
|
||||
unsigned row_offset = row_in_subm * m_dim;
|
||||
|
@ -264,8 +264,8 @@ void square_dense_submatrix<T, X>::apply_from_left_local(indexed_vector<L> & w,
|
|||
#ifdef Z3DEBUG
|
||||
// cout << "w final" << endl;
|
||||
// print_vector(w.m_data);
|
||||
// SASSERT(vectors_are_equal<T>(deb_w, w.m_data));
|
||||
// SASSERT(w.is_OK());
|
||||
// lp_assert(vectors_are_equal<T>(deb_w, w.m_data));
|
||||
// lp_assert(w.is_OK());
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -295,16 +295,16 @@ void square_dense_submatrix<T, X>::apply_from_left_to_vector(vector<L> & w) {
|
|||
#ifdef Z3DEBUG
|
||||
// cout << "w final" << endl;
|
||||
// print_vector(w.m_data);
|
||||
// SASSERT(vectors_are_equal<L>(deb_w, w));
|
||||
// lp_assert(vectors_are_equal<L>(deb_w, w));
|
||||
#endif
|
||||
}
|
||||
|
||||
template <typename T, typename X> bool square_dense_submatrix<T, X>::is_L_matrix() const {
|
||||
#ifdef Z3DEBUG
|
||||
SASSERT(m_row_permutation.is_identity());
|
||||
#ifdef LEAN_DEBUG
|
||||
lp_assert(m_row_permutation.is_identity());
|
||||
for (unsigned i = 0; i < m_parent->dimension(); i++) {
|
||||
if (i < m_index_start) {
|
||||
SASSERT(m_column_permutation[i] == i);
|
||||
lp_assert(m_column_permutation[i] == i);
|
||||
continue;
|
||||
}
|
||||
unsigned row_offs = (i-m_index_start)*m_dim;
|
||||
|
@ -312,9 +312,9 @@ template <typename T, typename X> bool square_dense_submatrix<T, X>::is_L_mat
|
|||
unsigned j = m_index_start + k;
|
||||
unsigned jex = adjust_column_inverse(j);
|
||||
if (jex > i) {
|
||||
SASSERT(is_zero(m_v[row_offs + k]));
|
||||
lp_assert(is_zero(m_v[row_offs + k]));
|
||||
} else if (jex == i) {
|
||||
SASSERT(!is_zero(m_v[row_offs + k]));
|
||||
lp_assert(!is_zero(m_v[row_offs + k]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -341,8 +341,8 @@ template <typename T, typename X> void square_dense_submatrix<T, X>::apply_from_
|
|||
t[adjust_column_inverse(j)] = column_by_vector_product(j, w);
|
||||
}
|
||||
w = t;
|
||||
#ifdef Z3DEBUG
|
||||
// SASSERT(vector_are_equal<T>(deb_w, w));
|
||||
#ifdef LEAN_DEBUG
|
||||
// lp_assert(vector_are_equal<T>(deb_w, w));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue