3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-28 19:35:50 +00:00

replace lean to lp

Signed-off-by: Lev Nachmanson <levnach@microsoft.com>
This commit is contained in:
Lev Nachmanson 2017-07-10 11:06:37 -07:00 committed by Lev Nachmanson
parent db0a3f4358
commit d41c65a4f9
72 changed files with 1334 additions and 1213 deletions

View file

@ -65,7 +65,7 @@ void permutation_matrix<T, X>::apply_from_left(vector<X> & w, lp_settings & ) {
// deb.apply_from_left(deb_w);
#endif
// std::cout << " apply_from_left " << std::endl;
SASSERT(m_X_buffer.size() == w.size());
lp_assert(m_X_buffer.size() == w.size());
unsigned i = size();
while (i-- > 0) {
m_X_buffer[i] = w[m_permutation[i]];
@ -74,8 +74,8 @@ void permutation_matrix<T, X>::apply_from_left(vector<X> & w, lp_settings & ) {
while (i-- > 0) {
w[i] = m_X_buffer[i];
}
#ifdef Z3DEBUG
// SASSERT(vectors_are_equal<L>(deb_w, w, row_count()));
#ifdef LEAN_DEBUG
// lp_assert(vectors_are_equal<L>(deb_w, w, row_count()));
// delete [] deb_w;
#endif
}
@ -101,7 +101,7 @@ template <typename T, typename X> void permutation_matrix<T, X>::apply_from_righ
// T * deb_w = clone_vector<T>(w, row_count());
// deb.apply_from_right(deb_w);
#endif
SASSERT(m_T_buffer.size() == w.size());
lp_assert(m_T_buffer.size() == w.size());
for (unsigned i = 0; i < size(); i++) {
m_T_buffer[i] = w[m_rev[i]];
}
@ -109,8 +109,8 @@ template <typename T, typename X> void permutation_matrix<T, X>::apply_from_righ
for (unsigned i = 0; i < size(); i++) {
w[i] = m_T_buffer[i];
}
#ifdef Z3DEBUG
// SASSERT(vectors_are_equal<T>(deb_w, w, row_count()));
#ifdef LEAN_DEBUG
// lp_assert(vectors_are_equal<T>(deb_w, w, row_count()));
// delete [] deb_w;
#endif
}
@ -132,9 +132,9 @@ template <typename T, typename X> void permutation_matrix<T, X>::apply_from_righ
unsigned pj = m_permutation[j];
w.set_value(buffer[i], pj);
}
SASSERT(w.is_OK());
#ifdef Z3DEBUG
SASSERT(vectors_are_equal(wcopy, w.m_data));
lp_assert(w.is_OK());
#ifdef LEAN_DEBUG
lp_assert(vectors_are_equal(wcopy, w.m_data));
#endif
}
@ -180,8 +180,8 @@ void permutation_matrix<T, X>::apply_reverse_from_left(indexed_vector<L> & w) {
w[j] = t[i];
w.m_index[i] = j;
}
#ifdef Z3DEBUG
// SASSERT(vectors_are_equal<L>(deb_w, w.m_data, row_count()));
#ifdef LEAN_DEBUG
// lp_assert(vectors_are_equal<L>(deb_w, w.m_data, row_count()));
// delete [] deb_w;
#endif
}
@ -189,7 +189,7 @@ void permutation_matrix<T, X>::apply_reverse_from_left(indexed_vector<L> & w) {
template <typename T, typename X>
void permutation_matrix<T, X>::apply_reverse_from_left_to_T(vector<T> & w) {
// the result will be w = p(-1) * w
SASSERT(m_T_buffer.size() == w.size());
lp_assert(m_T_buffer.size() == w.size());
unsigned i = size();
while (i-- > 0) {
m_T_buffer[m_permutation[i]] = w[i];
@ -202,7 +202,7 @@ void permutation_matrix<T, X>::apply_reverse_from_left_to_T(vector<T> & w) {
template <typename T, typename X>
void permutation_matrix<T, X>::apply_reverse_from_left_to_X(vector<X> & w) {
// the result will be w = p(-1) * w
SASSERT(m_X_buffer.size() == w.size());
lp_assert(m_X_buffer.size() == w.size());
unsigned i = size();
while (i-- > 0) {
m_X_buffer[m_permutation[i]] = w[i];
@ -216,7 +216,7 @@ void permutation_matrix<T, X>::apply_reverse_from_left_to_X(vector<X> & w) {
template <typename T, typename X>
void permutation_matrix<T, X>::apply_reverse_from_right_to_T(vector<T> & w) {
// the result will be w = w * p(-1)
SASSERT(m_T_buffer.size() == w.size());
lp_assert(m_T_buffer.size() == w.size());
unsigned i = size();
while (i-- > 0) {
m_T_buffer[i] = w[m_permutation[i]];
@ -234,7 +234,7 @@ void permutation_matrix<T, X>::apply_reverse_from_right_to_T(indexed_vector<T> &
// vector<T> wcopy(w.m_data);
// apply_reverse_from_right_to_T(wcopy);
#endif
SASSERT(w.is_OK());
lp_assert(w.is_OK());
vector<T> tmp;
vector<unsigned> tmp_index(w.m_index);
for (auto i : w.m_index) {
@ -247,15 +247,15 @@ void permutation_matrix<T, X>::apply_reverse_from_right_to_T(indexed_vector<T> &
w.set_value(tmp[k], m_rev[j]);
}
// SASSERT(w.is_OK());
// SASSERT(vectors_are_equal(w.m_data, wcopy));
// lp_assert(w.is_OK());
// lp_assert(vectors_are_equal(w.m_data, wcopy));
}
template <typename T, typename X>
void permutation_matrix<T, X>::apply_reverse_from_right_to_X(vector<X> & w) {
// the result will be w = w * p(-1)
SASSERT(m_X_buffer.size() == w.size());
lp_assert(m_X_buffer.size() == w.size());
unsigned i = size();
while (i-- > 0) {
m_X_buffer[i] = w[m_permutation[i]];
@ -268,7 +268,7 @@ void permutation_matrix<T, X>::apply_reverse_from_right_to_X(vector<X> & w) {
template <typename T, typename X> void permutation_matrix<T, X>::transpose_from_left(unsigned i, unsigned j) {
// the result will be this = (i,j)*this
SASSERT(i < size() && j < size() && i != j);
lp_assert(i < size() && j < size() && i != j);
auto pi = m_rev[i];
auto pj = m_rev[j];
set_val(pi, j);
@ -277,7 +277,7 @@ template <typename T, typename X> void permutation_matrix<T, X>::transpose_from_
template <typename T, typename X> void permutation_matrix<T, X>::transpose_from_right(unsigned i, unsigned j) {
// the result will be this = this * (i,j)
SASSERT(i < size() && j < size() && i != j);
lp_assert(i < size() && j < size() && i != j);
auto pi = m_permutation[i];
auto pj = m_permutation[j];
set_val(i, pj);
@ -286,7 +286,7 @@ template <typename T, typename X> void permutation_matrix<T, X>::transpose_from_
template <typename T, typename X> void permutation_matrix<T, X>::multiply_by_permutation_from_left(permutation_matrix<T, X> & p) {
m_work_array = m_permutation;
SASSERT(p.size() == size());
lp_assert(p.size() == size());
unsigned i = size();
while (i-- > 0) {
set_val(i, m_work_array[p[i]]); // we have m(P)*m(Q) = m(QP), where m is the matrix of the permutation
@ -296,7 +296,7 @@ template <typename T, typename X> void permutation_matrix<T, X>::multiply_by_per
// this is multiplication in the matrix sense
template <typename T, typename X> void permutation_matrix<T, X>::multiply_by_permutation_from_right(permutation_matrix<T, X> & p) {
m_work_array = m_permutation;
SASSERT(p.size() == size());
lp_assert(p.size() == size());
unsigned i = size();
while (i-- > 0)
set_val(i, p[m_work_array[i]]); // we have m(P)*m(Q) = m(QP), where m is the matrix of the permutation
@ -304,7 +304,7 @@ template <typename T, typename X> void permutation_matrix<T, X>::multiply_by_per
}
template <typename T, typename X> void permutation_matrix<T, X>::multiply_by_reverse_from_right(permutation_matrix<T, X> & q){ // todo : condensed permutations ?
SASSERT(q.size() == size());
lp_assert(q.size() == size());
m_work_array = m_permutation;
// the result is this = this*q(-1)
unsigned i = size();