Skip to content
Snippets Groups Projects
Commit 91768b70 authored by Kaushik Mallik's avatar Kaushik Mallik
Browse files

Bugfixes: Incorrect decimal to binary conversion at several places

parent a86806be
No related branches found
No related tags found
1 merge request!3WIP: Universal bdds representation
...@@ -416,14 +416,13 @@ namespace mascot { ...@@ -416,14 +416,13 @@ namespace mascot {
/* combute UBDD representation of x */ /* combute UBDD representation of x */
UBDD cube = base_.one(); UBDD cube = base_.one();
for (size_t i = 0; i < dim_; i++) { for (size_t i = 0; i < dim_; i++) {
std::vector<uint8_t> phase(nofBddVars_[i]); std::vector<uint8_t> phase(nofBddVars_[i], 0);
std::vector<UBDD> vars(nofBddVars_[i]); std::vector<UBDD> vars(nofBddVars_[i]);
int idx = std::lround((x[i] - firstGridPoint_[i]) / eta_[i]);
for (size_t j = 0; j < nofBddVars_[i]; j++) { for (size_t j = 0; j < nofBddVars_[i]; j++) {
phase[j] = idx % 2;
idx /= 2;
vars[j] = base_.var(indBddVars_[i][j]); vars[j] = base_.var(indBddVars_[i][j]);
} }
int idx = std::lround((x[i] - firstGridPoint_[i]) / eta_[i]);
for (size_t j = 0; idx; idx /= 2, j++) phase[j] = 0 + idx % 2;
cube &= base_.cube(vars, phase); cube &= base_.cube(vars, phase);
} }
return cube; return cube;
...@@ -1039,14 +1038,16 @@ namespace mascot { ...@@ -1039,14 +1038,16 @@ namespace mascot {
/* combute UBDD representation of x */ /* combute UBDD representation of x */
UBDD cube = base_.one(); UBDD cube = base_.one();
for (size_t i = 0; i < dim_; i++) { for (size_t i = 0; i < dim_; i++) {
std::vector<uint8_t> phase(nofBddVars_[i]); std::vector<uint8_t> phase(nofBddVars_[i], 0);
std::vector<UBDD> vars(nofBddVars_[i]); std::vector<UBDD> vars(nofBddVars_[i]);
int idx = std::lround((x[i] - firstGridPoint_[i]) / eta_[i]);
for (size_t j = 0; j < nofBddVars_[i]; j++) { for (size_t j = 0; j < nofBddVars_[i]; j++) {
phase[j] = idx % 2;
idx /= 2;
vars[j] = base_.var(indBddVars_[i][j]); vars[j] = base_.var(indBddVars_[i][j]);
} }
int idx = std::lround((x[i] - firstGridPoint_[i]) / eta_[i]);
for (size_t j = 0; idx; idx /= 2) {
phase[j] = 0 + idx % 2;
j++;
}
cube &= base_.cube(vars, phase); cube &= base_.cube(vars, phase);
} }
/* check if cube is element of symbolicSet_ */ /* check if cube is element of symbolicSet_ */
...@@ -1276,7 +1277,7 @@ namespace mascot { ...@@ -1276,7 +1277,7 @@ namespace mascot {
std::vector<int> phase(nofBddVars_[i], 0); std::vector<int> phase(nofBddVars_[i], 0);
for (size_t j = 0; j < nofGridPoints_[i]; j++) { for (size_t j = 0; j < nofGridPoints_[i]; j++) {
int x = j; int x = j;
for (int i = 0; x; x /= 2, i++) phase[i] = x % 2; for (int k = 0; x; x /= 2, k++) phase[k] = x % 2;
symset[i] += base_.cube(ubddVars[i], phase); symset[i] += base_.cube(ubddVars[i], phase);
} }
grid &= symset[i]; grid &= symset[i];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment