3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-23 00:55:31 +00:00

Print polynomials with power

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2021-04-12 10:39:48 -07:00
parent 6413c8717a
commit 278babe625

View file

@ -1350,12 +1350,25 @@ namespace dd {
out << c;
if (!m.second.empty()) out << "*";
}
bool f = true;
unsigned v_prev = UINT_MAX;
unsigned pow = 0;
for (unsigned v : m.second) {
if (!f) out << "*";
f = false;
out << "v" << v;
if (v == v_prev) {
pow++;
continue;
}
if (v_prev != UINT_MAX) {
out << "v" << v_prev;
if (pow > 1)
out << "^" << pow;
out << "*";
}
pow = 1;
v_prev = v;
}
out << "v" << v_prev;
if (pow > 1)
out << "^" << pow;
}
if (first) out << "0";
return out;