force fixed bits to be equal for all PIs found by a task

This commit is contained in:
Adrian Dusa 2025-03-31 07:51:29 +03:00
parent 4c506892fb
commit 12030db2c3

View file

@ -258,25 +258,30 @@ ccubes_task(int k,
}
// Rprintf("task: %d; rows: %d\n", task, *found);
// this should rarely be more than 5 (because k rarely exceeds 5)
// if it reaches 10 something is way wrong
int bit_index[10];
unsigned int fixed[IMPLICANT_WORDS];
for (int i = 0; i < IMPLICANT_WORDS; i++) {
fixed[i] = 0U;
}
for (int c = 0; c < k; c++) {
bit_index[c] = (tempk[c] % (BITS_PER_WORD / VALUE_BIT_WIDTH)) * VALUE_BIT_WIDTH;
int word_index = tempk[c] / (BITS_PER_WORD / VALUE_BIT_WIDTH);
fixed_bits[word_index] |= (VALUE_BIT_MASK << bit_index[c]);
}
for (int f = 0; f < *found; f++) {
// create a temporary vector of length k, containing the values from the initial ON set
// plus 1 (because 0 now signals a minimization, it becomes 1, and 1 becomes 2 etc).
int tempc[NINPUTS];
for (int c = 0; c < k; c++) {
int value = ON_set[tempk[c] * POSROWS + frows[f]];
tempc[c] = value + 1;
int word_index = tempk[c] / (BITS_PER_WORD / VALUE_BIT_WIDTH);
int bit_index = (tempk[c] % (BITS_PER_WORD / VALUE_BIT_WIDTH)) * VALUE_BIT_WIDTH;
fixed_bits[f * POSROWS + word_index] |= (VALUE_BIT_MASK << bit_index);
value_bits[f * POSROWS + word_index] |= ((unsigned int)value << bit_index);
fixed_bits[f * POSROWS + word_index] = fixed_bits[word_index];
value_bits[f * POSROWS + word_index] |= ((unsigned int)ON_set[tempk[c] * POSROWS + frows[f]] << bit_index[c]);
}
// check if the current PI is not redundant
// bool redundant = false;
redundant[f] = false;
int i = 0;