UNB/ CS/ David Bremner/ research/ sparks lp/ matrix-parity

SPARKS pseudocode

input matrix x[n,m]
output bool w
bool parity
parity <- 0
for i <- 0,n do
    for j <- 0,m do
        parity <- parity xor x[i,j]
    done
done
return w @ parity

SPARKS pseudo-assembly

. input matrix x n m
. output bool w
. var bool parity
0 set parity copy 0
. set i copyw 0
. set sentinel1 copyw n
. set sentinel1 incw sentinel1
for1 set test1 eqw i sentinel1
. if test1 done1
. set j copyw 0
. set sentinel2 copyw m
. set sentinel2 incw sentinel2
for2 set test2 eqw j sentinel2
. if test2 done2
. set  temp4 matrix_ref x i j
3 set parity xor parity temp4
. set j incw j
. goto for2
done2 nop
. set i incw i
. goto for1
done1 nop
5 return w copy parity

Parameter file

n=1
m=1
word_size=2
time_bound=60

Generated LP

Sample yes instance

param d['w'] := 0;
param c :=
    'x[0,0]'    -2
    'x[0,1]'    +2
    'x[1,0]'    +2
    'x[1,1]'    +2
;

Sample no instance

param d['w'] := 0;
param c :=
    'x[0,0]'    -2
    'x[0,1]'    +2
    'x[1,0]'    +2
    'x[1,1]'    -2
;