Example #1
0
def reverse_gate(b, g):
    if b.get_size() != g.get_size():
        return
    vec = b.get_vector()
    mat = g.get_matrix()
    result = mat.inv() * vec
    return bus.arbitrary_wire(b.get_size(), result)
Example #2
0
def apply_gate(b, g):
    if b.get_size() != g.get_size():
        return
    vec = b.get_vector()
    mat = g.get_matrix()
    result = mat * vec
    return bus.arbitrary_wire(b.get_size(), result)