**vtan posted on 03-31-2011 8:28 PM**

Hi John,

I'm using Infer.NET to solve a decoding problem in GF(2). I am trying to do a logical XOR of Variable<bool>[ ] m, since there's no inbuilt logical XOR. I've attached the code to the end of this message. It compiles fine but the inference
results are not symmetric in the arguments of the array m, when I think it should be since GF(2) + (or logical XOR) is commutative. Any help would be appreciated.

Thanks,

Vincent Tan

s1 = gf2sum4vectors(m1);

private Variable<bool> gf2sum4vectors(Variable<bool>[] m)

{

Variable<bool>[] partialSums = new Variable<bool>[m.Length];

for (int i = 0; i < m.Length; i++)

{

if (i == 0)

partialSums[i] = m[0];

else

partialSums[i] = gf2sum(partialSums[i - 1], m[i]);

}

return partialSums[m.Length - 1];

}

private Variable<bool> gf2sum(Variable<bool> a, Variable<bool> b)

{

return ((a & (!b)) | (b & (!a)));

}