3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-06-25 15:23:41 +00:00

enable printing in Release

Signed-off-by: Lev <levnach@hotmail.com>
This commit is contained in:
Lev 2018-07-09 20:48:39 -07:00
parent 5c712d471f
commit c4c52ad104
13 changed files with 10 additions and 33 deletions

View file

@ -78,8 +78,6 @@ public:
lp_assert(m_heap_size > 0); lp_assert(m_heap_size > 0);
return m_heap[1]; return m_heap[1];
} }
#ifdef Z3DEBUG
void print(std::ostream & out); void print(std::ostream & out);
#endif
}; };
} }

View file

@ -194,7 +194,6 @@ template <typename T> unsigned binary_heap_priority_queue<T>::dequeue() {
m_heap_inverse[ret] = -1; m_heap_inverse[ret] = -1;
return ret; return ret;
} }
#ifdef Z3DEBUG
template <typename T> void binary_heap_priority_queue<T>::print(std::ostream & out) { template <typename T> void binary_heap_priority_queue<T>::print(std::ostream & out) {
vector<int> index; vector<int> index;
vector<T> prs; vector<T> prs;
@ -210,5 +209,4 @@ template <typename T> void binary_heap_priority_queue<T>::print(std::ostream & o
for (int i = 0; i < index.size(); i++) for (int i = 0; i < index.size(); i++)
enqueue(index[i], prs[i]); enqueue(index[i], prs[i]);
} }
#endif
} }

View file

@ -71,7 +71,6 @@ public:
ref_row operator[](unsigned i) { return ref_row(*this, m_data[adjust_row(i)]); } ref_row operator[](unsigned i) { return ref_row(*this, m_data[adjust_row(i)]); }
ref_row_const operator[](unsigned i) const { return ref_row_const(*this, m_data[adjust_row(i)]); } ref_row_const operator[](unsigned i) const { return ref_row_const(*this, m_data[adjust_row(i)]); }
#ifdef Z3DEBUG
void print(std::ostream & out, unsigned blanks = 0) const { void print(std::ostream & out, unsigned blanks = 0) const {
unsigned m = row_count(); unsigned m = row_count();
unsigned n = column_count(); unsigned n = column_count();
@ -96,8 +95,6 @@ public:
print_matrix<mpq>(m.m_data, out, blanks); print_matrix<mpq>(m.m_data, out, blanks);
} }
#endif
void clear() { m_data.clear(); } void clear() { m_data.clear(); }
bool row_is_initialized_correctly(const vector<mpq>& row) { bool row_is_initialized_correctly(const vector<mpq>& row) {

View file

@ -37,10 +37,10 @@ template bool indexed_vector<unsigned>::is_OK() const;
template bool indexed_vector<double>::is_OK() const; template bool indexed_vector<double>::is_OK() const;
template bool indexed_vector<mpq>::is_OK() const; template bool indexed_vector<mpq>::is_OK() const;
template bool indexed_vector<lp::numeric_pair<mpq> >::is_OK() const; template bool indexed_vector<lp::numeric_pair<mpq> >::is_OK() const;
#endif
template void lp::indexed_vector< lp::mpq>::print(std::basic_ostream<char,struct std::char_traits<char> > &); template void lp::indexed_vector< lp::mpq>::print(std::basic_ostream<char,struct std::char_traits<char> > &);
template void lp::indexed_vector<double>::print(std::basic_ostream<char,struct std::char_traits<char> > &); template void lp::indexed_vector<double>::print(std::basic_ostream<char,struct std::char_traits<char> > &);
template void lp::indexed_vector<lp::numeric_pair<lp::mpq> >::print(std::ostream&); template void lp::indexed_vector<lp::numeric_pair<lp::mpq> >::print(std::ostream&);
#endif
} }
// template void lp::print_vector<double, vectro>(vector<double> const&, std::ostream&); // template void lp::print_vector<double, vectro>(vector<double> const&, std::ostream&);
// template void lp::print_vector<unsigned int>(vector<unsigned int> const&, std::ostream&); // template void lp::print_vector<unsigned int>(vector<unsigned int> const&, std::ostream&);

View file

@ -216,7 +216,7 @@ public:
#ifdef Z3DEBUG #ifdef Z3DEBUG
bool is_OK() const; bool is_OK() const;
void print(std::ostream & out);
#endif #endif
void print(std::ostream & out);
}; };
} }

View file

@ -96,6 +96,7 @@ bool indexed_vector<T>::is_OK() const {
return true; return true;
} }
#endif
template <typename T> template <typename T>
void indexed_vector<T>::print(std::ostream & out) { void indexed_vector<T>::print(std::ostream & out) {
out << "m_index " << std::endl; out << "m_index " << std::endl;
@ -105,6 +106,5 @@ void indexed_vector<T>::print(std::ostream & out) {
out << std::endl; out << std::endl;
print_vector(m_data, out); print_vector(m_data, out);
} }
#endif
} }

View file

@ -42,11 +42,11 @@ template void init_factorization<static_matrix<double, double>>
template void init_factorization<static_matrix<mpq, mpq>> template void init_factorization<static_matrix<mpq, mpq>>
(lu<static_matrix<mpq,mpq>>*&, static_matrix<mpq, mpq>&, vector<unsigned int>&, lp_settings&); (lu<static_matrix<mpq,mpq>>*&, static_matrix<mpq, mpq>&, vector<unsigned int>&, lp_settings&);
template void init_factorization<static_matrix<mpq, impq>>(lu<static_matrix<mpq, impq> >*&, static_matrix<mpq, impq >&, vector<unsigned int>&, lp_settings&); template void init_factorization<static_matrix<mpq, impq>>(lu<static_matrix<mpq, impq> >*&, static_matrix<mpq, impq >&, vector<unsigned int>&, lp_settings&);
#ifdef Z3DEBUG
template void print_matrix<square_sparse_matrix<double, double>>(square_sparse_matrix<double, double>&, std::ostream & out); template void print_matrix<square_sparse_matrix<double, double>>(square_sparse_matrix<double, double>&, std::ostream & out);
template void print_matrix<static_matrix<mpq,mpq>>(static_matrix<mpq, mpq>&, std::ostream&); template void print_matrix<static_matrix<mpq,mpq>>(static_matrix<mpq, mpq>&, std::ostream&);
template void print_matrix<static_matrix<mpq, impq> >(static_matrix<mpq, impq >&, std::ostream&); template void print_matrix<static_matrix<mpq, impq> >(static_matrix<mpq, impq >&, std::ostream&);
template void print_matrix<static_matrix<double, double>>(static_matrix<double, double>&, std::ostream & out); template void print_matrix<static_matrix<double, double>>(static_matrix<double, double>&, std::ostream & out);
#ifdef Z3DEBUG
template bool lu<static_matrix<double, double>>::is_correct(const vector<unsigned>& basis); template bool lu<static_matrix<double, double>>::is_correct(const vector<unsigned>& basis);
template bool lu<static_matrix<mpq, impq>>::is_correct( vector<unsigned int> const &); template bool lu<static_matrix<mpq, impq>>::is_correct( vector<unsigned int> const &);
template dense_matrix<double, double> get_B<static_matrix<double, double>>(lu<static_matrix<double, double>>&, const vector<unsigned>& basis); template dense_matrix<double, double> get_B<static_matrix<double, double>>(lu<static_matrix<double, double>>&, const vector<unsigned>& basis);

View file

@ -39,15 +39,12 @@ Revision History:
#include "util/lp/square_dense_submatrix.h" #include "util/lp/square_dense_submatrix.h"
#include "util/lp/dense_matrix.h" #include "util/lp/dense_matrix.h"
namespace lp { namespace lp {
#ifdef Z3DEBUG
template <typename T, typename X> // print the nr x nc submatrix at the top left corner template <typename T, typename X> // print the nr x nc submatrix at the top left corner
void print_submatrix(square_sparse_matrix<T, X> & m, unsigned mr, unsigned nc); void print_submatrix(square_sparse_matrix<T, X> & m, unsigned mr, unsigned nc);
template <typename M> template <typename M>
void print_matrix(M &m, std::ostream & out); void print_matrix(M &m, std::ostream & out);
#endif
template <typename T, typename X> template <typename T, typename X>
X dot_product(const vector<T> & a, const vector<X> & b) { X dot_product(const vector<T> & a, const vector<X> & b) {
lp_assert(a.size() == b.size()); lp_assert(a.size() == b.size());

View file

@ -25,7 +25,6 @@ Revision History:
#include "util/debug.h" #include "util/debug.h"
#include "util/lp/lu.h" #include "util/lp/lu.h"
namespace lp { namespace lp {
#ifdef Z3DEBUG
template <typename T, typename X, typename M> // print the nr x nc submatrix at the top left corner template <typename T, typename X, typename M> // print the nr x nc submatrix at the top left corner
void print_submatrix(square_sparse_matrix<T, X> & m, unsigned mr, unsigned nc, std::ostream & out) { void print_submatrix(square_sparse_matrix<T, X> & m, unsigned mr, unsigned nc, std::ostream & out) {
vector<vector<std::string>> A; vector<vector<std::string>> A;
@ -62,9 +61,6 @@ void print_matrix(M &m, std::ostream & out) {
print_matrix_with_widths(A, widths, out); print_matrix_with_widths(A, widths, out);
} }
#endif
template <typename T, typename X> template <typename T, typename X>
one_elem_on_diag<T, X>::one_elem_on_diag(const one_elem_on_diag & o) { one_elem_on_diag<T, X>::one_elem_on_diag(const one_elem_on_diag & o) {
m_i = o.m_i; m_i = o.m_i;

View file

@ -18,14 +18,14 @@ Revision History:
--*/ --*/
#include "util/lp/lp_settings.h" #include "util/lp/lp_settings.h"
#ifdef Z3DEBUG
#include "util/lp/matrix_def.h" #include "util/lp/matrix_def.h"
#include "util/lp/static_matrix.h" #include "util/lp/static_matrix.h"
#include <string> #include <string>
template void lp::print_matrix<double, double>(lp::matrix<double, double> const*, std::ostream & out); #ifdef Z3DEBUG
template bool lp::matrix<double, double>::is_equal(lp::matrix<double, double> const&); template bool lp::matrix<double, double>::is_equal(lp::matrix<double, double> const&);
template void lp::print_matrix<lp::mpq, lp::numeric_pair<lp::mpq> >(lp::matrix<lp::mpq, lp::numeric_pair<lp::mpq> > const *, std::basic_ostream<char, std::char_traits<char> > &);
template void lp::print_matrix<lp::mpq, lp::mpq>(lp::matrix<lp::mpq, lp::mpq> const*, std::ostream&);
template bool lp::matrix<lp::mpq, lp::numeric_pair<lp::mpq> >::is_equal(lp::matrix<lp::mpq, lp::numeric_pair<lp::mpq> > const&); template bool lp::matrix<lp::mpq, lp::numeric_pair<lp::mpq> >::is_equal(lp::matrix<lp::mpq, lp::numeric_pair<lp::mpq> > const&);
template bool lp::matrix<lp::mpq, lp::mpq>::is_equal(lp::matrix<lp::mpq, lp::mpq> const&); template bool lp::matrix<lp::mpq, lp::mpq>::is_equal(lp::matrix<lp::mpq, lp::mpq> const&);
#endif #endif
template void lp::print_matrix<double, double>(lp::matrix<double, double> const*, std::ostream & out);
template void lp::print_matrix<lp::mpq, lp::numeric_pair<lp::mpq> >(lp::matrix<lp::mpq, lp::numeric_pair<lp::mpq> > const *, std::basic_ostream<char, std::char_traits<char> > &);
template void lp::print_matrix<lp::mpq, lp::mpq>(lp::matrix<lp::mpq, lp::mpq> const*, std::ostream&);

View file

@ -17,7 +17,6 @@ Revision History:
--*/ --*/
#ifdef Z3DEBUG
#pragma once #pragma once
#include "util/lp/numeric_pair.h" #include "util/lp/numeric_pair.h"
#include "util/vector.h" #include "util/vector.h"
@ -70,4 +69,3 @@ void print_matrix(const vector<vector<T>> & A, std::ostream & out, unsigned blan
} }
#endif

View file

@ -18,11 +18,11 @@ Revision History:
--*/ --*/
#ifdef Z3DEBUG
#include <cmath> #include <cmath>
#include <string> #include <string>
#include "util/lp/matrix.h" #include "util/lp/matrix.h"
namespace lp { namespace lp {
#ifdef Z3DEBUG
template <typename T, typename X> template <typename T, typename X>
bool matrix<T, X>::is_equal(const matrix<T, X>& other) { bool matrix<T, X>::is_equal(const matrix<T, X>& other) {
if (other.row_count() != row_count() || other.column_count() != column_count()) if (other.row_count() != row_count() || other.column_count() != column_count())
@ -67,7 +67,7 @@ void apply_to_vector(matrix<T, X> & m, T * w) {
delete [] wc; delete [] wc;
} }
#endif
unsigned get_width_of_column(unsigned j, vector<vector<std::string>> & A) { unsigned get_width_of_column(unsigned j, vector<vector<std::string>> & A) {
unsigned r = 0; unsigned r = 0;
@ -132,4 +132,3 @@ void print_matrix(matrix<T, X> const * m, std::ostream & out) {
} }
} }
#endif

View file

@ -40,9 +40,7 @@ namespace lp {
// it is a square matrix // it is a square matrix
template <typename T, typename X> template <typename T, typename X>
class square_sparse_matrix class square_sparse_matrix
#ifdef Z3DEBUG
: public matrix<T, X> : public matrix<T, X>
#endif
{ {
struct col_header { struct col_header {
unsigned m_shortened_markovitz; unsigned m_shortened_markovitz;
@ -173,10 +171,8 @@ public:
unsigned dimension() const {return static_cast<unsigned>(m_row_permutation.size());} unsigned dimension() const {return static_cast<unsigned>(m_row_permutation.size());}
#ifdef Z3DEBUG
unsigned row_count() const override {return dimension();} unsigned row_count() const override {return dimension();}
unsigned column_count() const override {return dimension();} unsigned column_count() const override {return dimension();}
#endif
void init_row_headers(); void init_row_headers();
@ -309,13 +305,11 @@ public:
template <typename L> template <typename L>
void solve_U_y_indexed_only(indexed_vector<L> & y, const lp_settings&, vector<unsigned> & sorted_active_rows ); void solve_U_y_indexed_only(indexed_vector<L> & y, const lp_settings&, vector<unsigned> & sorted_active_rows );
#ifdef Z3DEBUG
T get_elem(unsigned i, unsigned j) const override { return get(i, j); } T get_elem(unsigned i, unsigned j) const override { return get(i, j); }
unsigned get_number_of_rows() const { return dimension(); } unsigned get_number_of_rows() const { return dimension(); }
unsigned get_number_of_columns() const { return dimension(); } unsigned get_number_of_columns() const { return dimension(); }
void set_number_of_rows(unsigned /*m*/) override { } void set_number_of_rows(unsigned /*m*/) override { }
void set_number_of_columns(unsigned /*n*/) override { } void set_number_of_columns(unsigned /*n*/) override { }
#endif
template <typename L> template <typename L>
L dot_product_with_row (unsigned row, const vector<L> & y) const; L dot_product_with_row (unsigned row, const vector<L> & y) const;