These commands attempt to remove superfluous operations involving constants from the building blocks of an SLProgram. The example below is contrived, but illustrates what may happen in general.
i1 : declareVariable \ {a,b,c} o1 = {a, b, c} o1 : List |
i2 : x = inputGate 1 o2 = 1 o2 : InputGate |
i3 : y = inputGate 2 o3 = 2 o3 : InputGate |
i4 : G = gateMatrix{{(x+y)+3+4+b+4+c+4*(a+b+2)}} o4 = {{(((((((1 + 2) + 3) + 4) + b) + 4) + c) + (4 * ((a + b) + 2)))}} o4 : GateMatrix |
i5 : cG = compress G o5 = {{(((4 + (10 + b)) + c) + (4 * (2 + (a + b))))}} o5 : GateMatrix |
i6 : depth G o6 = 7 |
i7 : depth cG o7 = 4 |
i8 : countGates G o8 = HashTable{cache => CacheTable{...17...}} InputGate => 7 ProductGate => 1 SumGate => 9 o8 : HashTable |
i9 : countGates cG o9 = HashTable{cache => CacheTable{...13...}} InputGate => 6 ProductGate => 1 SumGate => 6 o9 : HashTable |