3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-07-19 10:52:02 +00:00

make explicit rational(double)constructor

Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
This commit is contained in:
Lev Nachmanson 2019-03-19 14:58:23 -07:00
parent 057151c7a8
commit 885d640301
4 changed files with 11 additions and 11 deletions

View file

@ -214,7 +214,7 @@ public:
if (m_A.m_columns[bj].size() > 1) if (m_A.m_columns[bj].size() > 1)
return true; return true;
for (const auto & c : m_A.m_columns[bj]) { for (const auto & c : m_A.m_columns[bj]) {
if (m_A.get_val(c) != one_of_type<mpq>()) if (m_A.get_val(c) != one_of_type<T>())
return true; return true;
else else
break; break;

View file

@ -561,7 +561,7 @@ template <typename T, typename X> void lp_solver<T, X>::set_scaled_cost(unsigned
column_info<T> * ci = this->m_map_from_var_index_to_column_info[this->m_core_solver_columns_to_external_columns[j]]; column_info<T> * ci = this->m_map_from_var_index_to_column_info[this->m_core_solver_columns_to_external_columns[j]];
T cost = ci->get_cost(); T cost = ci->get_cost();
if (ci->is_flipped()){ if (ci->is_flipped()){
cost *= -1; cost *= T(-1);
} }
lp_assert(ci->is_fixed() == false); lp_assert(ci->is_fixed() == false);
this->m_costs[j] = cost * this->m_column_scale[j]; this->m_costs[j] = cost * this->m_column_scale[j];

View file

@ -221,15 +221,15 @@ template <typename T, typename X> void scaler<T, X>::scale_row(unsigned i) {
} }
if (row_max < m_scaling_minimum) { if (row_max < m_scaling_minimum) {
do { do {
alpha *= 2; alpha *= T(2);
row_max *= 2; row_max *= T(2);
} while (row_max < m_scaling_minimum); } while (row_max < m_scaling_minimum);
m_A.multiply_row(i, alpha); m_A.multiply_row(i, alpha);
m_b[i] *= alpha; m_b[i] *= alpha;
} else if (row_max > m_scaling_maximum) { } else if (row_max > m_scaling_maximum) {
do { do {
alpha /= 2; alpha /= T(2);
row_max /= 2; row_max /= T(2);
} while (row_max > m_scaling_maximum); } while (row_max > m_scaling_maximum);
m_A.multiply_row(i, alpha); m_A.multiply_row(i, alpha);
m_b[i] *= alpha; m_b[i] *= alpha;
@ -245,13 +245,13 @@ template <typename T, typename X> void scaler<T, X>::scale_column(unsigned i)
} }
if (column_max < m_scaling_minimum) { if (column_max < m_scaling_minimum) {
do { do {
alpha *= 2; alpha *= T(2);
column_max *= 2; column_max *= T(2);
} while (column_max < m_scaling_minimum); } while (column_max < m_scaling_minimum);
} else if (column_max > m_scaling_maximum) { } else if (column_max > m_scaling_maximum) {
do { do {
alpha /= 2; alpha /= T(2);
column_max /= 2; column_max /= T(2);
} while (column_max > m_scaling_maximum); } while (column_max > m_scaling_maximum);
} else { } else {
return; return;

View file

@ -53,7 +53,7 @@ public:
rational(mpz const & z) { m().set(m_val, z); } rational(mpz const & z) { m().set(m_val, z); }
rational(double z) { UNREACHABLE(); } explicit rational(double z) { UNREACHABLE(); }
explicit rational(char const * v) { m().set(m_val, v); } explicit rational(char const * v) { m().set(m_val, v); }