Refactor: Various updates
@@ -102,6 +102,17 @@ void printSDRFull(SDR *sdr)
)
printf("\n");
}
+
+// print indices of true bits
+void printSDRWhereTrue(SDR *sdr) {
+ ITERATE_SDR_BITS(i,j,
+ if (SDRReadBitInBlock(sdr,i,j)) {
+ printf("(%d,%d)\n", i, j);
+ }
+ )
+ printf("===\n");
+}
+
//One SDR minus the other
SDR SDRMinus(SDR a, SDR b)
{
@@ -148,6 +159,7 @@ SDR SDRCopy(SDR original)
ITERATE_SDR_BLOCKS(i,
c.blocks[i] = original.blocks[i];
)
+ return c;
}
//Apply the seq_permutation to the SDR
SDR applySeqPermutation(SDR sdr, bool forward)
@@ -160,9 +172,12 @@ SDR applySeqPermutation(SDR sdr, bool forward)
return c;
}
//Set can be made by simply using the SDRUnion
-#define SDRSet SDRUnion
+SDR SDRSet(SDR a, SDR b) {
+ return SDRUnion(a, b);
+}
+
//Tuple on the other hand:
-void SDRTuple(SDR *a, SDR *b)
+SDR SDRTuple(SDR *a, SDR *b)
{
SDR bPerm = applySeqPermutation(*b,true);
return SDRSet(*a, bPerm);
@@ -179,12 +194,14 @@ void SDR_INIT()
///////////////////////
// END SDR_TERM //
///////////////////////
-void main()
+int main()
{
SDR_INIT();
SDR *mySDR = getTerm(1);
- printSDRFull(mySDR);
+ printSDRWhereTrue(mySDR);
//not ready yet:
SDR sdr2 = applySeqPermutation(*mySDR, true);
- printSDRFull(&sdr2);
+ printSDRWhereTrue(&sdr2);
+
+ return 0;
}
