mirror of
https://github.com/Z3Prover/z3
synced 2025-05-05 23:05:46 +00:00
replace lean to lp
Signed-off-by: Lev Nachmanson <levnach@microsoft.com>
This commit is contained in:
parent
f6a75600c2
commit
cc32e45471
117 changed files with 1726 additions and 1726 deletions
|
@ -4,7 +4,7 @@
|
|||
*/
|
||||
#include "util/vector.h"
|
||||
#include "util/lp/permutation_matrix.h"
|
||||
namespace lean {
|
||||
namespace lp {
|
||||
template <typename T, typename X> permutation_matrix<T, X>::permutation_matrix(unsigned length): m_permutation(length), m_rev(length), m_T_buffer(length), m_X_buffer(length) {
|
||||
for (unsigned i = 0; i < length; i++) { // do not change the direction of the loop because of the vectorization bug in clang3.3
|
||||
m_permutation[i] = m_rev[i] = i;
|
||||
|
@ -50,7 +50,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;
|
||||
lean_assert(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]];
|
||||
|
@ -60,7 +60,7 @@ void permutation_matrix<T, X>::apply_from_left(vector<X> & w, lp_settings & ) {
|
|||
w[i] = m_X_buffer[i];
|
||||
}
|
||||
#ifdef LEAN_DEBUG
|
||||
// lean_assert(vectors_are_equal<L>(deb_w, w, row_count()));
|
||||
// lp_assert(vectors_are_equal<L>(deb_w, w, row_count()));
|
||||
// delete [] deb_w;
|
||||
#endif
|
||||
}
|
||||
|
@ -86,7 +86,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
|
||||
lean_assert(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]];
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ template <typename T, typename X> void permutation_matrix<T, X>::apply_from_righ
|
|||
w[i] = m_T_buffer[i];
|
||||
}
|
||||
#ifdef LEAN_DEBUG
|
||||
// lean_assert(vectors_are_equal<T>(deb_w, w, row_count()));
|
||||
// lp_assert(vectors_are_equal<T>(deb_w, w, row_count()));
|
||||
// delete [] deb_w;
|
||||
#endif
|
||||
}
|
||||
|
@ -117,9 +117,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);
|
||||
}
|
||||
lean_assert(w.is_OK());
|
||||
lp_assert(w.is_OK());
|
||||
#ifdef LEAN_DEBUG
|
||||
lean_assert(vectors_are_equal(wcopy, w.m_data));
|
||||
lp_assert(vectors_are_equal(wcopy, w.m_data));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -166,7 +166,7 @@ void permutation_matrix<T, X>::apply_reverse_from_left(indexed_vector<L> & w) {
|
|||
w.m_index[i] = j;
|
||||
}
|
||||
#ifdef LEAN_DEBUG
|
||||
// lean_assert(vectors_are_equal<L>(deb_w, w.m_data, row_count()));
|
||||
// lp_assert(vectors_are_equal<L>(deb_w, w.m_data, row_count()));
|
||||
// delete [] deb_w;
|
||||
#endif
|
||||
}
|
||||
|
@ -174,7 +174,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
|
||||
lean_assert(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];
|
||||
|
@ -187,7 +187,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
|
||||
lean_assert(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];
|
||||
|
@ -201,7 +201,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)
|
||||
lean_assert(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]];
|
||||
|
@ -219,7 +219,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
|
||||
lean_assert(w.is_OK());
|
||||
lp_assert(w.is_OK());
|
||||
vector<T> tmp;
|
||||
vector<unsigned> tmp_index(w.m_index);
|
||||
for (auto i : w.m_index) {
|
||||
|
@ -232,15 +232,15 @@ void permutation_matrix<T, X>::apply_reverse_from_right_to_T(indexed_vector<T> &
|
|||
w.set_value(tmp[k], m_rev[j]);
|
||||
}
|
||||
|
||||
// lean_assert(w.is_OK());
|
||||
// lean_assert(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)
|
||||
lean_assert(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]];
|
||||
|
@ -253,7 +253,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
|
||||
lean_assert(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);
|
||||
|
@ -262,7 +262,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)
|
||||
lean_assert(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);
|
||||
|
@ -271,7 +271,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;
|
||||
lean_assert(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
|
||||
|
@ -281,7 +281,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;
|
||||
lean_assert(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
|
||||
|
@ -289,7 +289,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 ?
|
||||
lean_assert(q.size() == size());
|
||||
lp_assert(q.size() == size());
|
||||
m_work_array = m_permutation;
|
||||
// the result is this = this*q(-1)
|
||||
unsigned i = size();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue